Altova Mailing List Archives


Re: [xsl] if statement

From: Bill French <bfh@------------->
To:
Date: 8/16/2006 9:57:00 PM
there are several problems here.



1. you are testing on element child, even though your xsl:template has 
made the child element the context node. so the child element you're 
using in your test doesn't exist, as the match would occur on child/child.



2. your xslt syntax is not well-formed XML.



3. your test syntax is not properly formed. i don't know what you're 
trying to accomplish with the brackets, but i'm assuming that you want 
to copy



<span style="color:red">
<xsl:apply-templates/>
</span>

to the output if a child's content is equal to &#21C4;



what you want is:



<xsl:if test=". = '&#x21C4;'">
  <span style="color:red">
    <xsl:apply-templates/>
  </span>
</xsl:if>

--Bill



vanaja selvaraj wrote:
<root>
<child>&#x21C4;</child>
<child>&#x0029;</child>
</root>

Using if statement I have coded like below:



<xsl:template match="child">
<xsl:if test="'[child=&#x21C4]'">
<span style="color:red">
<xsl:apply-templates/>
</xsl:if>
</span>
</xsl:template>

Regards,



S.Vanaja

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.