[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Disable Output escaping - what am i doing wrong?

Subject: Re: Disable Output escaping - what am i doing wrong?
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Wed, 3 Oct 2001 13:02:37 -0400
disable output escaping xmlns
Presumably  the database has already escaped the HTML tags, or put them in a
CDATA section, otherwise you would not have well-formed XML.  It could look
like this:

<root>
<field>&lt;p&gt;this &lt;br&gt;is a test
</field>
</root>

Here is how you can do disable-output-escaping to get what you want:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html' encoding='utf-8'/>

<xsl:template match="/">
<html>
 <xsl:value-of select='root/field' disable-output-escaping='yes'/>
</html>
</xsl:template>
</xsl:stylesheet>

Here is the actual transformed result of the little example above:

<html><p>this <br>is a test

</html>

Cheers,

Tom P

[Paul Mortimer]

>
> I'm having problems formatting information from an SQL 2000 data source.
The
> information is returned
> as xml and formatted with xsl. One of the fields contains HTML  such as
<P>
> and <BR> which are being converted in &lt;P&gt and &lt;BR&gt respectively.
I
> need to return the "text" data field as HTML,and
> believe that i need to use the disable-output-escaping attribute, but
don't
> know how to use it.
>
> The current list for the xsl is.
>
> <xsl:stylesheet version="1.0" xmlns:xsl =
> "http://www.w3.org/1999/XSL/Transform"
> xmlns="http://www.w3.org/TR/REC-html40">
> <xsl:output method="html" indent="yes"/>
> <xsl:template match = "/">
>
>
> <table border = "2" bgcolor = "yellow">
> <tr>
> <th>PressReleaseID</th>
> <th>Headline</th>
> <th>text</th>
>
> </tr>
> <xsl:for-each select = "SITES/PressReleases">
> <tr>
> <td class="nav-breadcrumb-title">
> <xsl:value-of select = "PressReleaseID"/>
> </td>
> <td>
> <xsl:value-of select = "Headline"/>
>
> </td>
> <td>
> <xsl:value-of select = "text"/>
> </td>
>
> </tr>
> </xsl:for-each>
> </table>
>
> </xsl:template>
> </xsl:stylesheet>
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.