Subject: RE: [xsl] apostrophe in paramter causing output problems From: "Uronis, Jeremy" <Jeremy.Uronis@xxxxxxxxxxxxx> Date: Wed, 15 Aug 2001 15:46:07 -0400 |
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(' input: ',$myString,' 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] apostrophe in paramter ca, Uronis, Jeremy | Thread | Re: [xsl] apostrophe in paramter ca, Mike Brown |
[xsl] pulling info from SVG file wi, Wilcox, Paul | Date | [xsl] string length, Eric Schenfeld |
Month |