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

RE: Replace function and apostrophes

Subject: RE: Replace function and apostrophes
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Thu, 17 Feb 2005 15:21:55 -0000
xsl replace function
> XPath 2.0 allows the delimiter of a string literal to be
> doubled withing the string, so you can write
> "replace(., '''', '\\''')"

Thanks, that's what I was looking for.

> Alternatively, use
> select='replace(., "&apos;", "\\&apos;")'

For some reason I've got an aversion for using single quote as attribute
delimiters, don't know why, I guess it's down to habit.

> or define the strings as variables:
> <xsl:variable name="x" as="xs:string">'</xsl:variable>
> <xsl:variable name="x" as="xs:string">\\'</xsl:variable>
> select="replace(.,$x,$y)"

Although I would say this is most readable, it just seems a bit too

Thanks again,

Current Thread


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.
First Name
Last Name
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.