This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: cannot force generation of " inside attribute value string
- To: xsl-list at mulberrytech dot com
- Subject: Re: cannot force generation of " inside attribute value string
- From: Warren Hedley <w dot hedley at auckland dot ac dot nz>
- Date: Thu, 31 Aug 2000 14:17:27 +1200
- CC: greg keraunen <gkeraunen at valinux dot com>
- Organization: The Departement of Engineering Science, The University of Auckland
- References: <39AD8F23.D1909986@valinux.com>
- Reply-To: xsl-list at mulberrytech dot com
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><?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