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 529223 - Top-level elements not in the XSLT namespace must be ignored
Top-level elements not in the XSLT namespace must be ignored
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.22
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2008-04-21 15:01 UTC by Karl O. Pinc
Modified: 2008-05-13 14:44 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Karl O. Pinc 2008-04-21 15:01:24 UTC
Top-level elements not in the XSLT namespace must be ignored, but
they're not.

$ ./xsltproc/xsltproc --version
Using libxml 20631, libxslt 10122 and libexslt 813
xsltproc was compiled against libxml 20631, libxslt 10122 and libexslt 813
libxslt 10122 was compiled against libxml 20631
libexslt 813 was compiled against libxml 20631


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

<xsl:output method="text"/>

<xsl:template match="/">
  <xsl:text>Hello </xsl:text>
  <xsl:if test="false()">
    <xsl:text>world</xsl:text>
  </xsl:if>
</xsl:template>

<x:ignore xmlns:x="x">
<xsl:template match="/">
  <!--this better not be here!-->
</xsl:template>
</x:ignore>

</xsl:stylesheet>
EOF
compilation error: file - line 14 element template
element template only allowed as child of stylesheet

I would expect the above to produce "Hello ", ignoring the <x:ignore>
element because XSL Transformations (XSLT) Version 1.0
(http://www.w3.org/TR/1999/REC-xslt-19991116), Section 2.2, says: 'In
addition, the xsl:stylesheet element may contain any element not from
the XSLT namespace, provided that the expanded-name of the element has
a non-null namespace URI. ...  Thus, an XSLT processor is always free
to ignore such top-level elements, and must ignore a top-level element
without giving an error if it does not recognize the namespace URI.'

The impact is that I cannot comment out sections of my xslt code.
This makes development and in-code documentation annoying.  The
problem also, potentially, impacts cool xslt documentation tools like:
http://www.cranesoftwrights.com/resources/xslstyle/index.htm

Note regarding the history of the bug.
The bug occurs in (where I first noticed it):
$ xsltproc --version
Using libxml 20627, libxslt 10119 and libexslt 813
xsltproc was compiled against libxml 20627, libxslt 10119 and libexslt 813
libxslt 10119 was compiled against libxml 20627
libexslt 813 was compiled against libxml 20627

but does not occur in:
$ xsltproc --version
Using libxml 20616, libxslt 10111 and libexslt 809
xsltproc was compiled against libxml 20616, libxslt 10111 and libexslt 809
libxslt 10111 was compiled against libxml 20616
libexslt 809 was compiled against libxml 20616
Comment 1 Daniel Veillard 2008-05-13 14:44:36 UTC
Apparently simple but actually painful because, if the element is
an extension then the normal processing must still occur.
using a comment to embed the discarded part is IMHO
way safer...
Anyway that should be fixed in SVN revision 1472.

  thanks,

Daniel