Reset figure numbering for each <part>/<chapter> in an pdf2 XSL:FO(FOP) deliverable

84 Views Asked by At

I'd like to reset figure numbering for each <part>/<chapter> element in a <bookmap>. I found dita-users.groups.io/45007, but this did not help me. In topic.xsl there is this statement:

<xsl:template match="*[contains(@class,' topic/fig ')]/*[contains(@class,' topic/title ')]" mode="fig.title-number">
    <xsl:value-of select="count(key('enumerableByClass', 'topic/fig')[. &lt;&lt; current()][dita-ot:notExcludedByDraftElement(.)])"/>
</xsl:template>

Probably here the modification is needed. But I don't understand how to modify it. Do you have an idea?

1

There are 1 best solutions below

3
On

How about something like this?

    <xsl:template match="*[contains(@class,' topic/fig ')]/*[contains(@class,' topic/title ')]" mode="fig.title-number">
      <xsl:variable name="thisChapter" select="ancestor::chapter[1]"/>
      
      <xsl:value-of select="count(preceding::fig[ancestor::chapter[1] = $thisChapter])"/>
    </xsl:template>