Subject: Re: replacing characters in a string From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 15 Oct 1999 13:33:02 +0100 (BST) |
> see if there's an apostrophe character, if so, convert this > to \', if not, just output the value of 'name'. something like this? David <xsl:call-template name="string-replace"> <xsl:with-param name="from" select="'''"/> <xsl:with-param name="to" select="'\''"/> <xsl:with-param name="string" select="."/> </xsl:call-template> <!-- replace all occurences of the character(s) `from' by the string `to' in the string `string'.--> <xsl:template name="string-replace" > <xsl:param name="string"/> <xsl:param name="from"/> <xsl:param name="to"/> <xsl:choose> <xsl:when test="contains($string,$from)"> <xsl:value-of select="substring-before($string,$from)"/> <xsl:value-of select="$to"/> <xsl:call-template name="string-replace"> <xsl:with-param name="string" select="substring-after($string,$from)"/> <xsl:with-param name="from" select="$from"/> <xsl:with-param name="to" select="$to"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string"/> </xsl:otherwise> </xsl:choose> </xsl:template> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
replacing characters in a string, Linda van den Brink | Thread | Re: replacing characters in a strin, Edd Dumbill |
RE: xt and jade, Linda van den Brink | Date | Re: OpenXML/XSL:P some problem, Garriss Jr.,James P. |
Month |