If the next step in your pipeline is an XSLT
transformation, then it doesn't make the slightest difference whether the text
nodes are represented as CDATA sections or not.
Michael Kay
Hi Michael - thanks for the reply. The xsl processing that I am
performing is an intermediate step that passes on the resulting xml to another
xsl stylesheet that performs the final step, so I need to keep the CDATA
sections.
To process the XML I'm using Javax/TraX inside a java bean - these
are the imported clases:
// Imported TraX classes
import
javax.xml.transform.TransformerFactory;
import
javax.xml.transform.Transformer;
import
javax.xml.transform.stream.StreamSource;
import
javax.xml.transform.stream.StreamResult;
import
javax.xml.transform.TransformerException;
import
javax.xml.transform.TransformerConfigurationException;
Any more suggestions or ideas are greatly appreciated -
thanks a lot.
Ciaran.
Michael Kay <mike@s...> wrote:
> The first problem was
that it was not keeping any of the CDATA sections around any elements - it
was simply removing them and just copying the text inside the
sections.
That's correct behaviour. CDATA is considered to be
just an input convenience, to save you using lots of entity and character
references for special characters. If there aren't any special characters,
then the CDATA brackets are just noise.
I then
added cdata-section-elements="UNIQUEJVID" and cdata-section-elements="TITLE"
(in a new line) to the xsl:output section of the xsl. This returned the
CDATA section around these element but incorrectly - as in below:
This looks like a quirk of the XSLT processor you are
using, you should report it on the support channel for that processor (or at
the very least, tell us which processor you are using.)
Michael Kay
http://www.saxonica.com/
|