You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/04/16 00:14:44 UTC

DO NOT REPLY [Bug 8131] New: - XPath in a stylesheet only finds nodes below start node

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8131>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8131

XPath in a stylesheet only finds nodes below start node

           Summary: XPath in a stylesheet only finds nodes below start node
           Product: XalanJ2
           Version: 2.2.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: mschilling@edgility.com


Use the input document:

  <top>
    <settings>10</settings>
    <order>
      <line>
        <item>spoon</item>
        <quantity>20</quantity>
      </line>
      <line>
        <item>fork</item>
        <quantity>10</quantity>
      </line>
    </order>
  </top>
and the stylesheet

  <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="order">
    <xsl:value-of select="../settings"/> settings
    <xsl:value-of select="sum(line/quantity)"/> pieces
  </xsl:template>

</xsl:stylesheet>

Begin the transformation at the "order" node.  One would expect the output:

   10 settings
   30 pieces

But the actual output is

   settings
   30 pieces

because "../settings" doesn;t match anything.  In fact, no XPath expression,
relative or absolute, matches anything outside the subtree headed by "order". 
This is contrary to the XPath 1.0 spec, which states "/ matches the root node of
the document containing the context node."

Note that Saxon produces the correct output.