Reputation: 23
There are anchor tags on each page of the document that relate back to the TOC, but they are located on the cover page also, so that anchor page 1 is the cover. I need the 3rd physical page (sumpage1) to be anchor page 1. How do I reset the anchor tags to make document page 1 be the 3rd page and the subsequent anchor numbers reset too follow the new sumpage1 numbering?
Desired result:
<Hpage Hplname="cover">
<DIV style="padding: 4pt; width: 98%; display: block;">
<P style="font: 8pt Arial, Helvetica, Sans-Serif;">
</P>
<Hpage Hplname="sumpage1">
<DIV style="padding: 4pt; width: 98%; display: block;">
<P style="font: 8pt Arial, Helvetica, Sans-Serif;">
<A href="#tocpage">Back to Contents</A>
<A name="toc1"/>
</P>
Following sumpage1 page allpagel should be toc2 (and so on):
<Hpage Hplname="allpagel">
<DIV style="padding: 4pt; width: 98%; display: block;">
<P style="font: 8pt Arial, Helvetica, Sans-Serif;">
<A href="#tocpage">Back to Contents</A>
<A name="toc4"/>
</P>
Upvotes: 1
Views: 14
Reputation: 167716
I guess you can use the identity transformation template
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
plus an empty
<xsl:template match="Hpage[@Hplname = 'cover']//A[@name]"/>
to remove the anchor from the cover and
<xsl:template match="Hpage[not(@Hplname = 'cover')]//A[@name]">
<xsl:variable name="count" as="xs:integer">
<xsl:number count="Hpage[not(@Hplname = 'cover')]//A[@name]" level="any"/>
</xsl:variable>
<A name="toc{$count}"/>
</xsl:template>
to number the anchors inside the Hpage
elements.
Upvotes: 1