[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Converting XML data

Subject: Re: Converting XML data
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Tue, 10 Aug 2004 00:30:02 -0700 (PDT)
xsl format string
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.