|
Subject: [xsl] Nuances of comparisons incorporating node set operands From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 01 Apr 2004 22:56:48 -0500 |
> <xsl:for-each select="Reports/GridBody0"> > > <xsl:if test="Col3 != ''" >
Though correct, it's preferable to use
not(Col3 = '')
T:\ftemp>type jarno.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:jarno="test" version="1.0">
<jarno:data1> <Col1>abc</Col1> <Col3>def</Col3> </jarno:data1>
<jarno:data2> <Col1>abc</Col1> </jarno:data2>
<xsl:template match="/">
<xsl:for-each select="document('')/*/jarno:data1">
Data test 1:
test="Col3 != ''" - <xsl:value-of select="Col3 != ''"/>
test="not(Col3 = '')" - <xsl:value-of select="not(Col3 = '')"/>
</xsl:for-each>
<xsl:for-each select="document('')/*/jarno:data2">
Data test 2:
test="Col3 != ''" - <xsl:value-of select="Col3 != ''"/>
test="not(Col3 = '')" - <xsl:value-of select="not(Col3 = '')"/>
</xsl:for-each>
</xsl:template></xsl:stylesheet> T:\ftemp>saxon jarno.xsl jarno.xsl
Data test 1:
test="Col3 != ''" - true
test="not(Col3 = '')" - true
Data test 2:
test="Col3 != ''" - false
test="not(Col3 = '')" - true
T:\ftemp>
-- Public courses: Spring 2004 world tour of hands-on XSL instruction Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18
World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Dynamically creating XPat, Jarno.Elovirta | Thread | [xsl] concat string to an variable , Jan Kohnert |
| RE: [xsl] Dynamically creating XPat, Jarno.Elovirta | Date | Re: [xsl] Experience with XSLT in I, Jacob Weintraub |
| Month |