metanorma-plateau 0.2.2 → 1.0.1

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,42 @@
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">
2802
2855
 
2803
2856
  </xsl:template>
2804
2857
 
@@ -2813,11 +2866,21 @@
2813
2866
  </xsl:attribute-set>
2814
2867
 
2815
2868
  <xsl:attribute-set name="figure-fn-number-style">
2816
- <xsl:attribute name="font-size">80%</xsl:attribute>
2817
2869
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2870
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
2871
+
2872
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
2873
+ <xsl:attribute name="font-size">80%</xsl:attribute>
2818
2874
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2819
2875
 
2820
- </xsl:attribute-set>
2876
+ <xsl:attribute name="font-size">60%</xsl:attribute>
2877
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2878
+
2879
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
2880
+
2881
+ <xsl:template name="refine_figure-fmt-fn-label-style">
2882
+
2883
+ </xsl:template>
2821
2884
 
2822
2885
  <xsl:attribute-set name="figure-fn-body-style">
2823
2886
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -2920,6 +2983,10 @@
2920
2983
 
2921
2984
  <xsl:template name="refine_note-name-style">
2922
2985
 
2986
+ <xsl:if test="ancestor::*[local-name() = 'figure']">
2987
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2988
+ </xsl:if>
2989
+
2923
2990
  </xsl:template> <!-- refine_note-name-style -->
2924
2991
 
2925
2992
  <xsl:attribute-set name="table-note-name-style">
@@ -2929,6 +2996,8 @@
2929
2996
 
2930
2997
  <xsl:template name="refine_table-note-name-style">
2931
2998
 
2999
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3000
+
2932
3001
  </xsl:template> <!-- refine_table-note-name-style -->
2933
3002
 
2934
3003
  <xsl:attribute-set name="note-p-style">
@@ -2987,6 +3056,10 @@
2987
3056
 
2988
3057
  <xsl:template name="refine_termsource-style">
2989
3058
 
3059
+ <xsl:if test="ancestor::*[local-name() = 'table']">
3060
+ <xsl:attribute name="margin-bottom">1pt</xsl:attribute>
3061
+ </xsl:if>
3062
+
2990
3063
  </xsl:template> <!-- refine_termsource-style -->
2991
3064
 
2992
3065
  <xsl:attribute-set name="termsource-text-style">
@@ -4297,7 +4370,13 @@
4297
4370
 
4298
4371
  <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
4372
  <xsl:if test="$isNoteOrFnExist = 'true'">
4300
-
4373
+ <!-- <xsl:choose>
4374
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
4375
+ <xsl:otherwise>
4376
+
4377
+ </xsl:otherwise>
4378
+ </xsl:choose> -->
4379
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
4301
4380
  </xsl:if>
4302
4381
 
4303
4382
  <xsl:choose>
@@ -4344,7 +4423,7 @@
4344
4423
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4345
4424
  </xsl:when>
4346
4425
  <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 -->
4426
+ <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
4427
  </xsl:otherwise>
4349
4428
  </xsl:choose>
4350
4429
 
@@ -4355,15 +4434,27 @@
4355
4434
 
4356
4435
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
4357
4436
 
4437
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
4358
4438
  <!-- table footer after table -->
4359
4439
 
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 -->
4440
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4441
+ <xsl:call-template name="insertTableFooterInSeparateTable">
4442
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
4443
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4444
+ <xsl:with-param name="colgroup" select="$colgroup"/>
4445
+ </xsl:call-template>
4446
+ </xsl:for-each>
4447
+
4448
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
4449
+ <xsl:if test="$namespace = 'plateau'">
4450
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
4451
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
4362
4452
  <xsl:variable name="table_fn_block">
4363
- <xsl:call-template name="table_fn_display"/>
4453
+ <xsl:call-template name="table_fn_display" />
4364
4454
  </xsl:variable>
4365
4455
  <xsl:copy-of select="$table_fn_block"/>
4366
4456
  </xsl:for-each>
4457
+ </xsl:if> -->
4367
4458
 
4368
4459
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
4369
4460
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -4980,9 +5071,7 @@
4980
5071
  </xsl:if>
4981
5072
 
4982
5073
  <!-- fn processing -->
4983
-
4984
- <!-- <xsl:call-template name="table_fn_display" /> -->
4985
- <xsl:copy-of select="$table_fn_block"/>
5074
+ <fo:block/><!-- display fn before 'source', see above -->
4986
5075
 
4987
5076
  <!-- for PAS display Notes after footnotes -->
4988
5077
 
@@ -5150,6 +5239,8 @@
5150
5239
 
5151
5240
  <xsl:template name="setTableRowAttributes">
5152
5241
 
5242
+ <xsl:call-template name="setColors"/>
5243
+
5153
5244
  </xsl:template> <!-- setTableRowAttributes -->
5154
5245
  <!-- ===================== -->
5155
5246
  <!-- END Table's row processing -->
@@ -5201,6 +5292,7 @@
5201
5292
  </xsl:attribute>
5202
5293
  </xsl:if>
5203
5294
  <xsl:call-template name="display-align"/>
5295
+ <xsl:call-template name="setColors"/>
5204
5296
  </xsl:template>
5205
5297
 
5206
5298
  <xsl:template name="display-align">
@@ -5216,6 +5308,29 @@
5216
5308
  </xsl:if>
5217
5309
  </xsl:template>
5218
5310
 
5311
+ <xsl:template name="setColors">
5312
+ <xsl:variable name="styles__">
5313
+ <xsl:call-template name="split">
5314
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
5315
+ <xsl:with-param name="sep" select="';'"/>
5316
+ </xsl:call-template>
5317
+ </xsl:variable>
5318
+ <xsl:variable name="quot">"</xsl:variable>
5319
+ <xsl:variable name="styles_">
5320
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
5321
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
5322
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
5323
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
5324
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
5325
+ </xsl:if>
5326
+ </xsl:for-each>
5327
+ </xsl:variable>
5328
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
5329
+ <xsl:for-each select="$styles/style">
5330
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
5331
+ </xsl:for-each>
5332
+ </xsl:template>
5333
+
5219
5334
  <!-- cell in table body, footer -->
