XalanJ2
  1. XalanJ2
  2. XALANJ-2097

Problem with variable reference followed by self::node() if you use XSLTC

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.7
    • Component/s: XSLTC
    • Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
    • Labels:
      None
    • Xalan info:
      PatchAvailable
    • Fix priority:
      fp2

      Description

      There is a problem when you have an XPath that contains a variable reference followed by self::node() if you use XSLTC (the problem does not occure if you just use Xalan without XSLTC).
      If you have for example $var1/self::node(). The following XSLTC Step is generated :

      FilterParentPath(variable-ref(var1/node-set), step("self", -1))

      This step is translated to the following piece of code (I decompiled to byte code):

      DTMAxisIterator dtmaxisiterator1 = (new CachedNodeListIterator(new StepIterator(dom.getTypedAxisIterator(3, 14), dom.getTypedAxisIterator(3, 15)))).setStartNode;
      this;
      dom;
      new StepIterator(dtmaxisiterator1.cloneIterator(), new SingletonIterator);

      As you can see the 'self::node()' step is translated to 'new SingletonIterator'. This is not correct because new SingletonIterator will refer to the node of the _parent of the FilterParentPath step.
      After applying the patch I made, the following code is generated if the _parent of the Step (self::node()) isn't a 'ParentLocationPath' :

      new StepIterator(dtmaxisiterator1.cloneIterator(), dom.getAxisIterator(13));

      To run the sample just run

      org.apache.xalan.xslt.Process -in items.xml -xsl problem2.xsl -xsltc

      1. items.xml
        0.1 kB
        Nick Van den Bleeken
      2. problem2.xsl
        0.4 kB
        Nick Van den Bleeken
      3. Step.patch
        2 kB
        Nick Van den Bleeken

        Activity

        Hide
        Nick Van den Bleeken added a comment -

        sample data xml file

        Show
        Nick Van den Bleeken added a comment - sample data xml file
        Hide
        Nick Van den Bleeken added a comment -

        sample xsl file

        Show
        Nick Van den Bleeken added a comment - sample xsl file
        Hide
        Nick Van den Bleeken added a comment -

        This patch 'solves' the problem

        Show
        Nick Van den Bleeken added a comment - This patch 'solves' the problem
        Hide
        Brian Minchau added a comment -

        The problem appears to be valid, and this issue may be related to another issue (Henry Zongaro might know which one, where you have a / path expression that doesn't resolve to the right right root node if the document() function is involved).

        Setting Henry Z. to be the patch reviewer, fix priority fp2, per the Xalan-J issue meeting on May 3, 2005.

        Show
        Brian Minchau added a comment - The problem appears to be valid, and this issue may be related to another issue (Henry Zongaro might know which one, where you have a / path expression that doesn't resolve to the right right root node if the document() function is involved). Setting Henry Z. to be the patch reviewer, fix priority fp2, per the Xalan-J issue meeting on May 3, 2005.
        Hide
        Henry Zongaro added a comment -

        I have reviewed the patch, and I believe that it correctly resolves the problem.

        Show
        Henry Zongaro added a comment - I have reviewed the patch, and I believe that it correctly resolves the problem.
        Hide
        Henry Zongaro added a comment -

        Applied patch to CVS.

        Show
        Henry Zongaro added a comment - Applied patch to CVS.
        Hide
        Brian Minchau added a comment -

        Nick, please confirm that this issue is resolved to your satisfaction in the Xalan-J 2.7 release, then we can close this issue.

        Show
        Brian Minchau added a comment - Nick, please confirm that this issue is resolved to your satisfaction in the Xalan-J 2.7 release, then we can close this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Nick Van den Bleeken
            Reviewer:
            Henry Zongaro
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development