lib/isodoc/un/un.plenary-attachment.xsl in metanorma-un-0.10.8 vs lib/isodoc/un/un.plenary-attachment.xsl in metanorma-un-0.10.9
- old
+ new
@@ -282,14 +282,14 @@
contents=<xsl:copy-of select="$contents"/>
<xsl:text disable-output-escaping="yes">--></xsl:text>
</xsl:if>
<!-- Preface Pages (except Abstract, that showed in Summary on cover page`) -->
- <xsl:if test="/un:un-standard/un:preface/*[not(local-name() = 'abstract' or local-name() = 'note' or local-name() = 'admonition')]">
+ <xsl:if test="/un:un-standard/un:preface/*[not(local-name() = 'abstract' or local-name() = 'note' or local-name() = 'admonition' or (local-name() = 'clause' and @type = 'toc'))]">
<xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
<xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
- <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements' and local-name() != 'note' and local-name() != 'admonition']"/>
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements' and local-name() != 'note' and local-name() != 'admonition' and not(local-name() = 'clause' and @type = 'toc')]"/>
<xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
<fo:block break-after="page"/>
</xsl:if>
<fo:block>
@@ -328,10 +328,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::un:bibitem">true</xsl:when>
<xsl:when test="ancestor-or-self::un:term">true</xsl:when>
<xsl:when test="@inline-header = 'true'">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
@@ -1127,10 +1128,14 @@
<xsl:attribute-set name="link-style">
</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">
@@ -1142,10 +1147,14 @@
<xsl:attribute name="margin-top">6pt</xsl:attribute>
<xsl:attribute name="margin-bottom">6pt</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="margin-top">6pt</xsl:attribute>
@@ -1219,10 +1228,14 @@
<xsl:attribute-set name="example-style">
</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">
@@ -1241,10 +1254,19 @@
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
<xsl:attribute name="margin-left">15mm</xsl:attribute>
</xsl:attribute-set> <!-- example-p-style -->
+ <xsl:template name="refine_example-p-style">
+
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
+ <xsl:if test="$num = 1">
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
+ </xsl:if>
+
+ </xsl:template> <!-- refine_example-p-style -->
+
<xsl:attribute-set name="termexample-name-style">
</xsl:attribute-set> <!-- termexample-name-style -->
<!-- ========================== -->
@@ -1267,18 +1289,39 @@
<xsl:attribute name="margin-bottom">18pt</xsl:attribute>
<xsl:attribute name="font-size">8pt</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 name="border-top">0.5pt solid black</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="margin-bottom">6pt</xsl:attribute>
<xsl:attribute name="font-weight">normal</xsl:attribute>
@@ -1287,28 +1330,49 @@
<xsl:attribute name="text-align">left</xsl:attribute>
<xsl:attribute name="text-indent">0mm</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>
@@ -1323,10 +1387,22 @@
<xsl:attribute name="border-bottom">solid black 1.5pt</xsl:attribute>
<xsl:attribute name="text-indent">0mm</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>
@@ -1338,24 +1414,44 @@
<xsl:attribute name="border-bottom">solid black 1.5pt</xsl:attribute>
<xsl:attribute name="text-indent">0mm</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 -->
@@ -1409,15 +1505,23 @@
<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-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>
@@ -1427,10 +1531,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">
@@ -1440,40 +1548,61 @@
<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-set>
<xsl:attribute-set name="eref-style">
<xsl:attribute name="color">blue</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="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">4mm</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:if test="@type = 'source' or @type = 'abbreviation'">
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
+ </xsl:if>
+
+ </xsl:template> <!-- refine_table-note-name-style -->
+
<xsl:attribute-set name="note-p-style">
<xsl:attribute name="margin-bottom">12pt</xsl:attribute>
<xsl:attribute name="text-indent">0</xsl:attribute>
@@ -1483,33 +1612,49 @@
<xsl:attribute name="margin-top">4pt</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">
<xsl:attribute name="margin-left">12mm</xsl:attribute>
<xsl:attribute name="margin-right">12mm</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>
<xsl:attribute-set name="termsource-style">
</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">
@@ -1542,10 +1687,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 -->
@@ -1558,10 +1707,19 @@
<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:if test="ancestor::*[local-name() ='annex']">
+ <xsl:attribute name="text-align">left</xsl:attribute>
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
+ </xsl:if>
+
+ </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 -->
@@ -1574,10 +1732,14 @@
<xsl:attribute name="border">2pt solid black</xsl:attribute>
<xsl:attribute name="text-indent">0</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">
@@ -1660,17 +1822,25 @@
<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">4mm</xsl:attribute>
<xsl:attribute name="margin-left">-8mm</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>
@@ -1678,28 +1848,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">
@@ -1721,19 +1907,27 @@
<xsl:attribute name="line-height">125%</xsl:attribute>
<xsl:attribute name="margin-left">8mm</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">8mm</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.25pt solid black</xsl:attribute>
<xsl:attribute name="margin-left">-3mm</xsl:attribute>
@@ -2381,15 +2575,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) -->
@@ -2411,17 +2604,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 -->
@@ -2482,11 +2672,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>
@@ -2569,10 +2759,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>
@@ -2951,10 +3145,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 -->
@@ -2963,10 +3159,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>
@@ -2987,11 +3187,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>
@@ -3047,18 +3247,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">
@@ -3186,11 +3389,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>
@@ -3220,10 +3423,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>
@@ -3233,13 +3438,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">
@@ -3258,18 +3464,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' -->
@@ -3306,18 +3506,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"/>
@@ -3343,16 +3537,16 @@
<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:if test="@type = 'source' or @type = 'abbreviation'">
- <xsl:attribute name="font-size">9pt</xsl:attribute>
- </xsl:if>
+ <xsl:call-template name="refine_table-note-name-style"/>
<xsl:apply-templates select="*[local-name() = 'name']"/>
</fo:inline>
@@ -3377,10 +3571,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']"/>
@@ -3401,11 +3603,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>
@@ -3427,11 +3636,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>
@@ -3447,12 +3656,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>
@@ -3500,10 +3713,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">
@@ -3674,10 +3909,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>
@@ -3773,10 +4010,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>
@@ -3786,10 +4025,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>
@@ -3800,16 +4041,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'">
@@ -3963,10 +4208,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>
@@ -4182,17 +4445,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"/> -->
@@ -4208,10 +4475,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>
@@ -4358,16 +4627,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']">
@@ -4830,11 +5105,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="."/>
@@ -5505,10 +5783,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">
@@ -5609,10 +5892,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>
@@ -5629,10 +5914,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'">
@@ -5773,10 +6062,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>
@@ -5817,10 +6108,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>
@@ -5904,10 +6197,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>
@@ -5965,14 +6261,11 @@
<fo:table-body>
<fo:table-row>
<fo:table-cell display-align="center">
<fo:block xsl:use-attribute-sets="formula-stem-block-style">
- <xsl:if test="ancestor::*[local-name() ='annex']">
- <xsl:attribute name="text-align">left</xsl:attribute>
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
- </xsl:if>
+ <xsl:call-template name="refine_formula-stem-block-style"/>
<xsl:apply-templates/>
</fo:block>
</fo:table-cell>
<fo:table-cell display-align="center">
@@ -6011,25 +6304,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:attribute name="font-size">10pt</xsl:attribute>
- <xsl:attribute name="text-indent">0</xsl:attribute>
- <xsl:attribute name="padding-top">1.5mm</xsl:attribute>
- <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
- <xsl:attribute name="font-size">9pt</xsl:attribute>
- <xsl:attribute name="text-align">justify</xsl:attribute>
- <xsl:attribute name="padding-top">0mm</xsl:attribute>
- </xsl:if>
+ <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>
@@ -6051,10 +6341,23 @@
</fo:block-container>
</fo:block-container>
</xsl:template>
+ <xsl:template name="refine_note_block_style">
+
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
+ <xsl:attribute name="text-indent">0</xsl:attribute>
+ <xsl:attribute name="padding-top">1.5mm</xsl:attribute>
+ <xsl:if test="../@type = 'source' or ../@type = 'abbreviation'">
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
+ <xsl:attribute name="text-align">justify</xsl:attribute>
+ <xsl:attribute name="padding-top">0mm</xsl:attribute>
+ </xsl:if>
+
+ </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">
@@ -6072,16 +6375,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>
@@ -6251,10 +6558,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>
@@ -7100,10 +7409,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>
@@ -7364,10 +7675,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>
@@ -8068,10 +8381,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>
@@ -8195,13 +8510,11 @@
<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:if test="$num = 1">
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
- </xsl:if>
+ <xsl:call-template name="refine_example-p-style"/>
<xsl:apply-templates/>
</fo:block>
</fo:block-container>
</xsl:when>
@@ -8215,10 +8528,11 @@
<xsl:apply-templates/>
</fo:inline>
</xsl:otherwise>
</xsl:choose>
</xsl:template> <!-- example/p -->
+
<!-- ====== -->
<!-- ====== -->
<!-- ====== -->
<!-- termsource -->
@@ -8226,10 +8540,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"/>
@@ -8341,10 +8657,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>
@@ -8415,22 +8733,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="text-decoration">underline</xsl:attribute>
+ <xsl:call-template name="refine_basic_link_style"/>
</xsl:if>
<xsl:choose>
<xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
@@ -8460,10 +8777,17 @@
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+
+ <xsl:template name="refine_basic_link_style">
+
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
+
+ </xsl:template> <!-- refine_basic_link_style -->
+
<!-- ====== -->
<!-- END eref -->
<!-- ====== -->
<!-- Tabulation processing -->
@@ -8602,20 +8926,26 @@
<xsl:template match="/*/*[local-name() = 'sections']/*" priority="2">
<fo:block>
<xsl:call-template name="setId"/>
- <xsl:variable name="num"><xsl:number/></xsl:variable>
- <xsl:if test="$num = 1">
- <xsl:attribute name="margin-top">20pt</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="num"><xsl:number/></xsl:variable>
+ <xsl:if test="$num = 1">
+ <xsl:attribute name="margin-top">20pt</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/>
@@ -8626,14 +8956,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>
@@ -8642,19 +8978,25 @@
<fo:block break-after="page"/>
<fo:block id="{@id}">
<xsl:call-template name="setBlockSpanAll"/>
- <xsl:variable name="num"><xsl:number/></xsl:variable>
- <xsl:if test="$num = 1">
- <xsl:attribute name="margin-top">3pt</xsl:attribute>
- </xsl:if>
+ <xsl:call-template name="refine_annex_style"/>
</fo:block>
<xsl:apply-templates/>
</xsl:template>
+ <xsl:template name="refine_annex_style">
+
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
+ <xsl:if test="$num = 1">
+ <xsl:attribute name="margin-top">3pt</xsl:attribute>
+ </xsl:if>
+
+ </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 /> -->
@@ -8815,10 +9157,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>
@@ -8832,25 +9176,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:if test="local-name() = 'ol'">
- <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
- </xsl:if>
-
+ <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>
@@ -8882,10 +9226,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')]"/>
@@ -8894,10 +9240,18 @@
<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:if test="local-name() = 'ol'">
+ <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
+ </xsl:if>
+
+ </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/>
@@ -8907,24 +9261,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">
@@ -9238,10 +9599,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']">
@@ -9255,10 +9617,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']">
@@ -9818,10 +10181,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>
@@ -10102,10 +10468,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"/>
@@ -10116,11 +10490,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