[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl:when - comparing parameter and element values

Subject: Re: xsl:when - comparing parameter and element values
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sat, 6 Jan 2001 11:34:59 +0000
xsl when true
Hi Edith,

> I can't get the right syntax for the comparison between the two
> values for xsl:when. What I want to test is when the 'showcasemgmt'
> parameter contains the value "true" and the element 'casemgmtind'
> contains the value "FALSE".

You're using:

  $showcasemgmt='true' && CaseMgmtInd='FALSE'

which is *almost* right, except that '&&' isn't valid XPath syntax.
You want to use 'and' instead:

  $showcasemgmt='true' and CaseMgmtInd='FALSE'

Similarly, XPath uses 'or' for or and not() for not and so on.
Guessing at syntax is always problematic.

> The second part to my question is...only if this case is NOT
> satisfied, do I want to output a <tr>, if I leave the contents of
> the "when" empty, will that work?

You're using:

  <xsl:choose>
    <xsl:when test="$showcasemgmt='true' and
                    CaseMgmtInd='FALSE'"></xsl:when>
    <xsl:otherwise>
      <tr>...</tr>
    </xsl:otherwise>
  </xsl:choose>

That's fine, and it will work, but you might be interested in an
alternative that's a bit shorter. You're only wanting to do something
if it's *not* the case that $showcasemgmt is 'true' and CaseMgmtInd is
'FALSE', and that's all you're concerned about testing, so you can
just use xsl:if instead:

  <xsl:if test="not($showcasemgmt = 'true' and
                    CaseMgmtInd = 'FALSE')">
    <tr>...</tr>
  </xsl:if>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.