|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] .. and parent::node()
This is a situation where SAXON (version 5.4) handles '..' and
'parent::node()' in different ways. 'parent::node()' returns an empty
node-set when applied to the document element, while '..' doesn't. XT
behaves the same.
Stylesheet:
<xsl:template match="*|/">
<crt-node type="{name()}">
<xsl:choose>
<xsl:when test="parent::node()">NOT ROOT</xsl:when>
<xsl:otherwise>ROOT</xsl:otherwise>
</xsl:choose>
</crt-node>
<xsl:apply-templates/>
</xsl:template>
Input file:
<list>
<group>
<element id="1"/>
<element id="2"/>
<element id="3"/>
</group>
</list>
Output:
<crt-node type="">ROOT</crt-node>
<crt-node type="list">ROOT</crt-node>
<crt-node type="group">NOT ROOT</crt-node>
<crt-node type="element">NOT ROOT</crt-node>
<crt-node type="element">NOT ROOT</crt-node>
<crt-node type="element">NOT ROOT</crt-node>
If the test in xsl:when is replaced by ".." SAXON works as expected:
<crt-node type="">ROOT</crt-node>
<crt-node type="list">NOT ROOT</crt-node>
<crt-node type="group">NOT ROOT</crt-node>
<crt-node type="element">NOT ROOT</crt-node>
<crt-node type="element">NOT ROOT</crt-node>
<crt-node type="element">NOT ROOT</crt-node>
SAXON bug?
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








