[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Treat CDATA section content as node
> So you might have: > > <xyz><![CDATA[<p>a paragraph</p><p>a paragraph</p><p>a > paragraph</p>]]></xyz> > > Maybe I want to tranlsate the <p> tags into <div> tags. Well, there aren't any <p> tags. That's what CDATA means: "the stuff in here might look like markup, but it isn't, it's ordinary character data". "<p>" is therefore not a tag, it's a sequence of three characters. If the author wanted it to be treated as markup, he shouldn't have put CDATA around it. Unfortunately this misuse of CDATA is very common. The only way to deal with it is to extract the string inside the CDATA (as a string) and then pass it to an XML parser to convert into a tree that XSLT can process. That needs calls to extension functions (unless you want to do the parsing in XSLT, of course, which isn't likely to be much fun in XSLT 1.0). Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay
|
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
|