5220
5335
  <xsl:template match="*[local-name()='td']" name="td">
5221
5336
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -5227,17 +5342,28 @@
5227
5342
 
5228
5343
  <xsl:call-template name="refine_table-cell-style"/>
5229
5344
 
5345
+ <xsl:call-template name="setTableCellAttributes"/>
5346
+
5230
5347
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
5231
5348
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
5232
5349
  </xsl:if>
5233
5350
 
5234
- <xsl:call-template name="setTableCellAttributes"/>
5235
-
5236
5351
  <xsl:if test="$isGenerateTableIF = 'true'">
5237
5352
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
5238
5353
  <xsl:attribute name="text-align">left</xsl:attribute>
5239
5354
  </xsl:if>
5240
5355
 
5356
+ <xsl:if test="$isGenerateTableIF = 'false'">
5357
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
5358
+ <xsl:attribute name="text-align">right</xsl:attribute>
5359
+ <xsl:attribute name="border">none</xsl:attribute>
5360
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
5361
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
5362
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
5363
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
5364
+ </xsl:if>
5365
+ </xsl:if>
5366
+
5241
5367
  <fo:block role="SKIP">
5242
5368
 
5243
5369
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -5256,7 +5382,8 @@
5256
5382
  </fo:table-cell>
5257
5383
  </xsl:template> <!-- td -->
5258
5384
 
5259
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
5385
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
5386
+ <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
5387
 
5261
5388
  <fo:block xsl:use-attribute-sets="table-note-style">
5262
5389
  <xsl:copy-of select="@id"/>
@@ -5277,65 +5404,54 @@
5277
5404
 
5278
5405
  </xsl:template> <!-- table/note -->
5279
5406
 
5280
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
5407
+ <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
5408
  <xsl:apply-templates/>
5282
5409
  </xsl:template>
5283
5410
 
5284
5411
  <!-- ===================== -->
5285
5412
  <!-- Footnotes processing -->
5286
5413
  <!-- ===================== -->
5414
+
5415
+ <!-- document text (not figures, or tables) footnotes -->
5416
+ <xsl:variable name="footnotes_">
5417
+ <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 -->
5418
+ <!-- <xsl:copy-of select="."/> -->
5419
+ <xsl:variable name="update_xml_step1">
5420
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
5421
+ </xsl:variable>
5422
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
5423
+ </xsl:for-each>
5424
+ </xsl:variable>
5425
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
5426
+
5287
5427
  <!--
5288
5428
  <fn reference="1">
5289
5429
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
5290
5430
  </fn>
5291
5431
  -->
5292
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
5432
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
5433
+ <!-- fn in text -->
5293
5434
  <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
5435
 
5295
- <!-- list of footnotes to calculate actual footnotes number -->
5436
+ <!-- list of unique footnotes -->
5296
5437
  <xsl:variable name="p_fn_">
5297
5438
  <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
5439
  </xsl:variable>
5307
5440
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
5308
5441
 
5309
5442
  <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_)"/>
5443
+
5316
5444
  <!-- 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>
5445
+ <xsl:variable name="current_fn_number" select="@reference"/>
5446
+
5325
5447
  <xsl:variable name="current_fn_number_text">
5326
5448
 
5327
- <xsl:value-of select="$current_fn_number"/>
5449
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5328
5450
 
5329
5451
  </xsl:variable>
5330
5452
 
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>
5453
+ <xsl:variable name="ref_id" select="@target"/>
5454
+
5339
5455
  <xsl:variable name="footnote_inline">
5340
5456
  <fo:inline role="Reference">
5341
5457
 
@@ -5380,7 +5496,9 @@
5380
5496
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
5381
5497
  <xsl:copy-of select="$footnote_inline"/>
5382
5498
  </xsl:when>
5499
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
5383
5500
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
5501
+
5384
5502
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
5385
5503
  <xsl:copy-of select="$footnote_inline"/>
5386
5504
  <fo:footnote-body role="Note">
@@ -5397,7 +5515,10 @@
5397
5515
  <xsl:value-of select="$current_fn_number_text"/>
5398
5516
 
5399
5517
  </fo:inline>
5400
- <xsl:apply-templates/>
5518
+ <!-- <xsl:apply-templates /> -->
5519
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
5520
+ <here><xsl:copy-of select="$footnotes"/></here> -->
5521
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
5401
5522
  </xsl:variable>
5402
5523
 
5403
5524
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -5451,81 +5572,138 @@
5451
5572
  </xsl:choose>
5452
5573
  </xsl:template>
5453
5574
 
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
5575
  <!-- ============================ -->
5477
5576
  <!-- table's footnotes rendering -->
5478
5577
  <!-- ============================ -->
5479
- <xsl:template name="table_fn_display">
5480
- <xsl:variable name="references">
5481
5578
 
5579
+ <!-- table/fmt-footnote-container -->
5580
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
5581
+
5582
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
5583
+ <xsl:for-each select=".">
5584
+ <xsl:call-template name="table_fn_display"/>
5585
+ </xsl:for-each>
5586
+ </xsl:template>
5587
+
5588
+ <xsl:template name="table_fn_display">
5589
+ <!-- <xsl:variable name="references">
5590
+ <xsl:if test="$namespace = 'bsi'">
5591
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
5592
+ <xsl:call-template name="create_fn" />
5593
+ </xsl:for-each>
5594
+ </xsl:if>
5482
5595
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
5483
- <xsl:call-template name="create_fn"/>
5596
+ <xsl:call-template name="create_fn" />
5484
5597
  </xsl:for-each>
5485
- </xsl:variable>
5486
-
5487
- <xsl:for-each select="xalan:nodeset($references)//fn">
5598
+ </xsl:variable> -->
5599
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
5488
5600
  <xsl:variable name="reference" select="@reference"/>
5489
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5601
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
5602
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
5490
5603
 
5491
5604
  <fo:block xsl:use-attribute-sets="table-fn-style">
5605
+ <xsl:copy-of select="@id"/>
5492
5606
  <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
5607
 
