GNOME Bugzilla – Bug 356939
Invalid xpath evaluation with a namespace prefix
Last modified: 2013-08-04 16:51:28 UTC
Release: xsltproc -V Using libxml 20626, libxslt 10117 and libexslt 813 xsltproc was compiled against libxml 20626, libxslt 10117 and libexslt 813 libxslt 10117 was compiled against libxml 20626 libexslt 813 was compiled against libxml 20626 When a matching pattern like this is used, with "m" as prefix for the MathML namespace: <xsl:template match="m:apply[1][@local='joke']"> <xsl:message>Here</xsl:message> <xsl:apply-templates/> </xsl:template> xsltproc complains: XPath error : Undefined namespace prefix xmlXPathEval: evaluation failed It seems due to the use of multiples expressions "[...]" because doing this works: <xsl:template match="m:apply[position()=1 and @local='joke']"> It also fails for things like match="m:apply[1][m:abs]" A complete example: The XSL stylesheet ------------------------ <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://www.w3.org/1998/Math/MathML" version='1.0'> <xsl:output method="text" encoding="ISO-8859-1" indent="yes"/> <xsl:template match="inlineequation|informalequation"> <xsl:apply-templates/> </xsl:template> <xsl:template match="equation"> <xsl:message>OK</xsl:message> <xsl:apply-templates/> </xsl:template> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="m:math"> <xsl:apply-templates/> </xsl:template> <xsl:template match="m:apply[1][@local='joke']"> <xsl:message>Here</xsl:message> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> ---------------------- The XML doc: ---------------------- <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook MathML Module V1.0//EN" "http://www.oasis-open.org/docbook/xml/mathml/1.0/dbmathml.dtd"> <article> <title>Titre</title> <section> <title>Introduction</title> <para> test </para> <equation> <title>A title</title> <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"> <mml:apply> <mml:abs/> <mml:apply> <mml:divide/> <mml:ci> H </mml:ci> <mml:ci> K </mml:ci> </mml:apply> </mml:apply> </mml:math> </equation> </section> </article> -------------------
Created attachment 73099 [details] A test case showing the problem
Works for me with libxslt 1.1.28. Probably fixed together with bug #407731.