>> English << | Français | Deutsch | Magyar | 中文 | Polski | ZVON > Tutorials > XSLT Tutorial |
Intro / Search / ZVON |
>> Page 42 << | Prev | Next | Contents | Element Index |
XML Source
<source> <number>253</number> <number>sd12</number> <number>-64</number> <number>2.25.25</number> <number>2.25</number> </source> Output
<DIV>253</DIV> <DIV>sd12 is not a number</DIV> <DIV>-64</DIV> <DIV>2.25.25 is not a number</DIV> <DIV>2.25</DIV> HTML view
253
sd12 is not a number
-64
2.25.25 is not a number
2.25 |
XSLT stylesheet
<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:template match="number"> <DIV> <xsl:value-of select="."/> <xsl:if test="string(number(.))='NaN'"> is not a number</xsl:if> </DIV> </xsl:template> </xsl:stylesheet> |