GNOME Bugzilla – Bug 314788
nodeset sort fails on a namespace node
Last modified: 2021-07-05 13:24:48 UTC
Consider the following code: [code] <x:stylesheet xmlns:x = "http://www.w3.org/1999/XSL/Transform" version = "1.0"> <!-- --> <x:template match="/"> <data aname="aval" xmlns:ns="ns:ns:ns"> <t1><x:value-of select="string(//data/namespace::ns)"/></t1> <t2><x:value-of select="string(//data/@aname)"/></t2> <t3><x:value-of select="string(//data/@aname | //data/namespace::ns)"/></t3> </data> </x:template> </x:stylesheet> [/code] xsltproc produces: [code] <?xml version="1.0"?> <data xmlns:ns="ns:ns:ns" aname="aval"><t1>ns:ns:ns</t1><t2>aval</t2><t3>aval</t3></data> [/code] but expected result is: [code] <?xml version="1.0"?> <data xmlns:ns="ns:ns:ns" aname="aval"><t1>ns:ns:ns</t1><t2>aval</t2><t3>ns:ns:ns</t3></data> [/code] <t3>ns:ns:ns</t3> instead of <t3>aval</t3> is expected because namespace nodes come before attribute nodes in the document order.
This is a bug in libxml2's XPath engine.
Created attachment 356642 [details] [review] Proposed patch Namespace nodes were simply ignored in the comparison functions.
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/libxml2/-/issues/ Thank you for your understanding and your help.