Re: [xsl] node-setting() escaped text

Subject: Re: [xsl] node-setting() escaped text
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 13 Feb 2003 13:53:05 GMT
This is a FAQ and the usual answer is "don't start from here" ie arrange
that your input doc looks like <html> rather than &lt;html&gt;
but failing that....


> <xsl:apply-templates select="xx:node-set(unescape(//item))"/>

the "unescape" function would be an XML parser. Some systems may have
extension functions to parse a string, or they may support the data: URI
scheme in which case you don't need any extension at all, just

<xsl:apply-templates select="document(concat('data:text/xml,',item))"/>

should do the job. (Netscape/mozilla support data: URIs if you are not
familiar with data: try typing 
data:text/html,<b>hello</b>
into netscape's location bar)

If you don't want to apply templates and just want a copy of the input
then copy-of instead of apply-templates. In thi scase as an absolute
last resort you could consider using value-of select="item" with
disable-output-escaping="yes" but d-o-e is almost always a bad idea,
even when it works.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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


Current Thread