metanorma-plateau 0.2.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@
13
13
  <xsl:variable name="i18n_doctype_dict_annex"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">doctype_dict.annex</xsl:with-param></xsl:call-template></xsl:variable>
14
14
  <xsl:variable name="i18n_doctype_dict_technical_report"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">doctype_dict.technical-report</xsl:with-param></xsl:call-template></xsl:variable>
15
15
  <xsl:variable name="i18n_table_of_contents"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">table_of_contents</xsl:with-param></xsl:call-template></xsl:variable>
16
+ <xsl:variable name="i18n_table_footnote"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">table_footnote</xsl:with-param></xsl:call-template></xsl:variable>
16
17
 
17
18
  <xsl:variable name="vertical_layout" select="normalize-space(/*/plateau:metanorma-extension/plateau:presentation-metadata/plateau:vertical-layout)"/>
18
19
  <xsl:variable name="vertical_layout_rotate_clause_numbers" select="normalize-space(/*/plateau:metanorma-extension/plateau:presentation-metadata/plateau:vertical-layout-rotate-clause-numbers)"/>
@@ -324,11 +325,7 @@
324
325
  <xsl:attribute name="initial-page-number">1</xsl:attribute>
325
326
  </xsl:if>
326
327
 
327
- <fo:static-content flow-name="xsl-footnote-separator">
328
- <fo:block>
329
- <fo:leader leader-pattern="rule" leader-length="15%"/>
330
- </fo:block>
331
- </fo:static-content>
328
+ <xsl:call-template name="insertFootnoteSeparatorCommon"><xsl:with-param name="leader_length">15%</xsl:with-param></xsl:call-template>
332
329
 
333
330
  <xsl:call-template name="insertHeaderFooter"/>
334
331
 
@@ -493,12 +490,6 @@
493
490
  </xsl:call-template>
494
491
  </xsl:template> <!-- END: processPrefaceAndMainSectionsPlateau_items -->
495
492
 
496
- <xsl:template match="*[local-name() = 'references'][not(@hidden = 'true')]" mode="linear_xml" priority="2">
497
- <xsl:copy>
498
- <xsl:apply-templates select="@*|node()" mode="linear_xml"/>
499
- </xsl:copy>
500
- </xsl:template>
501
-
502
493
  <xsl:template match="*[local-name()='preface']//*[local-name() = 'clause'][@type = 'toc']" priority="4">
503
494
  <xsl:param name="num"/>
504
495
  <xsl:if test="$doctype = 'technical-report'">
@@ -1158,7 +1149,12 @@
1158
1149
  <xsl:otherwise>
1159
1150
 
1160
1151
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
1161
- <xsl:variable name="element-name">fo:block</xsl:variable>
1152
+ <xsl:variable name="element-name">
1153
+ <xsl:choose>
1154
+ <xsl:when test="ancestor::plateau:figure and parent::plateau:note[not(@type = 'units')]">fo:inline</xsl:when>
1155
+ <xsl:otherwise>fo:block</xsl:otherwise>
1156
+ </xsl:choose>
1157
+ </xsl:variable>
1162
1158
 
1163
1159
  <xsl:element name="{$element-name}">
1164
1160
  <xsl:call-template name="setBlockAttributes">
@@ -1212,6 +1208,10 @@
1212
1208
  <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
1213
1209
  </xsl:if>
1214
1210
 
1211
+ <xsl:if test="parent::plateau:dd and ancestor::plateau:dl[@key = 'true'] and (ancestor::plateau:tfoot or ancestor::plateau:figure)">
1212
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1213
+ </xsl:if>
1214
+
1215
1215
  <xsl:if test="parent::plateau:clause[@type = 'inner-cover-note'] or ancestor::plateau:boilerplate">
1216
1216
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1217
1217
  </xsl:if>
@@ -1227,6 +1227,16 @@
1227
1227
  </xsl:if>
1228
1228
  </xsl:if>
1229
1229
 
1230
+ <xsl:if test="ancestor::*[local-name() = 'note'][@type = 'units']">
1231
+ <xsl:attribute name="text-align">right</xsl:attribute>
1232
+ </xsl:if>
1233
+
1234
+ <!-- paragraph in table or figure footer -->
1235
+ <xsl:if test="parent::plateau:table or parent::plateau:figure or (ancestor::plateau:tfoot and ancestor::td[1]/@colspan)">
1236
+ <xsl:attribute name="margin-left"><xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
1237
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1238
+ </xsl:if>
1239
+
1230
1240
  <xsl:if test="parent::plateau:clause or (ancestor::plateau:note and not(ancestor::plateau:table))">
1231
1241
  <xsl:text> </xsl:text>
1232
1242
  </xsl:if>
@@ -1235,14 +1245,14 @@
1235
1245
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
1236
1246
  </xsl:apply-templates>
1237
1247
  </xsl:element>
1238
- <xsl:if test="$element-name = 'fo:inline' and not(local-name(..) = 'admonition')"> <!-- and not($inline = 'true') -->
1248
+ <!-- <xsl:if test="$element-name = 'fo:inline' and not(local-name(..) = 'admonition')">
1239
1249
  <fo:block margin-bottom="12pt">
1240
1250
  <xsl:if test="ancestor::plateau:annex or following-sibling::plateau:table">
1241
1251
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
1242
1252
  </xsl:if>
1243
1253
  <xsl:value-of select="$linebreak"/>
1244
1254
  </fo:block>
1245
- </xsl:if>
1255
+ </xsl:if>-->
1246
1256
 
1247
1257
  </xsl:otherwise>
1248
1258
  </xsl:choose>
@@ -1278,7 +1288,7 @@
1278
1288
  </fo:block-container>
1279
1289
  </xsl:template>
1280
1290
 
1281
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="3"/>
1291
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][not(@type = 'units')]" priority="3"/>
1282
1292
 
1283
1293
  <xsl:template match="*[local-name() = 'note'][not(ancestor::plateau:table)]/*[local-name() = 'p']" priority="2">
1284
1294
  <xsl:call-template name="paragraph"/>
@@ -1414,8 +1424,10 @@
1414
1424
  <!-- <debug><xsl:copy-of select="$ancestor_tree"/></debug>
1415
1425
  <debug><ancestor><xsl:value-of select="$ancestor"/></ancestor></debug> -->
1416
1426
 
1427
+ <xsl:variable name="ref_id" select="@target"/>
1428
+
1417
1429
  <xsl:if test="$ancestor_tree//item[last()][. = $ancestor]">
1418
- <fo:block-container margin-left="11mm" margin-bottom="4pt" id="{@ref_id}">
1430
+ <fo:block-container margin-left="11mm" margin-bottom="4pt" id="{$ref_id}">
1419
1431
 
1420
1432
  <xsl:if test="position() = last()">
1421
1433
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
@@ -1424,11 +1436,13 @@
1424
1436
  <fo:list-block provisional-distance-between-starts="10mm">
1425
1437
  <fo:list-item>
1426
1438
  <fo:list-item-label end-indent="label-end()">
