|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:when - comparing parameter and element values
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








