lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.7.9 vs lib/isodoc/iho/iho.specification.xsl in metanorma-iho-0.7.10
- old
+ new
@@ -233,100 +233,11 @@
</fo:block-container>
</fo:block-container>
<fo:block break-after="page"/>
- <!-- Table of Contents -->
- <fo:block role="TOC">
- <fo:block font-weight="bold" margin-bottom="7.5pt" role="H1" font-size="12pt" margin-top="4pt">
- <fo:block-container width="18.3mm" border-bottom="1.25pt solid black">
- <fo:block line-height="75%">
- <xsl:call-template name="getLocalizedString">
- <xsl:with-param name="key">table_of_contents</xsl:with-param>
- </xsl:call-template>
- </fo:block>
- </fo:block-container>
- </fo:block>
- <xsl:if test="$debug = 'true'">
- <xsl:text disable-output-escaping="yes"><!--</xsl:text>
- DEBUG
- contents=<xsl:copy-of select="$contents"/>
- <xsl:text disable-output-escaping="yes">--></xsl:text>
- </xsl:if>
-
- <fo:block line-height="115%">
-
- <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
- <fo:block role="TOCI">
- <!-- <xsl:if test="@level = 1">
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
- </xsl:if> -->
-
- <fo:list-block>
-
- <xsl:attribute name="provisional-distance-between-starts">
- <xsl:choose>
- <xsl:when test="@level >= 1 and @root = 'preface'">0mm</xsl:when>
- <xsl:when test="@level >= 1 and @root = 'annex' and not(@type = 'annex')">13mm</xsl:when>
- <xsl:when test="@level >= 1 and not(@type = 'annex')">
- <xsl:choose>
- <xsl:when test="$toc_level = 3">12.9mm</xsl:when>
- <xsl:when test="$toc_level > 3">15mm</xsl:when>
- <xsl:otherwise>10mm</xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>0mm</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <fo:list-item>
- <fo:list-item-label end-indent="label-end()">
- <fo:block>
- <xsl:if test="@section != '' and not(@type = 'annex')"> <!-- output below -->
- <xsl:value-of select="@section"/>
- </xsl:if>
- </fo:block>
- </fo:list-item-label>
- <fo:list-item-body start-indent="body-start()">
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
- <xsl:apply-templates select="title"/>
- <fo:inline keep-together.within-line="always">
- <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
- </fo:inline>
- </fo:basic-link>
- </fo:block>
- </fo:list-item-body>
- </fo:list-item>
- </fo:list-block>
- </fo:block>
-
- </xsl:for-each>
-
- <!-- List of Tables -->
- <xsl:if test="$contents//tables/table">
- <xsl:call-template name="insertListOf_Title">
- <xsl:with-param name="title" select="$title-list-tables"/>
- </xsl:call-template>
- <xsl:for-each select="$contents//tables/table">
- <xsl:call-template name="insertListOf_Item"/>
- </xsl:for-each>
- </xsl:if>
-
- <!-- List of Figures -->
- <xsl:if test="$contents//figures/figure">
- <xsl:call-template name="insertListOf_Title">
- <xsl:with-param name="title" select="$title-list-figures"/>
- </xsl:call-template>
- <xsl:for-each select="$contents//figures/figure">
- <xsl:call-template name="insertListOf_Item"/>
- </xsl:for-each>
- </xsl:if>
- </fo:block>
- </fo:block>
-
- <!-- Foreword, Introduction -->
+ <!-- Contents, Foreword, Introduction -->
<xsl:call-template name="processPrefaceSectionsDefault"/>
</fo:flow>
</fo:page-sequence>
<!-- End Preface Pages -->
@@ -432,10 +343,105 @@
</fo:inline>
</fo:basic-link>
</fo:block>
</xsl:template>
+ <xsl:template match="iho:preface/iho:clause[@type = 'toc']" priority="4">
+ <!-- Table of Contents -->
+ <fo:block role="TOC">
+
+ <xsl:apply-templates/>
+
+ <xsl:if test="$debug = 'true'">
+ <xsl:text disable-output-escaping="yes"><!--</xsl:text>
+ DEBUG
+ contents=<xsl:copy-of select="$contents"/>
+ <xsl:text disable-output-escaping="yes">--></xsl:text>
+ </xsl:if>
+
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
+
+ <fo:block line-height="115%">
+
+ <xsl:for-each select="$contents//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
+ <fo:block role="TOCI">
+ <fo:list-block>
+ <xsl:attribute name="provisional-distance-between-starts">
+ <xsl:choose>
+ <xsl:when test="@level >= 1 and @root = 'preface'">0mm</xsl:when>
+ <xsl:when test="@level >= 1 and @root = 'annex' and not(@type = 'annex')">13mm</xsl:when>
+ <xsl:when test="@level >= 1 and not(@type = 'annex')">
+ <xsl:choose>
+ <xsl:when test="$toc_level = 3">12.9mm</xsl:when>
+ <xsl:when test="$toc_level > 3">15mm</xsl:when>
+ <xsl:otherwise>10mm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>0mm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <fo:list-item>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>
+ <xsl:if test="@section != '' and not(@type = 'annex')"> <!-- output below -->
+ <xsl:value-of select="@section"/>
+ </xsl:if>
+ </fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
+ <xsl:apply-templates select="title"/>
+ <fo:inline keep-together.within-line="always">
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
+ </fo:inline>
+ </fo:basic-link>
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </fo:list-block>
+ </fo:block>
+ </xsl:for-each>
+
+ <!-- List of Tables -->
+ <xsl:if test="$contents//tables/table">
+ <xsl:call-template name="insertListOf_Title">
+ <xsl:with-param name="title" select="$title-list-tables"/>
+ </xsl:call-template>
+ <xsl:for-each select="$contents//tables/table">
+ <xsl:call-template name="insertListOf_Item"/>
+ </xsl:for-each>
+ </xsl:if>
+
+ <!-- List of Figures -->
+ <xsl:if test="$contents//figures/figure">
+ <xsl:call-template name="insertListOf_Title">
+ <xsl:with-param name="title" select="$title-list-figures"/>
+ </xsl:call-template>
+ <xsl:for-each select="$contents//figures/figure">
+ <xsl:call-template name="insertListOf_Item"/>
+ </xsl:for-each>
+ </xsl:if>
+ </fo:block>
+ </xsl:if>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="iho:preface/iho:clause[@type = 'toc']/iho:title" priority="3">
+ <fo:block font-weight="bold" margin-bottom="7.5pt" role="H1" font-size="12pt" margin-top="4pt">
+ <fo:block-container width="18.3mm" border-bottom="1.25pt solid black">
+ <fo:block line-height="75%">
+ <!-- <xsl:call-template name="getLocalizedString">
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
+ </xsl:call-template> -->
+ <xsl:apply-templates/>
+ </fo:block>
+ </fo:block-container>
+ </fo:block>
+ </xsl:template>
+
<!-- ============================= -->
<!-- CONTENTS -->
<!-- ============================= -->
<!-- element with title -->
@@ -454,10 +460,11 @@
</xsl:choose>
</xsl:variable>
<xsl:variable name="skip">
<xsl:choose>
+ <xsl:when test="@type = 'toc'">true</xsl:when>
<xsl:when test="ancestor-or-self::iho:bibitem">true</xsl:when>
<xsl:when test="ancestor-or-self::iho:term">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>
@@ -1235,10 +1242,14 @@
<xsl:attribute name="color">blue</xsl:attribute>
<xsl:attribute name="text-decoration">underline</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_link-style">
+
+ </xsl:template> <!-- refine_link-style -->
+
<xsl:attribute-set name="sourcecode-container-style">
</xsl:attribute-set>
<xsl:attribute-set name="sourcecode-style">
@@ -1251,10 +1262,14 @@
<xsl:attribute name="keep-with-next">always</xsl:attribute>
<xsl:attribute name="line-height">113%</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_sourcecode-style">
+
+ </xsl:template> <!-- refine_sourcecode-style -->
+
<xsl:attribute-set name="pre-style">
<xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
<xsl:attribute name="font-family">Fira Code, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
@@ -1339,10 +1354,14 @@
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
<xsl:attribute name="text-align">justify</xsl:attribute>
</xsl:attribute-set> <!-- example-style -->
+ <xsl:template name="refine_example-style">
+
+ </xsl:template> <!-- refine_example-style -->
+
<xsl:attribute-set name="example-body-style">
</xsl:attribute-set> <!-- example-body-style -->
<xsl:attribute-set name="example-name-style">
@@ -1358,10 +1377,14 @@
<xsl:attribute name="font-size">11pt</xsl:attribute>
<xsl:attribute name="margin-left">12.7mm</xsl:attribute>
</xsl:attribute-set> <!-- example-p-style -->
+ <xsl:template name="refine_example-p-style">
+
+ </xsl:template> <!-- refine_example-p-style -->
+
<xsl:attribute-set name="termexample-name-style">
<xsl:attribute name="padding-right">5mm</xsl:attribute>
</xsl:attribute-set> <!-- termexample-name-style -->
@@ -1389,28 +1412,46 @@
<xsl:attribute name="font-size">9pt</xsl:attribute>
<xsl:attribute name="space-after">18pt</xsl:attribute>
</xsl:attribute-set> <!-- table-container-style -->
+ <xsl:template name="refine_table-container-style">
+ <xsl:param name="margin-side"/>
+
+ <!-- end table block-container attributes -->
+ </xsl:template> <!-- refine_table-container-style -->
+
<xsl:attribute-set name="table-style">
<xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
<xsl:attribute name="table-layout">fixed</xsl:attribute>
<xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
</xsl:attribute-set><!-- table-style -->
+ <xsl:template name="refine_table-style">
+ <xsl:param name="margin-side"/>
+
+ <xsl:call-template name="setBordersTableArray"/>
+
+ </xsl:template> <!-- refine_table-style -->
+
<xsl:attribute-set name="table-name-style">
<xsl:attribute name="keep-with-next">always</xsl:attribute>
<xsl:attribute name="text-align">center</xsl:attribute>
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="font-size">10pt</xsl:attribute>
</xsl:attribute-set> <!-- table-name-style -->
+ <xsl:template name="refine_table-name-style">
+ <xsl:param name="continued"/>
+
+ </xsl:template> <!-- refine_table-name-style -->
+
<xsl:attribute-set name="table-row-style">
<xsl:attribute name="min-height">4mm</xsl:attribute>
<xsl:attribute name="min-height">3mm</xsl:attribute> <!-- + padding-top + padding-bottom -->
@@ -1421,18 +1462,34 @@
<xsl:attribute name="background-color">rgb(217, 217, 217)</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_table-header-row-style">
+
+ <xsl:call-template name="setBordersTableArray"/>
+
+ </xsl:template> <!-- refine_table-header-row-style -->
+
<xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
</xsl:attribute-set>
+ <xsl:template name="refine_table-footer-row-style">
+
+ </xsl:template> <!-- refine_table-footer-row-style -->
+
<xsl:attribute-set name="table-body-row-style" use-attribute-sets="table-row-style">
</xsl:attribute-set>
+ <xsl:template name="refine_table-body-row-style">
+
+ <xsl:call-template name="setBordersTableArray"/>
+
+ </xsl:template> <!-- refine_table-body-row-style -->
+
<xsl:attribute-set name="table-header-cell-style">
<xsl:attribute name="font-weight">bold</xsl:attribute>
<xsl:attribute name="padding-left">1mm</xsl:attribute>
<xsl:attribute name="padding-right">1mm</xsl:attribute>
<xsl:attribute name="display-align">center</xsl:attribute>
@@ -1443,10 +1500,22 @@
<xsl:attribute name="padding-right">1.5mm</xsl:attribute>
<xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
</xsl:attribute-set> <!-- table-header-cell-style -->
+ <xsl:template name="refine_table-header-cell-style">
+
+ <xsl:call-template name="setBordersTableArray"/>
+
+ <xsl:if test="$lang = 'ar'">
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
+ </xsl:if>
+
+ <xsl:call-template name="setTableCellAttributes"/>
+
+ </xsl:template> <!-- refine_table-header-cell-style -->
+
<xsl:attribute-set name="table-cell-style">
<xsl:attribute name="display-align">center</xsl:attribute>
<xsl:attribute name="padding-left">1mm</xsl:attribute>
<xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -1456,30 +1525,50 @@
<xsl:attribute name="padding-right">1.5mm</xsl:attribute>
<xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
</xsl:attribute-set> <!-- table-cell-style -->
+ <xsl:template name="refine_table-cell-style">
+
+ <xsl:if test="$lang = 'ar'">
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
+ </xsl:if>
+
+ <!-- bsi -->
+
+ <xsl:call-template name="setBordersTableArray"/>
+
+ </xsl:template> <!-- refine_table-cell-style -->
+
<xsl:attribute-set name="table-footer-cell-style">
<xsl:attribute name="border">solid black 1pt</xsl:attribute>
<xsl:attribute name="padding-left">1mm</xsl:attribute>
<xsl:attribute name="padding-right">1mm</xsl:attribute>
<xsl:attribute name="padding-top">1mm</xsl:attribute>
<xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
</xsl:attribute-set> <!-- table-footer-cell-style -->
+ <xsl:template name="refine_table-footer-cell-style">
+
+ </xsl:template> <!-- refine_table-footer-cell-style -->
+
<xsl:attribute-set name="table-note-style">
<xsl:attribute name="font-size">10pt</xsl:attribute>
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
<xsl:attribute name="font-size">inherit</xsl:attribute>
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
<xsl:attribute name="space-after">6pt</xsl:attribute>
</xsl:attribute-set><!-- table-note-style -->
+ <xsl:template name="refine_table-note-style">
+
+ </xsl:template> <!-- refine_table-note-style -->
+
<xsl:attribute-set name="table-fn-style">
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
</xsl:attribute-set> <!-- table-fn-style -->
@@ -1531,17 +1620,25 @@
<xsl:attribute-set name="dt-cell-style">
</xsl:attribute-set>
+ <xsl:template name="refine_dt-cell-style">
+
+ </xsl:template> <!-- refine_dt-cell-style -->
+
<xsl:attribute-set name="dt-block-style">
<xsl:attribute name="margin-top">0pt</xsl:attribute>
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_dt-block-style">
+
+ </xsl:template> <!-- refine_dt-block-style -->
+
<xsl:attribute-set name="dl-name-style">
<xsl:attribute name="keep-with-next">always</xsl:attribute>
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
<xsl:attribute name="font-weight">normal</xsl:attribute>
@@ -1551,10 +1648,14 @@
<xsl:attribute-set name="dd-cell-style">
<xsl:attribute name="padding-left">2mm</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_dd-cell-style">
+
+ </xsl:template> <!-- refine_dd-cell-style -->
+
<!-- ========================== -->
<!-- END Definition's list styles -->
<!-- ========================== -->
<xsl:attribute-set name="appendix-style">
@@ -1564,47 +1665,64 @@
<xsl:attribute-set name="appendix-example-style">
</xsl:attribute-set>
<xsl:attribute-set name="xref-style">
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
<xsl:attribute name="color">blue</xsl:attribute>
<xsl:attribute name="text-decoration">underline</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="eref-style">
</xsl:attribute-set>
+ <xsl:template name="refine_eref-style">
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
+ <xsl:variable name="text" select="normalize-space()"/>
+
+ </xsl:template> <!-- refine_eref-style -->
+
<xsl:attribute-set name="note-style">
<!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
<xsl:attribute name="margin-top">4pt</xsl:attribute>
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
<xsl:attribute name="text-align">justify</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_note-style">
+
+ </xsl:template>
+
<xsl:variable name="note-body-indent">10mm</xsl:variable>
<xsl:variable name="note-body-indent-table">5mm</xsl:variable>
<xsl:attribute-set name="note-name-style">
<!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
<xsl:attribute name="padding-right">2mm</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_note-name-style">
+
+ </xsl:template> <!-- refine_note-name-style -->
+
<xsl:attribute-set name="table-note-name-style">
<xsl:attribute name="padding-right">2mm</xsl:attribute>
<!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
</xsl:attribute-set>
+ <xsl:template name="refine_table-note-name-style">
+
+ </xsl:template> <!-- refine_table-note-name-style -->
+
<xsl:attribute-set name="note-p-style">
<xsl:attribute name="margin-top">8pt</xsl:attribute>
<xsl:attribute name="margin-bottom">8pt</xsl:attribute>
@@ -1617,14 +1735,22 @@
<xsl:attribute name="margin-bottom">8pt</xsl:attribute>
<xsl:attribute name="text-align">justify</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_termnote-style">
+
+ </xsl:template> <!-- refine_termnote-style -->
+
<xsl:attribute-set name="termnote-name-style">
</xsl:attribute-set>
+ <xsl:template name="refine_termnote-name-style">
+
+ </xsl:template>
+
<xsl:attribute-set name="termnote-p-style">
</xsl:attribute-set>
<xsl:attribute-set name="quote-style">
@@ -1635,10 +1761,14 @@
<xsl:attribute name="margin-left">4.5mm</xsl:attribute>
<xsl:attribute name="margin-right">9mm</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_quote-style">
+
+ </xsl:template>
+
<xsl:attribute-set name="quote-source-style">
<xsl:attribute name="text-align">right</xsl:attribute>
</xsl:attribute-set>
@@ -1646,10 +1776,14 @@
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_termsource-style">
+
+ </xsl:template> <!-- refine_termsource-style -->
+
<xsl:attribute-set name="termsource-text-style">
</xsl:attribute-set>
<xsl:attribute-set name="origin-style">
@@ -1690,10 +1824,14 @@
<xsl:attribute name="space-after">6pt</xsl:attribute>
<xsl:attribute name="keep-with-previous">always</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_figure-name-style">
+
+ </xsl:template> <!-- refine_figure-name-style -->
+
<xsl:attribute-set name="figure-source-style">
</xsl:attribute-set>
<!-- Formula's styles -->
@@ -1706,10 +1844,14 @@
<xsl:attribute-set name="formula-stem-block-style">
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:attribute-set> <!-- formula-stem-block-style -->
+ <xsl:template name="refine_formula-stem-block-style">
+
+ </xsl:template> <!-- refine_formula-stem-block-style -->
+
<xsl:attribute-set name="formula-stem-number-style">
<xsl:attribute name="text-align">right</xsl:attribute>
</xsl:attribute-set> <!-- formula-stem-number-style -->
<!-- End Formula's styles -->
@@ -1717,10 +1859,14 @@
<xsl:attribute-set name="image-style">
<xsl:attribute name="text-align">center</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_image-style">
+
+ </xsl:template>
+
<xsl:attribute-set name="figure-pseudocode-p-style">
</xsl:attribute-set>
<xsl:attribute-set name="image-graphic-style">
@@ -1809,16 +1955,24 @@
<xsl:attribute-set name="mathml-style">
<xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_mathml-style">
+
+ </xsl:template>
+
<xsl:attribute-set name="list-style">
<xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
</xsl:attribute-set> <!-- list-style -->
+ <xsl:template name="refine_list-style">
+
+ </xsl:template> <!-- refine_list-style -->
+
<xsl:attribute-set name="list-name-style">
<xsl:attribute name="keep-with-next">always</xsl:attribute>
<xsl:attribute name="font-weight">normal</xsl:attribute>
@@ -1828,30 +1982,46 @@
<xsl:attribute name="margin-bottom">3pt</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_list-item-style">
+
+ </xsl:template> <!-- refine_list-item-style -->
+
<xsl:attribute-set name="list-item-label-style">
<xsl:attribute name="line-height">115%</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_list-item-label-style">
+
+ </xsl:template> <!-- refine_list-item-label-style -->
+
<xsl:attribute-set name="list-item-body-style">
</xsl:attribute-set>
+ <xsl:template name="refine_list-item-body-style">
+
+ </xsl:template> <!-- refine_list-item-body-style -->
+
<xsl:attribute-set name="toc-style">
<xsl:attribute name="line-height">135%</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="fn-reference-style">
<xsl:attribute name="font-size">80%</xsl:attribute>
<xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_fn-reference-style">
+
+ </xsl:template> <!-- refine_fn-reference-style -->
+
<xsl:attribute-set name="fn-style">
<xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="fn-num-style">
@@ -1871,19 +2041,27 @@
<xsl:attribute name="font-size">10pt</xsl:attribute>
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
</xsl:attribute-set>
+ <xsl:template name="refine_fn-body-style">
+
+ </xsl:template> <!-- refine_fn-body-style -->
+
<xsl:attribute-set name="fn-body-num-style">
<xsl:attribute name="keep-with-next.within-line">always</xsl:attribute>
<xsl:attribute name="font-size">60%</xsl:attribute>
<xsl:attribute name="vertical-align">super</xsl:attribute>
<xsl:attribute name="padding-right">1mm</xsl:attribute>
</xsl:attribute-set> <!-- fn-body-num-style -->
+ <xsl:template name="refine_fn-body-num-style">
+
+ </xsl:template> <!-- refine_fn-body-num-style -->
+
<!-- admonition -->
<xsl:attribute-set name="admonition-style">
<xsl:attribute name="border">0.5pt solid rgb(79, 129, 189)</xsl:attribute>
<xsl:attribute name="color">rgb(79, 129, 189)</xsl:attribute>
@@ -2534,11 +2712,13 @@
</xsl:choose>
</xsl:variable>
<fo:block-container xsl:use-attribute-sets="table-container-style">
- <!-- end table block-container attributes -->
+ <xsl:call-template name="refine_table-container-style">
+ <xsl:with-param name="margin-side" select="$margin-side"/>
+ </xsl:call-template>
<!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
<xsl:variable name="table_width_default">100%</xsl:variable>
<xsl:variable name="table_width">
@@ -2555,11 +2735,13 @@
<xsl:attribute name="margin-right">0mm</xsl:attribute>
</xsl:if>
<xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
- <xsl:call-template name="setBordersTableArray"/>
+ <xsl:call-template name="refine_table-style">
+ <xsl:with-param name="margin-side" select="$margin-side"/>
+ </xsl:call-template>
</xsl:element>
</xsl:variable>
<xsl:if test="$isGenerateTableIF = 'true'">
@@ -2621,11 +2803,11 @@
<xsl:choose>
<xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
<xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
</xsl:when>
<xsl:otherwise>
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'dl') and not(local-name() = 'source') and not(local-name() = 'p') and not(local-name() = 'thead') and not(local-name() = 'tfoot')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
@@ -2711,10 +2893,14 @@
<xsl:param name="continued"/>
<xsl:if test="normalize-space() != ''">
<fo:block xsl:use-attribute-sets="table-name-style">
+ <xsl:call-template name="refine_table-name-style">
+ <xsl:with-param name="continued" select="$continued"/>
+ </xsl:call-template>
+
<xsl:choose>
<xsl:when test="$continued = 'true'">
</xsl:when>
<xsl:otherwise>
@@ -3093,10 +3279,12 @@
<xsl:param name="cols-count"/>
<!-- row for title -->
<fo:table-row>
<fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
+ <xsl:call-template name="refine_table-header-title-style"/>
+
<xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
<xsl:with-param name="continued">true</xsl:with-param>
</xsl:apply-templates>
<xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
@@ -3105,10 +3293,14 @@
</fo:table-cell>
</fo:table-row>
</xsl:template> <!-- table-header-title -->
+ <xsl:template name="refine_table-header-title-style">
+
+ </xsl:template> <!-- refine_table-header-title-style -->
+
<xsl:template match="*[local-name()='thead']" mode="process_tbody">
<fo:table-body>
<xsl:apply-templates/>
</fo:table-body>
</xsl:template>
@@ -3129,11 +3321,11 @@
<xsl:template name="insertTableFooterInSeparateTable">
<xsl:param name="table_attributes"/>
<xsl:param name="colwidths"/>
<xsl:param name="colgroup"/>
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source']"/>
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
<xsl:variable name="isNoteOrFnExistShowAfterTable">
</xsl:variable>
@@ -3189,18 +3381,21 @@
<fo:table-body>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
+ <xsl:call-template name="refine_table-footer-cell-style"/>
+
<xsl:call-template name="setBordersTableArray"/>
<!-- fn will be processed inside 'note' processing -->
<!-- for BSI (not PAS) display Notes before footnotes -->
<!-- except gb and bsi -->
+ <xsl:apply-templates select="../*[local-name()='p']"/>
<xsl:apply-templates select="../*[local-name()='dl']"/>
<xsl:apply-templates select="../*[local-name()='note']"/>
<xsl:apply-templates select="../*[local-name()='source']"/>
<xsl:variable name="isDisplayRowSeparator">
@@ -3328,11 +3523,11 @@
<!-- ===================== -->
<!-- row in table header (thead) thead/tr -->
<xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
<fo:table-row xsl:use-attribute-sets="table-header-row-style">
- <xsl:call-template name="setBordersTableArray"/>
+ <xsl:call-template name="refine_table-header-row-style"/>
<xsl:call-template name="setTableRowAttributes"/>
<xsl:apply-templates/>
</fo:table-row>
@@ -3362,10 +3557,12 @@
<!-- row in table footer (tfoot), tfoot/tr -->
<xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
<fo:table-row xsl:use-attribute-sets="table-footer-row-style">
+ <xsl:call-template name="refine_table-footer-row-style"/>
+
<xsl:call-template name="setTableRowAttributes"/>
<xsl:apply-templates/>
</fo:table-row>
</xsl:template>
@@ -3375,13 +3572,14 @@
<xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
<xsl:attribute name="keep-with-next">always</xsl:attribute>
</xsl:if>
- <xsl:call-template name="setBordersTableArray"/>
+ <xsl:call-template name="refine_table-body-row-style"/>
<xsl:call-template name="setTableRowAttributes"/>
+
<xsl:apply-templates/>
</fo:table-row>
</xsl:template>
<xsl:template name="setTableRowAttributes">
@@ -3396,18 +3594,12 @@
<fo:table-cell xsl:use-attribute-sets="table-header-cell-style"> <!-- text-align="{@align}" -->
<xsl:call-template name="setTextAlignment">
<xsl:with-param name="default">center</xsl:with-param>
</xsl:call-template>
- <xsl:call-template name="setBordersTableArray"/>
+ <xsl:call-template name="refine_table-header-cell-style"/>
- <xsl:if test="$lang = 'ar'">
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
- </xsl:if>
-
- <xsl:call-template name="setTableCellAttributes"/>
-
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
</xsl:template> <!-- cell in table header row - 'th' -->
@@ -3444,18 +3636,12 @@
<fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
<xsl:call-template name="setTextAlignment">
<xsl:with-param name="default">left</xsl:with-param>
</xsl:call-template>
- <xsl:if test="$lang = 'ar'">
- <xsl:attribute name="padding-right">1mm</xsl:attribute>
- </xsl:if>
+ <xsl:call-template name="refine_table-cell-style"/>
- <!-- bsi -->
-
- <xsl:call-template name="setBordersTableArray"/>
-
<xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
<xsl:attribute name="padding-right">1mm</xsl:attribute>
</xsl:if>
<xsl:call-template name="setTableCellAttributes"/>
@@ -3481,13 +3667,17 @@
<xsl:template match="*[local-name()='table']/*[local-name()='note']" priority="2">
<fo:block xsl:use-attribute-sets="table-note-style">
+ <xsl:call-template name="refine_table-note-style"/>
+
<!-- Table's note name (NOTE, for example) -->
<fo:inline xsl:use-attribute-sets="table-note-name-style">
+ <xsl:call-template name="refine_table-note-name-style"/>
+
<xsl:apply-templates select="*[local-name() = 'name']"/>
</fo:inline>
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -3511,10 +3701,18 @@
<xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
<!-- list of footnotes to calculate actual footnotes number -->
<xsl:variable name="p_fn_">
<xsl:call-template name="get_fn_list"/>
+ <!-- <xsl:choose>
+ <xsl:when test="$namespace = 'jis'">
+ <xsl:call-template name="get_fn_list_for_element"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get_fn_list"/>
+ </xsl:otherwise>
+ </xsl:choose> -->
</xsl:variable>
<xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
<xsl:variable name="gen_id" select="generate-id(.)"/>
<xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
@@ -3535,11 +3733,18 @@
<xsl:variable name="current_fn_number_text">
<xsl:value-of select="$current_fn_number"/>
</xsl:variable>
- <xsl:variable name="ref_id" select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
+ <xsl:variable name="ref_id">
+ <xsl:choose>
+ <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<xsl:variable name="footnote_inline">
<fo:inline>
<xsl:variable name="fn_styles">
<xsl:choose>
@@ -3561,11 +3766,11 @@
</xsl:if>
<xsl:call-template name="insert_basic_link">
<xsl:with-param name="element">
<fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
- <xsl:value-of select="$current_fn_number_text"/>
+ <xsl:copy-of select="$current_fn_number_text"/>
</fo:basic-link>
</xsl:with-param>
</xsl:call-template>
</fo:inline>
</xsl:variable>
@@ -3581,12 +3786,16 @@
<fo:block-container xsl:use-attribute-sets="fn-container-body-style">
<fo:block xsl:use-attribute-sets="fn-body-style">
+ <xsl:call-template name="refine_fn-body-style"/>
+
<fo:inline id="{$ref_id}" xsl:use-attribute-sets="fn-body-num-style">
+ <xsl:call-template name="refine_fn-body-num-style"/>
+
<xsl:value-of select="$current_fn_number_text"/>
</fo:inline>
<xsl:apply-templates/>
</fo:block>
</fo:block-container>
@@ -3634,10 +3843,32 @@
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+ <xsl:template name="get_fn_list_for_element">
+ <xsl:choose>
+ <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
+ <fn gen_id="{generate-id(.)}">
+ <xsl:copy-of select="@*"/>
+ <xsl:copy-of select="node()"/>
+ </fn>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
+ <xsl:variable name="element_id" select="@id"/>
+ <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
+ <!-- copy unique fn -->
+ <fn gen_id="{generate-id(.)}">
+ <xsl:copy-of select="@*"/>
+ <xsl:copy-of select="node()"/>
+ </fn>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
<!-- ============================ -->
<!-- table's footnotes rendering -->
<!-- ============================ -->
<xsl:template name="table_fn_display">
<xsl:variable name="references">
@@ -3808,10 +4039,12 @@
<!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
<xsl:template match="*[local-name()='fn']">
<fo:inline xsl:use-attribute-sets="fn-reference-style">
+ <xsl:call-template name="refine_fn-reference-style"/>
+
<fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
<xsl:value-of select="@reference"/>
</fo:basic-link>
@@ -3907,10 +4140,12 @@
</xsl:when> <!-- END: only one component -->
<xsl:when test="$parent = 'formula'"> <!-- a few components -->
<fo:block margin-bottom="12pt" text-align="left">
+ <xsl:call-template name="refine_dl_formula_where_style"/>
+
<!-- <xsl:variable name="title-where">
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">where</xsl:with-param>
</xsl:call-template>
</xsl:variable>
@@ -3920,10 +4155,12 @@
</fo:block>
</xsl:when> <!-- END: a few components -->
<xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
<fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
+ <xsl:call-template name="refine_figure_key_style"/>
+
<xsl:variable name="title-key">
<xsl:call-template name="getLocalizedString">
<xsl:with-param name="key">key</xsl:with-param>
</xsl:call-template>
</xsl:variable>
@@ -3934,19 +4171,19 @@
<!-- a few components -->
<xsl:if test="$onlyOneComponent = 'false'">
<fo:block>
- <!-- <xsl:attribute name="margin-left">7mm</xsl:attribute> -->
+ <xsl:call-template name="refine_multicomponent_style"/>
<xsl:if test="ancestor::*[local-name() = 'dd' or local-name() = 'td']">
<xsl:attribute name="margin-top">0</xsl:attribute>
</xsl:if>
<fo:block>
- <!-- <xsl:attribute name="margin-left">-3.5mm</xsl:attribute> -->
+ <xsl:call-template name="refine_multicomponent_block_style"/>
<xsl:apply-templates select="*[local-name() = 'name']">
<xsl:with-param name="process">true</xsl:with-param>
</xsl:apply-templates>
@@ -4103,10 +4340,32 @@
<xsl:apply-templates select="*[local-name() = 'dd']/*[local-name() = 'dl']"/>
</xsl:if>
</xsl:template> <!-- END: dl -->
+ <xsl:template name="refine_dl_formula_where_style">
+
+ </xsl:template> <!-- refine_dl_formula_where_style -->
+
+ <xsl:template name="refine_figure_key_style">
+
+ </xsl:template> <!-- refine_figure_key_style -->
+
+ <xsl:template name="refine_multicomponent_style">
+ <xsl:variable name="parent" select="local-name(..)"/>
+
+ <!-- <xsl:attribute name="margin-left">7mm</xsl:attribute> -->
+
+ </xsl:template> <!-- refine_multicomponent_style -->
+
+ <xsl:template name="refine_multicomponent_block_style">
+ <xsl:variable name="parent" select="local-name(..)"/>
+
+ <!-- <xsl:attribute name="margin-left">-3.5mm</xsl:attribute> -->
+
+ </xsl:template> <!-- refine_multicomponent_block_style -->
+
<!-- ignore 'p' with 'where' in formula, before 'dl' -->
<xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
<xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
<xsl:param name="process">false</xsl:param>
@@ -4322,17 +4581,21 @@
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
<xsl:attribute name="text-align">left</xsl:attribute>
</xsl:if>
+ <xsl:call-template name="refine_dt-cell-style"/>
+
<fo:block xsl:use-attribute-sets="dt-block-style">
<xsl:copy-of select="@id"/>
<xsl:if test="normalize-space($key_iso) = 'true'">
<xsl:attribute name="margin-top">0</xsl:attribute>
</xsl:if>
+ <xsl:call-template name="refine_dt-block-style"/>
+
<xsl:apply-templates>
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
</xsl:apply-templates>
<xsl:if test="$isGenerateTableIF = 'true'"><fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
@@ -4348,10 +4611,12 @@
<xsl:if test="$isGenerateTableIF = 'true'">
<!-- border is mandatory, to calculate real width -->
<xsl:attribute name="border">0.1pt solid black</xsl:attribute>
</xsl:if>
+ <xsl:call-template name="refine_dd-cell-style"/>
+
<fo:block>
<xsl:if test="$isGenerateTableIF = 'true'">
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
</xsl:if>
@@ -4498,16 +4763,22 @@
<xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
<xsl:param name="split_keep-within-line"/>
<fo:inline font-weight="bold">
+ <xsl:call-template name="refine_strong_style"/>
+
<xsl:apply-templates>
<xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
</xsl:apply-templates>
</fo:inline>
</xsl:template>
+ <xsl:template name="refine_strong_style">
+
+ </xsl:template>
+
<xsl:template match="*[local-name()='padding']">
<fo:inline padding-right="{@value}"> </fo:inline>
</xsl:template>
<xsl:template match="*[local-name()='sup']">
@@ -5042,11 +5313,14 @@
</xsl:when>
<xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <xsl:value-of select="$text9"/>
+ <!-- replace sequence #x200B and space TO space -->
+ <xsl:variable name="text10" select="java:replaceAll(java:java.lang.String.new($text9), '\u200b ', ' ')"/>
+
+ <xsl:value-of select="$text10"/>
</xsl:template>
<xsl:template name="add-zero-spaces-link-java">
<xsl:param name="text" select="."/>
@@ -5717,10 +5991,15 @@
<xsl:variable name="isAdded" select="@added"/>
<xsl:variable name="isDeleted" select="@deleted"/>
<fo:inline xsl:use-attribute-sets="mathml-style">
+ <!-- DEBUG -->
+ <!-- <xsl:copy-of select="ancestor::*[local-name() = 'stem']/@font-family"/> -->
+
+ <xsl:call-template name="refine_mathml-style"/>
+
<xsl:if test="$isGenerateTableIF = 'true' and ancestor::*[local-name() = 'td' or local-name() = 'th' or local-name() = 'dl'] and not(following-sibling::node()[not(self::comment())][normalize-space() != ''])"> <!-- math in table cell, and math is last element -->
<!-- <xsl:attribute name="padding-right">1mm</xsl:attribute> -->
</xsl:if>
<xsl:call-template name="setTrackChangesStyles">
@@ -5821,10 +6100,12 @@
<xsl:apply-templates select="." mode="mathml"/>
</xsl:variable>
<fo:instream-foreign-object fox:alt-text="Math">
+ <xsl:call-template name="refine_mathml_insteam_object_style"/>
+
<!-- put MathML in Actual Text -->
<!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
<xsl:attribute name="fox:actual-text">
<xsl:value-of select="$mathml_content"/>
</xsl:attribute>
@@ -5841,10 +6122,14 @@
<xsl:copy-of select="xalan:nodeset($mathml)"/>
</fo:instream-foreign-object>
</xsl:template>
+ <xsl:template name="refine_mathml_insteam_object_style">
+
+ </xsl:template> <!-- refine_mathml_insteam_object_style -->
+
<xsl:template match="mathml:*" mode="mathml_actual_text">
<!-- <xsl:text>a+b</xsl:text> -->
<xsl:text><</xsl:text>
<xsl:value-of select="local-name()"/>
<xsl:if test="local-name() = 'math'">
@@ -5985,10 +6270,12 @@
<stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
-->
<xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
<fo:inline xsl:use-attribute-sets="mathml-style">
+ <xsl:call-template name="refine_mathml-style"/>
+
<xsl:choose>
<xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
<xsl:otherwise>
<xsl:apply-templates>
<xsl:with-param name="process">true</xsl:with-param>
@@ -6029,10 +6316,12 @@
<xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
</xsl:if>
+ <xsl:call-template name="refine_link-style"/>
+
<xsl:choose>
<xsl:when test="$target_text = ''">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
@@ -6116,10 +6405,13 @@
<xsl:template match="*[local-name() = 'xref']">
<xsl:call-template name="insert_basic_link">
<xsl:with-param name="element">
<fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
+ <xsl:if test="string-length(normalize-space()) < 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
+ </xsl:if>
<xsl:if test="parent::*[local-name() = 'add']">
<xsl:call-template name="append_add-style"/>
</xsl:if>
<xsl:apply-templates/>
</fo:basic-link>
@@ -6177,10 +6469,12 @@
<fo:table-body>
<fo:table-row>
<fo:table-cell display-align="center">
<fo:block xsl:use-attribute-sets="formula-stem-block-style">
+ <xsl:call-template name="refine_formula-stem-block-style"/>
+
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
<fo:table-cell display-align="center">
<fo:block xsl:use-attribute-sets="formula-stem-number-style">
@@ -6218,16 +6512,22 @@
<fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
<xsl:call-template name="setBlockSpanAll"/>
+ <xsl:call-template name="refine_note-style"/>
+
<fo:block-container margin-left="0mm" margin-right="0mm">
<fo:block>
+ <xsl:call-template name="refine_note_block_style"/>
+
<fo:inline xsl:use-attribute-sets="note-name-style">
+ <xsl:call-template name="refine_note-name-style"/>
+
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
<!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
<xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
<xsl:call-template name="append_add-style"/>
</xsl:if>
@@ -6249,10 +6549,14 @@
</fo:block-container>
</fo:block-container>
</xsl:template>
+ <xsl:template name="refine_note_block_style">
+
+ </xsl:template>
+
<xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
<xsl:variable name="num"><xsl:number/></xsl:variable>
<xsl:choose>
<xsl:when test="$num = 1"> <!-- display first NOTE's paragraph in the same line with label NOTE -->
<fo:inline xsl:use-attribute-sets="note-p-style">
@@ -6270,16 +6574,20 @@
<xsl:template match="*[local-name() = 'termnote']">
<fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
<xsl:call-template name="setBlockSpanAll"/>
+ <xsl:call-template name="refine_termnote-style"/>
+
<fo:inline xsl:use-attribute-sets="termnote-name-style">
<xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
<xsl:attribute name="padding-right">1mm</xsl:attribute>
</xsl:if>
+ <xsl:call-template name="refine_termnote-name-style"/>
+
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
<!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
<xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
<xsl:call-template name="append_add-style"/>
</xsl:if>
@@ -6447,10 +6755,12 @@
</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:block xsl:use-attribute-sets="image-style">
+ <xsl:call-template name="refine_image-style"/>
+
<xsl:variable name="src">
<xsl:call-template name="image_src"/>
</xsl:variable>
<xsl:choose>
@@ -7296,10 +7606,12 @@
<xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']">
<xsl:if test="normalize-space() != ''">
<fo:block xsl:use-attribute-sets="figure-name-style">
+ <xsl:call-template name="refine_figure-name-style"/>
+
<xsl:apply-templates/>
</fo:block>
</xsl:if>
</xsl:template>
@@ -7560,10 +7872,12 @@
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
+ <xsl:call-template name="refine_sourcecode-style"/>
+
<!-- remove margin between rows in the table with sourcecode line numbers -->
<xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
<xsl:attribute name="margin-top">0pt</xsl:attribute>
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
</xsl:if>
@@ -8264,10 +8578,12 @@
<fo:block-container id="{@id}" xsl:use-attribute-sets="example-style">
<xsl:call-template name="setBlockSpanAll"/>
+ <xsl:call-template name="refine_example-style"/>
+
<xsl:variable name="fo_element">
<xsl:if test=".//*[local-name() = 'table'] or .//*[local-name() = 'dl'] or *[not(local-name() = 'name')][1][local-name() = 'sourcecode']">block</xsl:if>
inline
</xsl:variable>
@@ -8391,10 +8707,12 @@
<xsl:attribute name="margin-left">0mm</xsl:attribute>
<xsl:attribute name="margin-right">0mm</xsl:attribute>
</xsl:if>
<fo:block xsl:use-attribute-sets="example-p-style">
+ <xsl:call-template name="refine_example-p-style"/>
+
<xsl:apply-templates/>
</fo:block>
</fo:block-container>
</xsl:when>
<xsl:when test="starts-with(normalize-space($element), 'list')">
@@ -8407,10 +8725,11 @@
<xsl:apply-templates/>
</fo:inline>
</xsl:otherwise>
</xsl:choose>
</xsl:template> <!-- example/p -->
+
<!-- ====== -->
<!-- ====== -->
<!-- ====== -->
<!-- termsource -->
@@ -8418,10 +8737,12 @@
<!-- modification -->
<!-- ====== -->
<xsl:template match="*[local-name() = 'termsource']" name="termsource">
<fo:block xsl:use-attribute-sets="termsource-style">
+ <xsl:call-template name="refine_termsource-style"/>
+
<!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
<xsl:variable name="termsource_text">
<xsl:apply-templates/>
</xsl:variable>
<xsl:copy-of select="$termsource_text"/>
@@ -8533,10 +8854,12 @@
</xsl:if>
<fo:block-container margin-left="0mm">
<fo:block-container xsl:use-attribute-sets="quote-style">
+ <xsl:call-template name="refine_quote-style"/>
+
<fo:block-container margin-left="0mm" margin-right="0mm">
<fo:block role="BlockQuote">
<xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
</fo:block>
</fo:block-container>
@@ -8607,23 +8930,21 @@
<xsl:attribute name="vertical-align">super</xsl:attribute>
<xsl:attribute name="font-size">80%</xsl:attribute>
</xsl:if>
- <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
- <xsl:variable name="text" select="normalize-space()"/>
+ <xsl:call-template name="refine_eref-style"/>
<xsl:call-template name="insert_basic_link">
<xsl:with-param name="element">
<fo:basic-link fox:alt-text="{@citeas}">
<xsl:if test="normalize-space(@citeas) = ''">
<xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
</xsl:if>
<xsl:if test="@type = 'inline'">
- <xsl:attribute name="color">blue</xsl:attribute>
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
+ <xsl:call-template name="refine_basic_link_style"/>
</xsl:if>
<xsl:choose>
<xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
@@ -8653,10 +8974,18 @@
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+
+ <xsl:template name="refine_basic_link_style">
+
+ <xsl:attribute name="color">blue</xsl:attribute>
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
+
+ </xsl:template> <!-- refine_basic_link_style -->
+
<!-- ====== -->
<!-- END eref -->
<!-- ====== -->
<!-- Tabulation processing -->
@@ -8796,15 +9125,21 @@
<xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
<fo:block>
<xsl:call-template name="setId"/>
+ <xsl:call-template name="sections_element_style"/>
+
<xsl:apply-templates/>
</fo:block>
</xsl:template>
+ <xsl:template name="sections_element_style">
+
+ </xsl:template> <!-- sections_element_style -->
+
<xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
<fo:block break-after="page"/>
<fo:block>
<xsl:call-template name="setId"/>
<xsl:apply-templates/>
@@ -8815,14 +9150,20 @@
<fo:block>
<xsl:call-template name="setId"/>
<xsl:call-template name="setBlockSpanAll"/>
+ <xsl:call-template name="refine_clause_style"/>
+
<xsl:apply-templates/>
</fo:block>
</xsl:template>
+ <xsl:template name="refine_clause_style">
+
+ </xsl:template> <!-- refine_clause_style -->
+
<xsl:template match="*[local-name() = 'definitions']">
<fo:block id="{@id}">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
@@ -8831,14 +9172,20 @@
<fo:block break-after="page"/>
<fo:block id="{@id}">
<xsl:call-template name="setBlockSpanAll"/>
+ <xsl:call-template name="refine_annex_style"/>
+
</fo:block>
<xsl:apply-templates/>
</xsl:template>
+ <xsl:template name="refine_annex_style">
+
+ </xsl:template>
+
<xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
<!-- comment 2019-11-29 -->
<!-- <fo:block font-weight="bold">Review:</fo:block>
<xsl:apply-templates /> -->
@@ -9002,10 +9349,12 @@
<xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
+ <xsl:call-template name="refine_list_container_style"/>
+
<fo:block-container margin-left="0mm">
<fo:block>
<xsl:apply-templates select="." mode="list"/>
</fo:block>
</fo:block-container>
@@ -9019,21 +9368,25 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+ <xsl:template name="refine_list_container_style">
+
+ </xsl:template> <!-- refine_list_container_style -->
+
<xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
<xsl:apply-templates select="*[local-name() = 'name']">
<xsl:with-param name="process">true</xsl:with-param>
</xsl:apply-templates>
<fo:list-block xsl:use-attribute-sets="list-style">
<xsl:variable name="provisional_distance_between_starts_">
<attributes xsl:use-attribute-sets="list-style">
-
+ <xsl:call-template name="refine_list-style_provisional-distance-between-starts"/>
</attributes>
</xsl:variable>
<xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
<xsl:if test="$provisional_distance_between_starts != ''">
<xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
@@ -9065,10 +9418,12 @@
<!-- <xsl:copy-of select="$item_numbers"/>
<max_length><xsl:value-of select="$max_length"/></max_length>
<addon><xsl:value-of select="$addon"/></addon> -->
</xsl:if>
+ <xsl:call-template name="refine_list-style"/>
+
<xsl:if test="*[local-name() = 'name']">
<xsl:attribute name="margin-top">0pt</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
@@ -9077,10 +9432,14 @@
<xsl:call-template name="note"/>
</xsl:for-each> -->
<xsl:apply-templates select="./*[local-name() = 'note']"/>
</xsl:template>
+ <xsl:template name="refine_list-style_provisional-distance-between-starts">
+
+ </xsl:template> <!-- refine_list-style_provisional-distance-between-starts -->
+
<xsl:template match="*[local-name() = 'ol' or local-name() = 'ul']/*[local-name() = 'name']">
<xsl:param name="process">false</xsl:param>
<xsl:if test="$process = 'true'">
<fo:block xsl:use-attribute-sets="list-name-style">
<xsl:apply-templates/>
@@ -9090,24 +9449,31 @@
<xsl:template match="*[local-name()='li']">
<fo:list-item xsl:use-attribute-sets="list-item-style">
<xsl:copy-of select="@id"/>
+ <xsl:call-template name="refine_list-item-style"/>
+
<fo:list-item-label end-indent="label-end()">
<fo:block xsl:use-attribute-sets="list-item-label-style">
+ <xsl:call-template name="refine_list-item-label-style"/>
+
<!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
<xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
<xsl:call-template name="append_add-style"/>
</xsl:if>
<xsl:call-template name="getListItemFormat"/>
+
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
<fo:block>
+ <xsl:call-template name="refine_list-item-body-style"/>
+
<xsl:apply-templates/>
<!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
<xsl:for-each select="./bsi:note">
@@ -9421,10 +9787,11 @@
<!-- Normative references -->
<xsl:template match="*[local-name() = 'references'][@normative='true']" priority="2">
<fo:block id="{@id}">
<xsl:apply-templates/>
+
</fo:block>
</xsl:template>
<!-- Bibliography (non-normative references) -->
<xsl:template match="*[local-name() = 'references']">
@@ -9438,10 +9805,11 @@
</xsl:if>
</xsl:if> -->
<fo:block id="{@id}" xsl:use-attribute-sets="references-non-normative-style">
<xsl:apply-templates/>
+
</fo:block>
</xsl:template> <!-- references -->
<xsl:template match="*[local-name() = 'bibitem']">
@@ -10021,10 +10389,13 @@
<xsl:call-template name="add_id"/>
<xsl:apply-templates mode="update_xml_step1"/>
</xsl:copy>
</xsl:template>
+ <!-- prevent empty thead processing in XSL-FO, remove it -->
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'thead'][count(*) = 0]" mode="update_xml_step1"/>
+
<xsl:template name="add_id">
<xsl:if test="not(@id)">
<!-- add @id - first element with @id plus '_element_name' -->
<xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
</xsl:if>
@@ -10305,10 +10676,18 @@
</fn>
-->
<xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" mode="linear_xml" name="linear_xml_fn">
<xsl:variable name="p_fn_">
<xsl:call-template name="get_fn_list"/>
+ <!-- <xsl:choose>
+ <xsl:when test="$namespace = 'jis'">
+ <xsl:call-template name="get_fn_list_for_element"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="get_fn_list"/>
+ </xsl:otherwise>
+ </xsl:choose> -->
</xsl:variable>
<xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
<xsl:variable name="gen_id" select="generate-id(.)"/>
<xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
<xsl:variable name="reference" select="@reference"/>
@@ -10319,11 +10698,17 @@
<xsl:apply-templates select="@*" mode="linear_xml"/>
<!-- put actual reference number -->
<xsl:attribute name="current_fn_number">
<xsl:value-of select="$current_fn_number"/>
</xsl:attribute>
+ <xsl:variable name="skip_footnote_body_" select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
<xsl:attribute name="skip_footnote_body"> <!-- false for repeatable footnote -->
- <xsl:value-of select="not($p_fn//fn[@gen_id = $gen_id] and (1 = 1))"/>
+
+ <xsl:value-of select="$skip_footnote_body_"/>
+
+ </xsl:attribute>
+ <xsl:attribute name="ref_id">
+ <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
</xsl:attribute>
<xsl:apply-templates select="node()" mode="linear_xml"/>
</xsl:copy>
</xsl:template>
\ No newline at end of file