1427
- <fo:block xsl:use-attribute-sets="note-name-style">注 <fo:inline xsl:use-attribute-sets="fn-num-style"><xsl:value-of select="@current_fn_number"/><fo:inline font-weight="normal">)</fo:inline></fo:inline></fo:block>
1439
+ <xsl:variable name="current_fn_number" select="translate(normalize-space(plateau:fmt-fn-label), ')', '')"/>
1440
+ <fo:block xsl:use-attribute-sets="note-name-style">注 <fo:inline xsl:use-attribute-sets="fn-num-style"><xsl:value-of select="$current_fn_number"/><fo:inline font-weight="normal">)</fo:inline></fo:inline></fo:block>
1428
1441
  </fo:list-item-label>
1429
1442
  <fo:list-item-body start-indent="body-start()">
1430
1443
  <fo:block>
1431
- <xsl:apply-templates/>
1444
+ <!-- <xsl:apply-templates /> -->
1445
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
1432
1446
  </fo:block>
1433
1447
  </fo:list-item-body>
1434
1448
  </fo:list-item>
@@ -1451,6 +1465,15 @@
1451
1465
  </xsl:copy>
1452
1466
  </xsl:template>
1453
1467
 
1468
+ <xsl:template match="plateau:ul//plateau:fn | plateau:ol//plateau:fn" mode="update_xml_pres">
1469
+ <xsl:copy>
1470
+ <xsl:apply-templates select="@*" mode="update_xml_pres"/>
1471
+ <!-- for output footnote after the 'li' -->
1472
+ <xsl:attribute name="skip_footnote_body">true</xsl:attribute>
1473
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
1474
+ </xsl:copy>
1475
+ </xsl:template>
1476
+
1454
1477
  <!-- remove Annex and (normative) -->
1455
1478
  <!-- <xsl:template match="*[local-name() = 'annex']/*[local-name() = 'title']" mode="update_xml_step1" priority="3">
1456
1479
  <xsl:copy>
@@ -1544,7 +1567,7 @@
1544
1567
  <xsl:variable name="tag_font_en_bold_open">###<xsl:value-of select="$element_name_font_en_bold"/>###</xsl:variable>
1545
1568
  <xsl:variable name="tag_font_en_bold_close">###/<xsl:value-of select="$element_name_font_en_bold"/>###</xsl:variable>
1546
1569
 
1547
- <xsl:template match="plateau:p//text()[not(ancestor::plateau:strong)] | plateau:dt/text() | plateau:td/text() | plateau:th/text()" mode="update_xml_step1">
1570
+ <xsl:template match="plateau:p//text()[not(ancestor::plateau:strong) and not(ancestor::plateau:stem)] | plateau:dt/text() | plateau:td/text() | plateau:th/text()" mode="update_xml_step1">
1548
1571
  <!-- add hairspace after 'IDEOGRAPHIC SPACE' (U+3000) -->
1549
1572
  <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.), '(\u3000)', concat('$1',$hair_space))"/>
1550
1573
  <xsl:variable name="text_en__">
@@ -1703,10 +1726,10 @@
1703
1726
  </xsl:template>
1704
1727
 
1705
1728
  <!-- Key title after the table -->
1706
- <xsl:template match="plateau:table/plateau:p[@class = 'ListTitle']" priority="2" mode="update_xml_step1"/>
1729
+ <!-- <xsl:template match="plateau:table/plateau:p[@class = 'ListTitle']" priority="2" mode="update_xml_step1"/> -->
1707
1730
 
1708
1731
  <!-- added to fix conflict with previous update in update_xml_pres -->
1709
- <xsl:template match="*[local-name() = 'preferred'] | *[local-name() = 'admitted'] | *[local-name() = 'deprecates'] | *[local-name() = 'definition'] | *[local-name() = 'termsource'] | *[local-name() = 'term'][@unnumbered = 'true'] | *[local-name() = 'identifier'] | *[local-name() = 'eref'] | *[local-name() = 'xref'] | *[local-name() = 'link'] | *[local-name() = 'origin']" mode="update_xml_step1" priority="2">
1732
+ <xsl:template match="*[local-name() = 'preferred'] | *[local-name() = 'admitted'] | *[local-name() = 'deprecates'] | *[local-name() = 'definition'] | *[local-name() = 'termsource'] | *[local-name() = 'term'][@unnumbered = 'true'] | *[local-name() = 'identifier'] | *[local-name() = 'eref'] | *[local-name() = 'xref'] | *[local-name() = 'link'] | *[local-name() = 'origin'] | *[local-name() = 'stem']" mode="update_xml_step1" priority="2">
1710
1733
  <xsl:copy>
1711
1734
  <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
1712
1735
  </xsl:copy>
@@ -1775,13 +1798,27 @@
1775
1798
  <!-- ========================= -->
1776
1799
 
1777
1800
  <!-- Table key -->
1778
- <xsl:template match="plateau:table/plateau:p[@class = 'dl']" priority="2">
1779
- <fo:block-container margin-left="90mm">
1801
+
1802
+ <xsl:template match="plateau:table/plateau:p[@class = 'ListTitle'] | plateau:figure/plateau:p[@keep-with-next = 'true']" priority="2">
1803
+ <fo:block>
1804
+ <xsl:copy-of select="@id"/>
1805
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1806
+ <xsl:apply-templates/>
1807
+ </fo:block>
1808
+ </xsl:template>
1809
+
1810
+ <xsl:variable name="tableAnnotationIndent">3mm</xsl:variable>
1811
+
1812
+ <xsl:template match="plateau:table/plateau:p[@class = 'dl'] | plateau:figure/plateau:p[@class = 'dl']" priority="2">
1813
+ <fo:block-container margin-left="{$tableAnnotationIndent}"> <!-- 90mm -->
1780
1814
  <xsl:if test="not(following-sibling::*[1][self::plateau:p[@class = 'dl']])"> <!-- last dl -->
1781
1815
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1782
1816
  </xsl:if>
1783
1817
  <fo:block-container margin-left="0mm">
1784
- <fo:block font-size="10pt">
1818
+ <fo:block>
1819
+ <xsl:if test="parent::plateau:table">
1820
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1821
+ </xsl:if>
1785
1822
  <xsl:copy-of select="@id"/>
1786
1823
  <xsl:apply-templates/>
1787
1824
  </fo:block>
@@ -2578,6 +2615,10 @@
2578
2615
 
2579
2616
  <xsl:template name="refine_example-name-style">
2580
2617
 
2618
+ <xsl:if test="ancestor::*[local-name() = 'figure']">
2619
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2620
+ </xsl:if>
2621
+
2581
2622
  </xsl:template>
2582
2623
 
2583
2624
  <xsl:attribute-set name="example-p-style">
@@ -2775,30 +2816,47 @@
2775
2816
 
2776
2817
  <xsl:template name="refine_table-note-style">
2777
2818
 
2819
+ <xsl:attribute name="margin-left"><xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
2820
+
2778
2821
  </xsl:template> <!-- refine_table-note-style -->
2779
2822
 
2780
2823
  <xsl:attribute-set name="table-fn-style">
2781
2824
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2782
2825
 
2783
- <xsl:attribute name="font-size">10.5pt</xsl:attribute>
2826
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2784
2827
  <xsl:attribute name="margin-bottom">1pt</xsl:attribute>
2785
2828
 
2786
2829
  </xsl:attribute-set> <!-- table-fn-style -->
2787
2830
 
2788
2831
  <xsl:template name="refine_table-fn-style">
2789
2832
 
2833
+ <xsl:attribute name="margin-left"><xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
2834
+
2790
2835
  </xsl:template>
