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

Re: proper usage of disable-output-escaping on XSLT 1

Subject: Re: proper usage of disable-output-escaping on XSLT 1.0-based stylesheets.
From: "M. David Peterson" <m.david@xxxxxxxxxx>
Date: Mon, 27 Dec 2004 06:03:57 -0700
xslt disable output escaping
M. David Peterson wrote:

When using Saxon 6.5.3 and Saxon 8.2 to process this XML:

<members>
...snip
 <member type="individual" href="">Johannes Dvbler</member>
...snip
</members>

Using this XSLT:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"
encoding="utf-8"/>
 <xsl:template match="/members">
...snip
     <xsl:apply-templates select="member[@type = 'individual']">
       <xsl:sort select="substring-after(., ' ')"/>
     </xsl:apply-templates>
....snip
 </xsl:template>
 <xsl:template match="member">
...snip
       <xsl:value-of select="."/>
...snip
 </xsl:template>
</xsl:stylesheet>

The expected output is given as:

...snip
     <a href="">Johannes Dvbler</a>
...snip

But when using Xalan I get:

...snip
     <a href="">Johannes D&#195;&#182;bler</a>
...snip

By changing the above XSLT to:

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

I get the expected:

...snip
     <a href="">Johannes Dvbler</a>
...snip

as the output.  The obvious problem with this is that by using  the
disable-output-escaping attribute with a value set to "yes" I have now
disabled any escaped output that should be legitimitally escaped such
as any HTML markup that should not be translated by the browswer and
instead printed out to the screen (e.g. &lt;XSLT:Blog /> would be
printed to the screen as "<XSLT:Blog />" where as <XSLT:Blog /> would
be read by the browser as markup and would never show up in the
non-view-source output of the browser.

Is this:

a) A problem with Xalan given that Saxon 6.5.3 correctly outputs the
utf-8 character instead of the escaped XML entity.
b) Just another example of why disable-output-escaping is inherently
bad to use in your XSLT 2.0 based code.

If "b" what would be the work around to this problem for developers using Xalan?

Thanks in advance for anybodys insight to this matter.

Cheers!

<M:D/>




Oops.. this:

...in your XSLT 2.0 based code.

Should have read:

in your XSLT 1.0 based code.

Sorry for the confusion!

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.