<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version =
"1.0" >
<xsl:output method =
"xml" indent =
"yes" />
<xsl:template match =
"/" >
<QQQ firstBBB =
"{generate-id(//BBB[1])}" lastBBB =
"{generate-id(//BBB[last()])}" >
<xsl:apply-templates />
</QQQ>
</xsl:template>
<xsl:template match =
"BBB" >
<BBB myID =
"{generate-id()}" >
<xsl:value-of select =
"." />
</BBB>
</xsl:template>
</xsl:stylesheet>
Author: Miloslav Nic [nicmila@idoox.com]