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

Printing out variables with escaped text.

Subject: Printing out variables with escaped text.
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Thu, 13 Apr 2000 15:22:54 +1200
saxon lt
I'm having a problem printing out variables that contain text
declared with disable-output-escaping="yes" (and yes, I'm doing
dodgy stuff, trying to create start and end tags where I
shouldn't, before anyone tells me I shouldn't be doing this.)

Consider the following stylesheet - it surprised me that this
didn't work.

--- START
<?xml version="1.0"?>

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

<xsl:output method="html" />

<xsl:template match="/">
  <xsl:variable name="bob">
    <xsl:text>&lt;fake_element_no_escaping&gt;
</xsl:text>
    <xsl:text disable-output-escaping="yes">&lt;fake_element_escaping&gt;
</xsl:text>
  </xsl:variable>
  <xsl:value-of select="$bob" />
</xsl:template>

</xsl:stylesheet>
--- END

The output from both Saxon and Xalan was (actually Saxon didn't bother
escaping the &gt;'s, but that's OK for now.)

&lt;fake_element_no_escaping&gt;
&lt;fake_element_escaping&gt;

So I pulled out the spec and it suggested using <xsl:copy-of> instead of
<xsl:value-of>.

So I tried that and got :

Saxon:

&lt;fake_element_no_escaping>
&lt;fake_element_escaping>

Xalan:

&lt;fake_element_no_escaping&gt;
<fake_element_escaping>

which is what I originally wanted.

It's getting pretty hard to find bugs in Saxon nowadays, so I thought I'd
post this to list instead of straight to Mike, to see if anyone had any
thoughts on what is the correct behaviour here - the spec doesn't appear
to address this issue specifically.

Any comments? Thanks.

-- 
Warren Hedley
Department of Engineering Science
Auckland University
New Zealand


 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.