|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Converting XML data
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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








