RE: Replace function and apostrophes
> 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(., "'", "\\'")' 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 verbose. Thanks again, andrew
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format