Jump to content

Working on xsl


ramu246

Recommended Posts

hello every one.

 

i am working on stylesheets. i have a stylesheet and an corresponding xml file. My final output should consists of some header(attachment is provided for header). however i succeeded with image. But the remaining part of header i am not able to produce.

 

i am using xsl formatter for producing pdf 's

 

 

i am getting an error while uploading those files to this files.. how should i upload those files

 

please help me in this issue.

 

 

 

thanks & regards

Link to comment
Share on other sites

this is my XSL file. i have to change the header section. the header consists of 3 columns and 4 rows.
1st column is merged with 4 rows and consists of an image
2nd column consists of 3 rows of data
3rd column consists of 1st row is merged and remaining 3 rows are tabled
please open this link for image
<?xml version="1.0" encoding="UTF-8"?>
<!-- XSL STYLESHEET -->
<xsl:stylesheet version="1.0"
xmlns:str="http://xsltsl.org/string" >
<!-- XSL IMPORT -->
<xsl:include href="w+h-attribute-sets.xsl"/>
<xsl:include href="w+h-templates.xsl"/>
<xsl:include href="w+h-fonts.xsl"/>
<xsl:include href="string.xsl"/>
<!-- XSL OUTPUT -->
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# variables:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!-- Language -->
<xsl:variable name="language" select="German"/>
<!-- Fonts -->
<xsl:variable name="font-list">,Arial, Arial Unicode MS</xsl:variable>
<xsl:variable name="font-default"><xsl:call-template name="get-font"><xsl:with-param name="language" select="$language"/></xsl:call-template><xsl:value-of select="$font-list"/></xsl:variable>
<xsl:variable name="font-bold"><xsl:value-of select="$font-default"/><xsl:value-of select="$font-list"/></xsl:variable>
<xsl:variable name="font-italic"><xsl:value-of select="$font-default"/><xsl:value-of select="$font-list"/></xsl:variable>
<xsl:variable name="font-parameter-box"><xsl:value-of select="$font-default"/><xsl:value-of select="$font-list"/></xsl:variable>
<xsl:variable name="dot-font">Arial</xsl:variable>
<!-- Images -->
<xsl:variable name="logo.pic"><xsl:value-of select="$style-graphic-path"/>logo.gif</xsl:variable>
<!-- Paths -->
<xsl:variable name="graphic-path"><xsl:value-of select="//processing-instruction('gpa')"/></xsl:variable>
<xsl:variable name="style-graphic-path">graphic/</xsl:variable>
<!-- Language code for hyphenation -->
<xsl:variable name="langcode" select="de"/>
<!-- Strings -->
<xsl:variable name="toc.str">Inhaltsverzeichnis</xsl:variable>
<xsl:variable name="index.str">Index</xsl:variable>
<xsl:variable name="see.str">siehe</xsl:variable>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# parameters:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!-- Pagesize in [mm]-->
<xsl:param name="pagewidth">210</xsl:param>
<xsl:param name="pageheight">297</xsl:param>
<!-- Margins in [mm]-->
<xsl:param name="pagemargin-main-top">0</xsl:param>
<xsl:param name="pagemargin-main-bottom">0</xsl:param>
<xsl:param name="header-extent">31</xsl:param><!-- 12 -->
<xsl:param name="footer-extent">13</xsl:param><!-- 7 -->
<!-- right page -->
<xsl:param name="bodymargin-main-top-right">37</xsl:param><!-- 25 Kleemann: 39 - 16 = 23-->
<xsl:param name="bodymargin-main-bottom-right">13</xsl:param><!-- 17 Kleemann: 38 - 12 = 26 -->
<xsl:param name="bodymargin-main-left-right">20</xsl:param><!-- 50 -->
<xsl:param name="bodymargin-main-right-right">15</xsl:param><!-- 25 -->
<!-- left page -->
<xsl:param name="bodymargin-main-top-left">37</xsl:param><!-- 25 Kleemann: 39 - 16 = 23-->
<xsl:param name="bodymargin-main-bottom-left">13</xsl:param><!-- 17 Kleemann: 38 - 12 = 26 -->
<xsl:param name="bodymargin-main-left-left">20</xsl:param><!-- 37 -->
<xsl:param name="bodymargin-main-right-left">15</xsl:param><!-- 38 -->
<!-- Margins -->
<xsl:param name="table-cell-margin-top">0pt</xsl:param>
<xsl:param name="table-cell-margin-bottom">0pt</xsl:param>
<xsl:param name="table-cell-margin-left">2pt</xsl:param>
<xsl:param name="table-cell-margin-right">2pt</xsl:param>
<xsl:param name="border-width">0.3pt</xsl:param>
<!-- Objectspacing used in: caption, gen.list, line, list, parameter || table, para -->
<xsl:param name="objectspacing-top">1em</xsl:param>
<xsl:param name="objectspacing-bottom">0.5em</xsl:param>
<!-- Lineheight -->
<xsl:param name="lineheight">12pt</xsl:param>
<!-- Colors -->
<xsl:param name="border-color">#000000</xsl:param>
<xsl:param name="font-color">#000000</xsl:param>
<xsl:param name="gray">#808080</xsl:param>
<!-- Images -->
<xsl:param name="gen.pic"><xsl:value-of select="$style-graphic-path"/>general-2.png</xsl:param>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# template | ROOT:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- Layout-Master-Set -->
<fo:layout-master-set>
<!-- Simple-Page-Master | PGM.toc-left -->
<fo:simple-page-master master-name="PGM.toc-left"
page-height="{$pageheight}mm"
page-width="{$pagewidth}mm"
margin-top="{$pagemargin-main-top}mm"
margin-bottom="{$pagemargin-main-bottom}mm"
margin-right="0mm"
margin-left="0mm">
<fo:region-body margin-top="{$bodymargin-main-top-left}mm"
margin-bottom="{$bodymargin-main-bottom-left}mm"
margin-left="{$bodymargin-main-left-left}mm"
margin-right="{$bodymargin-main-right-left}mm"
column-count="1"/>
<fo:region-before region-name="toc-left-before" display-align="after">
<xsl:attribute name="extent"><xsl:value-of select="$header-extent"/>mm</xsl:attribute>
</fo:region-before>
<fo:region-after region-name="toc-left-after" display-align="before">
<xsl:attribute name="extent"><xsl:value-of select="$footer-extent"/>mm</xsl:attribute>
</fo:region-after>
</fo:simple-page-master>
<!-- Simple-Page-Master | PGM.toc-right -->
<fo:simple-page-master master-name="PGM.toc-right"
page-height="{$pageheight}mm"
page-width="{$pagewidth}mm"
margin-top="{$pagemargin-main-top}mm"
margin-bottom="{$pagemargin-main-bottom}mm"
margin-right="0mm"
margin-left="0mm">
<fo:region-body margin-top="{$bodymargin-main-top-right}mm"
margin-bottom="{$bodymargin-main-bottom-right}mm"
margin-left="{$bodymargin-main-left-right}mm"
margin-right="{$bodymargin-main-right-right}mm"
column-count="1"/>
<fo:region-before region-name="toc-right-before" display-align="after">
<xsl:attribute name="extent"><xsl:value-of select="$header-extent"/>mm</xsl:attribute>
</fo:region-before>
<fo:region-after region-name="toc-right-after" display-align="before">
<xsl:attribute name="extent"><xsl:value-of select="$footer-extent"/>mm</xsl:attribute>
</fo:region-after>
</fo:simple-page-master>
<!-- Simple-Page-Master | PGM.main-left -->
<fo:simple-page-master master-name="PGM.main-left"
page-height="{$pageheight}mm"
page-width="{$pagewidth}mm"
margin-top="{$pagemargin-main-top}mm"
margin-bottom="{$pagemargin-main-bottom}mm"
margin-right="0mm"
margin-left="0mm">
<fo:region-body margin-top="{$bodymargin-main-top-left}mm"
margin-bottom="{$bodymargin-main-bottom-left}mm"
margin-left="{$bodymargin-main-left-left}mm"
margin-right="{$bodymargin-main-right-left}mm"
column-count="1"/>
<fo:region-before region-name="main-left-before" display-align="after">
<xsl:attribute name="extent"><xsl:value-of select="$header-extent"/>mm</xsl:attribute>
</fo:region-before>
<fo:region-after region-name="main-left-after" display-align="before">
<xsl:attribute name="extent"><xsl:value-of select="$footer-extent"/>mm</xsl:attribute>
</fo:region-after>
</fo:simple-page-master>
<!-- Simple-Page-Master | PGM.main-right -->
<fo:simple-page-master master-name="PGM.main-right"
page-height="{$pageheight}mm"
page-width="{$pagewidth}mm"
margin-top="{$pagemargin-main-top}mm"
margin-bottom="{$pagemargin-main-bottom}mm"
margin-right="0mm"
margin-left="0mm">
<fo:region-body margin-top="{$bodymargin-main-top-right}mm"
margin-bottom="{$bodymargin-main-bottom-right}mm"
margin-left="{$bodymargin-main-left-right}mm"
margin-right="{$bodymargin-main-right-right}mm"
column-count="1"
column-gap="8mm"/>
<fo:region-before region-name="main-right-before" display-align="after">
<xsl:attribute name="extent"><xsl:value-of select="$header-extent"/>mm</xsl:attribute>
</fo:region-before>
<fo:region-after region-name="main-right-after" display-align="before">
<xsl:attribute name="extent"><xsl:value-of select="$footer-extent"/>mm</xsl:attribute>
</fo:region-after>
</fo:simple-page-master>
<!-- Simple-Page-Master | PGM.index-left -->
<fo:simple-page-master master-name="PGM.index-left"
page-height="{$pageheight}mm"
page-width="{$pagewidth}mm"
margin-top="{$pagemargin-main-top}mm"
margin-bottom="{$pagemargin-main-bottom}mm"
margin-right="0mm"
margin-left="0mm">
<fo:region-body margin-top="{$bodymargin-main-top-left}mm"
margin-bottom="{$bodymargin-main-bottom-left}mm"
margin-left="{$bodymargin-main-left-left}mm"
margin-right="{$bodymargin-main-right-left}mm"
column-count="2"
column-gap="8mm"/>
<fo:region-before region-name="index-left-before" display-align="after">
<xsl:attribute name="extent"><xsl:value-of select="$header-extent"/>mm</xsl:attribute>
</fo:region-before>
<fo:region-after region-name="index-left-after" display-align="before">
<xsl:attribute name="extent"><xsl:value-of select="$footer-extent"/>mm</xsl:attribute>
</fo:region-after>
</fo:simple-page-master>
<!-- Simple-Page-Master | PGM.index-right -->
<fo:simple-page-master master-name="PGM.index-right"
page-height="{$pageheight}mm"
page-width="{$pagewidth}mm"
margin-top="{$pagemargin-main-top}mm"
margin-bottom="{$pagemargin-main-bottom}mm"
margin-right="0mm"
margin-left="0mm">
<fo:region-body margin-top="{$bodymargin-main-top-right}mm"
margin-bottom="{$bodymargin-main-bottom-right}mm"
margin-left="{$bodymargin-main-left-right}mm"
margin-right="{$bodymargin-main-right-right}mm"
column-count="2"
column-gap="8mm"/>
<fo:region-before region-name="index-right-before" display-align="after">
<xsl:attribute name="extent"><xsl:value-of select="$header-extent"/>mm</xsl:attribute>
</fo:region-before>
<fo:region-after region-name="index-right-after" display-align="before">
<xsl:attribute name="extent"><xsl:value-of select="$footer-extent"/>mm</xsl:attribute>
</fo:region-after>
</fo:simple-page-master>
<!-- Page-Sequence-Master | SQM.toc -->
<fo:page-sequence-master master-name="SQM.toc">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="PGM.toc-right" odd-or-even="odd"/>
<fo:conditional-page-master-reference master-reference="PGM.toc-left" odd-or-even="even"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<!-- Page-Sequence-Master | SQM.main -->
<fo:page-sequence-master master-name="SQM.main">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="PGM.main-right" odd-or-even="odd"/>
<fo:conditional-page-master-reference master-reference="PGM.main-left" odd-or-even="even"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<!-- Page-Sequence-Master | SQM.index -->
<fo:page-sequence-master master-name="SQM.index">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="PGM.index-right" odd-or-even="odd"/>
<fo:conditional-page-master-reference master-reference="PGM.index-left" odd-or-even="even"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<!-- Page-Sequence -->
<!-- TOC -->
<fo:page-sequence master-reference="SQM.toc" hyphenate="true" language="{$langcode}">
<!-- left header -->
<fo:static-content flow-name="toc-left-before">
<xsl:call-template name="generate-header">
<xsl:with-param name="align">left</xsl:with-param>
<xsl:with-param name="type">toc</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- left footer -->
<fo:static-content flow-name="toc-left-after">
<xsl:call-template name="generate-footer">
<xsl:with-param name="align">left</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- right header -->
<fo:static-content flow-name="toc-right-before">
<xsl:call-template name="generate-header">
<xsl:with-param name="align">right</xsl:with-param>
<xsl:with-param name="type">toc</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- right footer -->
<fo:static-content flow-name="toc-right-after">
<xsl:call-template name="generate-footer">
<xsl:with-param name="align">right</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- flow -->
<fo:flow flow-name="xsl-region-body">
<xsl:call-template name="generate-toc"/>
</fo:flow>
</fo:page-sequence>
<!-- MAIN -->
<xsl:for-each select="//*[parent::dita]">
<fo:page-sequence master-reference="SQM.main" hyphenate="true" language="{$langcode}">
<!-- left header -->
<fo:static-content flow-name="main-left-before">
<xsl:call-template name="generate-header">
<xsl:with-param name="align">left</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- left footer -->
<fo:static-content flow-name="main-left-after">
<xsl:call-template name="generate-footer">
<xsl:with-param name="align">left</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- right header -->
<fo:static-content flow-name="main-right-before">
<xsl:call-template name="generate-header">
<xsl:with-param name="align">right</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- right footer -->
<fo:static-content flow-name="main-right-after">
<xsl:call-template name="generate-footer">
<xsl:with-param name="align">right</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- flow -->
<fo:flow flow-name="xsl-region-body" font-family="{$font-default}" word-spacing="0.5pt">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</xsl:for-each>
<!-- INDEX -->
<fo:page-sequence master-reference="SQM.index" hyphenate="true" language="{$langcode}">
<!-- left header -->
<fo:static-content flow-name="index-left-before">
<xsl:call-template name="generate-header">
<xsl:with-param name="align">left</xsl:with-param>
<xsl:with-param name="type">index</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- left footer -->
<fo:static-content flow-name="index-left-after">
<xsl:call-template name="generate-footer">
<xsl:with-param name="align">left</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- right header -->
<fo:static-content flow-name="index-right-before">
<xsl:call-template name="generate-header">
<xsl:with-param name="align">right</xsl:with-param>
<xsl:with-param name="type">index</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- right footer -->
<fo:static-content flow-name="index-right-after">
<xsl:call-template name="generate-footer">
<xsl:with-param name="align">right</xsl:with-param>
</xsl:call-template>
</fo:static-content>
<!-- flow -->
<fo:flow flow-name="xsl-region-body">
<xsl:call-template name="generate-index"/>
<fo:block id="last"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# call-templates:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!-- # call-template | generate-footer -->
<xsl:template name="generate-footer">
<fo:table width="210mm" xsl:use-attribute-sets="font10" font-family="{$font-default}">
<fo:table-column column-number="1" column-width="20mm"/>
<fo:table-column column-number="2" column-width="175mm"/>
<fo:table-column column-number="3" column-width="15mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell column-number="1">
<fo:block> </fo:block>
</fo:table-cell>
<fo:table-cell column-number="2" text-align="right" padding-top="3mm">
<fo:block>
<fo:page-number/> / <fo:page-number-citation ref-id="last"/>
</fo:block>
</fo:table-cell>
<fo:table-cell column-number="3">
<fo:block> </fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
<!-- # call-template | generate-header -->
<xsl:template name="generate-header">
<fo:table width="210mm" xsl:use-attribute-sets="font10" font-family="{$font-default}">
<fo:table-column column-number="1" column-width="20mm"/>
<fo:table-column column-number="2" column-width="87.5mm"/>
<fo:table-column column-number="3" column-width="87.5mm"/>
<fo:table-column column-number="4" column-width="15mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell column-number="2" border-bottom-style="solid" border-bottom-width="1pt" text-align="left" number-columns-spanned="2">
<fo:block>
<fo:external-graphic content-height="11.5mm" scaling="uniform" src="{$logo.pic}"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell column-number="3" text-align="right" font-style="italic" font-size="9pt">
<fo:block><xsl:value-of select="child::*/@id"/> </fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
<!-- # call-template | generate-index -->
<xsl:template name="generate-index">
<fo:block id="index" break-before="page" span="none">
<fo:block xsl:use-attribute-sets="bold font20" margin-bottom="14mm" span="none" axf:outline-level="1">
<xsl:attribute name="axf:outline-title"><xsl:value-of select="$index.str"/></xsl:attribute>
<xsl:value-of select="$index.str"/>
</fo:block>
<xsl:for-each select="//indexterm">
<xsl:sort select="normalize-space(.)" data-type="text" order="ascending"/>
<xsl:variable name="this" select="normalize-space(.)"/>
<xsl:variable name="this-pos" select="position()"/>
<xsl:variable name="before-pos" select="$this-pos - 1"/>
<xsl:variable name="this-first">
<xsl:call-template name="str:to-upper">
<xsl:with-param name="text" select="substring($this,1,1)"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="before-text">
<xsl:for-each select="//indexterm">
<xsl:sort select="normalize-space(.)" data-type="text" order="ascending"/>
<xsl:if test="position() = $before-pos">
<xsl:value-of select="normalize-space(.)"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="before-first">
<xsl:call-template name="str:to-upper">
<xsl:with-param name="text" select="substring($before-text,1,1)"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$this-pos = '1'">
<fo:block xsl:use-attribute-sets="bold font16" keep-with-next.within-column="always">
<xsl:value-of select="$this-first"/>
</fo:block>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$this-first != $before-first">
<fo:block xsl:use-attribute-sets="bold font16" margin-top="5mm" keep-with-next.within-column="always">
<xsl:value-of select="$this-first"/>
</fo:block>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="preceding::indexterm[normalize-space(.) = $this]">
<xsl:call-template name="index-item">
<xsl:with-param name="text"><xsl:value-of select="$this"/></xsl:with-param>
<xsl:with-param name="duplicative">yes</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="index-item">
<xsl:with-param name="text"><xsl:value-of select="$this"/></xsl:with-param>
<xsl:with-param name="duplicative">no</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</fo:block>
</xsl:template>
<!-- # call-template | index-item -->
<xsl:template name="index-item">
<xsl:param name="text"/>
<xsl:param name="duplicative"/>
<xsl:param name="this-string"/>
<xsl:if test="$text != '' and $duplicative != 'yes'">
<fo:block>
<fo:table border-style="none" width="72mm" xsl:use-attribute-sets="default font10" margin-bottom="2mm">
<fo:table-column column-number="1" column-width="66mm"/>
<fo:table-column column-number="2" column-width="6mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell column-number="1" display-align="after" text-align="left">
<fo:block><fo:basic-link internal-destination="{generate-id()}">
<xsl:call-template name="str:capitalise">
<xsl:with-param name="text" select="."/>
</xsl:call-template></fo:basic-link>
</fo:block>
</fo:table-cell>
<fo:table-cell column-number="2" text-align="right" display-align="after">
<fo:block text-align="right" keep-together.within-line="always"><fo:basic-link internal-destination="{generate-id()}">
<fo:page-number-citation axf:suppress-duplicate-page-number="true">
<xsl:attribute name="ref-id"><xsl:value-of select="generate-id()"/></xsl:attribute>
</fo:page-number-citation></fo:basic-link>
<xsl:for-each select="following::indexterm[normalize-space(.) = $text]">, <fo:basic-link internal-destination="{generate-id()}">
<fo:page-number-citation axf:suppress-duplicate-page-number="true">
<xsl:attribute name="ref-id"><xsl:value-of select="generate-id()"/></xsl:attribute>
</fo:page-number-citation></fo:basic-link></xsl:for-each>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:if>
</xsl:template>
<!-- # call-template | generate-toc -->
<xsl:template name="generate-toc">
<fo:block xsl:use-attribute-sets="default lineheight">
<xsl:if test="@toc != 'exclude' or not(@toc)">
<!-- TOC -->
<fo:block xsl:use-attribute-sets="bold font20" margin-bottom="14mm" axf:outline-level="1">
<xsl:attribute name="axf:outline-title"><xsl:value-of select="$toc.str"/></xsl:attribute>
<xsl:value-of select="$toc.str"/>
</fo:block>
<fo:block>
<xsl:for-each select="//title[parent::*[parent::dita]]">
<xsl:call-template name="toc-item">
<xsl:with-param name="type">level1</xsl:with-param>
</xsl:call-template>
<xsl:for-each select="following-sibling::*/title">
<xsl:call-template name="toc-item">
<xsl:with-param name="type">level2</xsl:with-param>
</xsl:call-template>
<xsl:for-each select="following-sibling::*/title">
<xsl:call-template name="toc-item">
<xsl:with-param name="type">level3</xsl:with-param>
</xsl:call-template>
<xsl:for-each select="following-sibling::*/title">
<xsl:call-template name="toc-item">
<xsl:with-param name="type">level4</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
<xsl:call-template name="toc-item">
<xsl:with-param name="type">index</xsl:with-param>
</xsl:call-template>
</fo:block>
</xsl:if>
</fo:block>
</xsl:template>
<!-- # call-template | toc-item -->
<xsl:template name="toc-item">
<xsl:param name="type"/>
<xsl:variable name="link"><xsl:value-of select="parent::*/@id"/></xsl:variable>
<fo:table keep-together.within-column="always" padding="0" margin="0" width="175mm">
<fo:table-column column-number="1" column-width="18mm"/>
<fo:table-column column-number="2" column-width="157mm"/>
<fo:table-body>
<fo:table-row>
<!-- Chapter -->
<xsl:if test="$type = 'level1'">
<fo:table-cell column-number="1" text-align="left" display-align="center" padding-bottom="2mm">
<xsl:if test="count(parent::*/preceding-sibling::*) > 0">
<xsl:attribute name="padding-top">4mm</xsl:attribute>
</xsl:if>
<fo:block xsl:use-attribute-sets="bold font14">
<fo:basic-link internal-destination="{$link}">
<xsl:number count="//*[parent::dita]" level="multiple" format="1."/>
</fo:basic-link>
</fo:block>
</fo:table-cell>
<fo:table-cell column-number="2">
<xsl:if test="count(parent::*/preceding-sibling::*) > 0">
<xsl:attribute name="padding-top">4mm</xsl:attribute>
</xsl:if>
<fo:block xsl:use-attribute-sets="bold font14" text-align="justify" text-align-last="justify" display-align="center">
<fo:basic-link internal-destination="{$link}">
<fo:inline text-align="left"><xsl:apply-templates><xsl:with-param name="toc">yes</xsl:with-param></xsl:apply-templates></fo:inline>
<fo:inline text-align="center"><fo:leader rule-style="dotted" leader-pattern="dots"/></fo:inline>
<fo:inline text-align="right"><fo:page-number-citation ref-id="{generate-id()}"/></fo:inline>
</fo:basic-link>
</fo:block>
</fo:table-cell>
</xsl:if>
<!-- Section -->
<xsl:if test="$type = 'level2'">
<fo:table-cell column-number="1" text-align="left" display-align="center" padding-bottom="2mm">
<fo:block xsl:use-attribute-sets="font13">
<fo:basic-link internal-destination="{$link}">
<xsl:number count="//*[parent::dita]" level="multiple" format="1."/>
<xsl:value-of select="count(parent::*/preceding-sibling::*[child::title]) +1"/>.
</fo:basic-link>
</fo:block>
</fo:table-cell>
<fo:table-cell column-number="2" text-align="justify" text-align-last="justify">
<fo:block xsl:use-attribute-sets="font13" display-align="center">
<fo:basic-link internal-destination="{$link}">
<fo:inline text-align="left"><xsl:apply-templates><xsl:with-param name="toc">yes</xsl:with-param></xsl:apply-templates></fo:inline>
<fo:inline text-align="center"><fo:leader rule-style="dotted" leader-pattern="dots"/></fo:inline>
<fo:inline text-align="right"><fo:page-number-citation ref-id="{generate-id()}"/></fo:inline>
</fo:basic-link>
</fo:block>
</fo:table-cell>
</xsl:if>
<!-- Component -->
<xsl:if test="$type = 'level3'">
<fo:table-cell column-number="1" text-align="left" display-align="center" padding-bottom="2mm">
<fo:block xsl:use-attribute-sets="font13">
<fo:basic-link internal-destination="{$link}">
<xsl:number count="//*[parent::dita]" level="multiple" format="1."/>
<xsl:value-of select="count(parent::*/parent::*[child::title]/preceding-sibling::*[child::title]) +1"/>.<xsl:value-of select="count(parent::*/preceding-sibling::*[child::title]) +1"/>.
</fo:basic-link>
</fo:block>
</fo:table-cell>
<fo:table-cell column-number="2" text-align="justify" text-align-last="justify">
<fo:block xsl:use-attribute-sets="font13" display-align="center">
<fo:basic-link internal-destination="{$link}">
<fo:inline text-align="left"><xsl:apply-templates><xsl:with-param name="toc">yes</xsl:with-param></xsl:apply-templates></fo:inline>
<fo:inline text-align="center"><fo:leader rule-style="dotted" leader-pattern="dots"/></fo:inline>
<fo:inline text-align="right"><fo:page-number-citation ref-id="{generate-id()}"/></fo:inline>
</fo:basic-link>
</fo:block>
</fo:table-cell>
</xsl:if>
<xsl:if test="$type = 'level4'">
<fo:table-cell column-number="1" text-align="left" display-align="center" padding-bottom="2mm">
<fo:block xsl:use-attribute-sets="font13">
<fo:basic-link internal-destination="{$link}">
<xsl:number count="//*[parent::dita]" level="multiple" format="1."/>
<xsl:value-of select="count(parent::*/parent::*[child::title]/parent::*[child::title]/preceding-sibling::*[child::title]) +1"/>.<xsl:value-of select="count(parent::*/parent::*[child::title]/preceding-sibling::*[child::title]) +1"/>.<xsl:value-of select="count(parent::*/preceding-sibling::*[child::title]) +1"/>.
</fo:basic-link>
</fo:block>
</fo:table-cell>
<fo:table-cell column-number="2" text-align="justify" text-align-last="justify">
<fo:block xsl:use-attribute-sets="font13" display-align="center">
<fo:basic-link internal-destination="{$link}">
<fo:inline text-align="left"><xsl:apply-templates><xsl:with-param name="toc">yes</xsl:with-param></xsl:apply-templates></fo:inline>
<fo:inline text-align="center"><fo:leader rule-style="dotted" leader-pattern="dots"/></fo:inline>
<fo:inline text-align="right"><fo:page-number-citation ref-id="{generate-id()}"/></fo:inline>
</fo:basic-link>
</fo:block>
</fo:table-cell>
</xsl:if>
<!-- Index -->
<xsl:if test="$type = 'index'">
<fo:table-cell column-number="1" number-columns-spanned="2" padding-top="4mm">
<fo:block xsl:use-attribute-sets="bold font14" text-align="justify" text-align-last="justify" >
<fo:basic-link internal-destination="index">
<fo:inline text-align="left"><xsl:value-of select="$index.str"/></fo:inline>
<fo:inline text-align="center"><fo:leader rule-style="dotted" leader-pattern="dots"/></fo:inline>
<fo:inline text-align="right"><fo:page-number-citation ref-id="index"/></fo:inline>
</fo:basic-link>
</fo:block>
</fo:table-cell>
</xsl:if>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:template>
</xsl:stylesheet>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...