2791
2836
 
2792
2837
  <xsl:attribute-set name="table-fn-number-style">
2793
- <xsl:attribute name="font-size">80%</xsl:attribute>
2794
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
2838
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
2795
2839
 
2796
2840
  <xsl:attribute name="font-size">100%</xsl:attribute>
2797
- <xsl:attribute name="padding-right">0mm</xsl:attribute>
2841
+ <!-- <xsl:attribute name="padding-right">2mm</xsl:attribute> -->
2842
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2798
2843
 
2799
2844
  </xsl:attribute-set> <!-- table-fn-number-style -->
2800
2845
 
2801
- <xsl:template name="refine_table-fn-number-style">
2846
+ <xsl:attribute-set name="table-fmt-fn-label-style">
2847
+ <xsl:attribute name="font-size">80%</xsl:attribute>
2848
+
2849
+ <xsl:attribute name="font-size">60%</xsl:attribute>
2850
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2851
+
2852
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
2853
+
2854
+ <xsl:template name="refine_table-fmt-fn-label-style">
2855
+
2856
+ <xsl:attribute name="font-size">60%</xsl:attribute>
2857
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2858
+ <xsl:attribute name="padding-right">2mm</xsl:attribute>
2859
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2802
2860
 
2803
2861
  </xsl:template>
2804
2862
 
@@ -2813,11 +2871,21 @@
2813
2871
  </xsl:attribute-set>
2814
2872
 
2815
2873
  <xsl:attribute-set name="figure-fn-number-style">
2816
- <xsl:attribute name="font-size">80%</xsl:attribute>
2817
2874
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2875
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
2876
+
2877
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
2878
+ <xsl:attribute name="font-size">80%</xsl:attribute>
2818
2879
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2819
2880
 
2820
- </xsl:attribute-set>
2881
+ <xsl:attribute name="font-size">60%</xsl:attribute>
2882
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2883
+
2884
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
2885
+
2886
+ <xsl:template name="refine_figure-fmt-fn-label-style">
2887
+
2888
+ </xsl:template>
2821
2889
 
2822
2890
  <xsl:attribute-set name="figure-fn-body-style">
2823
2891
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -2920,6 +2988,10 @@
2920
2988
 
2921
2989
  <xsl:template name="refine_note-name-style">
2922
2990
 
2991
+ <xsl:if test="ancestor::*[local-name() = 'figure']">
2992
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2993
+ </xsl:if>
2994
+
2923
2995
  </xsl:template> <!-- refine_note-name-style -->
2924
2996
 
2925
2997
  <xsl:attribute-set name="table-note-name-style">
@@ -2929,6 +3001,8 @@
2929
3001
 
2930
3002
  <xsl:template name="refine_table-note-name-style">
2931
3003
 
3004
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3005
+
2932
3006
  </xsl:template> <!-- refine_table-note-name-style -->
2933
3007
 
2934
3008
  <xsl:attribute-set name="note-p-style">
@@ -2987,6 +3061,10 @@
2987
3061
 
2988
3062
  <xsl:template name="refine_termsource-style">
2989
3063
 
3064
+ <xsl:if test="ancestor::*[local-name() = 'table']">
3065
+ <xsl:attribute name="margin-bottom">1pt</xsl:attribute>
3066
+ </xsl:if>
3067
+
2990
3068
  </xsl:template> <!-- refine_termsource-style -->
2991
3069
 
2992
3070
  <xsl:attribute-set name="termsource-text-style">
@@ -4297,7 +4375,13 @@
4297
4375
 
4298
4376
  <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'][not(@type = 'units')] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
4299
4377
  <xsl:if test="$isNoteOrFnExist = 'true'">
4300
-
4378
+ <!-- <xsl:choose>
4379
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
4380
+ <xsl:otherwise>
4381
+
4382
+ </xsl:otherwise>
4383
+ </xsl:choose> -->
4384
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
4301
4385
  </xsl:if>
4302
4386
 
4303
4387
  <xsl:choose>
@@ -4344,7 +4428,7 @@
4344
4428
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4345
4429
  </xsl:when>
4346
4430
  <xsl:otherwise>
4347
- <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'example') 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 -->
4431
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note') and not(local-name() = 'example') 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') and not(local-name() = 'fmt-footnote-container')]"/> <!-- process all table' elements, except name, header, footer, note, source and dl which render separaterely -->
4348
4432
  </xsl:otherwise>
4349
4433
  </xsl:choose>
4350
4434
 
@@ -4355,15 +4439,27 @@
4355
4439
 
4356
4440
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
4357
4441
 
4442
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
4358
4443
  <!-- table footer after table -->
4359
4444
 
4360
- <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]"/>
4361
- <xsl:for-each select="*[local-name()='tbody']"> <!-- select context to tbody -->
4445
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4446
+ <xsl:call-template name="insertTableFooterInSeparateTable">
4447
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
4448
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4449
+ <xsl:with-param name="colgroup" select="$colgroup"/>
4450
+ </xsl:call-template>
4451
+ </xsl:for-each>
4452
+
4453
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
4454
+ <xsl:if test="$namespace = 'plateau'">
4455
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
4456
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
4362
4457
  <xsl:variable name="table_fn_block">
4363
- <xsl:call-template name="table_fn_display"/>
4458
+ <xsl:call-template name="table_fn_display" />
4364
4459
  </xsl:variable>
4365
4460
  <xsl:copy-of select="$table_fn_block"/>
4366
4461
  </xsl:for-each>
4462
+ </xsl:if> -->
4367
4463
 
4368
4464
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
4369
4465
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -4958,11 +5054,14 @@
4958
5054
 
4959
5055
  <!-- except gb and bsi -->
4960
5056
 
4961
- <xsl:apply-templates select="../*[local-name()='p']"/>
5057
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 : the order is: definition list, text paragraphs, EXAMPLEs, NOTEs, footnotes, then source at the end -->
4962
5058
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4963
- <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
5059
+ <xsl:apply-templates select="../*[local-name()='p']"/>
4964
5060
  <xsl:apply-templates select="../*[local-name()='example']"/>
5061
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
5062
+ <!-- <xsl:copy-of select="$table_fn_block"/> -->
4965
5063
  <xsl:apply-templates select="../*[local-name()='source']"/>
5064
+ <!-- renders in tfoot -->
4966
5065
 
4967
5066
  <xsl:variable name="isDisplayRowSeparator">
4968
5067
 
@@ -4980,9 +5079,7 @@
4980
5079
  </xsl:if>
4981
5080
 
4982
5081
  <!-- fn processing -->
4983
-
4984
- <!-- <xsl:call-template name="table_fn_display" /> -->
4985
- <xsl:copy-of select="$table_fn_block"/>
5082
+ <fo:block/><!-- display fn before 'source', see above -->
4986
5083
 
4987
5084
  <!-- for PAS display Notes after footnotes -->
4988
5085
 
@@ -5238,6 +5335,17 @@
5238
5335
  <xsl:attribute name="text-align">left</xsl:attribute>
5239
5336
  </xsl:if>
5240
5337
 
5338
+ <xsl:if test="$isGenerateTableIF = 'false'">
5339
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
5340
+ <xsl:attribute name="text-align">right</xsl:attribute>
5341
+ <xsl:attribute name="border">none</xsl:attribute>
5342
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
5343
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
5344
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
5345
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
5346
+ </xsl:if>
5347
+ </xsl:if>
5348
+
5241
5349
  <fo:block role="SKIP">