5496
- <xsl:text>※</xsl:text>
5497
-
5498
- <xsl:value-of select="@reference"/>
5499
-
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>
5608
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
5609
+ <xsl:with-param name="process">true</xsl:with-param>
5610
+ </xsl:apply-templates>
5506
5611
 
5507
- </fo:inline>
5508
5612
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
5509
- <xsl:copy-of select="./node()"/>
5613
+ <!-- <xsl:copy-of select="./node()"/> -->
5614
+ <xsl:apply-templates/>
5510
5615
  </fo:inline>
5511
5616
 
5512
5617
  </fo:block>
5513
5618
 
5514
- </xsl:if>
5619
+ <!-- </xsl:if> -->
5515
5620
  </xsl:for-each>
5516
5621
  </xsl:template> <!-- table_fn_display -->
5517
5622
 
5623
+ <!-- fmt-fn-body/fmt-fn-label in text -->
5624
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
5625
+
5626
+ <!-- table//fmt-fn-body//fmt-fn-label -->
5627
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
5628
+ <xsl:param name="process">false</xsl:param>
5629
+ <xsl:if test="$process = 'true'">
5630
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
5631
+
5632
+ <!-- tab is padding-right -->
5633
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
5634
+ <xsl:with-param name="process">true</xsl:with-param>
5635
+ </xsl:apply-templates>
5636
+
5637
+ <!-- <xsl:if test="$namespace = 'bipm'">
5638
+ <fo:inline font-style="normal">(</fo:inline>
5639
+ </xsl:if> -->
5640
+
5641
+ <!-- <xsl:if test="$namespace = 'plateau'">
5642
+ <xsl:text>※</xsl:text>
5643
+ </xsl:if> -->
5644
+
5645
+ <!-- <xsl:value-of select="@reference"/> -->
5646
+ <!-- <xsl:value-of select="normalize-space()"/> -->
5647
+ <xsl:apply-templates/>
5648
+
5649
+ <!-- <xsl:if test="$namespace = 'bipm'">
5650
+ <fo:inline font-style="normal">)</fo:inline>
5651
+ </xsl:if> -->
5652
+
5653
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5654
+ <!-- <xsl:if test="$namespace = 'itu'">
5655
+ <xsl:text>)</xsl:text>
5656
+ </xsl:if> -->
5657
+
5658
+ <!-- <xsl:if test="$namespace = 'plateau'">
5659
+ <xsl:text>:</xsl:text>
5660
+ </xsl:if> -->
5661
+
5662
+ </fo:inline>
5663
+ </xsl:if>
5664
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
5665
+
5666
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
5667
+ <xsl:param name="process">false</xsl:param>
5668
+ <xsl:if test="$process = 'true'">
5669
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
5670
+
5671
+ <xsl:attribute name="padding-right">2mm</xsl:attribute>
5672
+
5673
+ </xsl:if>
5674
+ </xsl:template>
5675
+
5676
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
5677
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
5678
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
5679
+ <xsl:apply-templates/>
5680
+ </fo:inline>
5681
+ </xsl:template>
5682
+
5683
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
5684
+ <!--
5518
5685
  <xsl:template name="create_fn">
5519
5686
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5520
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5687
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
5521
5688
  <xsl:attribute name="id">
5522
5689
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5523
5690
  </xsl:attribute>
5524
5691
  </xsl:if>
5525
-
5526
- <xsl:apply-templates/>
5692
+ <xsl:if test="$namespace = 'itu'">
5693
+ <xsl:if test="ancestor::*[local-name()='preface']">
5694
+ <xsl:attribute name="preface">true</xsl:attribute>
5695
+ </xsl:if>
5696
+ </xsl:if>
5697
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5698
+ <xsl:attribute name="id">
5699
+ <xsl:value-of select="@reference"/>
5700
+ <xsl:text>_</xsl:text>
5701
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5702
+ </xsl:attribute>
5703
+ </xsl:if>
5704
+ <xsl:apply-templates />
5527
5705
  </fn>
5528
- </xsl:template>
5706
+ </xsl:template> -->
5529
5707
 
5530
5708
  <!-- footnotes for table's name rendering -->
5531
5709
  <xsl:template name="table_name_fn_display">
@@ -5544,123 +5722,178 @@
5544
5722
  <!-- ============================ -->
5545
5723
  <!-- figure's footnotes rendering -->
5546
5724
  <!-- ============================ -->
5547
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
5548
5725
 
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_)"/>
5726
+ <!-- figure/fmt-footnote-container -->
5727
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
5728
+
5729
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
5730
+ <xsl:template name="figure_fn_display">
5555
5731
 
5556
- <!-- all footnotes relates to the current figure -->
5557
5732
  <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>
5733
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
5734
+ <xsl:variable name="curr_id" select="@id"/>
5735
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
5736
+ <curr><xsl:copy-of select="."/></curr>
5737
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
5738
+ <xsl:choose>
5739
+ <!-- skip figure/name/fn -->
5740
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
5741
+ <xsl:otherwise>
5742
+ <xsl:element name="figure" namespace="{$namespace_full}">
5743
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
5744
+ <xsl:copy-of select="."/>
5745
+ </xsl:element>
5746
+ </xsl:element>
5747
+ </xsl:otherwise>
5748
+ </xsl:choose>
5562
5749
  </xsl:for-each>
5563
5750
  </xsl:variable>
5751
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
5564
5752
 
5565
- <xsl:if test="xalan:nodeset($references)//fn">
5753
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
5566
5754
 
5567
5755
  <xsl:variable name="key_iso">
5568
5756
 
5569
5757
  </xsl:variable>
5570
5758
 
5571
5759
  <fo:block>
