XSLT - Find the last item in a loop

Details Needed expression:

<xsl:when test="position() = last()">




Example to find the last item in a loop:



	<xsl:for-each select="address/example/item">

	  <xsl:choose>

	    <xsl:when test="@checked = 'true'">

	      <xsl:choose>

	        <xsl:when test="position() = last()">

	             <xsl:value-of select="."/>

	         </xsl:when>

	         <xsl:otherwise>

	                <xsl:value-of select="."/><xsl:value-of select="', '"/>

	          </xsl:otherwise>

	        </xsl:choose>

	     </xsl:when>

	     <xsl:otherwise>

	     </xsl:otherwise>

	   </xsl:choose>

	</xsl:for-each>

	

    Last Changes

    1. More changes, added a lot of new Terraristic photos, drastically improved contact form [22.05.2017]
    2. Overall adjustments: Archive added for "Terraristic", removed "Blog" and "Programs" (since outdated) [14.05.2017]
    3. Added "Watercreature Details" to Creatures: Creatures [01.03.2017]
    4. Added "Thunder Bug Life Cycle" to Creatures: Creatures [23.02.2017]
    5. Added "Xanothl " to Creatures: Creatures [12.02.2017]

     For older changes, have a look at the website's history