5242
5350
 
5243
5351
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -5256,7 +5364,8 @@
5256
5364
  </fo:table-cell>
5257
5365
  </xsl:template> <!-- td -->
5258
5366
 
5259
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
5367
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
5368
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example'] | *[local-name()='table']/*[local-name()='tfoot']//*[local-name()='note' or local-name() = 'example']" priority="2">
5260
5369
 
5261
5370
  <fo:block xsl:use-attribute-sets="table-note-style">
5262
5371
  <xsl:copy-of select="@id"/>
@@ -5277,65 +5386,54 @@
5277
5386
 
5278
5387
  </xsl:template> <!-- table/note -->
5279
5388
 
5280
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
5389
+ <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p'] | *[local-name()='table']/*[local-name()='tfoot']//*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
5281
5390
  <xsl:apply-templates/>
5282
5391
  </xsl:template>
5283
5392
 
5284
5393
  <!-- ===================== -->
5285
5394
  <!-- Footnotes processing -->
5286
5395
  <!-- ===================== -->
5396
+
5397
+ <!-- document text (not figures, or tables) footnotes -->
5398
+ <xsl:variable name="footnotes_">
5399
+ <xsl:for-each select="//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']"> <!-- commented *[local-name() = 'metanorma']/, because there are fn in figure or table name -->
5400
+ <!-- <xsl:copy-of select="."/> -->
5401
+ <xsl:variable name="update_xml_step1">
5402
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
5403
+ </xsl:variable>
5404
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
5405
+ </xsl:for-each>
5406
+ </xsl:variable>
5407
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
5408
+
5287
5409
  <!--
5288
5410
  <fn reference="1">
5289
5411
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
5290
5412
  </fn>
5291
5413
  -->
5292
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
5414
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
5415
+ <!-- fn in text -->
5293
5416
  <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">
5294
5417
 
5295
- <!-- list of footnotes to calculate actual footnotes number -->
5418
+ <!-- list of unique footnotes -->
5296
5419
  <xsl:variable name="p_fn_">
5297
5420
  <xsl:call-template name="get_fn_list"/>
5298
- <!-- <xsl:choose>
5299
- <xsl:when test="$namespace = 'jis'">
5300
- <xsl:call-template name="get_fn_list_for_element"/>
5301
- </xsl:when>
5302
- <xsl:otherwise>
5303
- <xsl:call-template name="get_fn_list"/>
5304
- </xsl:otherwise>
5305
- </xsl:choose> -->
5306
5421
  </xsl:variable>
5307
5422
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
5308
5423
 
5309
5424
  <xsl:variable name="gen_id" select="generate-id(.)"/>
5310
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
5311
- <xsl:variable name="reference_">
5312
- <xsl:value-of select="@reference"/>
5313
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
5314
- </xsl:variable>
5315
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
5425
+
5316
5426
  <!-- fn sequence number in document -->
5317
- <xsl:variable name="current_fn_number">
5318
- <xsl:choose>
5319
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
5320
- <xsl:otherwise>
5321
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
5322
- </xsl:otherwise>
5323
- </xsl:choose>
5324
- </xsl:variable>
5427
+ <xsl:variable name="current_fn_number" select="@reference"/>
5428
+
5325
5429
  <xsl:variable name="current_fn_number_text">
5326
5430
 
5327
- <xsl:value-of select="$current_fn_number"/>
5431
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5328
5432
 
5329
5433
  </xsl:variable>
5330
5434
 
5331
- <xsl:variable name="ref_id">
5332
- <xsl:choose>
5333
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
5334
- <xsl:otherwise>
5335
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
5336
- </xsl:otherwise>
5337
- </xsl:choose>
5338
- </xsl:variable>
5435
+ <xsl:variable name="ref_id" select="@target"/>
5436
+
5339
5437
  <xsl:variable name="footnote_inline">
5340
5438
  <fo:inline role="Reference">
5341
5439
 
@@ -5380,7 +5478,9 @@
5380
5478
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
5381
5479
  <xsl:copy-of select="$footnote_inline"/>
5382
5480
  </xsl:when>
5481
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
5383
5482
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
5483
+
5384
5484
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
5385
5485
  <xsl:copy-of select="$footnote_inline"/>
5386
5486
  <fo:footnote-body role="Note">
@@ -5397,7 +5497,10 @@
5397
5497
  <xsl:value-of select="$current_fn_number_text"/>
5398
5498
 
5399
5499
  </fo:inline>
5400
- <xsl:apply-templates/>
5500
+ <!-- <xsl:apply-templates /> -->
5501
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
5502
+ <here><xsl:copy-of select="$footnotes"/></here> -->
5503
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
5401
5504
  </xsl:variable>
5402
5505
 
5403
5506
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -5451,81 +5554,138 @@
5451
5554
  </xsl:choose>
5452
5555
  </xsl:template>
5453
5556
 
5454
- <xsl:template name="get_fn_list_for_element">
5455
- <xsl:choose>
5456
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
5457
- <fn gen_id="{generate-id(.)}">
5458
- <xsl:copy-of select="@*"/>
5459
- <xsl:copy-of select="node()"/>
5460
- </fn>
5461
- </xsl:when>
5462
- <xsl:otherwise>
5463
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
5464
- <xsl:variable name="element_id" select="@id"/>
5465
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
5466
- <!-- copy unique fn -->
5467
- <fn gen_id="{generate-id(.)}">
5468
- <xsl:copy-of select="@*"/>
5469
- <xsl:copy-of select="node()"/>
5470
- </fn>
5471
- </xsl:for-each>
5472
- </xsl:for-each>
5473
- </xsl:otherwise>
5474
- </xsl:choose>
5475
- </xsl:template>
5476
5557
  <!-- ============================ -->
5477
5558
  <!-- table's footnotes rendering -->
5478
5559
  <!-- ============================ -->
5479
- <xsl:template name="table_fn_display">
5480
- <xsl:variable name="references">
5481
5560
 
5561
+ <!-- table/fmt-footnote-container -->
5562
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
5563
+
5564
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
5565
+ <xsl:for-each select=".">
5566
+ <xsl:call-template name="table_fn_display"/>
5567
+ </xsl:for-each>
5568
+ </xsl:template>
5569
+
5570
+ <xsl:template name="table_fn_display">
5571
+ <!-- <xsl:variable name="references">
5572
+ <xsl:if test="$namespace = 'bsi'">
5573
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
5574
+ <xsl:call-template name="create_fn" />
5575
+ </xsl:for-each>
5576
+ </xsl:if>
5482
5577
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
5483
- <xsl:call-template name="create_fn"/>
5578
+ <xsl:call-template name="create_fn" />
5484
5579
  </xsl:for-each>
5485
- </xsl:variable>
5486
-
5487
- <xsl:for-each select="xalan:nodeset($references)//fn">
5580
+ </xsl:variable> -->
5581
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
5488
5582
  <xsl:variable name="reference" select="@reference"/>
5489
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5583
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
5584
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
5490
5585
 
5491
5586
  <fo:block xsl:use-attribute-sets="table-fn-style">
