[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] De-escaping markup


Subject: RE: [xsl] De-escaping markup
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 3 Feb 2005 11:43:33 -0000

One approach is to serialize the content without escaping it:

<xsl:value-of select="CONTENT" disable-output-escaping="no"/>

A more flexible approach is to parse the content into a proper tree,
allowing the structured content to be manipulated:

<xsl:variable name="subtree" select="saxon:parse(CONTENT)"/>

Neither approach is 100% portable.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: ben.pickering@xxxxxxxxxxxxxxxx 
> [mailto:ben.pickering@xxxxxxxxxxxxxxxx] 
> Sent: 03 February 2005 11:11
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] De-escaping markup
> 
> Hi
> 
> I have a bit of a problem in that a system out of my control 
> is producing 
> "markup" looking like the following:
> 
> <CONTENT>
>         This is &lt;b&gt;bold&lt;/b&gt;
> </CONTENT>
> 
> i.e., with all the perfectly good markup escaped. 
> 
> I was wondering if anyone knows of a stylesheet which will 
> convert text 
> nodes like this into proper markup, for a whole document.  
> The above would 
> come out like:
> 
> <CONTENT>
>         This is <b>bold</b>
> </CONTENT>
> 
> Ideally it would operate on nested tags, as the system (which 
> will remain 
> nameless) is also breaking my <table>s.
> 
> Thanks for any help.
> Cheers,
> Ben.


Current Thread