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

Re: cannot force generation of " inside attribute value stri

Subject: Re: cannot force generation of " inside attribute value string
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Thu, 31 Aug 2000 14:17:27 +1200
xml quote inside attribute value
greg keraunen wrote:
> 
> dear friends,
> 
> I am having a problem producing xml output that includes double-quotes
> inside of an attribute value.

I'll assume that single quotes don't work. It would actually be nice if XSLT
processors occasionally output attributes surrounded by single quotes, as this
would solve your problem. What is your output method incidentally - if it is
XML or HTML, the quotes are the least of your worries - the '<' at the start
of the attribute is much harder to deal with.

Anyway, to produce dubious output, you have to resort to dubious methods ...

As of saxon 5.4, there is an extension attribute that disables output escaping
in attribute values, allowing you to create the kind of invalid output you're
looking for.

The following stylesheet

<?xml version="1.0" encoding="iso-8859-1"?>

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

<xsl:template match="/">
  <input type="text">
    <xsl:attribute name="value" saxon:disable-output-escaping="yes"
        xmlns:saxon="http://icl.com/saxon">
      <xsl:text>&lt;?php echo global_get("vg_answer.qa[1]" ); ?></xsl:text>
    </xsl:attribute>
  </input>
</xsl:template>

</xsl:stylesheet>

produces

<?xml version="1.0" encoding="utf-8"?>
<input type="text" value="<?php echo global_get("vg_answer.qa[1]" ); ?>"/>

Hope this helps.

-- 
Warren Hedley


 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.