Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Treat last element differently [Thread Next] Re: Treat last element differentlyTo: NULL Date: 2/5/2005 11:22:00 AM I have decided to wrap the <field> handling code in <xsl:for-each> instead of a <xsl:template> and it corrects the position() numbering. - Jason Jason wrote: > The exact code you suggested doesn't work. Interestingly, I place: > > <xsl:value-of select="position()" /> > <xsl:value-of select="last()" /> > > in the same location, position() = 2 for the first element, 4 for the > second and so on. The value of last() is always one greater than the > position of the final element. If I use: > > <xsl:if test="position() + 1 < last()"> > <xsl:text>,</xsl:text> > </xsl:if> > > Then it works. However, I am now concerned by the initial value of > position() and why it increments by 2 each time. Can anyone explain this? > > Thank again, > > - Jason > > > Neil Smith [MVP Digital Media] wrote: > >> I wonder if a variation on this might work : >> <xsl:if test="position() < last()"> >> <xsl:text>,</xsl:text> >> </xsl:if> >> >> If not, I did this last year somewhere so I'll dig out the code. >> Cheers - Neil >> >> >> On Sat, 05 Feb 2005 01:06:34 +1030, Jason >> <jason@j...> wrote: >> >> >>> <xsl:text>,</xsl:text> >> >> >> | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