5760
+ <!-- current hierarchy is 'figure' element -->
5761
+ <xsl:variable name="following_dl_colwidths">
5762
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5763
+ <xsl:variable name="simple-table">
5764
+ <!-- <xsl:variable name="doc_ns">
5765
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5766
+ </xsl:variable>
5767
+ <xsl:variable name="ns">
5768
+ <xsl:choose>
5769
+ <xsl:when test="normalize-space($doc_ns) != ''">
5770
+ <xsl:value-of select="normalize-space($doc_ns)"/>
5771
+ </xsl:when>
5772
+ <xsl:otherwise>
5773
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
5774
+ </xsl:otherwise>
5775
+ </xsl:choose>
5776
+ </xsl:variable> -->
5572
5777
 
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> -->
5778
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5779
+ <tbody>
5780
+ <xsl:apply-templates mode="dl"/>
5781
+ </tbody>
5782
+ </xsl:for-each>
5783
+ </xsl:variable>
5590
5784
 
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>
5785
+ <xsl:call-template name="calculate-column-widths">
5786
+ <xsl:with-param name="cols-count" select="2"/>
5787
+ <xsl:with-param name="table" select="$simple-table"/>
5788
+ </xsl:call-template>
5597
5789
 
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>
5790
+ </xsl:if>
5791
+ </xsl:variable>
5602
5792
 
5603
- </xsl:if>
5604
- </xsl:variable>
5793
+ <xsl:variable name="maxlength_dt">
5794
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5795
+ <xsl:call-template name="getMaxLength_dt"/>
5796
+ </xsl:for-each>
5797
+ </xsl:variable>
5605
5798
 
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>
5799
+ <fo:table width="95%" table-layout="fixed">
5800
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5801
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5802
+
5803
+ </xsl:if>
5804
+ <xsl:choose>
5805
+ <!-- if there 'dl', then set same columns width -->
5806
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5807
+ <xsl:call-template name="setColumnWidth_dl">
5808
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5809
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5810
+ </xsl:call-template>
5811
+ </xsl:when>
5812
+ <xsl:otherwise>
5813
+ <fo:table-column column-width="5%"/>
5814
+ <fo:table-column column-width="95%"/>
5815
+ </xsl:otherwise>
5816
+ </xsl:choose>
5817
+ <fo:table-body>
5818
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
5819
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
5611
5820
 
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>
5821
+ <xsl:variable name="reference" select="@reference"/>
5822
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
5823
+ <fo:table-row>
5824
+ <fo:table-cell>
5825
+ <fo:block>
5615
5826
 
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"/>
5827
+ <xsl:attribute name="margin-left"><xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
5828
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
5829
+
5830
+ <fo:inline id="{@id}">
5831
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
5832
+ <!-- <xsl:value-of select="@reference"/> -->
5833
+ <!-- <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/> -->
5834
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']/node()"/>
5639
5835
  </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
5836
 
5646
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
5837
+ </fo:block>
5838
+ </fo:table-cell>
5839
+ <fo:table-cell>
5840
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5841
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5647
5842
 
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>
5843
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5844
+
5845
+ </xsl:if>
5846
+
5847
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
5848
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5657
5849
 
5850
+ <!-- <xsl:copy-of select="./node()"/> -->
5851
+ <xsl:apply-templates/>
5852
+ </fo:block>
5853
+ </fo:table-cell>
5854
+ </fo:table-row>
5855
+ <!-- </xsl:if> -->
5856
+ </xsl:for-each>
5857
+ </fo:table-body>
5858
+ </fo:table>
5658
5859
  </fo:block>
5659
5860
  </xsl:if>
5660
- </xsl:template> <!-- fn_display_figure -->
5861
+ </xsl:template> <!-- figure_fn_display -->
5862
+
5863
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
5864
+ <xsl:param name="process">false</xsl:param>
5865
+ <xsl:if test="$process = 'true'">
5866
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
5867
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
5868
+
5869
+ <!-- tab is padding-right -->
5870
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
5871
+ <xsl:with-param name="process">true</xsl:with-param>
5872
+ </xsl:apply-templates>
5873
+
5874
+ <xsl:apply-templates/>
5875
+
5876
+ </fo:inline>
5877
+ </xsl:if>
5878
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
5879
+
5880
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
5881
+ <xsl:param name="process">false</xsl:param>
5882
+ <xsl:if test="$process = 'true'">
5883
+
5884
+ </xsl:if>
5885
+ </xsl:template>
5886
+
5887
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
5888
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
5889
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
5890
+ <xsl:apply-templates/>
5891
+ </fo:inline>
5892
+ </xsl:template>
5661
5893
 
5662
5894
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
5663
5895
  <!-- figure's footnote label -->
5896
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
5664
5897
  <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
5898
  <xsl:variable name="key_iso">
5666
5899
 
@@ -5669,7 +5902,7 @@
5669
5902
  <xsl:attribute name="font-size">10pt</xsl:attribute>
5670
5903
 
5671
5904
  </xsl:if>
5672
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
5905
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
5673
5906
  <!-- <xsl:value-of select="@reference"/> -->
5674
5907
  <xsl:apply-templates/>
5675
5908
  </fo:inline>
@@ -5679,40 +5912,65 @@
5679
5912
  <!-- END: figure's footnotes rendering -->
5680
5913
  <!-- ============================ -->
5681
5914
 
5682
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
5915
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
5916
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
5683
5917
  <xsl:template match="*[local-name()='fn']">
5684
5918
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
5685
5919
 
5686
5920
  <xsl:call-template name="refine_fn-reference-style"/>
5687
5921
 
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">
5922
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5923
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
5924
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
5925
+ <!-- <xsl:attribute name="internal-destination">
5691
5926
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5692
5927
  </xsl:attribute>
5693
5928
  </xsl:if>
5694
-
5929
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5930
+ <xsl:attribute name="internal-destination">
5931
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
5932
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5933
+ </xsl:attribute>
5934
+ </xsl:if> -->
5935
+ <!-- <xsl:if test="$namespace = 'plateau'">
5695
5936
  <xsl:text>※</xsl:text>
5937
+ </xsl:if> -->
5938
+ <!-- <xsl:value-of select="@reference"/> -->
5696
5939
 
5697
- <xsl:value-of select="@reference"/>
5940
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5698
5941
 
5942
+ <!-- <xsl:if test="$namespace = 'bsi'">
5943
+ <xsl:text>)</xsl:text>
5944
+ </xsl:if> -->
5699
5945
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5700
5946
  <!-- <xsl:if test="$namespace = 'jis'">
