Subject: Re: [xsl] Converting XML data From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 10 Aug 2004 12:34:04 +0100 |
Hi Narasingarao, > I need to format data from the XML in my XSL using functions. > > example : Input data from XML is HELLO , i want the output as | H | E > | L | L | O | In XSLT 1.0, you need a recursive function to step through the string "HELLO" character-by-character, on each recursion outputting "| " plus the character (if there is one), and stopping recursion if there's no string left. Here's an example: <xsl:template name="separate-characters"> <xsl:param name="string" select="'HELLO'" /> <xsl:text>| </xsl:text> <xsl:if test="$string"> <xsl:value-of select="concat(substring($string, 1, 1), ' ')" /> <xsl:call-template name="separate-characters"> <xsl:with-param name="string" select="substring($string, 2)" /> </xsl:call-template> </xsl:if> </xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Converting XML data, Narasingarao Kommire | Thread | RE: [xsl] Converting XML data, Narasingarao Kommire |
[xsl] Converting XML data, Narasingarao Kommire | Date | RE: [xsl] Converting XML data, Narasingarao Kommire |
Month |