使用Dita OT插件中的XSL按章级别计算图号

时间:2017-08-11 04:09:31

标签: xslt dita

在默认的DITA OT pdf插件中,所有数字都按文档级别编号,从图1,2,3到本文档的最后一个数字。

我希望按章级编号

In chapter 1, I have figure 1-1, 1-2, .....
In chapter 2, I have figure 2-1, 2-2, etc.

每章都有子章节,每章xml格式如下,无论是第1章还是第1.1.1章。

 <topic id="concept_hvx_wyx_dk">
    <title>Toolbar</title>` 
        <conbody>
         <p>This section describes the usage of the toolbar.
          <fig>
         <image placement="break" href="../images/toolbar.png" id="image_gw5_dtx_dk" width="450"/>
</fig>

我用来计算文档级别的图号的代码如下,它可以正常工作。

    <xsl:template match="*[contains(@class, ' topic/table ')]/*[contains(@class, ' topic/title ')]" mode="table.title-number">
    <xsl:call-template name="getChapterPrefix" />
    <xsl:value-of select="count(key('enumerableByClass', 'topic/table', ancestor::*[contains(@class, ' topic/topic ')][last()])[. &lt;&lt; current()])" />
  </xsl:template>

我按照章节杠杆复制到计算图号的代码如下,它的工作原理为NOK。所有数字仍然在文件级别的1,2 ......编号。

任何人都可以为我检查或解释它,因为我是这个xsl的新手。

   <xsl:template match="*[contains(@class, ' topic/fig ')]/*[contains(@class, ' topic/title ')]" mode="fig.title-number">
    <xsl:call-template name="getChapterPrefix" />    
      <xsl:value-of select="count(key('enumerableByClass', 'topic/fig', ancestor::*[contains(@class, ' topic/topic ')][last()])&#xA;  *[contains(@class, ' topic/title ')]]&#xA; [. &lt;&lt; current()])" />
  </xsl:template>

非常感谢!

莉莎

0 个答案:

没有答案
相关问题