5701
5947
  <fo:inline font-weight="normal">)</fo:inline>
5702
5948
  </xsl:if> -->
5703
5949
  </fo:basic-link>
5704
5950
  </fo:inline>
5705
- </xsl:template>
5951
+ </xsl:template> <!-- fn -->
5706
5952
 
5953
+ <!-- fn/text() -->
5707
5954
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
5708
5955
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
5709
5956
  </xsl:template>
5710
5957
 
5711
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
5958
+ <!-- fn//p fmt-fn-body//p -->
5959
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
5712
5960
  <fo:inline role="P">
5713
5961
  <xsl:apply-templates/>
5714
5962
  </fo:inline>
5715
5963
  </xsl:template>
5964
+
5965
+ <xsl:template name="insertFootnoteSeparatorCommon">
5966
+ <xsl:param name="leader_length">30%</xsl:param>
5967
+ <fo:static-content flow-name="xsl-footnote-separator">
5968
+ <fo:block>
5969
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
5970
+ </fo:block>
5971
+ </fo:static-content>
5972
+ </xsl:template>
5973
+
5716
5974
  <!-- ===================== -->
5717
5975
  <!-- END Footnotes processing -->
5718
5976
  <!-- ===================== -->
@@ -5750,6 +6008,11 @@
5750
6008
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
5751
6009
  </xsl:if>
5752
6010
 
6011
+ <xsl:if test="@key = 'true' and (ancestor::*[local-name() = 'tfoot'] or parent::*[local-name() = 'figure'])">
6012
+ <xsl:attribute name="margin-left"><xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
6013
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
6014
+ </xsl:if>
6015
+
5753
6016
  <xsl:if test="ancestor::*[local-name() = 'sourcecode']">
5754
6017
  <!-- set font-size as sourcecode font-size -->
5755
6018
  <xsl:variable name="sourcecode_attributes">
