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

Pattern of form "id('x')/a/b" treated as "id('x')/a//b"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 2.7.1
    • None
    • XPath
    • None
    • Operating System: All
      Platform: All
    • 9837

    Description

      If a pattern begins with either "id(Literal)" or "key(Literal,Literal)" and has
      two StepPatterns after, each separated by a single '/', the StepPatterns are
      treated by Xalan as if they were separated by '//'. For example, when the
      following stylesheet

      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="text"/>
      <xsl:template match='id("abc")/l1/v'>
      <xsl:text>Matched id("abc")/l1/v; </xsl:text>
      <xsl:value-of select='.'/>
      </xsl:template>
      </xsl:stylesheet>

      is applied to the following document

      <?xml version="1.0"?>
      <!DOCTYPE root [
      <!ELEMENT root (l1)>
      <!ATTLIST root id ID #REQUIRED>
      <!ELEMENT l1 (l2)>
      <!ELEMENT l2 (l3)>
      <!ELEMENT l3 EMPTY>
      <!ELEMENT v (#PCDATA)>
      ]>
      <root id='abc'>
      <l1>
      <v>Text from root(id='abc')/l1/v</v>
      <l2>
      <v>Text from root(id='abc')/l1/l2/v</v>
      <l3>
      <v>Text from root(id='abc')/l1/l2/l3/v</v>
      </l3>
      </l2>
      </l1>
      </root>

      Xalan produces the following output:

      Matched id("abc")/l1/v; Text from root(id='abc')/l1/v

      Matched id("abc")/l1/v; Text from root(id='abc')/l1/l2/v

      Matched id("abc")/l1/v; Text from root(id='abc')/l1/l2/l3/v

      Attachments

        Activity

          People

            zongaro@ca.ibm.com Henry Zongaro
            zongaro@ca.ibm.com Henry Zongaro
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: