[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

.. and parent::node()

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.