Subject: RE: [xsl] transforming xml data in cdata From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Mon, 9 Nov 2009 09:24:21 -0000 |
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@xxxxxxxxx] > Sent: 09 November 2009 02:59 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] transforming xml data in , Wolfgang Laun | Thread | [xsl] Filtering out a specific attr, Mark Wilson |
Re: [xsl] transforming xml data in , Wolfgang Laun | Date | [xsl] Filtering out a specific attr, Mark Wilson |
Month |