5587
+ <xsl:copy-of select="@id"/>
5492
5588
  <xsl:call-template name="refine_table-fn-style"/>
5493
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
5494
- <xsl:call-template name="refine_table-fn-number-style"/>
5495
-
5496
- <xsl:text>※</xsl:text>
5497
-
5498
- <xsl:value-of select="@reference"/>
5499
5589
 
5500
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5501
- <!-- <xsl:if test="$namespace = 'itu'">
5502
- <xsl:text>)</xsl:text>
5503
- </xsl:if> -->
5504
-
5505
- <xsl:text>:</xsl:text>
5590
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
5591
+ <xsl:with-param name="process">true</xsl:with-param>
5592
+ </xsl:apply-templates>
5506
5593
 
5507
- </fo:inline>
5508
5594
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
5509
- <xsl:copy-of select="./node()"/>
5595
+ <!-- <xsl:copy-of select="./node()"/> -->
5596
+ <xsl:apply-templates/>
5510
5597
  </fo:inline>
5511
5598
 
5512
5599
  </fo:block>
5513
5600
 
5514
- </xsl:if>
5601
+ <!-- </xsl:if> -->
5515
5602
  </xsl:for-each>
5516
5603
  </xsl:template> <!-- table_fn_display -->
5517
5604
 
5605
+ <!-- fmt-fn-body/fmt-fn-label in text -->
5606
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
5607
+
5608
+ <!-- table//fmt-fn-body//fmt-fn-label -->
5609
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
5610
+ <xsl:param name="process">false</xsl:param>
5611
+ <xsl:if test="$process = 'true'">
5612
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
5613
+
5614
+ <!-- tab is padding-right -->
5615
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
5616
+ <xsl:with-param name="process">true</xsl:with-param>
5617
+ </xsl:apply-templates>
5618
+
5619
+ <!-- <xsl:if test="$namespace = 'bipm'">
5620
+ <fo:inline font-style="normal">(</fo:inline>
5621
+ </xsl:if> -->
5622
+
5623
+ <!-- <xsl:if test="$namespace = 'plateau'">
5624
+ <xsl:text>※</xsl:text>
5625
+ </xsl:if> -->
5626
+
5627
+ <!-- <xsl:value-of select="@reference"/> -->
5628
+ <!-- <xsl:value-of select="normalize-space()"/> -->
5629
+ <xsl:apply-templates/>
5630
+
5631
+ <!-- <xsl:if test="$namespace = 'bipm'">
5632
+ <fo:inline font-style="normal">)</fo:inline>
5633
+ </xsl:if> -->
5634
+
5635
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5636
+ <!-- <xsl:if test="$namespace = 'itu'">
5637
+ <xsl:text>)</xsl:text>
5638
+ </xsl:if> -->
5639
+
5640
+ <!-- <xsl:if test="$namespace = 'plateau'">
5641
+ <xsl:text>:</xsl:text>
5642
+ </xsl:if> -->
5643
+
5644
+ </fo:inline>
5645
+ </xsl:if>
5646
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
5647
+
5648
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
5649
+ <xsl:param name="process">false</xsl:param>
5650
+ <xsl:if test="$process = 'true'">
5651
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
5652
+
5653
+ <xsl:attribute name="padding-right">2mm</xsl:attribute>
5654
+
5655
+ </xsl:if>
5656
+ </xsl:template>
5657
+
5658
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
5659
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
5660
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
5661
+ <xsl:apply-templates/>
5662
+ </fo:inline>
5663
+ </xsl:template>
5664
+
5665
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
5666
+ <!--
5518
5667
  <xsl:template name="create_fn">
5519
5668
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5520
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5669
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
5521
5670
  <xsl:attribute name="id">
5522
5671
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5523
5672
  </xsl:attribute>
5524
5673
  </xsl:if>
5525
-
5526
- <xsl:apply-templates/>
5674
+ <xsl:if test="$namespace = 'itu'">
5675
+ <xsl:if test="ancestor::*[local-name()='preface']">
5676
+ <xsl:attribute name="preface">true</xsl:attribute>
5677
+ </xsl:if>
5678
+ </xsl:if>
5679
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5680
+ <xsl:attribute name="id">
5681
+ <xsl:value-of select="@reference"/>
5682
+ <xsl:text>_</xsl:text>
5683
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5684
+ </xsl:attribute>
5685
+ </xsl:if>
5686
+ <xsl:apply-templates />
5527
5687
  </fn>
5528
- </xsl:template>
5688
+ </xsl:template> -->
5529
5689
 
5530
5690
  <!-- footnotes for table's name rendering -->
5531
5691
  <xsl:template name="table_name_fn_display">
@@ -5544,123 +5704,178 @@
5544
5704
  <!-- ============================ -->
5545
5705
  <!-- figure's footnotes rendering -->
5546
5706
  <!-- ============================ -->
5547
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
5548
5707
 
5549
- <!-- current figure id -->
5550
- <xsl:variable name="figure_id_">
5551
- <xsl:value-of select="@id"/>
5552
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
5553
- </xsl:variable>
5554
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
5708
+ <!-- figure/fmt-footnote-container -->
5709
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
5710
+
5711
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
5712
+ <xsl:template name="figure_fn_display">
5555
5713
 
5556
- <!-- all footnotes relates to the current figure -->
5557
5714
  <xsl:variable name="references">
5558
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
5559
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5560
- <xsl:apply-templates/>
5561
- </fn>
5715
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
5716
+ <xsl:variable name="curr_id" select="@id"/>
5717
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
5718
+ <curr><xsl:copy-of select="."/></curr>
5719
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
5720
+ <xsl:choose>
5721
+ <!-- skip figure/name/fn -->
5722
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
5723
+ <xsl:otherwise>
5724
+ <xsl:element name="figure" namespace="{$namespace_full}">
5725
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
5726
+ <xsl:copy-of select="."/>
5727
+ </xsl:element>
5728
+ </xsl:element>
5729
+ </xsl:otherwise>
5730
+ </xsl:choose>
5562
5731
  </xsl:for-each>
5563
5732
  </xsl:variable>
5733
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
5564
5734
 
5565
- <xsl:if test="xalan:nodeset($references)//fn">
5735
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
5566
5736
 
5567
5737
  <xsl:variable name="key_iso">
5568
5738
 
5569
5739
  </xsl:variable>
5570
5740
 
5571
5741
  <fo:block>
5742
+ <!-- current hierarchy is 'figure' element -->
5743
+ <xsl:variable name="following_dl_colwidths">
5744
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5745
+ <xsl:variable name="simple-table">
5746
+ <!-- <xsl:variable name="doc_ns">
5747
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5748
+ </xsl:variable>
5749
+ <xsl:variable name="ns">
5750
+ <xsl:choose>
5751
+ <xsl:when test="normalize-space($doc_ns) != ''">
5752
+ <xsl:value-of select="normalize-space($doc_ns)"/>
5753
+ </xsl:when>
5754
+ <xsl:otherwise>
5755
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
5756
+ </xsl:otherwise>
5757
+ </xsl:choose>
5758
+ </xsl:variable> -->
5572
5759
 
