xsltproc: nodeset sort fails on a namespace node

Another libxml2/libxslt bug is found and reported by me.

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.

Categories:

Updated: