Uploaded image for project: 'XalanC'
  1. XalanC
  2. XALANC-336

XPath with predicate [1] returns multiple nodes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Incomplete
    • 1.6
    • None
    • XPathC
    • None
    • Operating System: All
      Platform: All
    • 23933

    Description

      The following XPath
      //descendant-or-self::Assertion[parent::Security][1]
      When run over the following xml file
      <Envelope>
      <Security>
      <Assertion id="First"/>
      </Security>
      <Security >
      <Assertion id="Second"/>
      </Security>
      <Security >
      <Assertion id="Third"/>
      </Security>
      </Envelope>
      returns all three Assertion nodes. When the predicate [1] is changed to [2]
      only the node with id="Second" is selected, ditto when [1] is replaced by [3]
      only the third node is selected. Therefore there is an issue with the predicate
      [1] being used. This is at odds with the java implementation's evaluation of
      the same expression, which, as expected returns only one node when [1] is used.
      Notes:
      This issue is observed on Linux (kernel 2.4.7-10 and above), Win32(2000) and
      Solaris (5.8).
      The bug was seen in the last version of Xalan I was using (1.2) but is still
      present in the current release (1.6). I am using the default xerces (2.3.0).

      Here is a code snippet to clarify my usage.

      XPathEvaluator theEvaluator;
      XalanSourceTreeDOMSupport theSupport;

      const XObjectPtr dataObj = theEvaluator.evaluate(
      theSupport,
      theContext,
      theXPATH.c_str(),
      theResolver);
      if (dataObj->getType() != XObject::eTypeNodeSet)

      {//Error handling ommitted for clarity...}

      return new MutableNodeRefList((const NodeRefList)dataObj->nodeset());

      The context node is the document node. The prefix resolver has been extended in
      my impl but since there are no namespaces in my simplified example this should
      not be an issue.
      If you need any more information then I will be happy to oblige.
      Tony

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--test.xml
          0.3 kB
          Anthony Collen
        2. ASF.LICENSE.NOT.GRANTED--test.xsl
          1 kB
          Anthony Collen
        3. ASF.LICENSE.NOT.GRANTED--xalan.xml
          0.3 kB
          Anthony Collen

        Activity

          People

            Unassigned Unassigned
            tony Anthony Collen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: