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 581310 - Entities that expand to <xsl:text>...</xsl:text> don't work
Entities that expand to <xsl:text>...</xsl:text> don't work
Status: RESOLVED OBSOLETE
Product: libxslt
Classification: Platform
Component: general
1.1.x
Other Linux
: Normal minor
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2009-05-04 13:28 UTC by Mike Massonnet
Modified: 2021-07-05 10:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mike Massonnet 2009-05-04 13:28:26 UTC
I'm using the following xsl as a test file:

<!DOCTYPE xsl:stylesheet [
<!ENTITY CR "&#x0A;" >
<!ENTITY tCR "<xsl:text>&CR;</xsl:text>" >
]>

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

    <xsl:template match="test">
        <testOut>
            The Spanish word for "Spain" is: "Espana".&tCR;
            <xsl:apply-templates/>
        </testOut>
    </xsl:template>

</xsl:stylesheet>

It contains a carriage return entity and another entity with the tag xsl:text. When using xsltproc to compile the following xml test file:

<?xml version="1.0" ?>
<test></test>

It doesn't take the tCR entity into account. And actually it prints a warning for every entities that are using <xsl:text> as:

namespace error : Namespace prefix xsl on text is not defined
<xsl:text>&CR;</xsl:text>
         ^

I have only tested with version 1.1.24.
Comment 1 Daniel Veillard 2009-05-08 11:32:52 UTC
yes that's a libxml2 problem. Basically the entities are parsed out of the
context and the namespace declaration for the xsl prefix doesn't exist.
Namespace and entities do not mix well
Please note the following:

<!DOCTYPE foo [
<!ENTITY CR "&#x0A;" >
<!ENTITY tCR "<xsl:text>&CR;</xsl:text>" >
]>

<foo>
  <test xmlns:xsl="bar">&tCR;</test>
  <test xmlns:xsl="foo">&tCR;</test>
</foo>

  Here the namespace for the 2 entities replacement should be different.
libxml2 was designed for XML edititing, including entities content. At the
time of XML-1.0 when it was designed namespaces didn't exist, and the
content model for en entity replacement tree would be the same wherever in
the tree. Namespace broke that, after the design.

  Best solution is to never allow indeterminims when defining entities
in your case it's trivial, just put the namespace definition in your entity:

<!ENTITY tCR "<xsl:text xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>&CR;</xsl:text>" 

  I don't think I will rewrite the entity layer of libxml2 to cope with this,
so it's unlikely to get fixed anytime soon.

Daniel
Comment 2 Mike Massonnet 2009-05-09 11:38:29 UTC
Thanks for the valuable information!
Comment 3 GNOME Infrastructure Team 2021-07-05 10:59:16 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxslt/-/issues/

Thank you for your understanding and your help.