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
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext 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

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
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.