|
Subject: Re: [xsl] xsl:when - comparing parameter and element values From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Sat, 6 Jan 2001 11:34:59 +0000 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] xsl:when - comparing para, Keith | Thread | RE: [xsl] xsl:when - comparing para, Kay Michael |
| Re: [xsl] xsl:key and document(), Jeni Tennison | Date | RE: [xsl] xsl:when - comparing para, Kay Michael |
| Month |