在每个“sect1”中重新开始脚注编号在文档书中

发布于 2024-12-21 06:50:50 字数 3800 浏览 1 评论 0原文

正如标题所描述的,我的问题是我想重置每个“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.

As the title describes my problem is that I want to reset the footnote numbering in each 'sect1', not just in each 'chapter' or 'appendix' and etc.

So far I couldn't manage to reset it. I've tried to copy a part of the footnote.xsl to my customization layer and change it but it didn't have any effect.

<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) >= $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) >= $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>

Well, I guess this is the rule for footnote numbering reset. As I tried to modify this part of 'footnote.xsl', it didn't work and the xsltproc returned with a bunch of errors.

Like this:

Undefined namespace prefix.
1 object left on the stack.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文