@@ -5989,11 +6252,40 @@
5989
6252
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
5990
6253
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
5991
6254
 
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>
6255
+ <xsl:choose>
6256
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
6257
+ <xsl:when test="@key = 'true' and (ancestor::*[local-name() = 'tfoot'] or parent::*[local-name() = 'figure'])"> <!-- and not(xalan:nodeset($colwidths)//column) -->
6258
+ <xsl:variable name="dt_nodes">
6259
+ <xsl:for-each select="*[local-name() = 'dt']">
6260
+ <xsl:apply-templates select="." mode="dt_clean"/>
6261
+ </xsl:for-each>
6262
+ </xsl:variable>
6263
+ <!-- <xsl:copy-of select="$dt_nodes"/> -->
6264
+ <xsl:variable name="dt_length_max">
6265
+ <xsl:for-each select="xalan:nodeset($dt_nodes)//*[local-name() = 'dt']">
6266
+ <xsl:sort select="string-length(normalize-space())" data-type="number" order="descending"/>
6267
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(normalize-space())"/></xsl:if>
6268
+ </xsl:for-each>
6269
+ </xsl:variable>
6270
+ <xsl:variable name="col1_percent_" select="number($dt_length_max) + 1"/>
6271
+ <xsl:variable name="col1_percent">
6272
+ <xsl:choose>
6273
+ <xsl:when test="$col1_percent_ &gt; 50">50</xsl:when>
6274
+ <xsl:otherwise><xsl:value-of select="$col1_percent_"/></xsl:otherwise>
6275
+ </xsl:choose>
6276
+ </xsl:variable>
6277
+ <fo:table-column column-width="{$col1_percent}%"/>
6278
+ <fo:table-column column-width="{100 - $col1_percent}%"/>
6279
+ </xsl:when>
6280
+ <xsl:otherwise>
6281
+ <xsl:call-template name="setColumnWidth_dl">
6282
+ <xsl:with-param name="colwidths" select="$colwidths"/>
6283
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6284
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
6285
+ </xsl:call-template>
6286
+ </xsl:otherwise>
6287
+ </xsl:choose>
6288
+ <!-- $namespace = 'plateau' -->
5997
6289
 
5998
6290
  <fo:table-body>
5999
6291
 
@@ -6027,6 +6319,14 @@
6027
6319
 
6028
6320
  </xsl:template> <!-- END: dl -->
6029
6321
 
6322
+ <xsl:template match="@*|node()" mode="dt_clean">
6323
+ <xsl:copy>
6324
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
6325
+ </xsl:copy>
6326
+ </xsl:template>
6327
+
6328
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
6329
+
6030
6330
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
6031
6331
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
6032
6332
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -6056,10 +6356,18 @@
6056
6356
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
6057
6357
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
6058
6358
 
6359
+ <!-- dl/name -->
6059
6360
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
6060
6361
  <xsl:param name="process">false</xsl:param>
6061
6362
  <xsl:if test="$process = 'true'">
6062
6363
  <fo:block xsl:use-attribute-sets="dl-name-style">
6364
+
6365
+ <xsl:if test="ancestor::*[local-name() = 'tfoot'] and ../@key = 'true'">
6366
+ <xsl:attribute name="margin-left">-<xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
6367
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
6368
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
6369
+ </xsl:if>
6370
+
6063
6371
  <xsl:apply-templates/>
6064
6372
  </fo:block>
6065
6373
  </xsl:if>
@@ -6073,6 +6381,10 @@
6073
6381
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
6074
6382
 
6075
6383
  <xsl:choose>
6384
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
6385
+ <fo:table-column column-width="10%"/>
6386
+ <fo:table-column column-width="90%"/>
6387
+ </xsl:when> -->
6076
6388
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
6077
6389
  <xsl:call-template name="insertTableColumnWidth">
6078
6390
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -6866,7 +7178,7 @@
6866
7178
  <xsl:choose>
6867
7179
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
6868
7180
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
6869
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
7181
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
6870
7182
  </xsl:when>
6871
7183
  <xsl:otherwise>
6872
7184
  <xsl:apply-templates/>
@@ -6874,7 +7186,7 @@
6874
7186
  </xsl:choose>
6875
7187
  </xsl:template>
6876
7188
  <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
6877
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
7189
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
6878
7190
  </xsl:template>
6879
7191
 
6880
7192
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -7914,24 +8226,26 @@
7914
8226
  <xsl:apply-templates select="." mode="mathml"/>
7915
8227
  </xsl:variable>
7916
8228
 
7917
- <fo:instream-foreign-object fox:alt-text="Math">
8229
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
7918
8230
 
7919
8231
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
7920
8232
 
7921
- <!-- put MathML in Actual Text -->
7922
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
7923
- <xsl:attribute name="fox:actual-text">
7924
- <xsl:value-of select="$mathml_content"/>
7925
- </xsl:attribute>
7926
-
7927
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
7928
- <xsl:if test="normalize-space($asciimath_text_) != ''">
7929
- <!-- put Mathin Alternate Text -->
7930
- <xsl:attribute name="fox:alt-text">
7931
- <xsl:value-of select="$asciimath_text_"/>
8233
+ <xsl:if test="$isGenerateTableIF = 'false'">
8234
+ <!-- put MathML in Actual Text -->
8235
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
8236
+ <xsl:attribute name="fox:actual-text">
8237
+ <xsl:value-of select="$mathml_content"/>
7932
8238
  </xsl:attribute>
8239
+
8240
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8241
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
8242
+ <!-- put Mathin Alternate Text -->
8243
+ <xsl:attribute name="fox:alt-text">
8244
+ <xsl:value-of select="$asciimath_text_"/>
8245
+ </xsl:attribute>
8246
+ </xsl:if>
8247
+ <!-- </xsl:if> -->
7933
8248
  </xsl:if>
7934
- <!-- </xsl:if> -->
7935
8249
 
7936
8250
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
7937
8251
 
@@ -8194,6 +8508,27 @@
8194
8508
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8195
8509
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8196
8510
  </xsl:when> -->
8511
+
8512
+ <!-- <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'))">
8513
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8514
+ <xsl:variable name="filename">
8515
+ <xsl:call-template name="substring-after-last">
8516
+ <xsl:with-param name="value" select="$target_"/>
8517
+ <xsl:with-param name="delimiter" select="'/'"/>
8518
+ </xsl:call-template>
8519
+ </xsl:variable>
8520
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
8521
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
8522
+ <xsl:choose>
8523
+ <xsl:when test="$file_exists = 'true'">
8524
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
8525
+ </xsl:when>
8526
+ <xsl:otherwise>
8527
+ <xsl:value-of select="normalize-space(@target)"/>
8528
+ </xsl:otherwise>
8529
+ </xsl:choose>
8530
+ </xsl:when> -->
8531
+
8197
8532
  <xsl:otherwise>
8198
8533
  <xsl:value-of select="normalize-space(@target)"/>
8199
8534
  </xsl:otherwise>
@@ -8498,7 +8833,11 @@
8498
8833
 
8499
8834
  <xsl:template name="refine_note_block_style">
8500
8835
 
8501
- </xsl:template>
8836
+ <xsl:if test="ancestor::*[local-name() = 'figure']">
8837
+ <xsl:attribute name="margin-left"><xsl:value-of select="$tableAnnotationIndent"/></xsl:attribute>
8838
+ </xsl:if>
8839
+
8840
+ </xsl:template> <!-- refine_note_block_style -->
8502
8841
 
8503
8842
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
8504
8843
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -8690,10 +9029,21 @@
8690
9029
  </xsl:template>
8691
9030
 
8692
9031
  <xsl:template name="showFigureKey">
8693
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8694
- <xsl:call-template name="note"/>
9032
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
9033
+ <xsl:choose>
9034
+ <xsl:when test="local-name() = 'note'">
9035
+ <xsl:call-template name="note"/>
9036
+ </xsl:when>
9037
+ <xsl:when test="local-name() = 'example'">
9038
+ <xsl:call-template name="example"/>
9039
+ </xsl:when>
9040
+ <xsl:otherwise>
9041
+ <xsl:apply-templates select="."/>
9042
+ </xsl:otherwise>
9043
+ </xsl:choose>
8695
9044
  </xsl:for-each>
8696
- <xsl:call-template name="fn_display_figure"/>
9045
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
9046
+ <xsl:call-template name="figure_fn_display"/>
8697
9047
  </xsl:template>
8698
9048
 
8699
9049
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -9587,10 +9937,10 @@
9587
9937
  <xsl:when test="@type = 'section-title'">
9588
9938
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9589
9939
  <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')]"/>
9940
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
9591
9941
  </xsl:when>
9592
9942
  <xsl:otherwise>
9593
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9943
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
9594
9944
  </xsl:otherwise>
9595
9945
  </xsl:choose>
9596
9946
  </xsl:when>
@@ -9655,6 +10005,8 @@
9655
10005
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
9656
10006
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
9657
10007
 
10008
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
10009
+
9658
10010
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
9659
10011
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
9660
10012
  <xsl:apply-templates mode="bookmarks"/>
@@ -9676,6 +10028,8 @@
9676
10028
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
9677
10029
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
9678
10030
 
10031
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
10032
+
9679
10033
  <!-- Bookmarks -->
9680
10034
  <xsl:template name="addBookmarks">
9681
10035
  <xsl:param name="contents"/>
@@ -9921,9 +10275,15 @@
9921
10275
  </xsl:if>
9922
10276
  </xsl:template>
9923
10277
 
10278
+ <!-- figure/fn -->
9924
10279
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
9925
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
10280
+ <!-- figure/note -->
10281
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
10282
+ <!-- figure/example -->
10283
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
9926
10284
 
10285
+ <!-- figure/note[@type = 'units'] -->
10286
+ <!-- image/note[@type = 'units'] -->
9927
10287
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
9928
10288
  <fo:block text-align="right" keep-with-next="always">
9929
10289
  <xsl:apply-templates/>
@@ -10044,6 +10404,7 @@
10044
10404
  </xsl:choose>
10045
10405
  </xsl:template>
10046
10406
 
10407
+ <!-- fn -->
10047
10408
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
10048
10409
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
10049
10410
 
@@ -10939,7 +11300,7 @@
10939
11300
  text line 1
10940
11301
  text line 2
10941
11302
  -->
10942
- <xsl:template match="*[local-name() = 'example']">
11303
+ <xsl:template match="*[local-name() = 'example']" name="example">
10943
11304
 
10944
11305
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10945
11306
 
@@ -11045,6 +11406,7 @@
11045
11406
 
11046
11407
  </xsl:template>
11047
11408
 
11409
+ <!-- example/name -->
11048
11410
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
11049
11411
  <xsl:param name="fo_element">block</xsl:param>
11050
11412
 
@@ -11070,9 +11432,12 @@
11070
11432
 
11071
11433
  </xsl:template>
11072
11434
 
11073
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
11435
+ <!-- table/example/name, table/tfoot//example/name -->
11436
+ <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
11437
  <fo:inline xsl:use-attribute-sets="example-name-style">
11075
11438
 
11439
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
11440
+
11076
11441
  <xsl:apply-templates/>
11077
11442
  </fo:inline>
11078
11443
  </xsl:template>
@@ -11533,21 +11898,32 @@
11533
11898
  <!-- ========== -->
11534
11899
 
11535
11900
  <xsl:variable name="reviews_">
11536
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
11901
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
11537
11902
  <xsl:copy>
11538
11903
  <xsl:copy-of select="@from"/>
11539
11904
  <xsl:copy-of select="@id"/>
11540
11905
  </xsl:copy>
11541
11906
  </xsl:for-each>
11907
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
11908
+ <xsl:copy>
11909
+ <xsl:copy-of select="@source"/>
11910
+ <xsl:copy-of select="@id"/>
11911
+ </xsl:copy>
11912
+ </xsl:for-each>
11542
11913
  </xsl:variable>
11543
11914
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
11544
11915
 
11545
11916
  <xsl:template name="addReviewHelper">
11546
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
11547
- <xsl:variable name="curr_id" select="@id"/>
11548
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
11549
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
11550
- <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11917
+ <xsl:if test="$isGenerateTableIF = 'false'">
11918
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
11919
+ <xsl:variable name="curr_id" select="@id"/>
11920
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
11921
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
11922
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
11923
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
11924
+ <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11925
+ </xsl:if>
11926
+ </xsl:for-each>
11551
11927
  </xsl:if>
11552
11928
  <!-- <fo:block>
11553
11929
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -11684,14 +12060,61 @@
11684
12060
 
11685
12061
  </xsl:template>
11686
12062
 
11687
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
12063
+ <!-- document text (not figures, or tables) footnotes -->
12064
+ <xsl:variable name="reviews_container_">
12065
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
12066
+ <xsl:variable name="update_xml_step1">
12067
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
12068
+ </xsl:variable>
12069
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
12070
+ </xsl:for-each>
12071
+ </xsl:variable>
12072
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
12073
+
12074
+ <xsl:template match="*[local-name() = 'review-container']"/>
12075
+
12076
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
12077
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
12078
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
12079
+ <xsl:if test="$isGenerateTableIF = 'false'">
12080
+ <xsl:choose>
12081
+ <!-- if there isn't the attribute '@from', then -->
12082
+ <xsl:when test="$id_from = ''">
12083
+ <fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12084
+ </xsl:when>
12085
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
12086
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
12087
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12088
+ </xsl:when>
12089
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12090
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12091
+ </xsl:when>
12092
+ </xsl:choose>
12093
+ </xsl:if>
12094
+ </xsl:template>
12095
+
12096
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
12097
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11688
12098
  <!-- comment 2019-11-29 -->
11689
12099
  <!-- <fo:block font-weight="bold">Review:</fo:block>
11690
12100
  <xsl:apply-templates /> -->
11691
12101
 
11692
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
12102
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
11693
12103
 
11694
- <xsl:if test="1 = 1">
12104
+ <xsl:variable name="source" select="normalize-space(@source)"/>
12105
+
12106
+ <xsl:if test="$isGenerateTableIF = 'false'">
12107
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
12108
+
12109
+ <!-- <xsl:if test="@source = @end"> -->
12110
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
12111
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
12112
+ <!-- <fo:block id="{$source}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$source}" fox:alt-text="Annot___{$source}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block> -->
12113
+ <fo:block id="{@id}" font-size="1pt" role="SKIP" keep-with-next="always" line-height="0.1"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12114
+ <!-- </xsl:if> -->
12115
+ </xsl:if>
12116
+
12117
+ <xsl:if test="1 = 2">
11695
12118
  <xsl:choose>
11696
12119
  <!-- if there isn't the attribute '@from', then -->
11697
12120
  <xsl:when test="$id_from = ''">
@@ -11699,10 +12122,10 @@
11699
12122
  </xsl:when>
11700
12123
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
11701
12124
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
11702
- <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12125
+ <fo:block id="{$id_from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$id_from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11703
12126
  </xsl:when>
11704
12127
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11705
- <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
12128
+ <fo:block id="{$id_from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$id_from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
11706
12129
  </xsl:when>
11707
12130
  </xsl:choose>
11708
12131
  </xsl:if>
@@ -11738,40 +12161,35 @@
11738
12161
  <!-- ===================================== -->
11739
12162
  <xsl:variable name="ul_labels_">
11740
12163
 
11741
- <xsl:choose>
11742
- <xsl:when test="$doctype = 'technical-report'">
11743
- <label level="1" font-size="130%" line-height="1.2">・</label> <!-- Katakana Middle Dot -->
11744
- <label level="2">→</label> <!-- will be replaced in the template 'li' -->
11745
- <label level="3">☆</label> <!-- will be replaced in the template 'li' -->
11746
- </xsl:when>
11747
- <xsl:otherwise>
11748
- <label level="1" font-size="130%" line-height="1.2">・</label> <!-- Katakana Middle Dot -->
11749
- <label level="2">-</label> <!-- full-width hyphen minus -->
11750
- <label level="3" font-size="130%" line-height="1.2">・</label>
11751
- </xsl:otherwise>
11752
- </xsl:choose>
12164
+ <label level="1">-</label> <!-- full-width hyphen minus -->
12165
+ <label level="2" font-size="130%" line-height="1.2">・</label> <!-- Katakana Middle Dot -->
11753
12166
 
11754
12167
  </xsl:variable>
11755
12168
  <xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/>
11756
12169
 
11757
12170
  <xsl:template name="setULLabel">
11758
12171
  <xsl:variable name="list_level__">
11759
- <xsl:value-of select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
12172
+ <xsl:value-of select="count(ancestor::*[local-name() = 'ul'])"/>
11760
12173
  </xsl:variable>
11761
12174
  <xsl:variable name="list_level_" select="number($list_level__)"/>
11762
12175
  <xsl:variable name="list_level">
11763
12176
  <xsl:choose>
11764
12177
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
11765
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
12178
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
12179
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
12180
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
11766
12181
  </xsl:choose>
11767
12182
  </xsl:variable>
11768
12183
  <xsl:choose>
11769
12184
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
11770
12185
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
11771
12186
  </xsl:when>
11772
- <xsl:when test="$list_level mod 3 = 0">
12187
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
11773
12188
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
11774
12189
  </xsl:when>
12190
+ <xsl:when test="$list_level mod 3 = 0">
12191
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
12192
+ </xsl:when>
11775
12193
  <xsl:when test="$list_level mod 2 = 0">
11776
12194
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
11777
12195
  </xsl:when>
@@ -12323,10 +12741,22 @@
12323
12741
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
12324
12742
 
12325
12743
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
12326
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
12327
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
12328
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
12329
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
12744
+ <xsl:variable name="bookmark_id" select="@id"/>
12745
+ <xsl:choose>
12746
+ <!-- Example:
12747
+ <fmt-review-start id="_7ef81cf7-3f6c-4ed4-9c1f-1ba092052bbd" source="_dda23915-8574-ef1e-29a1-822d465a5b97" target="_ecfb2210-3b1b-46a2-b63a-8b8505be6686" end="_dda23915-8574-ef1e-29a1-822d465a5b97" author="" date="2025-03-24T00:00:00Z"/>
12748
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
12749
+ <fmt-review-end id="_f336a8d0-08a8-4b7f-a1aa-b04688ed40c1" source="_dda23915-8574-ef1e-29a1-822d465a5b97" target="_ecfb2210-3b1b-46a2-b63a-8b8505be6686" start="_dda23915-8574-ef1e-29a1-822d465a5b97" author="" date="2025-03-24T00:00:00Z"/> -->
12750
+ <xsl:when test="1 = 2 and preceding-sibling::node()[local-name() = 'fmt-review-start'][@source = $bookmark_id] and following-sibling::node()[local-name() = 'fmt-review-end'][@source = $bookmark_id]">
12751
+ <!-- skip here, see the template 'fmt-review-start' -->
12752
+ </xsl:when>
12753
+ <xsl:otherwise>
12754
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
12755
+ <fo:inline id="{@id}" font-size="1pt"><xsl:if test="preceding-sibling::node()[local-name() = 'fmt-review-start'][@source = $bookmark_id] and following-sibling::node()[local-name() = 'fmt-review-end'][@source = $bookmark_id]"><xsl:attribute name="line-height">0.1</xsl:attribute></xsl:if><xsl:value-of select="$hair_space"/></fo:inline>
12756
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
12757
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
12758
+ </xsl:otherwise>
12759
+ </xsl:choose>
12330
12760
  </xsl:template>
12331
12761
  <!-- =================== -->
12332
12762
  <!-- End of Index processing -->
@@ -12708,8 +13138,33 @@
12708
13138
 
12709
13139
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
12710
13140
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
13141
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
13142
+ <!-- <test><xsl:copy-of select="."/></test> -->
13143
+
12711
13144
  <xsl:variable name="target" select="@target"/>
13145
+
12712
13146
  <xsl:for-each select="*[local-name() = 'tab']">
13147
+
13148
+ <xsl:if test="position() = 1">
13149
+ <!-- first column (data before first `tab`) -->
13150
+ <fo:table-cell>
13151
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
13152
+ <xsl:call-template name="insert_basic_link">
13153
+ <xsl:with-param name="element">
13154
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
13155
+ <xsl:for-each select="preceding-sibling::node()">
13156
+ <xsl:choose>
13157
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13158
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
13159
+ </xsl:choose>
13160
+ </xsl:for-each>
13161
+ </fo:basic-link>
13162
+ </xsl:with-param>
13163
+ </xsl:call-template>
13164
+ </fo:block>
13165
+ </fo:table-cell>
13166
+ </xsl:if>
13167
+
12713
13168
  <xsl:variable name="current_id" select="generate-id()"/>
12714
13169
  <fo:table-cell>
12715
13170
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -12760,11 +13215,25 @@
12760
13215
 
12761
13216
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
12762
13217
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
13218
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12763
13219
  <xsl:for-each select="*[local-name() = 'tab']">
13220
+ <xsl:if test="position() = 1">
13221
+ <td>
13222
+ <xsl:for-each select="preceding-sibling::node()">
13223
+ <xsl:choose>
13224
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13225
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
13226
+ </xsl:choose>
13227
+ </xsl:for-each>
13228
+ </td>
13229
+ </xsl:if>
12764
13230
  <xsl:variable name="current_id" select="generate-id()"/>
12765
13231
  <td>
12766
13232
  <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="."/>
13233
+ <xsl:choose>
13234
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13235
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
13236
+ </xsl:choose>
12768
13237
  </xsl:for-each>
12769
13238
  </td>
12770
13239
  </xsl:for-each>
@@ -13634,6 +14103,9 @@
13634
14103
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
13635
14104
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
13636
14105
 
14106
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
14107
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
14108
+
13637
14109
  <!-- END: update new Presentation XML -->
13638
14110
 
13639
14111
  <!-- =========================================================================== -->
@@ -14261,6 +14733,7 @@
14261
14733
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
14262
14734
  </fn>
14263
14735
  -->
14736
+ <!-- fn in text -->
14264
14737
  <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
14738
  <xsl:variable name="p_fn_">
14266
14739
  <xsl:call-template name="get_fn_list"/>