Re: Export: HowTo Wrap text into CDATA sections

Frédéric Glorieux <[email protected]> Sat, 02 Apr 2005 21:56:35 +0200
Newsgroups gmane.comp.openoffice.devel.xml
Message-ID <[email protected]>
> I want to wrap all consecutive elements "text:p" with the attribute
> "text:style-name='PreformattedText'" into a CDATA-section.

To group following-sibling elements with same style name could be quite 
tricky. I got some public snippets, but perhaps not trivial and not 
relevant to your context.

> The problem I
> cannot solve at the moment is: to  prevent the OO-Writer from escaping
> special characters (such as < and > with the entities "&lt;" and "&gt;")

It seems to me an xsl topic more than OOo. I'm not sure they will open 
soon CDATA elements (sad, but it's not yet a real XML editor)

For your need, if it is absolutely requested for your production chain, 
have a look there

<http://www.w3.org/TR/xslt#output>
<xsl:output cdata-section-elements="my:cdata"/>

to create elements with CDATA inside

and

<http://www.w3.org/TR/xslt#section-Creating-Text>
<xsl:text disable-output-escaping = "yes"/>

depending on xslt processor but may have the desired effect of 
unescaping entities (&lt;, &gt;)

-- 
Frédéric Glorieux ("AJLSM", <http://ajlsm.com>)
"Transfolio" <http://transfolio.org>