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

Re: [xsl] entity reference...


Subject: Re: [xsl] entity reference...
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 25 Jul 2003 10:22:26 +0100

Hi Fei,

> I have data like this
>
> <teaser>Get more information on &lt;a href="http://www.abc.com"&gt;ABC&lt;/a&gt; web site.</teaser>
>
> The output html needs to be this
> Get more information on <a href="http://www.abc.com">ABC</a> web site.</teaser>
>
> instead of 
> Get more information on &lt;a href="http://www.abc.com"&gt;ABC&lt;/a&gt; web site.

You could use the disable-output-escaping attribute on <xsl:value-of>:

  <xsl:value-of select="teaser" disable-output-escaping="yes" />

The disable-output-escaping attribute disables the usual escaping of
the XML-significant characters & and <, instead writing them literally
to the result. Note that disable-output-escaping won't be honoured in
all situations, but you might get lucky.

It would be much better for all concerned if you could persuade
whoever's providing you with this XML to use unescaped, well-formed
HTML within the <teaser> element. Then you would be able to just copy
the contents directly.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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



Current Thread
Keywords
xml