Re: [xslt] expand entities
- From: Daniel Veillard <veillard redhat com>
- To: xslt gnome org
- Subject: Re: [xslt] expand entities
- Date: Mon, 3 Jun 2002 06:28:09 -0400
On Mon, Jun 03, 2002 at 11:21:43AM +0100, Matt Sergeant wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> There's a strange interaction between libxslt and libxml2's
> expandEntitiesDefaultValue flag. If you do XSLT on a stylesheet DOM that
> hasn't had it's entities expanded, then the entity gets completely dropped.
>
> You can demonstrate this by changing
> /*
> * Replace entities with their content.
> */
> xmlSubstituteEntitiesDefault(1);
>
> to a zero.
>
> Normally in libxml2, if you do this it leaves entities in-place in the
> document. But it appears that if you go through XSLT with this, the entities
> vanish into thin air. As can be seen with the above change to xsltproc, and
> the following style and xml files:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <root>foo</root>
>
> and
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE stylesheet [
> <!ENTITY ouml "ö">
> ]>
>
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="xml" />
>
> <xsl:template match="/">
> <out>fooöbar</out>
> </xsl:template>
>
> </xsl:stylesheet>
>
> Is this a bug, or do you just always have to have entity expansion turned on?
the latter, the XPath engine do not deal with entities references in the
tree so asking the parser to expand the entities is needed. On the other
hand this is doable on a case by case basis without forcing the global
setting to always turn expansion on, this requires to use a lower layer
in the libxml2 parsing API where the user code has access to the parser
context (where the replacement flag can be turned on).
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]