This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Copy CDATA nodes from XML to XML format w/ XALAN
- From: Morten Primdahl <morten at it-c dot dk>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 04 Mar 2002 13:42:09 +0100
- Subject: Re: [xsl] Copy CDATA nodes from XML to XML format w/ XALAN
- References: <001001c1c302$ae081240$66816bd5@pcukmka>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Thanks for the pushing me in the right direction Mike, it's really
appreciated. I've been having a lot of fun with copy and copy-of!
I added a call-template element to the <xsl:template match="text()">
example you gave, and can now succesfully perform some search/replace
on the output being generated. More specifically I can escape all
quotes contained in the text elements within data element.
Ie. the following
<data>
<a>
<b>"Bub"</b>
</a>
</data>
Gets translated to <a><b>\"Bub\"</b></a> - which is what I want it
to. But if one of the descendants of the data element contain an
attribute, I need to escape the quotes used there as well, eg.
<data>
<a>
<b foo="bar">"Bub"</b>
</a>
</data>
Should become <a><b foo=\"bar\">\"Bub\"</b></a> - I'm beginning to
doubt if this is at all possible as it's no longer "just content",
but syntax I'm messing with (sort of).
I tried using my search/replace template directly on the output
from the copy elements, but that just resulted in all tagged
elements getting filtered away.
I would prefer if there was some way to just treat the content
of the data element like a string value, there's no way to
have copy-of to copy the current node to a variable rather than
the output (or something similar)?
Thanks,
Morten
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list