简体   繁体   中英

Table of Contents for Bible (with xsl-fo apache)

I need a table of contents that is oriented according to the Bible books. At the moment I do this manually every time, but in the long run I make mistakes and it is of course very time consuming.

It should look like this:

它应该看起来像这样

I have already read in a book about it, but come unfortunately no further.

This is the code:

 <xsl:template match="Kapitel">
    <fo:block>
    <xsl:apply-templates select="Titel" mode="Kap-Titel"/>
    </fo:block>
    <xsl:for-each selcet="Abschnitt">
    <xsl:call-template name ="IVZ-Eintrag"/>
    </xsl:for-each>
    <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="Kapitel/Titel"/>


<xsl:template name="IVZ-Eintrag">
<fo:block text-align-last="justify">
<xsl:apply-templates selcet="Titel" mode="IVZ-Titel"/>
<fo:leader/>
<fo:page-number-citation ref-id="{generate-id()}"/>
</fo:block>
</xsl:template>

<xsl:template match="Abschnitt">
<fo:block id="{generate-id()}">
<xsl:apply-templates/>
</fo:block>
</xsl:template>

Here you can edit it right now https://xsltfiddle.liberty-development.net/nb9PtDi/120

I think it should be along the lines of

  <xsl:template match="BIBLEBOOK">
    <fo:block keep-with-next.within-page="always" span="all" font-size="{$Schriftgroesse} * 1.4" line-height="{$Schriftgroesse} * 1.3" font-weight="bold" text-align="center" space-after="-1mm" space-before="1mm" space-after.precedence="1">
      <xsl:apply-templates select="@bname"/>
      </fo:block>
      <!-- create the table of contents -->
      <fo:block page-break-after="always">
            <xsl:apply-templates select="CHAPTER" mode="toc"/>
      </fo:block>
  <!-- do the document -->
    <fo:block font-family="{$Schriftname}" font-style="{$Schriftschnitt}" font-size="{$Schriftgroesse}" line-height="{$Zeilenhoehe}" page-break-inside="auto">
      <xsl:apply-templates select="./CHAPTER"/>
    </fo:block>
  </xsl:template>
      
<xsl:template match="CHAPTER" mode="toc">
  <fo:block text-align-last="justify">
    <fo:basic-link internal-destination="{generate-id(.)}">
      <xsl:number level="single" count="CHAPTER"/>
      <xsl:text> </xsl:text>
      <fo:leader leader-length.minimum="12pt" leader-length.optimum="40pt"
               leader-length.maximum="100%" leader-pattern="dots"/>
      <xsl:text> </xsl:text>
      <fo:page-number-citation ref-id="{generate-id(.)}"/>
    </fo:basic-link>
  </fo:block>
</xsl:template>

  <xsl:template match="/XMLBIBLE/BIBLEBOOK/CHAPTER">
    <fo:block id="{generate-id()}">...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM