<xsl:template match="appendix[1]"> <appendix> <chapter> <xsl:call-template name="transform.id.attribute"/> <xsl:apply-templates/> </chapter> <xsl:for-each select="following-sibling::appendix"> <chapter> <xsl:call-template name="transform.id.attribute"/> <xsl:apply-templates/> </chapter> </xsl:for-each> </appendix> </xsl:template> <xsl:template match="appendix[position() != 1]"> </xsl:template>