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

RE: Escaping quotes in XPath expressions

Subject: RE: Escaping quotes in XPath expressions
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sat, 15 Nov 2003 13:48:11 -0000
xpath quote
<xsl:variable name="quot">"</xsl:variable>
<xsl:variable name="apos">'</xsl:variable>
<xsl:value-of select="translate(., $quot, $apos)"/>

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> yguaba@xxxxxxxxxxxx
> Sent: 15 November 2003 12:55
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Escaping quotes in XPath expressions
> 
> 
> Hello all,
> 
> Can anyone please tell me how I can escape a single-quote in 
> an XPath expression 
> such as the one below?
> 
> <xsl:value-of select="translate(normalize-space(.), 'x', 'y')"/>
> 
> If I use 'x' and 'y' as the search and replace arguments, 
> everything works well. But I 
> need to search for single-quotes and replace them with 
> backslash + single-quote. In 
> other words, my XPath expression would look something like this:
> 
> translate(normalize-space(.), ''', '\'')
> 
> Except, of course, that I can't use a single-quote 
> (character) between two single-quotes 
> (string delimiters). Backslashes don't escape anything, of 
> course, and using XML 
> entities (&quot;) inside the search and replace strings won't 
> work either.
> 
> But I just feel there must be a way to do this...
> 
> Thanks,
> 
> Erik
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.