5573
- <!-- current hierarchy is 'figure' element -->
5574
- <xsl:variable name="following_dl_colwidths">
5575
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5576
- <xsl:variable name="simple-table">
5577
- <!-- <xsl:variable name="doc_ns">
5578
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5579
- </xsl:variable>
5580
- <xsl:variable name="ns">
5581
- <xsl:choose>
5582
- <xsl:when test="normalize-space($doc_ns) != ''">
5583
- <xsl:value-of select="normalize-space($doc_ns)"/>
5584
- </xsl:when>
5585
- <xsl:otherwise>
5586
- <xsl:value-of select="substring-before(name(/*), '-')"/>
5587
- </xsl:otherwise>
5588
- </xsl:choose>
5589
- </xsl:variable> -->
5760
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5761
+ <tbody>
5762
+ <xsl:apply-templates mode="dl"/>
5763
+ </tbody>
5764
+ </xsl:for-each>
5765
+ </xsl:variable>
5590
5766
 
5591
- <xsl:for-each select="*[local-name() = 'dl'][1]">
5592
- <tbody>
5593
- <xsl:apply-templates mode="dl"/>
5594
- </tbody>
5595
- </xsl:for-each>
5596
- </xsl:variable>
5767
+ <xsl:call-template name="calculate-column-widths">
5768
+ <xsl:with-param name="cols-count" select="2"/>
5769
+ <xsl:with-param name="table" select="$simple-table"/>
5770
+ </xsl:call-template>
5597
5771
 
5598
- <xsl:call-template name="calculate-column-widths">
5599
- <xsl:with-param name="cols-count" select="2"/>
5600
- <xsl:with-param name="table" select="$simple-table"/>
5601
- </xsl:call-template>
5772
+ </xsl:if>
5773
+ </xsl:variable>
5602
5774
 
5603
- </xsl:if>
5604
- </xsl:variable>
5775
+ <xsl:variable name="maxlength_dt">
5776
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5777
+ <xsl:call-template name="getMaxLength_dt"/>
5778
+ </xsl:for-each>
5779
+ </xsl:variable>
5605
5780
 
5606
- <xsl:variable name="maxlength_dt">
5607
- <xsl:for-each select="*[local-name() = 'dl'][1]">
5608
- <xsl:call-template name="getMaxLength_dt"/>
5609
- </xsl:for-each>
5610
- </xsl:variable>
5781
+ <fo:table width="95%" table-layout="fixed">
5782
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5783
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5611
5784
 
5612
- <fo:table width="95%" table-layout="fixed">
5613
- <xsl:if test="normalize-space($key_iso) = 'true'">
5614
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5785
+ </xsl:if>
5786
+ <xsl:choose>
5787
+ <!-- if there 'dl', then set same columns width -->
5788
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5789
+ <xsl:call-template name="setColumnWidth_dl">
5790
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5791
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5792
+ </xsl:call-template>
5793
+ </xsl:when>
5794
+ <xsl:otherwise>
5795
+ <fo:table-column column-width="5%"/>
5796
+ <fo:table-column column-width="95%"/>
5797
+ </xsl:otherwise>
5798
+ </xsl:choose>
5799
+ <fo:table-body>
5800
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
5801
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
5615
5802
 
5616
- </xsl:if>
5617
- <xsl:choose>
5618
- <!-- if there 'dl', then set same columns width -->
5619
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5620
- <xsl:call-template name="setColumnWidth_dl">
5621
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5622
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5623
- </xsl:call-template>
5624
- </xsl:when>
5625
- <xsl:otherwise>
5626
- <fo:table-column column-width="5%"/>
5627
- <fo:table-column column-width="95%"/>
5628
- </xsl:otherwise>
5629
- </xsl:choose>
5630
- <fo:table-body>
5631
- <xsl:for-each select="xalan:nodeset($references)//fn">
5632
- <xsl:variable name="reference" select="@reference"/>
5633
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5634
- <fo:table-row>
5635
- <fo:table-cell>
5636
- <fo:block>
5637
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
5638
- <xsl:value-of select="@reference"/>
5803
+ <xsl:variable name="reference" select="@reference"/>
5804
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
5805
+ <fo:table-row>
5806
+ <fo:table-cell>
5807
+ <fo:block>
5808
+
5809
+ <xsl:attribute name="margin-left"><xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
5810
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5811
+
5812
+ <fo:inline id="{@id}">
5813
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
5814
+ <!-- <xsl:value-of select="@reference"/> -->
5815
+ <!-- <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/> -->
5816
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']/node()"/>
5639
5817
  </fo:inline>
5640
- </fo:block>
5641
- </fo:table-cell>
5642
- <fo:table-cell>
5643
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5644
- <xsl:if test="normalize-space($key_iso) = 'true'">
5645
5818
 
5646
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
5819
+ </fo:block>
5820
+ </fo:table-cell>
5821
+ <fo:table-cell>
5822
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5823
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5647
5824
 
5648
- </xsl:if>
5649
- <xsl:copy-of select="./node()"/>
5650
- </fo:block>
5651
- </fo:table-cell>
5652
- </fo:table-row>
5653
- </xsl:if>
5654
- </xsl:for-each>
5655
- </fo:table-body>
5656
- </fo:table>
5825
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5826
+
5827
+ </xsl:if>
5657
5828
 
5829
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
5830
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5831
+
5832
+ <!-- <xsl:copy-of select="./node()"/> -->
5833
+ <xsl:apply-templates/>
5834
+ </fo:block>
5835
+ </fo:table-cell>
5836
+ </fo:table-row>
5837
+ <!-- </xsl:if> -->
5838
+ </xsl:for-each>
5839
+ </fo:table-body>
5840
+ </fo:table>
5658
5841
  </fo:block>
5659
5842
  </xsl:if>
5660
- </xsl:template> <!-- fn_display_figure -->
5843
+ </xsl:template> <!-- figure_fn_display -->
5844
+
5845
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
5846
+ <xsl:param name="process">false</xsl:param>
5847
+ <xsl:if test="$process = 'true'">
5848
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
5849
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
5850
+
5851
+ <!-- tab is padding-right -->
5852
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
5853
+ <xsl:with-param name="process">true</xsl:with-param>
5854
+ </xsl:apply-templates>
5855
+
5856
+ <xsl:apply-templates/>
5857
+
5858
+ </fo:inline>
5859
+ </xsl:if>
5860
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
5861
+
5862
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
5863
+ <xsl:param name="process">false</xsl:param>
5864
+ <xsl:if test="$process = 'true'">
5865
+
5866
+ </xsl:if>
5867
+ </xsl:template>
5868
+
5869
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
5870
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
5871
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
5872
+ <xsl:apply-templates/>
5873
+ </fo:inline>
5874
+ </xsl:template>
5661
5875
 
5662
5876
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
5663
5877
  <!-- figure's footnote label -->
