Subject: RE: Check the value of a element
From: Michel Goossens <Michel.Goossens@xxxxxxx>
Date: Thu, 2 Sep 1999 17:16:56 +0200 (METDST)
|
The following XSL stylesheet
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:template match="/one/two[. < 10]">
<xsl:value-of select="."/><xsl:text> < 10</xsl:text>
</xsl:template>
<xsl:template match="/one/two[. = 10]">
<xsl:value-of select="."/><xsl:text> = 10</xsl:text>
</xsl:template>
<xsl:template match="/one/two[. > 10]">
<xsl:value-of select="."/><xsl:text> > 10</xsl:text>
</xsl:template>
</xsl:stylesheet>
on the following XML data
<one>
<two>9</two>
<two>10</two>
<two>11</two>
</one>
produces the following output
9 < 10
10 = 10
11 > 10
It is a little unfortunate that one has to use < in the comparison on
line 3 (otherwise xt displays a "character not allowed" message). On the
other hand, the > operator (gt) by itself seems to be accepted all right
as a literal, without needing the > entity reference.
mg
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|