I would like to generate table of content identifiers in an HTML document generated with XSL.From the following format:\[code\]<?xml version="1.0" encoding="utf-8"?><section> <header>Heading 1</header> <section> <section> <section> <header>Heading 4</header> </section> </section> </section> <section> <header>Heading 2</header> <section> <section> <section> <header>Heading 5</header> </section> </section> </section> <section> <header>Heading 3</header> </section> </section> <section> <header>Heading 2</header> </section></section>\[/code\]I am already able to generate:\[code\]<?xml version="1.0" encoding="utf-8"?><h1>Heading 1</h1><h4>Heading 4</h4><h2>Heading 2</h2><h5>Heading 5</h5><h6>Heading 6</h6><h2>Heading 2</h2>\[/code\]Thanks to:\[code\]<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xslutput method="html" indent="yes" encoding="UTF-8" /><xsl:template match="/"><xsl:apply-templates/></xsl:template><xsl:template match="header"><xsl:variable name="level" select="count(ancestor-or-self::section)"/><xsl:element name="h{$level}"><xsl:apply-templates/></xsl:element></xsl:template>\[/code\]But I need to add an additional TOC identifier to have:\[code\]<?xml version="1.0" encoding="utf-8"?><a name="toc1"></a><h1>Heading 1</h1><a name="toc1_0_0_1"></a><h4>Heading 4</h4><a name="toc1_1"><h2>Heading 2</h2><a name="toc1_1_0_0_1"><h5>Heading 5</h5><a name="toc1_1_0_0_1_1"><h6>Heading 6</h6><a name="toc1_2"><h2>Heading 2</h2>\[/code\]Is this possible with pure XSLT processing?