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

RE: apostrophe in paramter causing output problems

Subject: RE: apostrophe in paramter causing output problems
From: "Uronis, Jeremy" <Jeremy.Uronis@xxxxxxxxxxxxx>
Date: Wed, 15 Aug 2001 15:46:07 -0400
xsl concat apostrophe
actually im confused. how does myString
get set to the new value?


<xsl:template match="/">
	<!-- example showing replacement of '%20' with a single space -->
	<xsl:variable name="myString" select="'This%20is%20a%20Test'"/>
	<xsl:variable name="myNewString">
		<!-- go create the result tree fragment with the replacement
-->
		<xsl:call-template name="SubstringReplace">
			<xsl:with-param name="stringIn" select="$myString"/>
			<xsl:with-param name="substringIn" select="'%20'"/>
			<xsl:with-param name="substringOut" select="' '"/>
		</xsl:call-template>
	</xsl:variable>
	<!--
	show the new string. concat() will treat the result tree
	fragment as if it were a string returned by the string() function.
	-->
	<xsl:value-of select="concat('&#10;input: ',$myString,'&#10;output:
',$myNewString)"/>
</xsl:template>

<!-- here is the template that does the replacement -->
	<xsl:template name="SubstringReplace">
		<xsl:param name="stringIn"/>
		<xsl:param name="substringIn"/>
		<xsl:param name="substringOut"/>
		<xsl:choose>
			<xsl:when test="contains($stringIn,$substringIn)">
				<xsl:value-of
select="concat(substring-before($stringIn,$substringIn),$substringOut)"/>
				<xsl:call-template name="SubstringReplace">
					<xsl:with-param name="stringIn"
select="substring-after($stringIn,$substringIn)"/>
					<xsl:with-param name="substringIn"
select="$substringIn"/>
					<xsl:with-param name="substringOut"
select="$substringOut"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$stringIn"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

 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.