Re: CDATA or escape in the result tree problems
Can it be that the textarea nodes are also in the "ct" prefixed namespace? Or do you have another namespace attached to the textarea elements? This namespace must be used in the cdata-section-elements as well.
Any ideas why this is so? Is it because I import this stylesheet? Is it a weakness with libxslt? Or have I misunderstood cdata-section-elements?
If you are a purist, you don't need to worry about the way it is encoded in XML, as from the XML point of view, this does not matter.
The problem is that I allow users to insert pretty much any HTML in there. My application does some validation and a bit of cleanup, so it should be valid, but that makes is slightly harder to write the template that it should match on if I were to just escape the HTML. If the cdata thing above seems hard to do, I would be happy for advices on how to do this as well.
For XML (and so: XML applications) the following three are equal:
<textarea><sometag /></textarea> <textarea><![CDATA[<sometag />]]></textarea> <textarea><sometag />></textarea>
Which means, to some extend, that using CDATA-sections on the output is not needed. Unless of course you don't use XML tools to parse this result-xml, but you use literal string comparison. I recommend sticking to XML tools, so that you do not have to worry about he way it is encoded.
Of course, this does not give you a resolution for getting the CDATA sections in there. I don't use them often, but I believe that the way you tried it is the right way. Which makes me think it to be a problem with LibXSLT.
Cheers, -- Abel Braaksma http://www.nuntia.com
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format