Subject: replacing characters in a string From: Linda van den Brink <lvdbrink@xxxxxxx> Date: Fri, 15 Oct 1999 13:52:46 +0200 |
Hi, After reading Michel Goosens mail about "how to get an apostrophe into a test expression" and Mike Kay's answer, I've been trying to do something similar: <xsl:variable name="v1" select="string(name)"/> <xsl:variable name="v2"> <xsl:choose> <xsl:when test='substring($v1, 1)="'"'> <xsl:value-of select="substring-before"/> <xsl:text>\'</xsl:text> <xsl:value-of select="substring-after"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$v2"/> </xsl:otherwise> </xsl:choose> </xsl:variable> What I want this to do is convert the (contents of the) 'name' element in my XML to a string, see if there's an apostrophe character, if so, convert this to \', if not, just output the value of 'name'. ($v2 is used in a parameter for a javascript function). But I always get the value of 'name'. I tried other tests, but the tests always fail. Any insights? Linda XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: xt and jade, Linda van den Brink | Thread | Re: replacing characters in a strin, David Carlisle |
xt and jade, pietro abate | Date | RE: xt and jade, Linda van den Brink |
Month |