This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
testing for null string in a node
- To: xsl-list at mulberrytech dot com
- Subject: testing for null string in a node
- From: mxmodi at duke-energy dot com
- Date: Mon, 6 Nov 2000 12:43:10 -0600
- Reply-To: xsl-list at mulberrytech dot com
Hi,
I want to be able to test if the value of a certain node is empty and
depending on the result, perform more functions. I am having some troublwe
understanding how to test for that. Any help is appreciated.
Here is the sample XML:
<root>
<Names>
<Name>
<FN>aaa</FN>
<LN>bbb</LN>
<Dates>
<Date>
<Begin>11/11</Begin>
<End>12/11</End>
<Projects>
<Project>
<Name>proj a</Name>
<Code>abc-123</Code>
</Project>
........More <Project> Nodes
</Projects>
</Date>
.....more <Date> Nodes
</Dates>
</Name>
...........more <Name> Nodes
</Names>
</root>
Here is the sample XSL:
<xsl:template match="/">
...perform some code...
<xsl:apply-templates select="//Names/Name" >
<xsl:sort select="FN" />
</xsl:apply-templates>
</xsl:template>
<xsl: template match="Name">
<xsl:choose>
<xsl:when test="*[not(child::FN)]">
...do something...
</xsl:when>
<xsl:otherwise>
...do something else...
</xsl:otherwise>
</xsl:choose>
...continue doing rest of the stuff..
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list