[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] String literals with both single and double quotes
Subject: Re: [xsl] String literals with both single and double quotes
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 04 Jan 2007 12:30:15 +0100
|
Andrew Welch wrote:
So does that mean in XPath 2.0 they can?
Yes. You can escape a single quote (apostrophe) or a double quote by
doubling it, depending on the containing quotes. I.e., if your string is
contained in single quotes, you can double a single quote to escape it.
In a value-of select expression, it looks like this. where the single
quote is escaped:
<xsl:value-of select=" ' dquote: " and squote: '' ' " />
This selects the following:
dquote: " and squote: '
In XSLT literal attributes this is -- of course -- not possible due to
restrictions of XML:
<xsl:output-character character="1" string=" "" "/>
but here escaping isn't needed at all (but this is not XPath, but XSLT):
<xsl:output-character character="1" string=" " "/>
Cheers,
-- Abel
http://www.nuntia.nl
|