lib/isodoc/cc/cc.standard.xsl in metanorma-cc-2.2.8 vs lib/isodoc/cc/cc.standard.xsl in metanorma-cc-2.2.9
- old
+ new
@@ -217,80 +217,11 @@
<xsl:apply-templates select="/csd:csd-standard/csd:boilerplate/csd:feedback-statement/csd:clause/csd:p[@id = 'boilerplate-address']"/>
</fo:block>
<fo:block break-after="page"/>
- <fo:block-container font-weight="bold" line-height="115%">
- <fo:block role="TOC">
- <xsl:variable name="title-toc">
- <xsl:call-template name="getTitle">
- <xsl:with-param name="name" select="'title-toc'"/>
- </xsl:call-template>
- </xsl:variable>
- <fo:block font-size="14pt" margin-bottom="15.5pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block>
-
- <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>
- <!-- skip 0 section without subsections -->
- <xsl:when test="@section != ''">8mm</xsl:when> <!-- and not(@display-section = 'false') -->
- <xsl:otherwise>0mm</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <fo:list-item>
- <fo:list-item-label end-indent="label-end()">
- <fo:block>
- <xsl:value-of select="@section"/>
- </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 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-container>
-
- <!-- Foreword, Introduction -->
+ <!-- Table of contents, Foreword, Introduction -->
<xsl:call-template name="processPrefaceSectionsDefault"/>
</fo:flow>
</fo:page-sequence>
@@ -348,10 +279,91 @@
</fo:list-item>
</fo:list-block>
</fo:block>
</xsl:template>
+ <xsl:template match="csd:preface/csd:clause[@type = 'toc']" priority="3">
+ <fo:block-container font-weight="bold" line-height="115%">
+ <fo:block role="TOC">
+
+ <xsl:apply-templates/>
+
+ <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
+
+ <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>
+ <!-- skip 0 section without subsections -->
+ <xsl:when test="@section != ''">8mm</xsl:when> <!-- and not(@display-section = 'false') -->
+ <xsl:otherwise>0mm</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <fo:list-item>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>
+ <xsl:value-of select="@section"/>
+ </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 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>
+ </xsl:if>
+ </fo:block>
+ </fo:block-container>
+ </xsl:template>
+
+ <xsl:template match="csd:preface/csd:clause[@type = 'toc']/csd:title" priority="3">
+ <!-- <xsl:variable name="title-toc">
+ <xsl:call-template name="getTitle">
+ <xsl:with-param name="name" select="'title-toc'"/>
+ </xsl:call-template>
+ </xsl:variable> -->
+ <fo:block font-size="14pt" margin-bottom="15.5pt" role="H1">
+ <!-- <xsl:value-of select="$title-toc"/> -->
+ <xsl:apply-templates/>
+ </fo:block>
+ </xsl:template>
+
<xsl:template match="node()">
<xsl:apply-templates/>
</xsl:template>
<!-- ============================= -->
@@ -373,10 +385,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::csd:bibitem">true</xsl:when>
<xsl:when test="ancestor-or-self::csd:term">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>
@@ -962,10 +975,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">
@@ -977,10 +994,14 @@
<xsl:attribute name="margin-bottom">6pt</xsl:attribute>
<xsl:attribute name="keep-with-next">always</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"><xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
@@ -1059,10 +1080,14 @@
<xsl:attribute name="font-size">10pt</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 name="margin-left">12.5mm</xsl:attribute>
</xsl:attribute-set> <!-- example-body-style -->
@@ -1079,10 +1104,14 @@
<xsl:attribute name="margin-bottom">14pt</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">10mm</xsl:attribute>
</xsl:attribute-set> <!-- termexample-name-style -->
@@ -1106,72 +1135,146 @@
<xsl:attribute name="font-size">10pt</xsl:attribute>
</xsl:attribute-set> <!-- table-container-style -->
+ <xsl:template name="refine_table-container-style">
+ <xsl:param name="margin-side"/>
+
+ <xsl:attribute name="margin-left"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
+ <xsl:attribute name="margin-right"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
+
+ <!-- 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-set><!-- table-style -->
+ <xsl:template name="refine_table-style">
+ <xsl:param name="margin-side"/>
+
+ <xsl:if test="$margin-side != 0">
+ <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
+ <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
+ </xsl:if>
+
+ <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="font-weight">bold</xsl:attribute>
<xsl:attribute name="text-align">center</xsl:attribute>
<xsl:attribute name="margin-bottom">6pt</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-set>
<xsl:attribute-set name="table-header-row-style" use-attribute-sets="table-row-style">
<xsl:attribute name="font-weight">bold</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>
</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>
</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-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-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 -->
@@ -1223,17 +1326,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-left">7mm</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">bold</xsl:attribute>
@@ -1243,10 +1354,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">
@@ -1265,42 +1380,59 @@
<xsl:attribute name="margin-bottom">8pt</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="xref-style">
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="eref-style">
<xsl:attribute name="color">blue</xsl:attribute>
<xsl:attribute name="text-decoration">underline</xsl:attribute>
</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">10pt</xsl:attribute>
<xsl:attribute name="margin-bottom">12pt</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="padding-right">6mm</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-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-bottom">12pt</xsl:attribute>
</xsl:attribute-set>
@@ -1310,14 +1442,22 @@
<xsl:attribute name="font-size">10pt</xsl:attribute>
<xsl:attribute name="margin-bottom">12pt</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">
@@ -1326,10 +1466,14 @@
<xsl:attribute name="margin-top">12pt</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>
@@ -1338,10 +1482,14 @@
<xsl:attribute name="margin-bottom">8pt</xsl:attribute>
<xsl:attribute name="keep-with-previous">always</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">
@@ -1376,10 +1524,14 @@
<xsl:attribute name="space-after">12pt</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 -->
@@ -1395,10 +1547,14 @@
<xsl:attribute name="text-align">left</xsl:attribute>
<xsl:attribute name="margin-left">5mm</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 -->
@@ -1406,10 +1562,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">
@@ -1498,17 +1658,29 @@
<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">6.5mm</xsl:attribute>
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
</xsl:attribute-set> <!-- list-style -->
+ <xsl:template name="refine_list-style">
+
+ <xsl:if test="ancestor::csd:ol">
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
+ </xsl:if>
+
+ </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">bold</xsl:attribute>
@@ -1516,28 +1688,44 @@
<xsl:attribute-set name="list-item-style">
</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-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">
@@ -1557,18 +1745,26 @@
<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-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="margin-bottom">12pt</xsl:attribute>
<xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -2199,15 +2395,14 @@
</xsl:choose>
</xsl:variable>
<fo:block-container xsl:use-attribute-sets="table-container-style">
- <xsl:attribute name="margin-left"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
- <xsl:attribute name="margin-right"><xsl:value-of select="-$margin-side"/>mm</xsl:attribute>
+ <xsl:call-template name="refine_table-container-style">
+ <xsl:with-param name="margin-side" select="$margin-side"/>
+ </xsl:call-template>
- <!-- end table block-container attributes -->
-
<!-- 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">
<!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
@@ -2223,17 +2418,14 @@
<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:if test="$margin-side != 0">
- <xsl:attribute name="margin-left"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
- <xsl:attribute name="margin-right"><xsl:value-of select="$margin-side"/>mm</xsl:attribute>
- </xsl:if>
+ <xsl:call-template name="refine_table-style">
+ <xsl:with-param name="margin-side" select="$margin-side"/>
+ </xsl:call-template>
- <xsl:call-template name="setBordersTableArray"/>
-
</xsl:element>
</xsl:variable>
<xsl:if test="$isGenerateTableIF = 'true'">
<!-- to determine start of table -->
@@ -2294,11 +2486,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>
@@ -2384,10 +2576,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>
@@ -2766,10 +2962,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 -->
@@ -2778,10 +2976,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>
@@ -2802,11 +3004,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>
@@ -2862,18 +3064,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">
@@ -3001,11 +3206,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>
@@ -3035,10 +3240,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>
@@ -3048,13 +3255,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">
@@ -3069,18 +3277,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' -->
@@ -3117,18 +3319,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"/>
@@ -3154,13 +3350,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')]"/>
@@ -3184,10 +3384,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']"/>
@@ -3208,11 +3416,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>
@@ -3234,11 +3449,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>
@@ -3254,12 +3469,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>
@@ -3307,10 +3526,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">
@@ -3481,10 +3722,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>
@@ -3580,10 +3823,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>
@@ -3593,10 +3838,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>
@@ -3607,16 +3854,20 @@
<!-- a few components -->
<xsl:if test="$onlyOneComponent = 'false'">
<fo:block>
+ <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: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>
<xsl:if test="$isGenerateTableIF = 'true'">
@@ -3770,10 +4021,28 @@
<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:template> <!-- refine_multicomponent_style -->
+
+ <xsl:template name="refine_multicomponent_block_style">
+ <xsl:variable name="parent" select="local-name(..)"/>
+
+ </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>
@@ -3989,17 +4258,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"/> -->
@@ -4015,10 +4288,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>
@@ -4165,16 +4440,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']">
@@ -5315,10 +5596,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">
@@ -5419,10 +5705,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>
@@ -5439,10 +5727,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'">
@@ -5583,10 +5875,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>
@@ -5627,10 +5921,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>
@@ -5714,10 +6010,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://'))">
+ <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>
@@ -5775,10 +6074,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">
@@ -5816,16 +6117,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>
@@ -5847,10 +6154,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">
@@ -5868,16 +6179,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>
@@ -6043,10 +6358,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>
@@ -6892,10 +7209,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>
@@ -7158,10 +7477,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>
@@ -7862,10 +8183,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>
block
</xsl:variable>
@@ -7989,10 +8312,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')">
@@ -8005,10 +8330,11 @@
<xsl:apply-templates/>
</fo:inline>
</xsl:otherwise>
</xsl:choose>
</xsl:template> <!-- example/p -->
+
<!-- ====== -->
<!-- ====== -->
<!-- ====== -->
<!-- termsource -->
@@ -8016,10 +8342,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"/>
@@ -8131,10 +8459,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>
@@ -8205,23 +8535,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 -->
@@ -8251,10 +8579,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 -->
@@ -8399,20 +8735,26 @@
<xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
<fo:block>
<xsl:call-template name="setId"/>
- <xsl:variable name="pos"><xsl:number count="csd:sections/csd:clause | csd:sections/csd:terms"/></xsl:variable>
- <xsl:if test="$pos >= 2">
- <xsl:attribute name="space-before">18pt</xsl:attribute>
- </xsl:if>
+ <xsl:call-template name="sections_element_style"/>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
+ <xsl:template name="sections_element_style">
+
+ <xsl:variable name="pos"><xsl:number count="csd:sections/csd:clause | csd:sections/csd:terms"/></xsl:variable>
+ <xsl:if test="$pos >= 2">
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
+ </xsl:if>
+
+ </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/>
@@ -8423,14 +8765,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>
@@ -8439,14 +8787,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 /> -->
@@ -8607,10 +8961,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>
@@ -8624,21 +8980,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>
@@ -8670,13 +9030,11 @@
<!-- <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:if test="ancestor::csd:ol">
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
- </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>
@@ -8686,10 +9044,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/>
@@ -8699,24 +9061,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">
@@ -9030,10 +9399,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']">
@@ -9049,10 +9419,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']">
@@ -9631,10 +10002,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>
@@ -9915,10 +10289,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"/>
@@ -9929,11 +10311,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