XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
- Stylus Studio Technical Forum (14621)
-> + XML to 837I EDI -- multiple NM... (3)
-> + WYSIWYG in SSv7 (2)
-> - Write into < head /> tags us... (1)
-> + Maximum recursion depth exceed... (2)
-> - Code coverage testing (1)
-> - Passing JavaScript with multip... (1)
-> + preserving white space in XML ... (8)
-> + XXX maps to XXX system (3)
-> + Help with extracting bookmarks... (2)
-> + Stylus Studio crashes when sou... (2)
-> + WSDL not Displaying properly (5)
-> + How to use fonts other than ba... (5)
-> + Saxon XSLT2 and FOP for XSL:FO... (3)
-> + Converting from XML to EDIFACT (5)
-> + Looping more than one time thr... (2)
-> - Need help with using XQuery in... (1)
-> - Looping - Taking the comma out (3)
-> ->Looping - Taking the comm...
-> ->Looping - Taking the comm...
-> + xslt mapper is only processing... (4)
-> - Newbie: using Saxon 9.1 with F... (1)
-> + Editing ![CDATA[]]> in the Gr... (2)
-- Previous [781-800] [801-820] [821-840] Next
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Jon GallegosSubject: Looping - Taking the comma out
Author: Jon Gallegos
Date: 16 Apr 2009 12:52 PM
Please take note fo the commas

Here is my code

<item name="Pname">
<text>
<xsl:for-each select="a:Form/a:UserValue/a:Item">
<xsl:value-of select="@value"/>,
</xsl:for-each>
</text>
</item>

This is what I am getting
<text>WADDING COVER A, COVER PIVOT BASE R,</text>

This is what I want
<text>WADDING COVER A, COVER PIVOT BASE R</text>

How can I get to were i want to go?

Postnext
Tony LavinioSubject: Looping - Taking the comma out
Author: Tony Lavinio
Date: 17 Apr 2009 09:47 AM
Well, for the document
<root>
<row>a</row>
<row>b</row>
<row>c</row>
</root>
A solution that would produce "a,b,c" is this:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="root/row">
<xsl:value-of select="."/>
<xsl:if test="position() &lt; last()">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

You should easily be able to adjust it to your need.

Posttop
Jon GallegosSubject: Looping - Taking the comma out
Author: Jon Gallegos
Date: 21 Apr 2009 10:58 AM
Thanks

That did the trick

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.