After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 356939 - Invalid xpath evaluation with a namespace prefix
Invalid xpath evaluation with a namespace prefix
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.x
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2006-09-20 18:05 UTC by nicolas.marsgui
Modified: 2013-08-04 16:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A test case showing the problem (936 bytes, application/bzip2)
2006-09-20 18:08 UTC, nicolas.marsgui
Details

Description nicolas.marsgui 2006-09-20 18:05:42 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>
-------------------
Comment 1 nicolas.marsgui 2006-09-20 18:08:53 UTC
Created attachment 73099 [details]
A test case showing the problem
Comment 2 Nick Wellnhofer 2013-08-04 16:51:28 UTC
Works for me with libxslt 1.1.28. Probably fixed together with bug #407731.