salbatron cdata problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am playing with a few xml feeds changing them into different formats
and merging them with others, and have found that when using cdata-
section-elements salbatron adds an extra line break at the begining
and end of the cdata tags. e.g.

Inital code is

<text>blah blah</text>

This gets changed to

         <![CDATA[blah blah]]>

Thats not the end of the world but when i then process this feed and
merge it with other stored feeds I use xsl:copy-of to simply copy that
node. cdata-section-elements is used again but this time it assumes
that the line breaks are part of the text and keeps them in so the
resulting code is

blah blah

If the merge transformation is run again then it will again assume the
line breaks outside the <![CDATA[ are part of it again so the code
will be


blah blah


This keeps on occuring adding more and more line breaks into the
text.  I can use normalize-space in the presentaiton of the text but
woudl prefer not to have to. it also means that I end up with files
that are very long and full of line breaks.

Does anyone have any ideas why this is happening and how to stop it.
Thanks for your help

Re: salbatron cdata problem

andybdi wrote:
Quoted text here. Click to load it
You probably mean Sablotron...

Quoted text here. Click to load it

You can use the <xsl:strip-space elements="list-of-element-names"/> to
define elements for which you want to have whitespace stripped. Maybe this
is helping with the situation..

Best regards,
insOMnia - We never sleep...

Re: salbatron cdata problem

Sorry about the spelling, although salbatron does sound a bit cooler!

Anyway, thanks for your help, unfortunatly this didn't work but I have
managed to fix the problem now.  The problem was that I was specifying
indent="yes" in the xsl:output tag.  This was indenting the cdata
section within the tag.  So the next time is was run it was assuming
it was a correct line break including it and then indenting it all
again.  When I took indent="yes" out it worked properly, although now
the whole file is spread over one line!  Thanks for you help.

Site Timeline