Subject: RE: [xsl] Replace function and apostrophes From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx> Date: Thu, 17 Feb 2005 15:21:55 -0000 |
> 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] FOP, Help fo:page-number, Fabio Maggi | Thread | [xsl] Custom node-set in a variable, Lyublinski, Leonid |
Re: [xsl] Optimization using keys, António Mota | Date | Re: [xsl] Optimization using keys, Robert Koberg |
Month |