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

Re: String literals with both single and double quotes

Subject: Re: String literals with both single and double quotes
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 03 Jan 2007 21:50:50 +0100
double quotes xsl escape
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

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.