metanorma-ogc 2.7.1 → 2.7.2

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">
@@ -5418,6 +5437,17 @@
5418
5437
  <xsl:attribute name="text-align">left</xsl:attribute>
5419
5438
  </xsl:if>
5420
5439
 
5440
+ <xsl:if test="$isGenerateTableIF = 'false'">
5441
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
5442
+ <xsl:attribute name="text-align">right</xsl:attribute>
5443
+ <xsl:attribute name="border">none</xsl:attribute>
5444
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
5445
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
5446
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
5447
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
5448
+ </xsl:if>
5449
+ </xsl:if>
5450
+
5421
5451
  <fo:block role="SKIP">
5422
5452
 
5423
5453
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -5436,7 +5466,8 @@
5436
5466
  </fo:table-cell>
5437
5467
  </xsl:template> <!-- td -->
5438
5468
 
5439
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
5469
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
5470
+ <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
5471
 
5441
5472
  <fo:block xsl:use-attribute-sets="table-note-style">
5442
5473
  <xsl:copy-of select="@id"/>
@@ -5457,65 +5488,54 @@
5457
5488
 
5458
5489
  </xsl:template> <!-- table/note -->
5459
5490
 
5460
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
5491
+ <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
5492
  <xsl:apply-templates/>
5462
5493
  </xsl:template>
5463
5494
 
5464
5495
  <!-- ===================== -->
5465
5496
  <!-- Footnotes processing -->
5466
5497
  <!-- ===================== -->
5498
+
5499
+ <!-- document text (not figures, or tables) footnotes -->
5500
+ <xsl:variable name="footnotes_">
5501
+ <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 -->
5502
+ <!-- <xsl:copy-of select="."/> -->
5503
+ <xsl:variable name="update_xml_step1">
5504
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
5505
+ </xsl:variable>
5506
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
5507
+ </xsl:for-each>
5508
+ </xsl:variable>
5509
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
5510
+
5467
5511
  <!--
5468
5512
  <fn reference="1">
5469
5513
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
5470
5514
  </fn>
5471
5515
  -->
5472
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
5516
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
5517
+ <!-- fn in text -->
5473
5518
  <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
5519
 
5475
- <!-- list of footnotes to calculate actual footnotes number -->
5520
+ <!-- list of unique footnotes -->
5476
5521
  <xsl:variable name="p_fn_">
5477
5522
  <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
5523
  </xsl:variable>
5487
5524
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
5488
5525
 
5489
5526
  <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_)"/>
5527
+
5496
5528
  <!-- 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>
5529
+ <xsl:variable name="current_fn_number" select="@reference"/>
5530
+
5505
5531
  <xsl:variable name="current_fn_number_text">
5506
5532
 
5507
5533
  <xsl:value-of select="$current_fn_number"/>
5508
5534
 
5509
5535
  </xsl:variable>
5510
5536
 
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>
5537
+ <xsl:variable name="ref_id" select="@target"/>
5538
+
5519
5539
  <xsl:variable name="footnote_inline">
5520
5540
  <fo:inline role="Reference">
5521
5541
 
@@ -5560,7 +5580,9 @@
5560
5580
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
5561
5581
  <xsl:copy-of select="$footnote_inline"/>
5562
5582
  </xsl:when>
5583
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
5563
5584
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
5585
+
5564
5586
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
5565
5587
  <xsl:copy-of select="$footnote_inline"/>
5566
5588
  <fo:footnote-body role="Note">
@@ -5577,7 +5599,10 @@
5577
5599
  <xsl:value-of select="$current_fn_number_text"/>
5578
5600
 
5579
5601
  </fo:inline>
5580
- <xsl:apply-templates/>
5602
+ <!-- <xsl:apply-templates /> -->
5603
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
5604
+ <here><xsl:copy-of select="$footnotes"/></here> -->
5605
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
5581
5606
  </xsl:variable>
5582
5607
 
5583
5608
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -5631,83 +5656,136 @@
5631
5656
  </xsl:choose>
