|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] replacing characters in a string
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
|
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
|

Cart








