Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(Simple!) XPath Text Comparison 1

Status
Not open for further replies.

woogoo

Programmer
Feb 14, 2004
247
GB
Hi, I'm scratching my head over this (I assume trivial) task. I want to skip outputing a table within my HTML transformation, when a given elements value is "no" (well ideally ignoring case).

I've tried several variations from <xsl:if test="ELF = 'Yes'"> to using fn:match(..., ...) but some either bomb out on validation or nothing changes when the flag's value changes.

Any help would be apprciated.





woogoo
 
>I've tried several variations from <xsl:if test="ELF = 'Yes'"> to using fn:match(..., ...) but some either bomb out on validation or nothing changes when the flag's value changes.
So you might accept xslt 2.0..., but, you can use simply xslt 1.0 built-in function to get this done. The logic goes like this.
[tt]
<xsl:choose>
<xsl:when test="translate(ELF,'YES','yes')='yes'">
<xsl:call-template name="output_table" />
</xsl:when>
<xsl:when test="translate(ELF,"NO",'no')='no'">
<xsl:call-template name="output_without_table" />
</xsl:when>
<xsl:eek:therwise>
<!-- decide what you want -->
</xsl:eek:therwise>
</xsl:choose>
[/tt]
It assumes at least two named templates "output_table" and "output_without_table" where you put all the desired processing script.
 
Thank you tsuji, very much appreciated. *


woogoo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top