5632
5657
  </xsl:template>
5633
5658
 
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
5659
  <!-- ============================ -->
5657
5660
  <!-- table's footnotes rendering -->
5658
5661
  <!-- ============================ -->
5659
- <xsl:template name="table_fn_display">
5660
- <xsl:variable name="references">
5661
5662
 
5663
+ <!-- table/fmt-footnote-container -->
5664
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
5665
+
5666
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
5667
+ <xsl:for-each select=".">
5668
+ <xsl:call-template name="table_fn_display"/>
5669
+ </xsl:for-each>
5670
+ </xsl:template>
5671
+
5672
+ <xsl:template name="table_fn_display">
5673
+ <!-- <xsl:variable name="references">
5674
+ <xsl:if test="$namespace = 'bsi'">
5675
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
5676
+ <xsl:call-template name="create_fn" />
5677
+ </xsl:for-each>
5678
+ </xsl:if>
5662
5679
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
5663
- <xsl:call-template name="create_fn"/>
5680
+ <xsl:call-template name="create_fn" />
5664
5681
  </xsl:for-each>
5665
- </xsl:variable>
5666
-
5667
- <xsl:for-each select="xalan:nodeset($references)//fn">
5682
+ </xsl:variable> -->
5683
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
5668
5684
  <xsl:variable name="reference" select="@reference"/>
5669
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
5685
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
5686
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
5670
5687
 
5671
5688
  <fo:block xsl:use-attribute-sets="table-fn-style">
5689
+ <xsl:copy-of select="@id"/>
5672
5690
  <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
5691
 
5676
- <xsl:value-of select="@reference"/>
5677
-
5678
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5679
- <!-- <xsl:if test="$namespace = 'itu'">
5680
- <xsl:text>)</xsl:text>
5681
- </xsl:if> -->
5692
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
5693
+ <xsl:with-param name="process">true</xsl:with-param>
5694
+ </xsl:apply-templates>
5682
5695
 
5683
- </fo:inline>
5684
5696
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
5685
- <xsl:copy-of select="./node()"/>
5697
+ <!-- <xsl:copy-of select="./node()"/> -->
5698
+ <xsl:apply-templates/>
5686
5699
  </fo:inline>
5687
5700
 
5688
5701
  </fo:block>
5689
5702
 
5690
- </xsl:if>
5703
+ <!-- </xsl:if> -->
5691
5704
  </xsl:for-each>
5692
5705
  </xsl:template> <!-- table_fn_display -->
5693
5706
 
5707
+ <!-- fmt-fn-body/fmt-fn-label in text -->
5708
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
5709
+
5710
+ <!-- table//fmt-fn-body//fmt-fn-label -->
5711
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
5712
+ <xsl:param name="process">false</xsl:param>
5713
+ <xsl:if test="$process = 'true'">
5714
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
5715
+
5716
+ <!-- tab is padding-right -->
5717
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
5718
+ <xsl:with-param name="process">true</xsl:with-param>
5719
+ </xsl:apply-templates>
5720
+
5721
+ <!-- <xsl:if test="$namespace = 'bipm'">
5722
+ <fo:inline font-style="normal">(</fo:inline>
5723
+ </xsl:if> -->
5724
+
5725
+ <!-- <xsl:if test="$namespace = 'plateau'">
5726
+ <xsl:text>※</xsl:text>
5727
+ </xsl:if> -->
5728
+
5729
+ <!-- <xsl:value-of select="@reference"/> -->
5730
+ <!-- <xsl:value-of select="normalize-space()"/> -->
5731
+ <xsl:apply-templates/>
5732
+
5733
+ <!-- <xsl:if test="$namespace = 'bipm'">
5734
+ <fo:inline font-style="normal">)</fo:inline>
5735
+ </xsl:if> -->
5736
+
5737
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
5738
+ <!-- <xsl:if test="$namespace = 'itu'">
5739
+ <xsl:text>)</xsl:text>
5740
+ </xsl:if> -->
5741
+
5742
+ <!-- <xsl:if test="$namespace = 'plateau'">
5743
+ <xsl:text>:</xsl:text>
5744
+ </xsl:if> -->
5745
+
5746
+ </fo:inline>
5747
+ </xsl:if>
5748
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
5749
+
5750
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
5751
+ <xsl:param name="process">false</xsl:param>
5752
+ <xsl:if test="$process = 'true'">
5753
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
5754
+
5755
+ </xsl:if>
5756
+ </xsl:template>
5757
+
5758
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
5759
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
5760
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
5761
+ <xsl:apply-templates/>
5762
+ </fo:inline>
5763
+ </xsl:template>
5764
+
5765
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
5766
+ <!--
5694
5767
  <xsl:template name="create_fn">
5695
5768
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5696
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5769
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
5697
5770
  <xsl:attribute name="id">
5698
5771
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5699
5772
  </xsl:attribute>
5700
5773
  </xsl:if>
5701
-
5774
+ <xsl:if test="$namespace = 'itu'">
5775
+ <xsl:if test="ancestor::*[local-name()='preface']">
5776
+ <xsl:attribute name="preface">true</xsl:attribute>
5777
+ </xsl:if>
5778
+ </xsl:if>
5779
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5702
5780
  <xsl:attribute name="id">
5703
5781
  <xsl:value-of select="@reference"/>
5704
5782
  <xsl:text>_</xsl:text>
5705
5783
  <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5706
5784
  </xsl:attribute>
5707
-
5708
- <xsl:apply-templates/>
5785
+ </xsl:if>
5786
+ <xsl:apply-templates />
5709
5787
  </fn>
5710
- </xsl:template>
5788
+ </xsl:template> -->
5711
5789
 
5712
5790
  <!-- footnotes for table's name rendering -->
5713
5791
  <xsl:template name="table_name_fn_display">
@@ -5726,123 +5804,171 @@
5726
5804
  <!-- ============================ -->
5727
5805
  <!-- figure's footnotes rendering -->
5728
5806
  <!-- ============================ -->
5729
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
5730
5807
 
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_)"/>
5808
+ <!-- figure/fmt-footnote-container -->
5809
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
5810
+
5811
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
5812
+ <xsl:template name="figure_fn_display">
5737
5813
 
5738
- <!-- all footnotes relates to the current figure -->
5739
5814
  <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>
5815
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
5816
+ <xsl:variable name="curr_id" select="@id"/>
5817
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
5818
+ <curr><xsl:copy-of select="."/></curr>
5819
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
5820
+ <xsl:choose>
5821
+ <!-- skip figure/name/fn -->
5822
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
5823
+ <xsl:otherwise>
5824
+ <xsl:element name="figure" namespace="{$namespace_full}">
5825
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
5826
+ <xsl:copy-of select="."/>
5827
+ </xsl:element>
5828
+ </xsl:element>
5829
+ </xsl:otherwise>
5830
+ </xsl:choose>
5744
5831
  </xsl:for-each>
5745
5832
  </xsl:variable>
5833
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
5746
5834
 
5747
- <xsl:if test="xalan:nodeset($references)//fn">
5835
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
5748
5836
 
5749
5837
  <xsl:variable name="key_iso">
5750
5838
 
5751
5839
  </xsl:variable>
5752
5840
 
5753
5841
  <fo:block>
5842
+ <!-- current hierarchy is 'figure' element -->
5843
+ <xsl:variable name="following_dl_colwidths">
5844
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
5845
+ <xsl:variable name="simple-table">
5846
+ <!-- <xsl:variable name="doc_ns">
5847
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
5848
+ </xsl:variable>
5849
+ <xsl:variable name="ns">
5850
+ <xsl:choose>
5851
+ <xsl:when test="normalize-space($doc_ns) != ''">
5852
+ <xsl:value-of select="normalize-space($doc_ns)"/>
5853
+ </xsl:when>
5854
+ <xsl:otherwise>
5855
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
5856
+ </xsl:otherwise>
5857
+ </xsl:choose>
5858
+ </xsl:variable> -->
5754
5859
 
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> -->
5860
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5861
+ <tbody>
5862
+ <xsl:apply-templates mode="dl"/>
5863
+ </tbody>
5864
+ </xsl:for-each>
5865
+ </xsl:variable>
5772
5866
 
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>
5867
+ <xsl:call-template name="calculate-column-widths">
5868
+ <xsl:with-param name="cols-count" select="2"/>
5869
+ <xsl:with-param name="table" select="$simple-table"/>
5870
+ </xsl:call-template>
5779
5871
 
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>
5872
+ </xsl:if>
5873
+ </xsl:variable>
5784
5874
 
5785
- </xsl:if>
5786
- </xsl:variable>
5875
+ <xsl:variable name="maxlength_dt">
5876
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
5877
+ <xsl:call-template name="getMaxLength_dt"/>
5878
+ </xsl:for-each>
5879
+ </xsl:variable>
5787
5880
 
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>
5881
+ <fo:table width="95%" table-layout="fixed">
5882
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5883
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
5793
5884
 
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>
5885
+ </xsl:if>
5886
+ <xsl:choose>
5887
+ <!-- if there 'dl', then set same columns width -->
5888
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
5889
+ <xsl:call-template name="setColumnWidth_dl">
5890
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
5891
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5892
+ </xsl:call-template>
5893
+ </xsl:when>
5894
+ <xsl:otherwise>
5895
+ <fo:table-column column-width="5%"/>
5896
+ <fo:table-column column-width="95%"/>
5897
+ </xsl:otherwise>
5898
+ </xsl:choose>
5899
+ <fo:table-body>
5900
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
5901
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
5797
5902
 
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"/>
5903
+ <xsl:variable name="reference" select="@reference"/>
5904
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
5905
+ <fo:table-row>
5906
+ <fo:table-cell>
5907
+ <fo:block>
5908
+
5909
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
5910
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
5911
+ <!-- <xsl:value-of select="@reference"/> -->
5912
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
5821
5913
  </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
5914
 
5828
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
5915
+ </fo:block>
5916
+ </fo:table-cell>
5917
+ <fo:table-cell>
5918
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
5919
+ <xsl:if test="normalize-space($key_iso) = 'true'">
5829
5920
 
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>
5921
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
5922
+
5923
+ </xsl:if>
5839
5924
 
5925
+ <!-- <xsl:copy-of select="./node()"/> -->
5926
+ <xsl:apply-templates/>
5927
+ </fo:block>
5928
+ </fo:table-cell>
5929
+ </fo:table-row>
5930
+ <!-- </xsl:if> -->
5931
+ </xsl:for-each>
5932
+ </fo:table-body>
5933
+ </fo:table>
5840
5934
  </fo:block>
5841
5935
  </xsl:if>
5842
- </xsl:template> <!-- fn_display_figure -->
5936
+ </xsl:template> <!-- figure_fn_display -->
5937
+
5938
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
5939
+ <xsl:param name="process">false</xsl:param>
5940
+ <xsl:if test="$process = 'true'">
5941
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
5942
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
5943
+
5944
+ <!-- tab is padding-right -->
5945
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
5946
+ <xsl:with-param name="process">true</xsl:with-param>
5947
+ </xsl:apply-templates>
5948
+
5949
+ <xsl:apply-templates/>
5950
+
5951
+ </fo:inline>
5952
+ </xsl:if>
5953
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
5954
+
5955
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
5956
+ <xsl:param name="process">false</xsl:param>
5957
+ <xsl:if test="$process = 'true'">
5958
+
5959
+ </xsl:if>
5960
+ </xsl:template>
5961
+
5962
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
5963
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
5964
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
5965
+ <xsl:apply-templates/>
5966
+ </fo:inline>
5967
+ </xsl:template>
5843
5968
 
5844
5969
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
5845
5970
  <!-- figure's footnote label -->
5971
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
5846
5972
  <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
5973
  <xsl:variable name="key_iso">
5848
5974
 
@@ -5851,7 +5977,7 @@
5851
5977
  <xsl:attribute name="font-size">10pt</xsl:attribute>
5852
5978
 
5853
5979
  </xsl:if>
5854
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
5980
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
5855
5981
  <!-- <xsl:value-of select="@reference"/> -->
5856
5982
  <xsl:apply-templates/>
5857
5983
  </fo:inline>
@@ -5861,43 +5987,65 @@
5861
5987
  <!-- END: figure's footnotes rendering -->
5862
5988
  <!-- ============================ -->
5863
5989
 
5864
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
5990
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
5991
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
5865
5992
  <xsl:template match="*[local-name()='fn']">
5866
5993
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
5867
5994
 
5868
5995
  <xsl:call-template name="refine_fn-reference-style"/>
5869
5996
 
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">
5997
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5998
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
5999
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
6000
+ <!-- <xsl:attribute name="internal-destination">
5873
6001
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5874
6002
  </xsl:attribute>
5875
6003
  </xsl:if>
5876
-
6004
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5877
6005
  <xsl:attribute name="internal-destination">
5878
6006
  <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
5879
6007
  <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5880
6008
  </xsl:attribute>
6009
+ </xsl:if> -->
6010
+ <!-- <xsl:if test="$namespace = 'plateau'">
6011
+ <xsl:text>※</xsl:text>
6012
+ </xsl:if> -->
6013
+ <!-- <xsl:value-of select="@reference"/> -->
5881
6014
 
5882
- <xsl:value-of select="@reference"/>
6015
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5883
6016
 
6017
+ <!-- <xsl:if test="$namespace = 'bsi'">
6018
+ <xsl:text>)</xsl:text>
6019
+ </xsl:if> -->
5884
6020
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5885
6021
  <!-- <xsl:if test="$namespace = 'jis'">
5886
6022
  <fo:inline font-weight="normal">)</fo:inline>
5887
6023
  </xsl:if> -->
5888
6024
  </fo:basic-link>
5889
6025
  </fo:inline>
5890
- </xsl:template>
6026
+ </xsl:template> <!-- fn -->
5891
6027
 
6028
+ <!-- fn/text() -->
5892
6029
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
5893
6030
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
5894
6031
  </xsl:template>
5895
6032
 
5896
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
6033
+ <!-- fn//p fmt-fn-body//p -->
6034
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
5897
6035
  <fo:inline role="P">
5898
6036
  <xsl:apply-templates/>
5899
6037
  </fo:inline>
5900
6038
  </xsl:template>
6039
+
6040
+ <xsl:template name="insertFootnoteSeparatorCommon">
6041
+ <xsl:param name="leader_length">30%</xsl:param>
6042
+ <fo:static-content flow-name="xsl-footnote-separator">
6043
+ <fo:block>
6044
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
6045
+ </fo:block>
6046
+ </fo:static-content>
6047
+ </xsl:template>
6048
+
5901
6049
  <!-- ===================== -->
5902
6050
  <!-- END Footnotes processing -->
5903
6051
  <!-- ===================== -->
@@ -6174,11 +6322,11 @@
6174
6322
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
6175
6323
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
6176
6324
 
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>
6325
+ <xsl:call-template name="setColumnWidth_dl">
6326
+ <xsl:with-param name="colwidths" select="$colwidths"/>
6327
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6328
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
6329
+ </xsl:call-template>
6182
6330
 
6183
6331
  <fo:table-body>
6184
6332
 
@@ -6212,6 +6360,14 @@
6212
6360
 
6213
6361
  </xsl:template> <!-- END: dl -->
6214
6362
 
6363
+ <xsl:template match="@*|node()" mode="dt_clean">
6364
+ <xsl:copy>
6365
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
6366
+ </xsl:copy>
6367
+ </xsl:template>
6368
+
6369
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
6370
+
6215
6371
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
6216
6372
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
6217
6373
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -6241,10 +6397,12 @@
6241
6397
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
6242
6398
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
6243
6399
 
6400
+ <!-- dl/name -->
6244
6401
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
6245
6402
  <xsl:param name="process">false</xsl:param>
6246
6403
  <xsl:if test="$process = 'true'">
6247
6404
  <fo:block xsl:use-attribute-sets="dl-name-style">
6405
+
6248
6406
  <xsl:apply-templates/>
6249
6407
  </fo:block>
6250
6408
  </xsl:if>
@@ -6258,6 +6416,10 @@
6258
6416
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
6259
6417
 
6260
6418
  <xsl:choose>
6419
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
6420
+ <fo:table-column column-width="10%"/>
6421
+ <fo:table-column column-width="90%"/>
6422
+ </xsl:when> -->
6261
6423
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
6262
6424
  <xsl:call-template name="insertTableColumnWidth">
6263
6425
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -8391,6 +8553,27 @@
8391
8553
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8392
8554
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8393
8555
  </xsl:when> -->
8556
+
8557
+ <!-- <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'))">
8558
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8559
+ <xsl:variable name="filename">
8560
+ <xsl:call-template name="substring-after-last">
8561
+ <xsl:with-param name="value" select="$target_"/>
8562
+ <xsl:with-param name="delimiter" select="'/'"/>
8563
+ </xsl:call-template>
8564
+ </xsl:variable>
8565
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
8566
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
8567
+ <xsl:choose>
8568
+ <xsl:when test="$file_exists = 'true'">
8569
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
8570
+ </xsl:when>
8571
+ <xsl:otherwise>
8572
+ <xsl:value-of select="normalize-space(@target)"/>
8573
+ </xsl:otherwise>
8574
+ </xsl:choose>
8575
+ </xsl:when> -->
8576
+
8394
8577
  <xsl:otherwise>
8395
8578
  <xsl:value-of select="normalize-space(@target)"/>
8396
8579
  </xsl:otherwise>
@@ -8699,7 +8882,7 @@
8699
8882
 
8700
8883
  <xsl:template name="refine_note_block_style">
8701
8884
 
8702
- </xsl:template>
8885
+ </xsl:template> <!-- refine_note_block_style -->
8703
8886
 
8704
8887
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
8705
8888
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -8893,10 +9076,21 @@
8893
9076
  </xsl:template>
8894
9077
 
8895
9078
  <xsl:template name="showFigureKey">
8896
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
8897
- <xsl:call-template name="note"/>
9079
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
9080
+ <xsl:choose>
9081
+ <xsl:when test="local-name() = 'note'">
9082
+ <xsl:call-template name="note"/>
9083
+ </xsl:when>
9084
+ <xsl:when test="local-name() = 'example'">
9085
+ <xsl:call-template name="example"/>
9086
+ </xsl:when>
9087
+ <xsl:otherwise>
9088
+ <xsl:apply-templates select="."/>
9089
+ </xsl:otherwise>
9090
+ </xsl:choose>
8898
9091
  </xsl:for-each>
8899
- <xsl:call-template name="fn_display_figure"/>
9092
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
9093
+ <xsl:call-template name="figure_fn_display"/>
8900
9094
  </xsl:template>
8901
9095
 
8902
9096
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -9790,10 +9984,10 @@
9790
9984
  <xsl:when test="@type = 'section-title'">
9791
9985
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
9792
9986
  <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')]"/>
9987
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
9794
9988
  </xsl:when>
9795
9989
  <xsl:otherwise>
9796
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
9990
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
9797
9991
  </xsl:otherwise>
9798
9992
  </xsl:choose>
9799
9993
  </xsl:when>
@@ -10090,9 +10284,15 @@
10090
10284
  </xsl:if>
10091
10285
  </xsl:template>
10092
10286
 
10287
+ <!-- figure/fn -->
10093
10288
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
10094
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
10289
+ <!-- figure/note -->
10290
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
10291
+ <!-- figure/example -->
10292
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
10095
10293
 
10294
+ <!-- figure/note[@type = 'units'] -->
10295
+ <!-- image/note[@type = 'units'] -->
10096
10296
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
10097
10297
  <fo:block text-align="right" keep-with-next="always">
10098
10298
  <xsl:apply-templates/>
@@ -10213,6 +10413,7 @@
10213
10413
  </xsl:choose>
10214
10414
  </xsl:template>
10215
10415
 
10416
+ <!-- fn -->
10216
10417
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
10217
10418
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
10218
10419
 
@@ -11143,7 +11344,7 @@
11143
11344
  text line 1
11144
11345
  text line 2
11145
11346
  -->
11146
- <xsl:template match="*[local-name() = 'example']">
11347
+ <xsl:template match="*[local-name() = 'example']" name="example">
11147
11348
 
11148
11349
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11149
11350
 
@@ -11249,6 +11450,7 @@
11249
11450
 
11250
11451
  </xsl:template>
11251
11452
 
11453
+ <!-- example/name -->
11252
11454
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
11253
11455
  <xsl:param name="fo_element">block</xsl:param>
11254
11456
 
@@ -11274,7 +11476,8 @@
11274
11476
 
11275
11477
  </xsl:template>
11276
11478
 
11277
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
11479
+ <!-- table/example/name, table/tfoot//example/name -->
11480
+ <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
11481
  <fo:inline xsl:use-attribute-sets="example-name-style">
11279
11482
 
11280
11483
  <xsl:apply-templates/>
@@ -11632,6 +11835,8 @@
11632
11835
 
11633
11836
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
11634
11837
 
11838
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
11839
+
11635
11840
  </xsl:template>
11636
11841
 
11637
11842
  <xsl:template name="insertNonBreakSpaces">
@@ -12903,8 +13108,33 @@
12903
13108
 
12904
13109
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
12905
13110
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
13111
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
13112
+ <!-- <test><xsl:copy-of select="."/></test> -->
13113
+
12906
13114
  <xsl:variable name="target" select="@target"/>
13115
+
12907
13116
  <xsl:for-each select="*[local-name() = 'tab']">
13117
+
13118
+ <xsl:if test="position() = 1">
13119
+ <!-- first column (data before first `tab`) -->
13120
+ <fo:table-cell>
13121
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
13122
+ <xsl:call-template name="insert_basic_link">
13123
+ <xsl:with-param name="element">
13124
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
13125
+ <xsl:for-each select="preceding-sibling::node()">
13126
+ <xsl:choose>
13127
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13128
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
13129
+ </xsl:choose>
13130
+ </xsl:for-each>
13131
+ </fo:basic-link>
13132
+ </xsl:with-param>
13133
+ </xsl:call-template>
13134
+ </fo:block>
13135
+ </fo:table-cell>
13136
+ </xsl:if>
13137
+
12908
13138
  <xsl:variable name="current_id" select="generate-id()"/>
12909
13139
  <fo:table-cell>
12910
13140
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -12955,11 +13185,25 @@
12955
13185
 
12956
13186
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
12957
13187
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
13188
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12958
13189
  <xsl:for-each select="*[local-name() = 'tab']">
13190
+ <xsl:if test="position() = 1">
13191
+ <td>
13192
+ <xsl:for-each select="preceding-sibling::node()">
13193
+ <xsl:choose>
13194
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13195
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
13196
+ </xsl:choose>
13197
+ </xsl:for-each>
13198
+ </td>
13199
+ </xsl:if>
12959
13200
  <xsl:variable name="current_id" select="generate-id()"/>
12960
13201
  <td>
12961
13202
  <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="."/>
13203
+ <xsl:choose>
13204
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
13205
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
13206
+ </xsl:choose>
12963
13207
  </xsl:for-each>
12964
13208
  </td>
12965
13209
  </xsl:for-each>
@@ -14359,6 +14603,7 @@
14359
14603
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
14360
14604
  </fn>
14361
14605
  -->
14606
+ <!-- fn in text -->
14362
14607
  <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
14608
  <xsl:variable name="p_fn_">
14364
14609
  <xsl:call-template name="get_fn_list"/>