try <xsl:when test="../../child::node()[postion()=last()]"> ..... <xsl:when> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list