xsl-list
[Top] [All Lists]

Re: [xsl] String literals with both single and double quotes

2007-01-04 04:31:36
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: &quot; 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=" &quot; "/>

Cheers,
-- Abel
  http://www.nuntia.nl



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--