xsl-list
[Top] [All Lists]

RE: [xsl] transforming xml data in cdata

2009-11-09 04:24:48
Generally I advise against designing your XML this way: the purpose of CDATA
is to say "the stuff in here is not to be treated as markup", and if you
then want to treat it as markup after all, you've burnt your boats.

However, since so many people dig themselves into this hole, Saxon has an
extension saxon:parse() designed to get you out of it: you can take the
contents of the SkuDetails element and pass it to the XML parser, getting
back a tree of nodes which will essentially be the same as if you had left
out the CDATA start and end tags in the first place.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay  

-----Original Message-----
From: road speeder [mailto:roadspeed2002(_at_)yahoo(_dot_)com] 
Sent: 09 November 2009 02:59
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] transforming xml data in cdata

Hi, I have the following xml data:
<Sale><Site>101</Site>
<Details><![CDATA[ <?xml 
version="1.0"?><items><item>desk</item><cost>10</cost></items>
 ]]> </Details> </Sale>
 
 I have an xslt "my.xslt" that tranforms the elements above 
except cdata part to result.xml. e.g 
<SalesItem><Location>101</Location></SalesItem>
 However, I also have "another.xslt" that can transform the 
xml part within the cdata section.
 I would like to import "another.xslt" into my.xslt and be 
able to transform the xml document within cdata as well.
 With the result looking similar to the following:
 <SalesItem><Location>101</Location><SkuDetails>
 <![CDATA<?xml 
version="1.0"?><skus><sku>desk</sku><amount>10</amount></skus>]]>
</SkuDetails></SalesItem>

Any ideas would be appreciated if this can be accomplished.
Thanks



      

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>