Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2212

descendant-or-self isn't sorted

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • XPath
    • None
    • Windows XP SP 2, JRE 1.4.2_05, Xalan 2.7.1

    Description

      Take the following instance:
      <a>
      <b>
      <c>
      <d/>
      </c>
      </b>
      </a>

      And make a transformation with the following stylesheet:
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="/">
      Should Return:b1,c2 =
      <xsl:for-each select="/descendant-or-self::/descendant-or-self::[ (local-name()='b' and position()=1) or (local-name()='c' and position()=3)]">
      <xsl:value-of select="concat(local-name(), position())"/>,</xsl:for-each>
      Should Return: b =
      <xsl:value-of select="local-name(/descendant-or-self::/descendant-or-self::[ (local-name()='b' and position()=1) or (local-name()='c' and position()=3)])"/>
      Should Return: 4=
      <xsl:value-of select="count(/descendant-or-self::/descendant-or-self::)"/>
      </xsl:template>
      </xsl:stylesheet>

      The result should be (which it is when using xsltc):
      Should Return:b1,c2 =
      b1,c2,
      Should Return: b =
      b
      Should Return: 4=
      4

      But the result is:
      Should Return:b1,c2 =
      c1,b2,
      Should Return: b =
      c
      Should Return: 4=
      10

      It looks like the descendant-or-self::/descendant-or-self:: isn't sorted and that the nodes returned from the iterator isn't unique (e.g. that the iterator believes it returns unique nodes).

      Attachments

        Activity

          People

            Unassigned Unassigned
            davidlandwehr David Landwehr
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: