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

Re: string manipulation

Subject: Re: string manipulation
From: Scott Bronson <bronson@xxxxxxxxxxx>
Date: 26 Oct 2002 16:04:35 -0700
scott bronson
You need to use recursion.  Something like the following might do it for
your attributes (warning: untested!):


<xsl:template match="/item">
  <xsl:call-template name="print-att">
    <xsl:with-param name="string" select="@key"/>
  </xsl:call-template>
</xsl:template>


<xsl:template name="print-att">
  <xsl:param name="string"/>
  <xsl:variable name="first" select="substring-before($string, ',')"/>
  <xsl:if test="$first">
    <xsl:value-of select="concat(' <-> ', $first"/>
    <xsl:call-template name="print-att">
      <xsl:with-param name="string" select="substring-after($string,
',')"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template>



On Fri, 2002-10-25 at 10:52, john liao wrote:
> Hi Listmembers,
> 
> I'm finding myself having to manipulate strings
> because the tool that generates my xml can't generate
> new elements that I need:
> 
> <item name="var1" description="subscribed
> key=att1,att2 corc=att2,att3,att4,att21,att25"/>
> 
> I want to parse the description so I can print
> key: att1
> key: att2
> a: att2
> a: att3
> a: att4
> a: att21
> a: att25
> 
> I can't figure it out using substring-before or
> substring-after. Your help is very much appreciated.
> 
> J.L.
> 
> =====
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Y! Web Hosting - Let the expert host your web site
> http://webhosting.yahoo.com/
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.