“undefined namespace prefix” with XSLT prefix and two predicates

I've caught yet another libxml2/libxslt bug: Bug 407731.

Consider the stylesheet (test.xsl):

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="*[xsl:template][1]">
  <x/>
</xsl:template>

</xsl:stylesheet>

Let run it:

$ ~/p/third_party/libxslt/opt/bin/xsltproc test.xsl test.xsl
XPath error : Undefined namespace prefix
<?xml version="1.0"?>
<x/>

Note the error "Undefined namespace prefix" is appeared, but there is no error. And, for example, Saxon doesn't complaint.

The funny thing is that if I change "*[xsl:template][1]" to "*[xsl:template]", the error is disappeared.

Categories:

Updated: