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

replacing characters in a string

Subject: replacing characters in a string
From: Linda van den Brink <lvdbrink@xxxxxxx>
Date: Fri, 15 Oct 1999 13:52:46 +0200
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)="&apos;"'>
			<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

PURCHASE STYLUS STUDIO ONLINE TODAY!

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