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

RE: XSLT Disable-Output-Escaping Not Working

Subject: RE: XSLT Disable-Output-Escaping Not Working
From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx>
Date: Thu, 13 May 2004 11:57:34 -0500
disable output escaping not working
Hi Shelli,

You do not need to use the d-o-e, since in fact, as it was pointed out,
doesn't do anything on attribute values.

Your code should work fine without it. However, you need to set the output
to html. To demonstrate, I have created the following XML:

<root>
<title>This &amp; That</title>
</root>


and XSLT:


<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" omit-xml-declaration="yes"/>

<xsl:template match="/">

<xsl:element name="img">
	<xsl:attribute name="src">xxx</xsl:attribute>
	<xsl:attribute name="alt">
		<xsl:value-of select="root/title"/>
	</xsl:attribute>
</xsl:element>

</xsl:template>

</xsl:transform>


which does output


<img src="xxx" alt="This &amp; That">


and that works fine in the browser. I tested on Xselerator 2.6.

HTH,
<prs/>
http://www.pietsieg.com
http://www.pietsieg.com/dotnetnuke


-----Original Message-----
From: Shelli D. Orton [mailto:shelli.orton@xxxxxxxxx] 
Sent: Thursday, May 13, 2004 11:29 AM
To: XSL List
Subject:  XSLT Disable-Output-Escaping Not Working

Hi,

I'm fairly new to XLST and have come across this problem.  I have a template
that creates an image element as below:

<xsl:element name="img">
	<xsl:attribute name="src">
		<xsl:choose>
			<xsl:when test="Content/Title/image">
				<xsl:value-of select="Content/Title/image"
/>
			</xsl:when>
			<xsl:otherwise>
					<xsl:value-of
select="$defaultImage"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:attribute>
	<xsl:attribute name="alt">
		<xsl:value-of select="MetaData/title"
disable-output-escaping="yes"/>
	</xsl:attribute>
</xsl:element>

When the value of MetaData/title is "This &amp; That", the &amp; is escaped
resulting in a title of "This &amp;amp; That" which the browser displays as
"This &amp; That".  Shouldn't the result be "This &amp; That" which the
browser displays as "This & That"?  I have used the disable-output-escaping
attribute in many other places and it has always worked before.


Thanks for any help.

Shelli

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.