I use XSLT to convert a very large XML document into (X) HTML. For some tags, I convert them to <div>. I would like to be able to create a unique identifier for these tags, using an extra integer to form part of the unique identifier.
An example of the rule used:
<xsl:template match="bookcoll/book">
<div class="book">
<xsl:apply-templates/>
</div>
</xsl:template>
This XSLT template works well. Now I would like to mark the tag:
<div class="book">;
becomes:
<div class="book" id="book-[COUNTER-VALUE]">
Ideally, the counter will start at 1, not 0.
I don't know if this matters, I use javax.xml.parsers and javax.xml.transform Java packages to perform the actual conversion. I am a bit XSLT noob, so if there is any relevant information that I missed, let me know.
XSLT?