Re: [xsl] Converting XML data

Subject: Re: [xsl] Converting XML data
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Tue, 10 Aug 2004 00:30:02 -0700 (PDT)
Please try this XSL -

<?xml version="1.0"?> 
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
 
<xsl:output method="text"/> 

<xsl:template match="/root">
  <xsl:call-template name="FormatString">
     <xsl:with-param name="str" select="s" />  
  </xsl:call-template>
  <xsl:text>|</xsl:text>
</xsl:template> 
 
<xsl:template name="FormatString">
   <xsl:param name="str" />
   
   <xsl:if test="string-length($str) &gt; 0">
     <xsl:text>|</xsl:text><xsl:value-of
select="substring($str,1,1)" /> 
     <xsl:call-template name="FormatString">
       <xsl:with-param name="str"
select="substring($str,2,string-length($str))" />
     </xsl:call-template>
   </xsl:if>
   
</xsl:template>
  
</xsl:stylesheet>

For e.g., when it is applied to XML -
<?xml version="1.0"?>
<root>
  <s>HELLO</s>
</root>

it produces output -
|H|E|L|L|O|

Regards,
Mukul

--- Narasingarao Kommireddi
<Narasingarao.Kommireddi@xxxxxxxxxxxxxxxx> wrote:
> 
> 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  |
> 
> How do i go abt it..



	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

Current Thread