Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: question questionTo: NULL Date: 1/4/2005 11:54:00 AM Hello,
I'm trying to capture elements from an XML document by using an XSL document that splits the XML elements with a comma. When I apply my XSL with the XML, it gives all of the elements followed by a comma, but the last element has a comma attached to it also. I don't want that last comma. What can I do to get rid of the comma that is attached to the last element.
Here is my XSL file!!!
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="/eBay/*"/>
<xsl:template match="/eBay/WatchList">
<xsl:for-each select="Items/Item">
<xsl:apply-templates select="Id"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="Id">
<xsl:for-each select=".">
<xsl:choose>
<xsl:when test="not(Id = '.' )">
<xsl:value-of select="."/>
<xsl:text>,</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
