RE: [xslt] XSL and multiple contiguous CDATA
- From: "Meunier, Jean-Luc" <Jean-Luc Meunier xrce xerox com>
- To: "The Gnome XSLT library mailing-list" <xslt gnome org>
- Subject: RE: [xslt] XSL and multiple contiguous CDATA
- Date: Tue, 15 Nov 2005 09:54:42 +0100
Ok, thanks!
The first part is now in bugzilla.
JL
-----Original Message-----
From: xslt-bounces gnome org [mailto:xslt-bounces gnome org] On Behalf
Of Daniel Veillard
Sent: Tuesday, November 15, 2005 12:20 AM
To: The Gnome XSLT library mailing-list
Subject: Re: [xslt] XSL and multiple contiguous CDATA
On Mon, Nov 14, 2005 at 03:34:47PM +0100, Meunier, Jean-Luc wrote:
> Hi,
>
>
>
> My XSLT stylesheet produces strange results when it comes to CDATA.
And
> in Python it's getting worse.
>
>
>
> First, instead of encapsulating all the data of my <content> element
> into one CDATA, I see many contiguous CDATA:
please bugzilla this, provide a complete standalone xslt with the
associated xml input, this should like a bug and will be fixed.
> (My stylesheet says at the beginning: <xsl:output method="xml"
> cdata-section-elements="content" indent="yes"/> )
>
>
>
> <content><![CDATA[Contract Change Order]]><![CDATA[
>
> Application and Certificate for Payment]]><![CDATA[
>
> Progress Schedule and Report]]><![CDATA[
>
> Inventory of Stored Materials]]> </content>
>
>
>
> It seems that because multiple templates generate the data of the
> <content> element, there are many CDATA.
>
> BTW, Saxon creates only one CDATA
>
>
>
> As a workaround, I pass the following additional XSLT:
>
> <xsl:output method="xml" cdata-section-elements="content"
> indent="yes"/>
>
> <xsl:template match="@*|node()">
>
> <xsl:copy>
>
> <xsl:apply-templates select="@*|node()"/>
>
> </xsl:copy>
>
> </xsl:template>
>
>
>
> Then contiguous CDATA are merged. Ok.
>
>
>
> **BUT**, my really big problem is that this workaround doesn't work in
> Python. The workaround XSL keeps things unchanged.
Depends how the input is parsed, the XML_PARSE_NOCDATA removes CDATA
from
the input (because CDATA doesn't exist in the XPath data model used by
XSLT)
and hence all CDATA are included as text nodes and adjacent text nodes
are automatically merged when parsed. If your python processes the tree
and
not parse an instance, or if it lacks the XML_PARSE_NOCDATA option at
parsing
then you won't see the same effect.
Daniel
--
Daniel Veillard | Red Hat http://redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit
http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
xslt gnome org
http://mail.gnome.org/mailman/listinfo/xslt
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]