RE: [xsl] converting escaped values to literal for text output

Subject: RE: [xsl] converting escaped values to literal for text output
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 20 Jan 2004 14:42:01 +0200
Hi,

> What is the best way to convert xml escape values like `&',
> `Á' etc to their literal values for text output.

An XML parser.

> I need this method for my own stylesheet which I use to convert 
> proprietary XML to text.

Ah, so you want to write an XML parser with XSLT. There are extension function in some XSLT engines that allow you to call an XML parser on a string and get a source tree back, suggest you use those if you need to process looks-like-XML-but-is-not-XML. Make sure, thought, that the string you pass to the extension method really is XML, it will choke on it if it's not well-formed. Another approach is to preprocess the XML before feeding it to the XSLT engine, with e.g. a SAX filter, that will unescape your pseudo-XML into XML.

Cheers,

Jarno - Velvet Acid Christ: The Hand (cut Throat Psycho Rave Mix)

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread