在Docbook中的每个“sect1”中重新开始脚注编号

时间:2011-12-15 12:39:42

标签: apache-fop docbook xslt footnotes

正如标题所描述的那样,我的问题是我想重置每个'sect1'中的脚注编号,而不仅仅是每个'章节'或'附录'等等。

到目前为止,我无法重置它。我试图将footnote.xsl的一部分复制到我的自定义层并更改它,但它没有任何效果。

<xsl:template match="footnote" mode="footnote.number">
  <xsl:choose>
    <xsl:when test="string-length(@label) != 0">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="ancestor::table or ancestor::informaltable">
      <xsl:variable name="tfnum">
        <xsl:number level="any" from="table|informaltable" format="1"/>
      </xsl:variable>

      <xsl:choose>
        <xsl:when test="string-length($table.footnote.number.symbols) &gt;= $tfnum">
          <xsl:value-of select="substring($table.footnote.number.symbols, $tfnum, 1)"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:number level="any" from="table|informaltable"
                      format="{$table.footnote.number.format}"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <xsl:variable name="fnum">
        <!-- * Determine the footnote number to display for this footnote, -->
        <!-- * by counting all foonotes, ulinks, and any elements that have -->
        <!-- * an xlink:href attribute that meets the following criteria: -->
        <!-- * -->
        <!-- * - the content of the element is not a URI that is the same -->
        <!-- *   URI as the value of the href attribute -->
        <!-- * - the href attribute is not an internal ID reference (does -->
        <!-- *   not start with a hash sign) -->
        <!-- * - the href is not part of an olink reference (the element -->
        <!-- * - does not have an xlink:role attribute that indicates it is -->
        <!-- *   an olink, and the hrf does not contain a hash sign) -->
        <!-- * - the element either has no xlink:type attribute or has -->
        <!-- *   an xlink:type attribute whose value is 'simple' -->
        <!-- *  -->
        <!-- * Note that hyperlinks are counted only if both the value of -->
        <!-- * ulink.footnotes is non-zero and the value of ulink.show is -->
        <!-- * non-zero -->
        <!-- FIXME: list in @from is probably not complete -->
        <xsl:number level="any" 
                    from="chapter|appendix|preface|article|refentry|bibliography|sect1" 
                    count="footnote[not(@label)][not(ancestor::table) and not(ancestor::informaltable)]
                    |ulink[$ulink.footnotes != 0][node()][@url != .][not(ancestor::footnote)][$ulink.show != 0]
                    |*[node()][@xlink:href][not(@xlink:href = .)][not(starts-with(@xlink:href,'#'))]
                      [not(contains(@xlink:href,'#') and @xlink:role = $xolink.role)]
                      [not(@xlink:type) or @xlink:type='simple']
                      [not(ancestor::footnote)][$ulink.footnotes != 0][$ulink.show != 0]
                    "
                    format="1"/>
      </xsl:variable>
      <xsl:choose>
        <xsl:when test="string-length($footnote.number.symbols) &gt;= $fnum">
          <xsl:value-of select="substring($footnote.number.symbols, $fnum, 1)"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:number value="$fnum" format="{$footnote.number.format}"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

嗯,我想这是脚注编号重置的规则。当我试图修改'footnote.xsl'的这一部分时,它没有用,并且xsltproc返回了一堆错误。

像这样:

Undefined namespace prefix.
1 object left on the stack.

0 个答案:

没有答案