Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Treat last element differently

From: Jason <jason@-----.-----.-----.--->
To: 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 &lt; 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() &lt; 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>
>>
>>
>>


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent