[xslt] strange match failure



We are using libxml/libxsl through the lxml python bindings and are really grateful for such a high quality xml/xslt implementation.

But, I think were hit a bug in libxslt today. A xpath in a match-template is throwing, for no obvious reasons, a XPATH_INVALID_CTXT_POSITION error.

I was able to reproduce the problem on the following minimalistic example transformation:

XML Doc
----------------------------
<root>
    <a type="b"/>
</root>
----------------------------

XSLT Doc
----------------------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:template match="a[ type='b']" >
        <xsl:if test="position()"/>
    </xsl:template>
    <xsl:template match="a[ type='XX'][.]"/>
</xsl:stylesheet>
----------------------------

Somehow the evaluation of the position() function in the first template leads to an error in the evaluation of the second. But only if the second xpath for the match uses two predicates.

If the match xpath is spelled equivalently with a single predicate: <xsl:template match="a[ type='XX' and .]"/> the error doesn't happen.

Should I report this as a bug or exists there an explanation.

thnx, dirk


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]