.. and parent::node()

Subject: .. and parent::node()
From: "Alex Albu" <xsl@xxxxxxxxxxxxxxx>
Date: Wed, 25 Oct 2000 16:40:18 -0400
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


Current Thread