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

How to use for-each to get comma searated list?

Subject: How to use for-each to get comma searated list?
From: "Farrukh S. Najmi" <najmi@xxxxxxxxx>
Date: Wed, 02 Dec 1998 12:43:30 -0500
xsl comma list
I am trying to use the current version of XSL (ala IE5.0 beta2) to
format the values inside a XML element into a comma separated list. The
problem is that I cannot figure out how to not have a comma after the
last element in the list. Any help would be appreciated. Following is
simplified XML file, desired output and my attempt at the XSL file:

-------------
#Following is a simplified XML file

<Doc>
  <Section>
    <Foo><Value>3.75</Value></Foo>
  </Section>

  <Section>
    <Foo><Value>2.25</Value></Foo>
  </Section>
</Doc>

--------------
#Following is a simplified target HTML mapping desired

<BODY>valueList="3.75,2.25"</BODY>

--------------

#Following is my simplified XSL file

<xsl:template match="/">
<BODY>
       <xsl:text>valueList="</xsl:text>
       <xsl:for-each select="Section/Foo">
          <xsl:process select="Value"/>
          <xsl:text>,</xsl:text>
       </xsl:for-each> 
       <xsl:text>"</xsl:text>
</BODY>
</xsl:template> 

-- 

Regards,
Farrukh Najmi


 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.