Transform XML with XSLT and preserve CDATA (in Ruby)?

You cannot preserve the precise sequence of CDATA nodes if they're mixed with plain text nodes. At best, you can force all content of a particular element in the output to be CDATA, by listing that element name in xsl:output/@cdata-section-elements : xsl:output cdata-section-elements="text.

You cannot preserve the precise sequence of CDATA nodes if they're mixed with plain text nodes. At best, you can force all content of a particular element in the output to be CDATA, by listing that element name in xsl:output/@cdata-section-elements.

The cdata-section-elements isn't quite cutting it because I'm using variables and such. Thanks for the tip. – Lance Pollard Oct 1 '09 at 7:17 If you absolutely need CDATA, then you'll have to look for something other than XSLT.

That said, I'm very curious as to the reason why you need it. XDM doesn't distinguish between text and CDATA for a very good reason - no sane XML-processing application should ever give different semantics for them, so CDATA and character-escaping should be useable interchangeably. – Pavel Minaev Oct 1 '09 at 17:24 I am using this data in Flash, and I have heard there's lots of problems with CDATA/no CDATA.

I haven't really tried yet tho :p – Lance Pollard Oct 5 '09 at 8:23.

Sorry to post an answer to my own question, but I found something that works: That will wrap all text() nodes in CDATA, which works for what I need, and it will preserve html tags inside the text.

I guess it's a way to get CDATA node specifically in the output (except that you can get > in input text(), in which case it won't quite do what you expect), but I don't see how this would let you preserve CDATA nodes that were there in the first place, since you still have no way of distinguishing input text nodes from input CDATA nodes. Otherwise, I don't see how this is any different than cdata-section-elements... – Pavel Minaev Oct 5 '09 at 15:24.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions