metanorma-ogc 2.7.1 → 2.7.3

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.
@@ -349,11 +349,7 @@
349
349
 
350
350
  <!-- Cover Page -->
351
351
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
352
- <fo:static-content flow-name="xsl-footnote-separator">
353
- <fo:block>
354
- <fo:leader leader-pattern="rule" leader-length="30%"/>
355
- </fo:block>
356
- </fo:static-content>
352
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
357
353
 
358
354
  <fo:flow flow-name="xsl-region-body" color="white">
359
355
 
@@ -1483,12 +1479,6 @@
1483
1479
  </xsl:if>
1484
1480
  </xsl:template>
1485
1481
 
1486
- <xsl:template match="ogc:fn/ogc:p">
1487
- <fo:block>
1488
- <xsl:apply-templates/>
1489
- </fo:block>
1490
- </xsl:template>
1491
-
1492
1482
  <xsl:template match="ogc:ul | ogc:ol" mode="list" priority="2">
1493
1483
  <xsl:param name="indent">0</xsl:param>
1494
1484
  <!-- <fo:block>debug ul ol indent=<xsl:value-of select="$indent"/></fo:block> -->
@@ -1642,12 +1632,13 @@
1642
1632
  <!-- <fo:block>debug figure indent=<xsl:value-of select="$indent"/></fo:block> -->
1643
1633
  <fo:block-container id="{@id}" margin-top="12pt" margin-bottom="12pt">
1644
1634
  <fo:block>
1645
- <xsl:apply-templates select="node()[not(local-name() = 'name')]">
1635
+ <xsl:apply-templates select="ogc:note[@type = 'units']"/>
1636
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]">
1646
1637
  <xsl:with-param name="indent" select="$indent"/>
1647
1638
  </xsl:apply-templates>
1648
1639
  </fo:block>
1649
- <xsl:call-template name="fn_display_figure"/>
1650
- <xsl:for-each select="ogc:note">
1640
+ <xsl:call-template name="figure_fn_display"/>
1641
+ <xsl:for-each select="ogc:note[not(@type = 'units')]">
1651
1642
  <xsl:call-template name="note"/>
1652
1643
  </xsl:for-each>
1653
1644
  <xsl:apply-templates select="ogc:name"/>
@@ -2860,14 +2851,18 @@
2860
2851
  </xsl:template>
2861
2852
 
2862
2853
  <xsl:attribute-set name="table-fn-number-style">
2854
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
2855
+
2856
+ </xsl:attribute-set> <!-- table-fn-number-style -->
2857
+
2858
+ <xsl:attribute-set name="table-fmt-fn-label-style">
2863
2859
  <xsl:attribute name="font-size">80%</xsl:attribute>
2864
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
2865
2860
 
2866
2861
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2867
2862
 
2868
- </xsl:attribute-set> <!-- table-fn-number-style -->
2863
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
2869
2864
 
2870
- <xsl:template name="refine_table-fn-number-style">
2865
+ <xsl:template name="refine_table-fmt-fn-label-style">
2871
2866
 
2872
2867
  </xsl:template>
2873
2868
 
@@ -2882,11 +2877,18 @@
2882
2877
  </xsl:attribute-set>
2883
2878
 
2884
2879
  <xsl:attribute-set name="figure-fn-number-style">
2885
- <xsl:attribute name="font-size">80%</xsl:attribute>
2886
2880
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2881
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
2882
+
2883
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
2884
+ <xsl:attribute name="font-size">80%</xsl:attribute>
2887
2885
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2888
2886
 
2889
- </xsl:attribute-set>
2887
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
2888
+
2889
+ <xsl:template name="refine_figure-fmt-fn-label-style">
2890
+
2891
+ </xsl:template>
2890
2892
 
2891
2893
  <xsl:attribute-set name="figure-fn-body-style">
2892
2894
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -4481,9 +4483,13 @@
4481
4483
 
4482
4484
  <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']"/>
4483
4485
  <xsl:if test="$isNoteOrFnExist = 'true'">
4484
-
4485
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
4486
-
4486
+ <!-- <xsl:choose>
4487
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
4488
+ <xsl:otherwise>
4489
+
4490
+ </xsl:otherwise>
4491
+ </xsl:choose> -->
4492
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
4487
4493
  </xsl:if>
4488
4494
 
4489
4495
  <xsl:choose>
@@ -4530,7 +4536,7 @@
4530
4536
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4531
4537
  </xsl:when>
4532
4538
  <xsl:otherwise>
4533
- <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 -->
4539
+ <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 -->
4534
4540
  </xsl:otherwise>
4535
4541
  </xsl:choose>
4536
4542
 
@@ -4541,13 +4547,26 @@
4541
4547
 
4542
4548
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
4543
4549
 
4544
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4545
- <xsl:call-template name="insertTableFooterInSeparateTable">
4546
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
4547
- <xsl:with-param name="colwidths" select="$colwidths"/>
4548
- <xsl:with-param name="colgroup" select="$colgroup"/>
4549
- </xsl:call-template>
4550
- </xsl:for-each>
4550
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
4551
+
4552
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4553
+ <xsl:call-template name="insertTableFooterInSeparateTable">
4554
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
4555
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4556
+ <xsl:with-param name="colgroup" select="$colgroup"/>
4557
+ </xsl:call-template>
4558
+ </xsl:for-each>
4559
+
4560
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
4561
+ <xsl:if test="$namespace = 'plateau'">
4562
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
4563
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
4564
+ <xsl:variable name="table_fn_block">
4565
+ <xsl:call-template name="table_fn_display" />
4566
+ </xsl:variable>
4567
+ <xsl:copy-of select="$table_fn_block"/>
4568
+ </xsl:for-each>
4569
+ </xsl:if> -->
4551
4570
 
4552
4571
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
4553
4572
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -5330,6 +5349,8 @@
5330
5349
 
5331
5350
  <xsl:template name="setTableRowAttributes">
5332
5351
 
5352
+ <xsl:call-template name="setColors"/>
5353
+
5333
5354
  </xsl:template> <!-- setTableRowAttributes -->
5334
5355
  <!-- ===================== -->
5335
5356
  <!-- END Table's row processing -->
@@ -5381,6 +5402,7 @@
5381
5402
  </xsl:attribute>
5382
5403
  </xsl:if>
5383
5404
  <xsl:call-template name="display-align"/>
5405
+ <xsl:call-template name="setColors"/>
5384
5406
  </xsl:template>
5385
5407
 
5386
5408
  <xsl:template name="display-align">
@@ -5396,6 +5418,29 @@
5396
5418
  </xsl:if>
5397
5419
  </xsl:template>
5398
5420
 
5421
+ <xsl:template name="setColors">
5422
+ <xsl:variable name="styles__">
5423
+ <xsl:call-template name="split">
5424
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
5425
+ <xsl:with-param name="sep" select="';'"/>
5426
+ </xsl:call-template>
5427
+ </xsl:variable>
5428
+ <xsl:variable name="quot">"</xsl:variable>
5429
+ <xsl:variable name="styles_">
5430
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
5431
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
5432
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
5433
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
5434
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
5435
+ </xsl:if>
5436
+ </xsl:for-each>
5437
+ </xsl:variable>
5438
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
5439
+ <xsl:for-each select="$styles/style">
5440
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
5441
+ </xsl:for-each>
5442
+ </xsl:template>
5443
+
5399
5444
  <!-- cell in table body, footer -->
5400
5445
  <xsl:template match="*[local-name()='td']" name="td">
5401
5446
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -5407,17 +5452,28 @@
5407
5452
 
5408
5453
  <xsl:call-template name="refine_table-cell-style"/>
5409
5454
 
5455
+ <xsl:call-template name="setTableCellAttributes"/>
5456
+
5410
5457
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
5411
5458
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
5412
5459
  </xsl:if>
5413
5460
 
5414
- <xsl:call-template name="setTableCellAttributes"/>
5415
-
5416
5461
  <xsl:if test="$isGenerateTableIF = 'true'">
5417
5462
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
5418
5463
  <xsl:attribute name="text-align">left</xsl:attribute>
5419
5464
  </xsl:if>
5420
5465
 
5466
+ <xsl:if test="$isGenerateTableIF = 'false'">
5467
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
5468
+ <xsl:attribute name="text-align">right</xsl:attribute>
5469
+ <xsl:attribute name="border">none</xsl:attribute>
5470
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
5471
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
5472
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
5473
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
5474
+ </xsl:if>
5475
+ </xsl:if>
5476
+
5421
5477
  <fo:block role="SKIP">
5422
5478
 
5423
5479
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -5436,7 +5492,8 @@
5436
5492
  </fo:table-cell>
5437
5493
  </xsl:template> <!-- td -->
5438
5494
 
5439
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
5495
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
5496
+ <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">
5440
5497
 
5441
5498
  <fo:block xsl:use-attribute-sets="table-note-style">
5442
5499
  <xsl:copy-of select="@id"/>
@@ -5457,65 +5514,54 @@
5457
5514
 
5458
5515
  </xsl:template> <!-- table/note -->
5459
5516
 
5460
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
5517
+ <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">
5461
5518
  <xsl:apply-templates/>
5462
5519
  </xsl:template>
5463
5520
 
5464
5521
  <!-- ===================== -->
5465
5522
  <!-- Footnotes processing -->
5466
5523
  <!-- ===================== -->
5524
+
5525
+ <!-- document text (not figures, or tables) footnotes -->
5526
+ <xsl:variable name="footnotes_">
5527
+ <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 -->
5528
+ <!-- <xsl:copy-of select="."/> -->
5529
+ <xsl:variable name="update_xml_step1">
5530
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
5531
+ </xsl:variable>
5532
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
5533
+ </xsl:for-each>
5534
+ </xsl:variable>
5535
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
5536
+
5467
5537
  <!--
5468
5538
  <fn reference="1">
5469
5539
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
5470
5540
  </fn>
5471
5541
  -->
5472
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
5542
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
5543
+ <!-- fn in text -->
5473
5544
  <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">
5474
5545
 
5475
- <!-- list of footnotes to calculate actual footnotes number -->
5546
+ <!-- list of unique footnotes -->
5476
5547
  <xsl:variable name="p_fn_">
5477
5548
  <xsl:call-template name="get_fn_list"/>
5478
- <!-- <xsl:choose>
5479
- <xsl:when test="$namespace = 'jis'">
5480
- <xsl:call-template name="get_fn_list_for_element"/>
5481
- </xsl:when>
5482
- <xsl:otherwise>
5483
- <xsl:call-template name="get_fn_list"/>
5484
- </xsl:otherwise>
5485
- </xsl:choose> -->
5486
5549
  </xsl:variable>
5487
5550
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
5488
5551
 
5489
5552
  <xsl:variable name="gen_id" select="generate-id(.)"/>
5490
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
5491
- <xsl:variable name="reference_">
5492
- <xsl:value-of select="@reference"/>
5493
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
5494
- </xsl:variable>
5495
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
5553
+
5496
5554
  <!-- fn sequence number in document -->
5497
- <xsl:variable name="current_fn_number">
5498
- <xsl:choose>
5499
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
5500
- <xsl:otherwise>
5501
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
5502
- </xsl:otherwise>
5503
- </xsl:choose>
5504
- </xsl:variable>
5555
+ <xsl:variable name="current_fn_number" select="@reference"/>
5556
+
5505
5557
  <xsl:variable name="current_fn_number_text">
5506
5558
 
5507
5559
  <xsl:value-of select="$current_fn_number"/>
5508
5560
 
5509
5561
  </xsl:variable>
5510
5562
 
5511
- <xsl:variable name="ref_id">
5512
- <xsl:choose>
5513
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
5514
- <xsl:otherwise>
5515
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
5516
- </xsl:otherwise>
5517
- </xsl:choose>
5518
- </xsl:variable>
5563
+ <xsl:variable name="ref_id" select="@target"/>
5564
+
5519
5565
  <xsl:variable name="footnote_inline">
5520
5566
  <fo:inline role="Reference">
5521
5567
 
@@ -5560,7 +5606,9 @@
5560
5606
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
5561
5607
  <xsl:copy-of select="$footnote_inline"/>
5562
5608
  </xsl:when>
5609
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
5563
5610
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
5611
+
5564
5612
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
5565
5613
  <xsl:copy-of select="$footnote_inline"/>
5566
5614
  <fo:footnote-body role="Note">
@@ -5577,7 +5625,10 @@
5577
5625
  <xsl:value-of select="$current_fn_number_text"/>
5578
5626
 
5579
5627
  </fo:inline>
5580
- <xsl:apply-templates/>
5628
+ <!-- <xsl:apply-templates /> -->
5629
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
5630
+ <here><xsl:copy-of select="$footnotes"/></here> -->
5631
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
5581
5632
  </xsl:variable>
5582
5633
 
5583
5634
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -5631,83 +5682,136 @@
5631
5682
  </xsl:choose>
5632
5683
  </xsl:template>
5633
5684
 
5634
- <xsl:template name="get_fn_list_for_element">
5635
- <xsl:choose>
5636
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
5637
- <fn gen_id="{generate-id(.)}">
5638
- <xsl:copy-of select="@*"/>
5639
- <xsl:copy-of select="node()"/>
5640
- </fn>
5641
- </xsl:when>
5642
- <xsl:otherwise>
5643
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
5644
- <xsl:variable name="element_id" select="@id"/>
5645
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
5646
- <!-- copy unique fn -->
5647
- <fn gen_id="{generate-id(.)}">
5648
- <xsl:copy-of select="@*"/>
5649
- <xsl:copy-of select="node()"/>
5650
- </fn>
5651
- </xsl:for-each>
5652
- </xsl:for-each>
5653
- </xsl:otherwise>
5654
- </xsl:choose>
5655
- </xsl:template>
5656
5685
  <!-- ============================ -->
5657
5686
  <!-- table's footnotes rendering -->
5658
5687
  <!-- ============================ -->
5659
- <xsl:template name="table_fn_display">
5660
- <xsl:variable name="references">
5661
5688
 
5689
+ <!-- table/fmt-footnote-container -->
5690
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
5691
+
5692
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
5693
+ <xsl:for-each select=".">
5694
+ <xsl:call-template name="table_fn_display"/>
5695
+ </xsl:for-each>
5696
+ </xsl:template>
5697
+
5698
+ <xsl:template name="table_fn_display">
5699
+ <!-- <xsl:variable name="references">
5700
+ <xsl:if test="$namespace = 'bsi'">
5701
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
5702
+ <xsl:call-template name="create_fn" />
5703
+ </xsl:for-each>
5704
+ </xsl:if>
5662
5705
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
5663
- <xsl:call-template name="create_fn"/>
5706
+ <xsl:call-template name="create_fn" />
5664
5707
  </xsl:for-each>
5665
- </xsl:variable>
5666
-
5667
- <xsl:for-each select="xalan:nodeset($references)//fn">
5708
+ </xsl:variable> -->
5709
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
5668
5710
  <xsl:variable name="reference" select="@reference"/>
5669
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5711
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
5712
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
5670
5713
 
5671
5714
  <fo:block xsl:use-attribute-sets="table-fn-style">
5715
+ <xsl:copy-of select="@id"/>
5672
5716
  <xsl:call-template name="refine_table-fn-style"/>
5673
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
5674
- <xsl:call-template name="refine_table-fn-number-style"/>
5675
-
5676
- <xsl:value-of select="@reference"/>
5677
5717
 
5678
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5679
- <!-- <xsl:if test="$namespace = 'itu'">
5680
- <xsl:text>)</xsl:text>
5681
- </xsl:if> -->
5718
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
5719
+ <xsl:with-param name="process">true</xsl:with-param>
5720
+ </xsl:apply-templates>
5682
5721
 
5683
- </fo:inline>
5684
5722
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
5685
- <xsl:copy-of select="./node()"/>
5723
+ <!-- <xsl:copy-of select="./node()"/> -->
5724
+ <xsl:apply-templates/>
5686
5725
  </fo:inline>
5687
5726
 
5688
5727
  </fo:block>
5689
5728
 
5690
- </xsl:if>
5729
+ <!-- </xsl:if> -->
5691
5730
  </xsl:for-each>
5692
5731
  </xsl:template> <!-- table_fn_display -->
5693
5732
 
5733
+ <!-- fmt-fn-body/fmt-fn-label in text -->
5734
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
5735
+
5736
+ <!-- table//fmt-fn-body//fmt-fn-label -->
5737
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
5738
+ <xsl:param name="process">false</xsl:param>
5739
+ <xsl:if test="$process = 'true'">
5740
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
5741
+
5742
+ <!-- tab is padding-right -->
5743
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
5744
+ <xsl:with-param name="process">true</xsl:with-param>
5745
+ </xsl:apply-templates>
5746
+
5747
+ <!-- <xsl:if test="$namespace = 'bipm'">
5748
+ <fo:inline font-style="normal">(</fo:inline>
5749
+ </xsl:if> -->
5750
+
5751
+ <!-- <xsl:if test="$namespace = 'plateau'">
5752
+ <xsl:text>※</xsl:text>
5753
+ </xsl:if> -->
5754
+
5755
+ <!-- <xsl:value-of select="@reference"/> -->
5756
+ <!-- <xsl:value-of select="normalize-space()"/> -->
5757
+ <xsl:apply-templates/>
5758
+
5759
+ <!-- <xsl:if test="$namespace = 'bipm'">
5760
+ <fo:inline font-style="normal">)</fo:inline>
5761
+ </xsl:if> -->
5762
+
5763
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5764
+ <!-- <xsl:if test="$namespace = 'itu'">
5765
+ <xsl:text>)</xsl:text>
5766
+ </xsl:if> -->
5767
+
5768
+ <!-- <xsl:if test="$namespace = 'plateau'">
5769
+ <xsl:text>:</xsl:text>
5770
+ </xsl:if> -->
5771
+
5772
+ </fo:inline>
5773
+ </xsl:if>
5774
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
5775
+
5776
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
5777
+ <xsl:param name="process">false</xsl:param>
5778
+ <xsl:if test="$process = 'true'">
5779
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
5780
+
5781
+ </xsl:if>
5782
+ </xsl:template>
5783
+
5784
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
5785
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
5786
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
5787
+ <xsl:apply-templates/>
5788
+ </fo:inline>
5789
+ </xsl:template>
5790
+
5791
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
5792
+ <!--
5694
5793
  <xsl:template name="create_fn">
5695
5794
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5696
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5795
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
5697
5796
  <xsl:attribute name="id">
5698
5797
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5699
5798
  </xsl:attribute>
5700
5799
  </xsl:if>
5701
-
5800
+ <xsl:if test="$namespace = 'itu'">
5801
+ <xsl:if test="ancestor::*[local-name()='preface']">
5802
+ <xsl:attribute name="preface">true</xsl:attribute>
5803
+ </xsl:if>
5804
+ </xsl:if>
5805
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5702
5806
  <xsl:attribute name="id">
5703
5807
  <xsl:value-of select="@reference"/>
5704
5808
  <xsl:text>_</xsl:text>
5705
5809
  <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5706
5810
  </xsl:attribute>
5707
-
5708
- <xsl:apply-templates/>
5811
+ </xsl:if>
5812
+ <xsl:apply-templates />
5709
5813
  </fn>
5710
- </xsl:template>
5814
+ </xsl:template> -->
5711
5815
 
5712
5816
  <!-- footnotes for table's name rendering -->
5713
5817
  <xsl:template name="table_name_fn_display">
@@ -5726,123 +5830,171 @@
5726
5830
  <!-- ============================ -->
5727
5831
  <!-- figure's footnotes rendering -->
5728
5832
  <!-- ============================ -->
5729
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
5730
5833
 
5731
- <!-- current figure id -->
5732
- <xsl:variable name="figure_id_">
5733
- <xsl:value-of select="@id"/>
5734
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
5735
- </xsl:variable>
5736
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
5834
+ <!-- figure/fmt-footnote-container -->
5835
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
5836
+
5837
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
5838
+ <xsl:template name="figure_fn_display">
5737
5839
 
5738
- <!-- all footnotes relates to the current figure -->
5739
5840
  <xsl:variable name="references">
5740
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
5741
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5742
- <xsl:apply-templates/>
5743
- </fn>
5841
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
5842
+ <xsl:variable name="curr_id" select="@id"/>
5843
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
5844
+ <curr><xsl:copy-of select="."/></curr>
5845
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
5846
+ <xsl:choose>
5847
+ <!-- skip figure/name/fn -->
5848
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
5849
+ <xsl:otherwise>
5850
+ <xsl:element name="figure" namespace="{$namespace_full}">
5851
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
5852
+ <xsl:copy-of select="."/>
5853
+ </xsl:element>
5854
+ </xsl:element>
5855
+ </xsl:otherwise>
5856
+ </xsl:choose>
5744
5857
  </xsl:for-each>
5745
5858
  </xsl:variable>
5859
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
5746
5860
 
5747
- <xsl:if test="xalan:nodeset($references)//fn">
5861
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
5748
5862
 
5749
5863
  <xsl:variable name="key_iso">
5750
5864
 
5751
5865
  </xsl:variable>
5752
5866
 
5753
5867
  <fo:block>
5868
+ <!-- current hierarchy is 'figure' element -->
5869
+ <xsl:variable name="following_dl_colwidths">
5870
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5871
+ <xsl:variable name="simple-table">
5872
+ <!-- <xsl:variable name="doc_ns">
5873
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5874
+ </xsl:variable>
5875
+ <xsl:variable name="ns">
5876
+ <xsl:choose>
5877
+ <xsl:when test="normalize-space($doc_ns) != ''">
5878
+ <xsl:value-of select="normalize-space($doc_ns)"/>
5879
+ </xsl:when>
5880
+ <xsl:otherwise>
5881
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
5882
+ </xsl:otherwise>
5883
+ </xsl:choose>
5884
+ </xsl:variable> -->
5754
5885
 
5755
- <!-- current hierarchy is 'figure' element -->
5756
- <xsl:variable name="following_dl_colwidths">
5757
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5758
- <xsl:variable name="simple-table">
5759
- <!-- <xsl:variable name="doc_ns">
5760
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5761
- </xsl:variable>
5762
- <xsl:variable name="ns">
5763
- <xsl:choose>
5764
- <xsl:when test="normalize-space($doc_ns) != ''">
5765
- <xsl:value-of select="normalize-space($doc_ns)"/>
5766
- </xsl:when>
5767
- <xsl:otherwise>
5768
- <xsl:value-of select="substring-before(name(/*), '-')"/>
5769
- </xsl:otherwise>
5770
- </xsl:choose>
5771
- </xsl:variable> -->
5886
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5887
+ <tbody>
5888
+ <xsl:apply-templates mode="dl"/>
5889
+ </tbody>
5890
+ </xsl:for-each>
5891
+ </xsl:variable>
5772
5892
 
5773
- <xsl:for-each select="*[local-name() = 'dl'][1]">
5774
- <tbody>
5775
- <xsl:apply-templates mode="dl"/>
5776
- </tbody>
5777
- </xsl:for-each>
5778
- </xsl:variable>
5893
+ <xsl:call-template name="calculate-column-widths">
5894
+ <xsl:with-param name="cols-count" select="2"/>
5895
+ <xsl:with-param name="table" select="$simple-table"/>
5896
+ </xsl:call-template>
5779
5897
 
5780
- <xsl:call-template name="calculate-column-widths">
5781
- <xsl:with-param name="cols-count" select="2"/>
5782
- <xsl:with-param name="table" select="$simple-table"/>
5783
- </xsl:call-template>
5898
+ </xsl:if>
5899
+ </xsl:variable>
5784
5900
 
5785
- </xsl:if>
5786
- </xsl:variable>
5901
+ <xsl:variable name="maxlength_dt">
5902
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5903
+ <xsl:call-template name="getMaxLength_dt"/>
5904
+ </xsl:for-each>
5905
+ </xsl:variable>
5787
5906
 
5788
- <xsl:variable name="maxlength_dt">
5789
- <xsl:for-each select="*[local-name() = 'dl'][1]">
5790
- <xsl:call-template name="getMaxLength_dt"/>
5791
- </xsl:for-each>
5792
- </xsl:variable>
5907
+ <fo:table width="95%" table-layout="fixed">
5908
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5909
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5910
+
5911
+ </xsl:if>
5912
+ <xsl:choose>
5913
+ <!-- if there 'dl', then set same columns width -->
5914
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5915
+ <xsl:call-template name="setColumnWidth_dl">
5916
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5917
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5918
+ </xsl:call-template>
5919
+ </xsl:when>
5920
+ <xsl:otherwise>
5921
+ <fo:table-column column-width="5%"/>
5922
+ <fo:table-column column-width="95%"/>
5923
+ </xsl:otherwise>
5924
+ </xsl:choose>
5925
+ <fo:table-body>
5926
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
5927
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
5793
5928
 
5794
- <fo:table width="95%" table-layout="fixed">
5795
- <xsl:if test="normalize-space($key_iso) = 'true'">
5796
- <xsl:attribute name="font-size">10pt</xsl:attribute>
5929
+ <xsl:variable name="reference" select="@reference"/>
5930
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
5931
+ <fo:table-row>
5932
+ <fo:table-cell>
5933
+ <fo:block>
5797
5934
 
5798
- </xsl:if>
5799
- <xsl:choose>
5800
- <!-- if there 'dl', then set same columns width -->
5801
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5802
- <xsl:call-template name="setColumnWidth_dl">
5803
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5804
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5805
- </xsl:call-template>
5806
- </xsl:when>
5807
- <xsl:otherwise>
5808
- <fo:table-column column-width="5%"/>
5809
- <fo:table-column column-width="95%"/>
5810
- </xsl:otherwise>
5811
- </xsl:choose>
5812
- <fo:table-body>
5813
- <xsl:for-each select="xalan:nodeset($references)//fn">
5814
- <xsl:variable name="reference" select="@reference"/>
5815
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5816
- <fo:table-row>
5817
- <fo:table-cell>
5818
- <fo:block>
5819
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
5820
- <xsl:value-of select="@reference"/>
5935
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
5936
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
5937
+ <!-- <xsl:value-of select="@reference"/> -->
5938
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
5821
5939
  </fo:inline>
5822
- </fo:block>
5823
- </fo:table-cell>
5824
- <fo:table-cell>
5825
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5826
- <xsl:if test="normalize-space($key_iso) = 'true'">
5827
5940
 
5828
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
5941
+ </fo:block>
5942
+ </fo:table-cell>
5943
+ <fo:table-cell>
5944
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5945
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5829
5946
 
5830
- </xsl:if>
5831
- <xsl:copy-of select="./node()"/>
5832
- </fo:block>
5833
- </fo:table-cell>
5834
- </fo:table-row>
5835
- </xsl:if>
5836
- </xsl:for-each>
5837
- </fo:table-body>
5838
- </fo:table>
5947
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5948
+
5949
+ </xsl:if>
5839
5950
 
5951
+ <!-- <xsl:copy-of select="./node()"/> -->
5952
+ <xsl:apply-templates/>
5953
+ </fo:block>
5954
+ </fo:table-cell>
5955
+ </fo:table-row>
5956
+ <!-- </xsl:if> -->
5957
+ </xsl:for-each>
5958
+ </fo:table-body>
5959
+ </fo:table>
5840
5960
  </fo:block>
5841
5961
  </xsl:if>
5842
- </xsl:template> <!-- fn_display_figure -->
5962
+ </xsl:template> <!-- figure_fn_display -->
5963
+
5964
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
5965
+ <xsl:param name="process">false</xsl:param>
5966
+ <xsl:if test="$process = 'true'">
5967
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
5968
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
5969
+
5970
+ <!-- tab is padding-right -->
5971
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
5972
+ <xsl:with-param name="process">true</xsl:with-param>
5973
+ </xsl:apply-templates>
5974
+
5975
+ <xsl:apply-templates/>
5976
+
5977
+ </fo:inline>
5978
+ </xsl:if>
5979
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
5980
+
5981
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
5982
+ <xsl:param name="process">false</xsl:param>
5983
+ <xsl:if test="$process = 'true'">
5984
+
5985
+ </xsl:if>
5986
+ </xsl:template>
5987
+
5988
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
5989
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
5990
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
5991
+ <xsl:apply-templates/>
5992
+ </fo:inline>
5993
+ </xsl:template>
5843
5994
 
5844
5995
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
5845
5996
  <!-- figure's footnote label -->
5997
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
5846
5998
  <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">
5847
5999
  <xsl:variable name="key_iso">
5848
6000
 
@@ -5851,7 +6003,7 @@
5851
6003
  <xsl:attribute name="font-size">10pt</xsl:attribute>
5852
6004
 
5853
6005
  </xsl:if>
5854
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
6006
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
5855
6007
  <!-- <xsl:value-of select="@reference"/> -->
5856
6008
  <xsl:apply-templates/>
5857
6009
  </fo:inline>
@@ -5861,43 +6013,65 @@
5861
6013
  <!-- END: figure's footnotes rendering -->
5862
6014
  <!-- ============================ -->
5863
6015
 
5864
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
6016
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
6017
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
5865
6018
  <xsl:template match="*[local-name()='fn']">
5866
6019
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
5867
6020
 
5868
6021
  <xsl:call-template name="refine_fn-reference-style"/>
5869
6022
 
5870
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5871
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5872
- <xsl:attribute name="internal-destination">
6023
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
6024
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
6025
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
6026
+ <!-- <xsl:attribute name="internal-destination">
5873
6027
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5874
6028
  </xsl:attribute>
5875
6029
  </xsl:if>
5876
-
6030
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5877
6031
  <xsl:attribute name="internal-destination">
5878
6032
  <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
5879
6033
  <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5880
6034
  </xsl:attribute>
6035
+ </xsl:if> -->
6036
+ <!-- <xsl:if test="$namespace = 'plateau'">
6037
+ <xsl:text>※</xsl:text>
6038
+ </xsl:if> -->
6039
+ <!-- <xsl:value-of select="@reference"/> -->
5881
6040
 
5882
- <xsl:value-of select="@reference"/>
6041
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5883
6042
 
6043
+ <!-- <xsl:if test="$namespace = 'bsi'">
6044
+ <xsl:text>)</xsl:text>
6045
+ </xsl:if> -->
5884
6046
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5885
6047
  <!-- <xsl:if test="$namespace = 'jis'">
5886
6048
  <fo:inline font-weight="normal">)</fo:inline>
5887
6049
  </xsl:if> -->
5888
6050
  </fo:basic-link>
5889
6051
  </fo:inline>
5890
- </xsl:template>
6052
+ </xsl:template> <!-- fn -->
5891
6053
 
6054
+ <!-- fn/text() -->
5892
6055
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
5893
6056
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
5894
6057
  </xsl:template>
5895
6058
 
5896
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
6059
+ <!-- fn//p fmt-fn-body//p -->
6060
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
5897
6061
  <fo:inline role="P">
5898
6062
  <xsl:apply-templates/>
5899
6063
  </fo:inline>
5900
6064
  </xsl:template>
6065
+
6066
+ <xsl:template name="insertFootnoteSeparatorCommon">
6067
+ <xsl:param name="leader_length">30%</xsl:param>
6068
+ <fo:static-content flow-name="xsl-footnote-separator">
6069
+ <fo:block>
6070
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
6071
+ </fo:block>
6072
+ </fo:static-content>
6073
+ </xsl:template>
6074
+
5901
6075
  <!-- ===================== -->
5902
6076
  <!-- END Footnotes processing -->
5903
6077
  <!-- ===================== -->
@@ -6174,11 +6348,11 @@
6174
6348
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
6175
6349
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
6176
6350
 
6177
- <xsl:call-template name="setColumnWidth_dl">
6178
- <xsl:with-param name="colwidths" select="$colwidths"/>
6179
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6180
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
6181
- </xsl:call-template>
6351
+ <xsl:call-template name="setColumnWidth_dl">
6352
+ <xsl:with-param name="colwidths" select="$colwidths"/>
6353
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6354
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
6355
+ </xsl:call-template>
6182
6356
 
6183
6357
  <fo:table-body>
6184
6358
 
@@ -6212,6 +6386,14 @@
6212
6386
 
6213
6387
  </xsl:template> <!-- END: dl -->
6214
6388
 
6389
+ <xsl:template match="@*|node()" mode="dt_clean">
6390
+ <xsl:copy>
6391
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
6392
+ </xsl:copy>
6393
+ </xsl:template>
6394
+
6395
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
6396
+
6215
6397
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
6216
6398
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
6217
6399
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -6241,10 +6423,12 @@
6241
6423
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
6242
6424
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
6243
6425
 
6426
+ <!-- dl/name -->
6244
6427
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
6245
6428
  <xsl:param name="process">false</xsl:param>
6246
6429
  <xsl:if test="$process = 'true'">
6247
6430
  <fo:block xsl:use-attribute-sets="dl-name-style">
6431
+
6248
6432
  <xsl:apply-templates/>
6249
6433
  </fo:block>
6250
6434
  </xsl:if>
@@ -6258,6 +6442,10 @@
6258
6442
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
6259
6443
 
6260
6444
  <xsl:choose>
6445
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
6446
+ <fo:table-column column-width="10%"/>
6447
+ <fo:table-column column-width="90%"/>
6448
+ </xsl:when> -->
6261
6449
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
6262
6450
  <xsl:call-template name="insertTableColumnWidth">
6263
6451
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -7063,7 +7251,7 @@
7063
7251
  <xsl:choose>
7064
7252
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
7065
7253
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
7066
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
7254
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
7067
7255
  </xsl:when>
7068
7256
  <xsl:otherwise>
7069
7257
  <xsl:apply-templates/>
@@ -7071,7 +7259,7 @@
7071
7259
  </xsl:choose>
7072
7260
  </xsl:template>
7073
7261
  <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">
7074
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
7262
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
7075
7263
  </xsl:template>
7076
7264
 
7077
7265
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -8111,24 +8299,26 @@
8111
8299
  <xsl:apply-templates select="." mode="mathml"/>
8112
8300
  </xsl:variable>
8113
8301
 
8114
- <fo:instream-foreign-object fox:alt-text="Math">
8302
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
8115
8303
 
8116
8304
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
8117
8305
 
8118
- <!-- put MathML in Actual Text -->
8119
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
8120
- <xsl:attribute name="fox:actual-text">
8121
- <xsl:value-of select="$mathml_content"/>
8122
- </xsl:attribute>
8123
-
8124
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8125
- <xsl:if test="normalize-space($asciimath_text_) != ''">
8126
- <!-- put Mathin Alternate Text -->
8127
- <xsl:attribute name="fox:alt-text">
8128
- <xsl:value-of select="$asciimath_text_"/>
8306
+ <xsl:if test="$isGenerateTableIF = 'false'">
8307
+ <!-- put MathML in Actual Text -->
8308
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
8309
+ <xsl:attribute name="fox:actual-text">
8310
+ <xsl:value-of select="$mathml_content"/>
8129
8311
  </xsl:attribute>
8312
+
8313
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
8314
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
8315
+ <!-- put Mathin Alternate Text -->
8316
+ <xsl:attribute name="fox:alt-text">
8317
+ <xsl:value-of select="$asciimath_text_"/>
8318
+ </xsl:attribute>
8319
+ </xsl:if>
8320
+ <!-- </xsl:if> -->
8130
8321
  </xsl:if>
8131
- <!-- </xsl:if> -->
8132
8322
 
8133
8323
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
8134
8324
 
@@ -8391,6 +8581,27 @@
8391
8581
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8392
8582
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8393
8583
  </xsl:when> -->
8584
+
8585
+ <!-- <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'))">
8586
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8587
+ <xsl:variable name="filename">
8588
+ <xsl:call-template name="substring-after-last">
8589
+ <xsl:with-param name="value" select="$target_"/>
8590
+ <xsl:with-param name="delimiter" select="'/'"/>
8591
+ </xsl:call-template>
8592
+ </xsl:variable>
8593
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
8594
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
8595
+ <xsl:choose>
8596
+ <xsl:when test="$file_exists = 'true'">
8597
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
8598
+ </xsl:when>
8599
+ <xsl:otherwise>
8600
+ <xsl:value-of select="normalize-space(@target)"/>
8601
+ </xsl:otherwise>
8602
+ </xsl:choose>
8603
+ </xsl:when> -->
8604
+
8394
8605
  <xsl:otherwise>
8395
8606
  <xsl:value-of select="normalize-space(@target)"/>
8396
8607
  </xsl:otherwise>
@@ -8699,7 +8910,7 @@
8699
8910
 
8700
8911
  <xsl:template name="refine_note_block_style">
8701
8912
 
8702
- </xsl:template>
8913
+ </xsl:template> <!-- refine_note_block_style -->
8703
8914
 
8704
8915
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
8705
8916
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -8893,10 +9104,21 @@
8893
9104
  </xsl:template>
8894
9105
 
8895
9106
  <xsl:template name="showFigureKey">
8896
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8897
- <xsl:call-template name="note"/>
9107
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
9108
+ <xsl:choose>
9109
+ <xsl:when test="local-name() = 'note'">
9110
+ <xsl:call-template name="note"/>
9111
+ </xsl:when>
9112
+ <xsl:when test="local-name() = 'example'">
9113
+ <xsl:call-template name="example"/>
9114
+ </xsl:when>
9115
+ <xsl:otherwise>
9116
+ <xsl:apply-templates select="."/>
9117
+ </xsl:otherwise>
9118
+ </xsl:choose>
8898
9119
  </xsl:for-each>
8899
- <xsl:call-template name="fn_display_figure"/>
9120
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
9121
+ <xsl:call-template name="figure_fn_display"/>
8900
9122
  </xsl:template>
8901
9123
 
8902
9124
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -9790,10 +10012,10 @@
9790
10012
  <xsl:when test="@type = 'section-title'">
9791
10013
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9792
10014
  <xsl:text>: </xsl:text>
9793
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
10015
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
9794
10016
  </xsl:when>
9795
10017
  <xsl:otherwise>
9796
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
10018
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
9797
10019
  </xsl:otherwise>
9798
10020
  </xsl:choose>
9799
10021
  </xsl:when>
@@ -9858,6 +10080,8 @@
9858
10080
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
9859
10081
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
9860
10082
 
10083
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
10084
+
9861
10085
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
9862
10086
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
9863
10087
  <xsl:apply-templates mode="bookmarks"/>
@@ -9879,6 +10103,8 @@
9879
10103
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
9880
10104
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
9881
10105
 
10106
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
10107
+
9882
10108
  <!-- Bookmarks -->
9883
10109
  <xsl:template name="addBookmarks">
9884
10110
  <xsl:param name="contents"/>
@@ -10090,9 +10316,15 @@
10090
10316
  </xsl:if>
10091
10317
  </xsl:template>
10092
10318
 
10319
+ <!-- figure/fn -->
10093
10320
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
10094
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
10321
+ <!-- figure/note -->
10322
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
10323
+ <!-- figure/example -->
10324
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
10095
10325
 
10326
+ <!-- figure/note[@type = 'units'] -->
10327
+ <!-- image/note[@type = 'units'] -->
10096
10328
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
10097
10329
  <fo:block text-align="right" keep-with-next="always">
10098
10330
  <xsl:apply-templates/>
@@ -10213,6 +10445,7 @@
10213
10445
  </xsl:choose>
10214
10446
  </xsl:template>
10215
10447
 
10448
+ <!-- fn -->
10216
10449
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
10217
10450
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
10218
10451
 
@@ -11143,7 +11376,7 @@
11143
11376
  text line 1
11144
11377
  text line 2
11145
11378
  -->
11146
- <xsl:template match="*[local-name() = 'example']">
11379
+ <xsl:template match="*[local-name() = 'example']" name="example">
11147
11380
 
11148
11381
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11149
11382
 
@@ -11249,6 +11482,7 @@
11249
11482
 
11250
11483
  </xsl:template>
11251
11484
 
11485
+ <!-- example/name -->
11252
11486
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
11253
11487
  <xsl:param name="fo_element">block</xsl:param>
11254
11488
 
@@ -11274,7 +11508,8 @@
11274
11508
 
11275
11509
  </xsl:template>
11276
11510
 
11277
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
11511
+ <!-- table/example/name, table/tfoot//example/name -->
11512
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
11278
11513
  <fo:inline xsl:use-attribute-sets="example-name-style">
11279
11514
 
11280
11515
  <xsl:apply-templates/>
@@ -11632,6 +11867,8 @@
11632
11867
 
11633
11868
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
11634
11869
 
11870
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
11871
+
11635
11872
  </xsl:template>
11636
11873
 
11637
11874
  <xsl:template name="insertNonBreakSpaces">
@@ -11743,21 +11980,32 @@
11743
11980
  <!-- ========== -->
11744
11981
 
11745
11982
  <xsl:variable name="reviews_">
11746
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
11983
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
11747
11984
  <xsl:copy>
11748
11985
  <xsl:copy-of select="@from"/>
11749
11986
  <xsl:copy-of select="@id"/>
11750
11987
  </xsl:copy>
11751
11988
  </xsl:for-each>
11989
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
11990
+ <xsl:copy>
11991
+ <xsl:copy-of select="@source"/>
11992
+ <xsl:copy-of select="@id"/>
11993
+ </xsl:copy>
11994
+ </xsl:for-each>
11752
11995
  </xsl:variable>
11753
11996
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
11754
11997
 
11755
11998
  <xsl:template name="addReviewHelper">
11756
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
11757
- <xsl:variable name="curr_id" select="@id"/>
11758
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
11759
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
11760
- <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>
11999
+ <xsl:if test="$isGenerateTableIF = 'false'">
12000
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
12001
+ <xsl:variable name="curr_id" select="@id"/>
12002
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
12003
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
12004
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
12005
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
12006
+ <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>
12007
+ </xsl:if>
12008
+ </xsl:for-each>
11761
12009
  </xsl:if>
11762
12010
  <!-- <fo:block>
11763
12011
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -11899,14 +12147,61 @@
11899
12147
 
11900
12148
  </xsl:template>
11901
12149
 
11902
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
12150
+ <!-- document text (not figures, or tables) footnotes -->
12151
+ <xsl:variable name="reviews_container_">
12152
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
12153
+ <xsl:variable name="update_xml_step1">
12154
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
12155
+ </xsl:variable>
12156
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
12157
+ </xsl:for-each>
12158
+ </xsl:variable>
12159
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
12160
+
12161
+ <xsl:template match="*[local-name() = 'review-container']"/>
12162
+
12163
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
12164
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
12165
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
12166
+ <xsl:if test="$isGenerateTableIF = 'false'">
12167
+ <xsl:choose>
12168
+ <!-- if there isn't the attribute '@from', then -->
12169
+ <xsl:when test="$id_from = ''">
12170
+ <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>
12171
+ </xsl:when>
12172
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
12173
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
12174
+ <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>
12175
+ </xsl:when>
12176
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
12177
+ <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>
12178
+ </xsl:when>
12179
+ </xsl:choose>
12180
+ </xsl:if>
12181
+ </xsl:template>
12182
+
12183
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
12184
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11903
12185
  <!-- comment 2019-11-29 -->
11904
12186
  <!-- <fo:block font-weight="bold">Review:</fo:block>
11905
12187
  <xsl:apply-templates /> -->
11906
12188
 
11907
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
12189
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
11908
12190
 
11909
- <xsl:if test="1 = 1">
12191
+ <xsl:variable name="source" select="normalize-space(@source)"/>
12192
+
12193
+ <xsl:if test="$isGenerateTableIF = 'false'">
12194
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
12195
+
12196
+ <!-- <xsl:if test="@source = @end"> -->
12197
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
12198
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
12199
+ <!-- <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> -->
12200
+ <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>
12201
+ <!-- </xsl:if> -->
12202
+ </xsl:if>
12203
+
12204
+ <xsl:if test="1 = 2">
11910
12205
  <xsl:choose>
11911
12206
  <!-- if there isn't the attribute '@from', then -->
11912
12207
  <xsl:when test="$id_from = ''">
@@ -11914,10 +12209,10 @@
11914
12209
  </xsl:when>
11915
12210
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
11916
12211
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
11917
- <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>
12212
+ <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>
11918
12213
  </xsl:when>
11919
12214
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11920
- <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>
12215
+ <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>
11921
12216
  </xsl:when>
11922
12217
  </xsl:choose>
11923
12218
  </xsl:if>
@@ -11966,16 +12261,21 @@
11966
12261
  <xsl:variable name="list_level">
11967
12262
  <xsl:choose>
11968
12263
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
11969
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
12264
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
12265
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
12266
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
11970
12267
  </xsl:choose>
11971
12268
  </xsl:variable>
11972
12269
  <xsl:choose>
11973
12270
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
11974
12271
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
11975
12272
  </xsl:when>
11976
- <xsl:when test="$list_level mod 3 = 0">
12273
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
11977
12274
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
11978
12275
  </xsl:when>
12276
+ <xsl:when test="$list_level mod 3 = 0">
12277
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
12278
+ </xsl:when>
11979
12279
  <xsl:when test="$list_level mod 2 = 0">
11980
12280
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
11981
12281
  </xsl:when>
@@ -12518,10 +12818,22 @@
12518
12818
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
12519
12819
 
12520
12820
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
12521
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
12522
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
12523
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
12524
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
12821
+ <xsl:variable name="bookmark_id" select="@id"/>
12822
+ <xsl:choose>
12823
+ <!-- Example:
12824
+ <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"/>
12825
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
12826
+ <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"/> -->
12827
+ <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]">
12828
+ <!-- skip here, see the template 'fmt-review-start' -->
12829
+ </xsl:when>
12830
+ <xsl:otherwise>
12831
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
12832
+ <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>
12833
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
12834
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
12835
+ </xsl:otherwise>
12836
+ </xsl:choose>
12525
12837
  </xsl:template>
12526
12838
  <!-- =================== -->
12527
12839
  <!-- End of Index processing -->
@@ -12903,8 +13215,33 @@
12903
13215
 
12904
13216
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
12905
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> -->
13219
+ <!-- <test><xsl:copy-of select="."/></test> -->
13220
+
12906
13221
  <xsl:variable name="target" select="@target"/>
13222
+
12907
13223
  <xsl:for-each select="*[local-name() = 'tab']">
13224
+
13225
+ <xsl:if test="position() = 1">
13226
+ <!-- first column (data before first `tab`) -->
13227
+ <fo:table-cell>
13228
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
13229
+ <xsl:call-template name="insert_basic_link">
13230
+ <xsl:with-param name="element">
13231
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
13232
+ <xsl:for-each select="preceding-sibling::node()">
13233
+ <xsl:choose>
13234
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13235
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
13236
+ </xsl:choose>
13237
+ </xsl:for-each>
13238
+ </fo:basic-link>
13239
+ </xsl:with-param>
13240
+ </xsl:call-template>
13241
+ </fo:block>
13242
+ </fo:table-cell>
13243
+ </xsl:if>
13244
+
12908
13245
  <xsl:variable name="current_id" select="generate-id()"/>
12909
13246
  <fo:table-cell>
12910
13247
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -12955,11 +13292,25 @@
12955
13292
 
12956
13293
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
12957
13294
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
13295
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12958
13296
  <xsl:for-each select="*[local-name() = 'tab']">
13297
+ <xsl:if test="position() = 1">
13298
+ <td>
13299
+ <xsl:for-each select="preceding-sibling::node()">
13300
+ <xsl:choose>
13301
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13302
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
13303
+ </xsl:choose>
13304
+ </xsl:for-each>
13305
+ </td>
13306
+ </xsl:if>
12959
13307
  <xsl:variable name="current_id" select="generate-id()"/>
12960
13308
  <td>
12961
13309
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
12962
- <xsl:copy-of select="."/>
13310
+ <xsl:choose>
13311
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13312
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
13313
+ </xsl:choose>
12963
13314
  </xsl:for-each>
12964
13315
  </td>
12965
13316
  </xsl:for-each>
@@ -13836,6 +14187,9 @@
13836
14187
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
13837
14188
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
13838
14189
 
14190
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
14191
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
14192
+
13839
14193
  <!-- END: update new Presentation XML -->
13840
14194
 
13841
14195
  <!-- =========================================================================== -->
@@ -14359,6 +14713,7 @@
14359
14713
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
14360
14714
  </fn>
14361
14715
  -->
14716
+ <!-- fn in text -->
14362
14717
  <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">
14363
14718
  <xsl:variable name="p_fn_">
14364
14719
  <xsl:call-template name="get_fn_list"/>