5878
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
5664
5879
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'dl'][@key = 'true']/*[local-name() = 'dt']/ *[local-name() = 'p'][count(node()[normalize-space() != '']) = 1]/*[local-name() = 'sup']" priority="3">
5665
5880
  <xsl:variable name="key_iso">
5666
5881
 
@@ -5669,7 +5884,7 @@
5669
5884
  <xsl:attribute name="font-size">10pt</xsl:attribute>
5670
5885
 
5671
5886
  </xsl:if>
5672
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
5887
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
5673
5888
  <!-- <xsl:value-of select="@reference"/> -->
5674
5889
  <xsl:apply-templates/>
5675
5890
  </fo:inline>
@@ -5679,40 +5894,65 @@
5679
5894
  <!-- END: figure's footnotes rendering -->
5680
5895
  <!-- ============================ -->
5681
5896
 
5682
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
5897
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
5898
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
5683
5899
  <xsl:template match="*[local-name()='fn']">
5684
5900
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
5685
5901
 
5686
5902
  <xsl:call-template name="refine_fn-reference-style"/>
5687
5903
 
5688
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5689
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5690
- <xsl:attribute name="internal-destination">
5904
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5905
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
5906
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
5907
+ <!-- <xsl:attribute name="internal-destination">
5691
5908
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5692
5909
  </xsl:attribute>
5693
5910
  </xsl:if>
5694
-
5911
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5912
+ <xsl:attribute name="internal-destination">
5913
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
5914
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5915
+ </xsl:attribute>
5916
+ </xsl:if> -->
5917
+ <!-- <xsl:if test="$namespace = 'plateau'">
5695
5918
  <xsl:text>※</xsl:text>
5919
+ </xsl:if> -->
5920
+ <!-- <xsl:value-of select="@reference"/> -->
5696
5921
 
5697
- <xsl:value-of select="@reference"/>
5922
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5698
5923
 
5924
+ <!-- <xsl:if test="$namespace = 'bsi'">
5925
+ <xsl:text>)</xsl:text>
5926
+ </xsl:if> -->
5699
5927
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5700
5928
  <!-- <xsl:if test="$namespace = 'jis'">
5701
5929
  <fo:inline font-weight="normal">)</fo:inline>
5702
5930
  </xsl:if> -->
5703
5931
  </fo:basic-link>
5704
5932
  </fo:inline>
5705
- </xsl:template>
5933
+ </xsl:template> <!-- fn -->
5706
5934
 
5935
+ <!-- fn/text() -->
5707
5936
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
5708
5937
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
5709
5938
  </xsl:template>
5710
5939
 
5711
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
5940
+ <!-- fn//p fmt-fn-body//p -->
5941
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
5712
5942
  <fo:inline role="P">
5713
5943
  <xsl:apply-templates/>
5714
5944
  </fo:inline>
5715
5945
  </xsl:template>
5946
+
5947
+ <xsl:template name="insertFootnoteSeparatorCommon">
5948
+ <xsl:param name="leader_length">30%</xsl:param>
5949
+ <fo:static-content flow-name="xsl-footnote-separator">
5950
+ <fo:block>
5951
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
5952
+ </fo:block>
5953
+ </fo:static-content>
5954
+ </xsl:template>
5955
+
5716
5956
  <!-- ===================== -->
5717
5957
  <!-- END Footnotes processing -->
5718
5958
  <!-- ===================== -->
@@ -5750,6 +5990,11 @@
5750
5990
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
5751
5991
  </xsl:if>
5752
5992
 
5993
+ <xsl:if test="@key = 'true' and (ancestor::*[local-name() = 'tfoot'] or parent::*[local-name() = 'figure'])">
5994
+ <xsl:attribute name="margin-left"><xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
5995
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5996
+ </xsl:if>
5997
+
5753
5998
  <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
5754
5999
  <!-- set font-size as sourcecode font-size -->
5755
6000
  <xsl:variable name="sourcecode_attributes">
@@ -5989,11 +6234,40 @@
5989
6234
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
5990
6235
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
5991
6236
 
5992
- <xsl:call-template name="setColumnWidth_dl">
5993
- <xsl:with-param name="colwidths" select="$colwidths"/>
5994
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5995
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
5996
- </xsl:call-template>
6237
+ <xsl:choose>
6238
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
6239
+ <xsl:when test="@key = 'true' and (ancestor::*[local-name() = 'tfoot'] or parent::*[local-name() = 'figure'])"> <!-- and not(xalan:nodeset($colwidths)//column) -->
6240
+ <xsl:variable name="dt_nodes">
6241
+ <xsl:for-each select="*[local-name() = 'dt']">
6242
+ <xsl:apply-templates select="." mode="dt_clean"/>
6243
+ </xsl:for-each>
6244
+ </xsl:variable>
6245
+ <!-- <xsl:copy-of select="$dt_nodes"/> -->
6246
+ <xsl:variable name="dt_length_max">
6247
+ <xsl:for-each select="xalan:nodeset($dt_nodes)//*[local-name() = 'dt']">
6248
+ <xsl:sort select="string-length(normalize-space())" data-type="number" order="descending"/>
6249
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(normalize-space())"/></xsl:if>
6250
+ </xsl:for-each>
6251
+ </xsl:variable>
6252
+ <xsl:variable name="col1_percent_" select="number($dt_length_max) + 1"/>
6253
+ <xsl:variable name="col1_percent">
6254
+ <xsl:choose>
6255
+ <xsl:when test="$col1_percent_ &gt; 50">50</xsl:when>
6256
+ <xsl:otherwise><xsl:value-of select="$col1_percent_"/></xsl:otherwise>
6257
+ </xsl:choose>
6258
+ </xsl:variable>
6259
+ <fo:table-column column-width="{$col1_percent}%"/>
6260
+ <fo:table-column column-width="{100 - $col1_percent}%"/>
6261
+ </xsl:when>
6262
+ <xsl:otherwise>
6263
+ <xsl:call-template name="setColumnWidth_dl">
6264
+ <xsl:with-param name="colwidths" select="$colwidths"/>
6265
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6266
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
6267
+ </xsl:call-template>
6268
+ </xsl:otherwise>
6269
+ </xsl:choose>
6270
+ <!-- $namespace = 'plateau' -->
5997
6271
 
5998
6272
  <fo:table-body>
5999
6273
 
@@ -6027,6 +6301,14 @@
6027
6301
 
6028
6302
  </xsl:template> <!-- END: dl -->
6029
6303
 
6304
+ <xsl:template match="@*|node()" mode="dt_clean">
6305
+ <xsl:copy>
6306
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
6307
+ </xsl:copy>
6308
+ </xsl:template>
6309
+
6310
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
6311
+
6030
6312
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
6031
6313
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
6032
6314
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -6056,10 +6338,18 @@
6056
6338
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
6057
6339
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
6058
6340
 
6341
+ <!-- dl/name -->
6059
6342
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
6060
6343
  <xsl:param name="process">false</xsl:param>
6061
6344
  <xsl:if test="$process = 'true'">
6062
6345
  <fo:block xsl:use-attribute-sets="dl-name-style">
6346
+
6347
+ <xsl:if test="ancestor::*[local-name() = 'tfoot'] and ../@key = 'true'">
6348
+ <xsl:attribute name="margin-left">-<xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
6349
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
6350
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
6351
+ </xsl:if>
6352
+
6063
6353
  <xsl:apply-templates/>
6064
6354
  </fo:block>
6065
6355
  </xsl:if>
@@ -6073,6 +6363,10 @@
6073
6363
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
6074
6364
 
6075
6365
  <xsl:choose>
6366
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
6367
+ <fo:table-column column-width="10%"/>
6368
+ <fo:table-column column-width="90%"/>
6369
+ </xsl:when> -->
6076
6370
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
6077
6371
  <xsl:call-template name="insertTableColumnWidth">
6078
6372
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -8194,6 +8488,27 @@
8194
8488
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8195
8489
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8196
8490
  </xsl:when> -->
8491
+
8492
+ <!-- <xsl:when test="not(starts-with(@target, 'http:') or starts-with(@target, 'https') or starts-with(@target, 'www') or starts-with(@target, 'mailto') or starts-with(@target, 'ftp'))">
8493
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8494
+ <xsl:variable name="filename">
8495
+ <xsl:call-template name="substring-after-last">
8496
+ <xsl:with-param name="value" select="$target_"/>
8497
+ <xsl:with-param name="delimiter" select="'/'"/>
8498
+ </xsl:call-template>
8499
+ </xsl:variable>
8500
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
8501
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
8502
+ <xsl:choose>
8503
+ <xsl:when test="$file_exists = 'true'">
8504
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
8505
+ </xsl:when>
8506
+ <xsl:otherwise>
8507
+ <xsl:value-of select="normalize-space(@target)"/>
8508
+ </xsl:otherwise>
8509
+ </xsl:choose>
8510
+ </xsl:when> -->
8511
+
8197
8512
  <xsl:otherwise>
8198
8513
  <xsl:value-of select="normalize-space(@target)"/>
8199
8514
  </xsl:otherwise>
@@ -8498,7 +8813,11 @@
8498
8813
 
8499
8814
  <xsl:template name="refine_note_block_style">
8500
8815
 
8501
- </xsl:template>
8816
+ <xsl:if test="ancestor::*[local-name() = 'figure']">
8817
+ <xsl:attribute name="margin-left"><xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
8818
+ </xsl:if>
8819
+
8820
+ </xsl:template> <!-- refine_note_block_style -->
8502
8821
 
8503
8822
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
8504
8823
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -8690,10 +9009,21 @@
8690
9009
  </xsl:template>
8691
9010
 
8692
9011
  <xsl:template name="showFigureKey">
8693
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8694
- <xsl:call-template name="note"/>
9012
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
9013
+ <xsl:choose>
9014
+ <xsl:when test="local-name() = 'note'">
9015
+ <xsl:call-template name="note"/>
9016
+ </xsl:when>
9017
+ <xsl:when test="local-name() = 'example'">
9018
+ <xsl:call-template name="example"/>
9019
+ </xsl:when>
9020
+ <xsl:otherwise>
9021
+ <xsl:apply-templates select="."/>
9022
+ </xsl:otherwise>
9023
+ </xsl:choose>
8695
9024
  </xsl:for-each>
8696
- <xsl:call-template name="fn_display_figure"/>
9025
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
9026
+ <xsl:call-template name="figure_fn_display"/>
8697
9027
  </xsl:template>
8698
9028
 
8699
9029
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -9587,10 +9917,10 @@
9587
9917
  <xsl:when test="@type = 'section-title'">
9588
9918
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9589
9919
  <xsl:text>: </xsl:text>
9590
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9920
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
9591
9921
  </xsl:when>
9592
9922
  <xsl:otherwise>
9593
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9923
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
9594
9924
  </xsl:otherwise>
9595
9925
  </xsl:choose>
9596
9926
  </xsl:when>
@@ -9921,9 +10251,15 @@
9921
10251
  </xsl:if>
9922
10252
  </xsl:template>
9923
10253
 
10254
+ <!-- figure/fn -->
9924
10255
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
9925
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
10256
+ <!-- figure/note -->
10257
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
10258
+ <!-- figure/example -->
10259
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
9926
10260
 
10261
+ <!-- figure/note[@type = 'units'] -->
10262
+ <!-- image/note[@type = 'units'] -->
9927
10263
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
9928
10264
  <fo:block text-align="right" keep-with-next="always">
9929
10265
  <xsl:apply-templates/>
@@ -10044,6 +10380,7 @@
10044
10380
  </xsl:choose>
10045
10381
  </xsl:template>
10046
10382
 
10383
+ <!-- fn -->
10047
10384
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
10048
10385
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
10049
10386
 
@@ -10939,7 +11276,7 @@
10939
11276
  text line 1
10940
11277
  text line 2
10941
11278
  -->
10942
- <xsl:template match="*[local-name() = 'example']">
11279
+ <xsl:template match="*[local-name() = 'example']" name="example">
10943
11280
 
10944
11281
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10945
11282
 
@@ -11045,6 +11382,7 @@
11045
11382
 
11046
11383
  </xsl:template>
11047
11384
 
11385
+ <!-- example/name -->
11048
11386
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
11049
11387
  <xsl:param name="fo_element">block</xsl:param>
11050
11388
 
@@ -11070,9 +11408,12 @@
11070
11408
 
11071
11409
  </xsl:template>
11072
11410
 
11073
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
11411
+ <!-- table/example/name, table/tfoot//example/name -->
11412
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
11074
11413
  <fo:inline xsl:use-attribute-sets="example-name-style">
11075
11414
 
11415
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
11416
+
11076
11417
  <xsl:apply-templates/>
11077
11418
  </fo:inline>
11078
11419
  </xsl:template>
@@ -12708,8 +13049,33 @@
12708
13049
 
12709
13050
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
12710
13051
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
13052
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
13053
+ <!-- <test><xsl:copy-of select="."/></test> -->
13054
+
12711
13055
  <xsl:variable name="target" select="@target"/>
13056
+
12712
13057
  <xsl:for-each select="*[local-name() = 'tab']">
13058
+
13059
+ <xsl:if test="position() = 1">
13060
+ <!-- first column (data before first `tab`) -->
13061
+ <fo:table-cell>
13062
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
13063
+ <xsl:call-template name="insert_basic_link">
13064
+ <xsl:with-param name="element">
13065
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
13066
+ <xsl:for-each select="preceding-sibling::node()">
13067
+ <xsl:choose>
13068
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13069
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
13070
+ </xsl:choose>
13071
+ </xsl:for-each>
13072
+ </fo:basic-link>
13073
+ </xsl:with-param>
13074
+ </xsl:call-template>
13075
+ </fo:block>
13076
+ </fo:table-cell>
13077
+ </xsl:if>
13078
+
12713
13079
  <xsl:variable name="current_id" select="generate-id()"/>
12714
13080
  <fo:table-cell>
12715
13081
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -12760,11 +13126,25 @@
12760
13126
 
12761
13127
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
12762
13128
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
13129
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12763
13130
  <xsl:for-each select="*[local-name() = 'tab']">
13131
+ <xsl:if test="position() = 1">
13132
+ <td>
13133
+ <xsl:for-each select="preceding-sibling::node()">
13134
+ <xsl:choose>
13135
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13136
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
13137
+ </xsl:choose>
13138
+ </xsl:for-each>
13139
+ </td>
13140
+ </xsl:if>
12764
13141
  <xsl:variable name="current_id" select="generate-id()"/>
12765
13142
  <td>
12766
13143
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
12767
- <xsl:copy-of select="."/>
13144
+ <xsl:choose>
13145
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13146
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
13147
+ </xsl:choose>
12768
13148
  </xsl:for-each>
12769
13149
  </td>
12770
13150
  </xsl:for-each>
@@ -14261,6 +14641,7 @@
14261
14641
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
14262
14642
  </fn>
14263
14643
  -->
14644
+ <!-- fn in text -->
14264
14645
  <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">
14265
14646
  <xsl:variable name="p_fn_">
14266
14647
  <xsl:call-template name="get_fn_list"/>