Re: XSL transform escape question
Holmberg Rick-ra0119 wrote: > I am processing an xml file with html tags in it. Sorry to be unsympathetic, but there's your problem. This is a FAQ. > When I do the transform (using the transform method with > the SAX parser) XML parsers generally don't transforms, except identity transforms. You mean an XSLT processor. > it is translating the < to < and > to >. ...as it is required to do (at least with "<"), when those start-of-markup characters appear in a portion of the XML that is clearly intended to be character data, not markup. XSLT does not provide for the possibility of interpreting character data as markup; that's the job of an XML parser. > I just want the < to remain as a < and not have the conversion > take place. disable-output-escaping="yes" on the xsl:text or xsl:value-of instructions may work, but it doesn't always, for various reasons. It is considered a hack by many its use is shunned by the old-timers on this list. The biggest problem with it is that *if* it is supported at all (an XSLT processor is not required to support it .. are you using Cocoon, perhaps? They intentionally disabled it), it only applies to serialized output. If you are outputting a DOM (which is what happens behind the scenes in Mozilla), there's no way to flag a text node in the DOM as being in any way special. Some XSLT processors have extensions that allow one to feed an arbitrary string to a parser and get back a node-set or result tree fragment if the parse goes OK. You could also write your own extension function/element to do just that. Consult the docs for your processor for its API for writing extensions. - Mike ____________________________________________________________________________ mike j. brown | xml/xslt: http://skew.org/xml/ denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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