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

Re: 0utput Escaping not behaving

Subject: Re: 0utput Escaping not behaving
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Sat, 23 Feb 2008 09:46:45 -0000
Re:  0utput Escaping not behaving
--------------------------------------------------
From: "Marroc" <marrocdanderfluff@xxxxxxxxxxx>
Sent: Friday, February 22, 2008 11:02 AM
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  0utput Escaping not behaving

Hello all,

I have a problem that is possibly a bug. I'm using .NET XslTransform for
XSLT 1.0 (not my choice) to transform XHTML to XHTML.

When I create this element like this:

<xsl:element name="a">
<xsl:attribute name="href">
<xsl:text>javascript:include('</xsl:text>
<xsl:value-of select="@href"/>
<xsl:text>?i=1','</xsl:text>
<xsl:value-of select="@target"/>
<xsl:text>');</xsl:text>
</xsl:attribute>
</xsl:element>

I get this:

<a href="javascript:include('toc41837.htm?i=1','TOC');">

Notice the happy apostrophes. However, when I use a variable $href
containing a query string instead of @href. $href being similar to:

/support?p=Compare&c=Compare/help/6.2/toc41837.htm

I get this:

<a
href="javascript:include(&apos;/support?p=Compare&amp;c=Compare/help/6.2/toc
41837.htm?i=1&apos;,&apos;TOC&apos;);">

I've tried to 'disable-output-escaping' in the xsl:text elements but it
doesn't make any difference. Can anyone say what is going on?

Thanks in advance,
Richard


As an alternative solution how about putting the JavaScript into the a element's onclick attribute? I've found the these suffer less from unwanted escape problems.
Especially, as Michael Kay pointed out, the javascript scheme for href attributes is non-standard anyway.


Joe
http://joe.fawcett.name


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.