xsl-list
[Top] [All Lists]

Re: proper usage of disable-output-escaping on XSLT 1.0-based stylesheets.

2004-12-27 06:03:57
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 Döbler</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[(_at_)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 Döbler</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 Döbler</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!


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>