xsl-list
[Top] [All Lists]

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

2007-01-03 13:52:35
Elliotte Harold wrote:
I need to check my spec reading. I currently believe this statement to be true:

In XPath 1.0 a single string literal cannot contain both single and double quotes.

Is that accurate? If so I can delete an ugly branch in Jaxen.

In XPath 1 and XSLT 1 you can do this to output a single apostrophe or quote respectively:

<xsl:value-of select=' " &apos; " ' />
<xsl:value-of select=" ' &quot; ' " />

To create a string with both literal apostrophe and quote, you can do this:

<xsl:value-of select="concat( ' &quot; ',  &quot; &apos; &quot; ) "/>

In XPath 2, this becomes much easier, because you can escape by using a double quote or apostrophe, like this:

<xsl:value-of select=" ' &quot; '' ' " />

Cheers,
-- Abel Braaksma
  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>
--~--