After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 595312 - Problem with libexslt (Exslt) node-set() and the preceding axis
Problem with libexslt (Exslt) node-set() and the preceding axis
Status: RESOLVED OBSOLETE
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Windows
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2009-09-15 21:03 UTC by Chris Maloney
Modified: 2021-07-05 11:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test files (2.43 KB, application/force-download)
2009-09-15 21:04 UTC, Chris Maloney
Details
Another test case: test3.xslt (1.43 KB, application/xml)
2009-09-16 00:27 UTC, Nick Wellnhofer
Details

Description Chris Maloney 2009-09-15 21:03:36 UTC
When I create a node-set using the Exslt node-set function on a list of XML elements with no wrapper, I find that the preceding axis does not work correctly on the nodes in the new node-set.

I created the file test0.xslt which exhibits this problem when I run it from a Windows command prompt with
  xsltproc test0.xslt dummy.xml
Look at the output for <test0> -- the <Id>0</Id> appears twice, but it should only appear once.

Note that the problem occurs for the "preceding" axis but not the "following" axis.   Also, a work-around is illustrated in test1.xslt, where I wrap the original list in a parent element.

test2.xslt should be run against list.xml:
  xsltproc test2.xslt list.xml
It shows that the problem is related to the Exslt c:node-set() function when it is applied to a result-tree fragment, but not to nodes in the input document.

This problem doesn't occur in the oXygen debugger, which uses Xalan.

On my Windows command prompt, "xsltproc --version" reports:
  Using libxml 20703, libxslt 10124 and libexslt 813
Comment 1 Chris Maloney 2009-09-15 21:04:27 UTC
Created attachment 143248 [details]
Test files
Comment 2 Nick Wellnhofer 2009-09-16 00:26:31 UTC
The following test case sheds more light on the problem.

$ xsltproc test3.xslt dummy.xml
<?xml version="1.0"?>
<foo>
  <test1>
    <result>1 preceded by </result>
    <result>2 preceded by </result>
    <result>3 preceded by 2</result>
    <result>4 preceded by 23</result>
    <result>5 preceded by 234</result>
    <result>6 preceded by 2345</result>
  </test1>
  <test2>
    <result>1 preceded by </result>
    <result>2 preceded by 1</result>
    <result>3 preceded by 12</result>
    <result>4 preceded by 123</result>
    <result>5 preceded by 1234</result>
    <result>6 preceded by 12345</result>
  </test2>
</foo>

The first top-level node never appears in the preceding nodes. The test

    if (cur == ctxt->context->doc->children)
        return (NULL);

in xmlXPathNextPreceding and xmlXPathNextPrecedingInternal in http://git.gnome.org/cgit/libxml2/tree/xpath.c might be the reason. This optimization doesn't seem to work for document fragments that have more than one child at the top level.
Comment 3 Nick Wellnhofer 2009-09-16 00:27:26 UTC
Created attachment 143257 [details]
Another test case: test3.xslt
Comment 4 Chris Maloney 2009-09-16 13:36:35 UTC
Brilliant!  I like your test example much better than mine.
I'm new here, so I'd like to ask -- what are the chances of this getting in the next release?
Comment 5 Nick Wellnhofer 2009-09-18 15:05:54 UTC
First we would need a real for patch that fixes the bug. But I'd suggest you simply use the preceding-sibling axis instead of the preceding axis. This should work as expected.
Comment 6 GNOME Infrastructure Team 2021-07-05 11:00:04 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxslt/-/issues/

Thank you for your understanding and your help.