metanorma-itu 2.6.1 → 2.6.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.
@@ -1609,11 +1609,9 @@
1609
1609
  <xsl:if test="$doctype = 'service-publication'">
1610
1610
  <xsl:attribute name="initial-page-number">auto</xsl:attribute>
1611
1611
  </xsl:if>
1612
- <fo:static-content flow-name="xsl-footnote-separator">
1613
- <fo:block>
1614
- <fo:leader leader-pattern="rule" leader-length="30%"/>
1615
- </fo:block>
1616
- </fo:static-content>
1612
+
1613
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
1614
+
1617
1615
  <xsl:choose>
1618
1616
  <xsl:when test="$doctype = 'service-publication'">
1619
1617
  <xsl:call-template name="insertHeaderFooterSP">
@@ -3879,16 +3877,21 @@
3879
3877
  </xsl:template>
3880
3878
 
3881
3879
  <xsl:attribute-set name="table-fn-number-style">
3880
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
3881
+
3882
+ <!-- <xsl:attribute name="padding-right">3mm</xsl:attribute> -->
3883
+
3884
+ </xsl:attribute-set> <!-- table-fn-number-style -->
3885
+
3886
+ <xsl:attribute-set name="table-fmt-fn-label-style">
3882
3887
  <xsl:attribute name="font-size">80%</xsl:attribute>
3883
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
3884
3888
 
3885
3889
  <xsl:attribute name="vertical-align">super</xsl:attribute>
3886
- <xsl:attribute name="padding-right">3mm</xsl:attribute>
3887
3890
  <xsl:attribute name="font-size">70%</xsl:attribute>
3888
3891
 
3889
- </xsl:attribute-set> <!-- table-fn-number-style -->
3892
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
3890
3893
 
3891
- <xsl:template name="refine_table-fn-number-style">
3894
+ <xsl:template name="refine_table-fmt-fn-label-style">
3892
3895
 
3893
3896
  </xsl:template>
3894
3897
 
@@ -3903,11 +3906,18 @@
3903
3906
  </xsl:attribute-set>
3904
3907
 
3905
3908
  <xsl:attribute-set name="figure-fn-number-style">
3906
- <xsl:attribute name="font-size">80%</xsl:attribute>
3907
3909
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
3910
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
3911
+
3912
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
3913
+ <xsl:attribute name="font-size">80%</xsl:attribute>
3908
3914
  <xsl:attribute name="vertical-align">super</xsl:attribute>
3909
3915
 
3910
- </xsl:attribute-set>
3916
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
3917
+
3918
+ <xsl:template name="refine_figure-fmt-fn-label-style">
3919
+
3920
+ </xsl:template>
3911
3921
 
3912
3922
  <xsl:attribute-set name="figure-fn-body-style">
3913
3923
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -5441,9 +5451,13 @@
5441
5451
 
5442
5452
  <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']"/>
5443
5453
  <xsl:if test="$isNoteOrFnExist = 'true'">
5444
-
5445
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
5446
-
5454
+ <!-- <xsl:choose>
5455
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
5456
+ <xsl:otherwise>
5457
+
5458
+ </xsl:otherwise>
5459
+ </xsl:choose> -->
5460
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
5447
5461
  </xsl:if>
5448
5462
 
5449
5463
  <xsl:choose>
@@ -5490,7 +5504,7 @@
5490
5504
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
5491
5505
  </xsl:when>
5492
5506
  <xsl:otherwise>
5493
- <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 -->
5507
+ <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 -->
5494
5508
  </xsl:otherwise>
5495
5509
  </xsl:choose>
5496
5510
 
@@ -5501,13 +5515,26 @@
5501
5515
 
5502
5516
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
5503
5517
 
5504
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
5505
- <xsl:call-template name="insertTableFooterInSeparateTable">
5506
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
5507
- <xsl:with-param name="colwidths" select="$colwidths"/>
5508
- <xsl:with-param name="colgroup" select="$colgroup"/>
5509
- </xsl:call-template>
5510
- </xsl:for-each>
5518
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
5519
+
5520
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
5521
+ <xsl:call-template name="insertTableFooterInSeparateTable">
5522
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
5523
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5524
+ <xsl:with-param name="colgroup" select="$colgroup"/>
5525
+ </xsl:call-template>
5526
+ </xsl:for-each>
5527
+
5528
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
5529
+ <xsl:if test="$namespace = 'plateau'">
5530
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
5531
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
5532
+ <xsl:variable name="table_fn_block">
5533
+ <xsl:call-template name="table_fn_display" />
5534
+ </xsl:variable>
5535
+ <xsl:copy-of select="$table_fn_block"/>
5536
+ </xsl:for-each>
5537
+ </xsl:if> -->
5511
5538
 
5512
5539
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
5513
5540
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -6399,6 +6426,17 @@
6399
6426
  <xsl:attribute name="text-align">left</xsl:attribute>
6400
6427
  </xsl:if>
6401
6428
 
6429
+ <xsl:if test="$isGenerateTableIF = 'false'">
6430
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
6431
+ <xsl:attribute name="text-align">right</xsl:attribute>
6432
+ <xsl:attribute name="border">none</xsl:attribute>
6433
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
6434
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
6435
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
6436
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
6437
+ </xsl:if>
6438
+ </xsl:if>
6439
+
6402
6440
  <fo:block role="SKIP">
6403
6441
 
6404
6442
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -6417,7 +6455,8 @@
6417
6455
  </fo:table-cell>
6418
6456
  </xsl:template> <!-- td -->
6419
6457
 
6420
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
6458
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
6459
+ <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">
6421
6460
 
6422
6461
  <fo:block xsl:use-attribute-sets="table-note-style">
6423
6462
  <xsl:copy-of select="@id"/>
@@ -6438,65 +6477,54 @@
6438
6477
 
6439
6478
  </xsl:template> <!-- table/note -->
6440
6479
 
6441
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
6480
+ <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">
6442
6481
  <xsl:apply-templates/>
6443
6482
  </xsl:template>
6444
6483
 
6445
6484
  <!-- ===================== -->
6446
6485
  <!-- Footnotes processing -->
6447
6486
  <!-- ===================== -->
6487
+
6488
+ <!-- document text (not figures, or tables) footnotes -->
6489
+ <xsl:variable name="footnotes_">
6490
+ <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 -->
6491
+ <!-- <xsl:copy-of select="."/> -->
6492
+ <xsl:variable name="update_xml_step1">
6493
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
6494
+ </xsl:variable>
6495
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
6496
+ </xsl:for-each>
6497
+ </xsl:variable>
6498
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
6499
+
6448
6500
  <!--
6449
6501
  <fn reference="1">
6450
6502
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
6451
6503
  </fn>
6452
6504
  -->
6453
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
6505
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
6506
+ <!-- fn in text -->
6454
6507
  <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">
6455
6508
 
6456
- <!-- list of footnotes to calculate actual footnotes number -->
6509
+ <!-- list of unique footnotes -->
6457
6510
  <xsl:variable name="p_fn_">
6458
6511
  <xsl:call-template name="get_fn_list"/>
6459
- <!-- <xsl:choose>
6460
- <xsl:when test="$namespace = 'jis'">
6461
- <xsl:call-template name="get_fn_list_for_element"/>
6462
- </xsl:when>
6463
- <xsl:otherwise>
6464
- <xsl:call-template name="get_fn_list"/>
6465
- </xsl:otherwise>
6466
- </xsl:choose> -->
6467
6512
  </xsl:variable>
6468
6513
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
6469
6514
 
6470
6515
  <xsl:variable name="gen_id" select="generate-id(.)"/>
6471
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
6472
- <xsl:variable name="reference_">
6473
- <xsl:value-of select="@reference"/>
6474
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
6475
- </xsl:variable>
6476
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
6516
+
6477
6517
  <!-- fn sequence number in document -->
6478
- <xsl:variable name="current_fn_number">
6479
- <xsl:choose>
6480
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
6481
- <xsl:otherwise>
6482
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
6483
- </xsl:otherwise>
6484
- </xsl:choose>
6485
- </xsl:variable>
6518
+ <xsl:variable name="current_fn_number" select="@reference"/>
6519
+
6486
6520
  <xsl:variable name="current_fn_number_text">
6487
6521
 
6488
6522
  <xsl:value-of select="$current_fn_number"/>
6489
6523
 
6490
6524
  </xsl:variable>
6491
6525
 
6492
- <xsl:variable name="ref_id">
6493
- <xsl:choose>
6494
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
6495
- <xsl:otherwise>
6496
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
6497
- </xsl:otherwise>
6498
- </xsl:choose>
6499
- </xsl:variable>
6526
+ <xsl:variable name="ref_id" select="@target"/>
6527
+
6500
6528
  <xsl:variable name="footnote_inline">
6501
6529
  <fo:inline role="Reference">
6502
6530
 
@@ -6541,7 +6569,9 @@
6541
6569
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
6542
6570
  <xsl:copy-of select="$footnote_inline"/>
6543
6571
  </xsl:when>
6572
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
6544
6573
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
6574
+
6545
6575
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
6546
6576
  <xsl:copy-of select="$footnote_inline"/>
6547
6577
  <fo:footnote-body role="Note">
@@ -6558,7 +6588,10 @@
6558
6588
  <xsl:value-of select="$current_fn_number_text"/>
6559
6589
 
6560
6590
  </fo:inline>
6561
- <xsl:apply-templates/>
6591
+ <!-- <xsl:apply-templates /> -->
6592
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
6593
+ <here><xsl:copy-of select="$footnotes"/></here> -->
6594
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
6562
6595
  </xsl:variable>
6563
6596
 
6564
6597
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -6612,81 +6645,138 @@
6612
6645
  </xsl:choose>
6613
6646
  </xsl:template>
6614
6647
 
6615
- <xsl:template name="get_fn_list_for_element">
6616
- <xsl:choose>
6617
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
6618
- <fn gen_id="{generate-id(.)}">
6619
- <xsl:copy-of select="@*"/>
6620
- <xsl:copy-of select="node()"/>
6621
- </fn>
6622
- </xsl:when>
6623
- <xsl:otherwise>
6624
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
6625
- <xsl:variable name="element_id" select="@id"/>
6626
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
6627
- <!-- copy unique fn -->
6628
- <fn gen_id="{generate-id(.)}">
6629
- <xsl:copy-of select="@*"/>
6630
- <xsl:copy-of select="node()"/>
6631
- </fn>
6632
- </xsl:for-each>
6633
- </xsl:for-each>
6634
- </xsl:otherwise>
6635
- </xsl:choose>
6636
- </xsl:template>
6637
6648
  <!-- ============================ -->
6638
6649
  <!-- table's footnotes rendering -->
6639
6650
  <!-- ============================ -->
6640
- <xsl:template name="table_fn_display">
6641
- <xsl:variable name="references">
6642
6651
 
6652
+ <!-- table/fmt-footnote-container -->
6653
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
6654
+
6655
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
6656
+ <xsl:for-each select=".">
6657
+ <xsl:call-template name="table_fn_display"/>
6658
+ </xsl:for-each>
6659
+ </xsl:template>
6660
+
6661
+ <xsl:template name="table_fn_display">
6662
+ <!-- <xsl:variable name="references">
6663
+ <xsl:if test="$namespace = 'bsi'">
6664
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
6665
+ <xsl:call-template name="create_fn" />
6666
+ </xsl:for-each>
6667
+ </xsl:if>
6643
6668
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
6644
- <xsl:call-template name="create_fn"/>
6669
+ <xsl:call-template name="create_fn" />
6645
6670
  </xsl:for-each>
6646
- </xsl:variable>
6647
-
6648
- <xsl:for-each select="xalan:nodeset($references)//fn">
6671
+ </xsl:variable> -->
6672
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
6649
6673
  <xsl:variable name="reference" select="@reference"/>
6650
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6674
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
6675
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
6651
6676
 
6652
6677
  <fo:block xsl:use-attribute-sets="table-fn-style">
6678
+ <xsl:copy-of select="@id"/>
6653
6679
  <xsl:call-template name="refine_table-fn-style"/>
6654
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
6655
- <xsl:call-template name="refine_table-fn-number-style"/>
6656
-
6657
- <xsl:value-of select="@reference"/>
6658
6680
 
6659
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
6660
- <!-- <xsl:if test="$namespace = 'itu'">
6661
- <xsl:text>)</xsl:text>
6662
- </xsl:if> -->
6681
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
6682
+ <xsl:with-param name="process">true</xsl:with-param>
6683
+ </xsl:apply-templates>
6663
6684
 
6664
- </fo:inline>
6665
6685
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
6666
- <xsl:copy-of select="./node()"/>
6686
+ <!-- <xsl:copy-of select="./node()"/> -->
6687
+ <xsl:apply-templates/>
6667
6688
  </fo:inline>
6668
6689
 
6669
6690
  </fo:block>
6670
6691
 
6671
- </xsl:if>
6692
+ <!-- </xsl:if> -->
6672
6693
  </xsl:for-each>
6673
6694
  </xsl:template> <!-- table_fn_display -->
6674
6695
 
6696
+ <!-- fmt-fn-body/fmt-fn-label in text -->
6697
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
6698
+
6699
+ <!-- table//fmt-fn-body//fmt-fn-label -->
6700
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
6701
+ <xsl:param name="process">false</xsl:param>
6702
+ <xsl:if test="$process = 'true'">
6703
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
6704
+
6705
+ <!-- tab is padding-right -->
6706
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
6707
+ <xsl:with-param name="process">true</xsl:with-param>
6708
+ </xsl:apply-templates>
6709
+
6710
+ <!-- <xsl:if test="$namespace = 'bipm'">
6711
+ <fo:inline font-style="normal">(</fo:inline>
6712
+ </xsl:if> -->
6713
+
6714
+ <!-- <xsl:if test="$namespace = 'plateau'">
6715
+ <xsl:text>※</xsl:text>
6716
+ </xsl:if> -->
6717
+
6718
+ <!-- <xsl:value-of select="@reference"/> -->
6719
+ <!-- <xsl:value-of select="normalize-space()"/> -->
6720
+ <xsl:apply-templates/>
6721
+
6722
+ <!-- <xsl:if test="$namespace = 'bipm'">
6723
+ <fo:inline font-style="normal">)</fo:inline>
6724
+ </xsl:if> -->
6725
+
6726
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
6727
+ <!-- <xsl:if test="$namespace = 'itu'">
6728
+ <xsl:text>)</xsl:text>
6729
+ </xsl:if> -->
6730
+
6731
+ <!-- <xsl:if test="$namespace = 'plateau'">
6732
+ <xsl:text>:</xsl:text>
6733
+ </xsl:if> -->
6734
+
6735
+ </fo:inline>
6736
+ </xsl:if>
6737
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
6738
+
6739
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
6740
+ <xsl:param name="process">false</xsl:param>
6741
+ <xsl:if test="$process = 'true'">
6742
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
6743
+
6744
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
6745
+
6746
+ </xsl:if>
6747
+ </xsl:template>
6748
+
6749
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
6750
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
6751
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
6752
+ <xsl:apply-templates/>
6753
+ </fo:inline>
6754
+ </xsl:template>
6755
+
6756
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
6757
+ <!--
6675
6758
  <xsl:template name="create_fn">
6676
6759
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
6677
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
6760
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
6678
6761
  <xsl:attribute name="id">
6679
6762
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
6680
6763
  </xsl:attribute>
6681
6764
  </xsl:if>
6682
-
6765
+ <xsl:if test="$namespace = 'itu'">
6683
6766
  <xsl:if test="ancestor::*[local-name()='preface']">
6684
6767
  <xsl:attribute name="preface">true</xsl:attribute>
6685
6768
  </xsl:if>
6686
-
6687
- <xsl:apply-templates/>
6769
+ </xsl:if>
6770
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
6771
+ <xsl:attribute name="id">
6772
+ <xsl:value-of select="@reference"/>
6773
+ <xsl:text>_</xsl:text>
6774
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
6775
+ </xsl:attribute>
6776
+ </xsl:if>
6777
+ <xsl:apply-templates />
6688
6778
  </fn>
6689
- </xsl:template>
6779
+ </xsl:template> -->
6690
6780
 
6691
6781
  <!-- footnotes for table's name rendering -->
6692
6782
  <xsl:template name="table_name_fn_display">
@@ -6705,123 +6795,171 @@
6705
6795
  <!-- ============================ -->
6706
6796
  <!-- figure's footnotes rendering -->
6707
6797
  <!-- ============================ -->
6708
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
6709
6798
 
6710
- <!-- current figure id -->
6711
- <xsl:variable name="figure_id_">
6712
- <xsl:value-of select="@id"/>
6713
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
6714
- </xsl:variable>
6715
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
6799
+ <!-- figure/fmt-footnote-container -->
6800
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
6801
+
6802
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
6803
+ <xsl:template name="figure_fn_display">
6716
6804
 
6717
- <!-- all footnotes relates to the current figure -->
6718
6805
  <xsl:variable name="references">
6719
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
6720
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
6721
- <xsl:apply-templates/>
6722
- </fn>
6806
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
6807
+ <xsl:variable name="curr_id" select="@id"/>
6808
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
6809
+ <curr><xsl:copy-of select="."/></curr>
6810
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
6811
+ <xsl:choose>
6812
+ <!-- skip figure/name/fn -->
6813
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
6814
+ <xsl:otherwise>
6815
+ <xsl:element name="figure" namespace="{$namespace_full}">
6816
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
6817
+ <xsl:copy-of select="."/>
6818
+ </xsl:element>
6819
+ </xsl:element>
6820
+ </xsl:otherwise>
6821
+ </xsl:choose>
6723
6822
  </xsl:for-each>
6724
6823
  </xsl:variable>
6824
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
6725
6825
 
6726
- <xsl:if test="xalan:nodeset($references)//fn">
6826
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
6727
6827
 
6728
6828
  <xsl:variable name="key_iso">
6729
6829
 
6730
6830
  </xsl:variable>
6731
6831
 
6732
6832
  <fo:block>
6833
+ <!-- current hierarchy is 'figure' element -->
6834
+ <xsl:variable name="following_dl_colwidths">
6835
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
6836
+ <xsl:variable name="simple-table">
6837
+ <!-- <xsl:variable name="doc_ns">
6838
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
6839
+ </xsl:variable>
6840
+ <xsl:variable name="ns">
6841
+ <xsl:choose>
6842
+ <xsl:when test="normalize-space($doc_ns) != ''">
6843
+ <xsl:value-of select="normalize-space($doc_ns)"/>
6844
+ </xsl:when>
6845
+ <xsl:otherwise>
6846
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
6847
+ </xsl:otherwise>
6848
+ </xsl:choose>
6849
+ </xsl:variable> -->
6733
6850
 
6734
- <!-- current hierarchy is 'figure' element -->
6735
- <xsl:variable name="following_dl_colwidths">
6736
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
6737
- <xsl:variable name="simple-table">
6738
- <!-- <xsl:variable name="doc_ns">
6739
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
6740
- </xsl:variable>
6741
- <xsl:variable name="ns">
6742
- <xsl:choose>
6743
- <xsl:when test="normalize-space($doc_ns) != ''">
6744
- <xsl:value-of select="normalize-space($doc_ns)"/>
6745
- </xsl:when>
6746
- <xsl:otherwise>
6747
- <xsl:value-of select="substring-before(name(/*), '-')"/>
6748
- </xsl:otherwise>
6749
- </xsl:choose>
6750
- </xsl:variable> -->
6851
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
6852
+ <tbody>
6853
+ <xsl:apply-templates mode="dl"/>
6854
+ </tbody>
6855
+ </xsl:for-each>
6856
+ </xsl:variable>
6751
6857
 
6752
- <xsl:for-each select="*[local-name() = 'dl'][1]">
6753
- <tbody>
6754
- <xsl:apply-templates mode="dl"/>
6755
- </tbody>
6756
- </xsl:for-each>
6757
- </xsl:variable>
6858
+ <xsl:call-template name="calculate-column-widths">
6859
+ <xsl:with-param name="cols-count" select="2"/>
6860
+ <xsl:with-param name="table" select="$simple-table"/>
6861
+ </xsl:call-template>
6758
6862
 
6759
- <xsl:call-template name="calculate-column-widths">
6760
- <xsl:with-param name="cols-count" select="2"/>
6761
- <xsl:with-param name="table" select="$simple-table"/>
6762
- </xsl:call-template>
6863
+ </xsl:if>
6864
+ </xsl:variable>
6763
6865
 
6764
- </xsl:if>
6765
- </xsl:variable>
6866
+ <xsl:variable name="maxlength_dt">
6867
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
6868
+ <xsl:call-template name="getMaxLength_dt"/>
6869
+ </xsl:for-each>
6870
+ </xsl:variable>
6766
6871
 
6767
- <xsl:variable name="maxlength_dt">
6768
- <xsl:for-each select="*[local-name() = 'dl'][1]">
6769
- <xsl:call-template name="getMaxLength_dt"/>
6770
- </xsl:for-each>
6771
- </xsl:variable>
6872
+ <fo:table width="95%" table-layout="fixed">
6873
+ <xsl:if test="normalize-space($key_iso) = 'true'">
6874
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
6772
6875
 
6773
- <fo:table width="95%" table-layout="fixed">
6774
- <xsl:if test="normalize-space($key_iso) = 'true'">
6775
- <xsl:attribute name="font-size">10pt</xsl:attribute>
6876
+ </xsl:if>
6877
+ <xsl:choose>
6878
+ <!-- if there 'dl', then set same columns width -->
6879
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
6880
+ <xsl:call-template name="setColumnWidth_dl">
6881
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
6882
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6883
+ </xsl:call-template>
6884
+ </xsl:when>
6885
+ <xsl:otherwise>
6886
+ <fo:table-column column-width="5%"/>
6887
+ <fo:table-column column-width="95%"/>
6888
+ </xsl:otherwise>
6889
+ </xsl:choose>
6890
+ <fo:table-body>
6891
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
6892
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
6776
6893
 
6777
- </xsl:if>
6778
- <xsl:choose>
6779
- <!-- if there 'dl', then set same columns width -->
6780
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
6781
- <xsl:call-template name="setColumnWidth_dl">
6782
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
6783
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6784
- </xsl:call-template>
6785
- </xsl:when>
6786
- <xsl:otherwise>
6787
- <fo:table-column column-width="5%"/>
6788
- <fo:table-column column-width="95%"/>
6789
- </xsl:otherwise>
6790
- </xsl:choose>
6791
- <fo:table-body>
6792
- <xsl:for-each select="xalan:nodeset($references)//fn">
6793
- <xsl:variable name="reference" select="@reference"/>
6794
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6795
- <fo:table-row>
6796
- <fo:table-cell>
6797
- <fo:block>
6798
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
6799
- <xsl:value-of select="@reference"/>
6894
+ <xsl:variable name="reference" select="@reference"/>
6895
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
6896
+ <fo:table-row>
6897
+ <fo:table-cell>
6898
+ <fo:block>
6899
+
6900
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
6901
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
6902
+ <!-- <xsl:value-of select="@reference"/> -->
6903
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
6800
6904
  </fo:inline>
6801
- </fo:block>
6802
- </fo:table-cell>
6803
- <fo:table-cell>
6804
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
6805
- <xsl:if test="normalize-space($key_iso) = 'true'">
6806
6905
 
6807
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
6906
+ </fo:block>
6907
+ </fo:table-cell>
6908
+ <fo:table-cell>
6909
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
6910
+ <xsl:if test="normalize-space($key_iso) = 'true'">
6808
6911
 
6809
- </xsl:if>
6810
- <xsl:copy-of select="./node()"/>
6811
- </fo:block>
6812
- </fo:table-cell>
6813
- </fo:table-row>
6814
- </xsl:if>
6815
- </xsl:for-each>
6816
- </fo:table-body>
6817
- </fo:table>
6912
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
6913
+
6914
+ </xsl:if>
6818
6915
 
6916
+ <!-- <xsl:copy-of select="./node()"/> -->
6917
+ <xsl:apply-templates/>
6918
+ </fo:block>
6919
+ </fo:table-cell>
6920
+ </fo:table-row>
6921
+ <!-- </xsl:if> -->
6922
+ </xsl:for-each>
6923
+ </fo:table-body>
6924
+ </fo:table>
6819
6925
  </fo:block>
6820
6926
  </xsl:if>
6821
- </xsl:template> <!-- fn_display_figure -->
6927
+ </xsl:template> <!-- figure_fn_display -->
6928
+
6929
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
6930
+ <xsl:param name="process">false</xsl:param>
6931
+ <xsl:if test="$process = 'true'">
6932
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
6933
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
6934
+
6935
+ <!-- tab is padding-right -->
6936
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
6937
+ <xsl:with-param name="process">true</xsl:with-param>
6938
+ </xsl:apply-templates>
6939
+
6940
+ <xsl:apply-templates/>
6941
+
6942
+ </fo:inline>
6943
+ </xsl:if>
6944
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
6945
+
6946
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
6947
+ <xsl:param name="process">false</xsl:param>
6948
+ <xsl:if test="$process = 'true'">
6949
+
6950
+ </xsl:if>
6951
+ </xsl:template>
6952
+
6953
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
6954
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
6955
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
6956
+ <xsl:apply-templates/>
6957
+ </fo:inline>
6958
+ </xsl:template>
6822
6959
 
6823
6960
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
6824
6961
  <!-- figure's footnote label -->
6962
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
6825
6963
  <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">
6826
6964
  <xsl:variable name="key_iso">
6827
6965
 
@@ -6830,7 +6968,7 @@
6830
6968
  <xsl:attribute name="font-size">10pt</xsl:attribute>
6831
6969
 
6832
6970
  </xsl:if>
6833
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
6971
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
6834
6972
  <!-- <xsl:value-of select="@reference"/> -->
6835
6973
  <xsl:apply-templates/>
6836
6974
  </fo:inline>
@@ -6840,38 +6978,65 @@
6840
6978
  <!-- END: figure's footnotes rendering -->
6841
6979
  <!-- ============================ -->
6842
6980
 
6843
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
6981
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
6982
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
6844
6983
  <xsl:template match="*[local-name()='fn']">
6845
6984
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
6846
6985
 
6847
6986
  <xsl:call-template name="refine_fn-reference-style"/>
6848
6987
 
6849
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
6850
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
6851
- <xsl:attribute name="internal-destination">
6988
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
6989
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
6990
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
6991
+ <!-- <xsl:attribute name="internal-destination">
6852
6992
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
6853
6993
  </xsl:attribute>
6854
6994
  </xsl:if>
6995
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
6996
+ <xsl:attribute name="internal-destination">
6997
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
6998
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
6999
+ </xsl:attribute>
7000
+ </xsl:if> -->
7001
+ <!-- <xsl:if test="$namespace = 'plateau'">
7002
+ <xsl:text>※</xsl:text>
7003
+ </xsl:if> -->
7004
+ <!-- <xsl:value-of select="@reference"/> -->
6855
7005
 
6856
- <xsl:value-of select="@reference"/>
7006
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
6857
7007
 
7008
+ <!-- <xsl:if test="$namespace = 'bsi'">
7009
+ <xsl:text>)</xsl:text>
7010
+ </xsl:if> -->
6858
7011
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
6859
7012
  <!-- <xsl:if test="$namespace = 'jis'">
6860
7013
  <fo:inline font-weight="normal">)</fo:inline>
6861
7014
  </xsl:if> -->
6862
7015
  </fo:basic-link>
6863
7016
  </fo:inline>
6864
- </xsl:template>
7017
+ </xsl:template> <!-- fn -->
6865
7018
 
7019
+ <!-- fn/text() -->
6866
7020
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
6867
7021
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
6868
7022
  </xsl:template>
6869
7023
 
6870
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
7024
+ <!-- fn//p fmt-fn-body//p -->
7025
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
6871
7026
  <fo:inline role="P">
6872
7027
  <xsl:apply-templates/>
6873
7028
  </fo:inline>
6874
7029
  </xsl:template>
7030
+
7031
+ <xsl:template name="insertFootnoteSeparatorCommon">
7032
+ <xsl:param name="leader_length">30%</xsl:param>
7033
+ <fo:static-content flow-name="xsl-footnote-separator">
7034
+ <fo:block>
7035
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
7036
+ </fo:block>
7037
+ </fo:static-content>
7038
+ </xsl:template>
7039
+
6875
7040
  <!-- ===================== -->
6876
7041
  <!-- END Footnotes processing -->
6877
7042
  <!-- ===================== -->
@@ -7182,11 +7347,11 @@
7182
7347
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
7183
7348
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
7184
7349
 
7185
- <xsl:call-template name="setColumnWidth_dl">
7186
- <xsl:with-param name="colwidths" select="$colwidths"/>
7187
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
7188
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
7189
- </xsl:call-template>
7350
+ <xsl:call-template name="setColumnWidth_dl">
7351
+ <xsl:with-param name="colwidths" select="$colwidths"/>
7352
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
7353
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
7354
+ </xsl:call-template>
7190
7355
 
7191
7356
  <fo:table-body>
7192
7357
 
@@ -7220,6 +7385,14 @@
7220
7385
 
7221
7386
  </xsl:template> <!-- END: dl -->
7222
7387
 
7388
+ <xsl:template match="@*|node()" mode="dt_clean">
7389
+ <xsl:copy>
7390
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
7391
+ </xsl:copy>
7392
+ </xsl:template>
7393
+
7394
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
7395
+
7223
7396
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
7224
7397
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
7225
7398
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -7255,10 +7428,12 @@
7255
7428
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
7256
7429
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
7257
7430
 
7431
+ <!-- dl/name -->
7258
7432
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
7259
7433
  <xsl:param name="process">false</xsl:param>
7260
7434
  <xsl:if test="$process = 'true'">
7261
7435
  <fo:block xsl:use-attribute-sets="dl-name-style">
7436
+
7262
7437
  <xsl:apply-templates/>
7263
7438
  </fo:block>
7264
7439
  </xsl:if>
@@ -7272,6 +7447,10 @@
7272
7447
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
7273
7448
 
7274
7449
  <xsl:choose>
7450
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
7451
+ <fo:table-column column-width="10%"/>
7452
+ <fo:table-column column-width="90%"/>
7453
+ </xsl:when> -->
7275
7454
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
7276
7455
  <xsl:call-template name="insertTableColumnWidth">
7277
7456
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -9399,6 +9578,27 @@
9399
9578
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
9400
9579
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
9401
9580
  </xsl:when> -->
9581
+
9582
+ <!-- <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'))">
9583
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
9584
+ <xsl:variable name="filename">
9585
+ <xsl:call-template name="substring-after-last">
9586
+ <xsl:with-param name="value" select="$target_"/>
9587
+ <xsl:with-param name="delimiter" select="'/'"/>
9588
+ </xsl:call-template>
9589
+ </xsl:variable>
9590
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
9591
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
9592
+ <xsl:choose>
9593
+ <xsl:when test="$file_exists = 'true'">
9594
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
9595
+ </xsl:when>
9596
+ <xsl:otherwise>
9597
+ <xsl:value-of select="normalize-space(@target)"/>
9598
+ </xsl:otherwise>
9599
+ </xsl:choose>
9600
+ </xsl:when> -->
9601
+
9402
9602
  <xsl:otherwise>
9403
9603
  <xsl:value-of select="normalize-space(@target)"/>
9404
9604
  </xsl:otherwise>
@@ -9707,7 +9907,7 @@
9707
9907
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
9708
9908
  </xsl:if>
9709
9909
 
9710
- </xsl:template>
9910
+ </xsl:template> <!-- refine_note_block_style -->
9711
9911
 
9712
9912
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
9713
9913
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -9899,10 +10099,21 @@
9899
10099
  </xsl:template>
9900
10100
 
9901
10101
  <xsl:template name="showFigureKey">
9902
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9903
- <xsl:call-template name="note"/>
10102
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
10103
+ <xsl:choose>
10104
+ <xsl:when test="local-name() = 'note'">
10105
+ <xsl:call-template name="note"/>
10106
+ </xsl:when>
10107
+ <xsl:when test="local-name() = 'example'">
10108
+ <xsl:call-template name="example"/>
10109
+ </xsl:when>
10110
+ <xsl:otherwise>
10111
+ <xsl:apply-templates select="."/>
10112
+ </xsl:otherwise>
10113
+ </xsl:choose>
9904
10114
  </xsl:for-each>
9905
- <xsl:call-template name="fn_display_figure"/>
10115
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
10116
+ <xsl:call-template name="figure_fn_display"/>
9906
10117
  </xsl:template>
9907
10118
 
9908
10119
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -10796,10 +11007,10 @@
10796
11007
  <xsl:when test="@type = 'section-title'">
10797
11008
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
10798
11009
  <xsl:text>: </xsl:text>
10799
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
11010
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
10800
11011
  </xsl:when>
10801
11012
  <xsl:otherwise>
10802
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
11013
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
10803
11014
  </xsl:otherwise>
10804
11015
  </xsl:choose>
10805
11016
  </xsl:when>
@@ -11130,9 +11341,15 @@
11130
11341
  </xsl:if>
11131
11342
  </xsl:template>
11132
11343
 
11344
+ <!-- figure/fn -->
11133
11345
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
11134
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
11346
+ <!-- figure/note -->
11347
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
11348
+ <!-- figure/example -->
11349
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
11135
11350
 
11351
+ <!-- figure/note[@type = 'units'] -->
11352
+ <!-- image/note[@type = 'units'] -->
11136
11353
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
11137
11354
  <fo:block text-align="right" keep-with-next="always">
11138
11355
  <xsl:apply-templates/>
@@ -11253,6 +11470,7 @@
11253
11470
  </xsl:choose>
11254
11471
  </xsl:template>
11255
11472
 
11473
+ <!-- fn -->
11256
11474
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
11257
11475
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
11258
11476
 
@@ -12150,7 +12368,7 @@
12150
12368
  text line 1
12151
12369
  text line 2
12152
12370
  -->
12153
- <xsl:template match="*[local-name() = 'example']">
12371
+ <xsl:template match="*[local-name() = 'example']" name="example">
12154
12372
 
12155
12373
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
12156
12374
 
@@ -12256,6 +12474,7 @@
12256
12474
 
12257
12475
  </xsl:template>
12258
12476
 
12477
+ <!-- example/name -->
12259
12478
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
12260
12479
  <xsl:param name="fo_element">block</xsl:param>
12261
12480
 
@@ -12281,7 +12500,8 @@
12281
12500
 
12282
12501
  </xsl:template>
12283
12502
 
12284
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
12503
+ <!-- table/example/name, table/tfoot//example/name -->
12504
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
12285
12505
  <fo:inline xsl:use-attribute-sets="example-name-style">
12286
12506
 
12287
12507
  <xsl:apply-templates/>
@@ -13958,8 +14178,33 @@
13958
14178
 
13959
14179
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
13960
14180
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
14181
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
14182
+ <!-- <test><xsl:copy-of select="."/></test> -->
14183
+
13961
14184
  <xsl:variable name="target" select="@target"/>
14185
+
13962
14186
  <xsl:for-each select="*[local-name() = 'tab']">
14187
+
14188
+ <xsl:if test="position() = 1">
14189
+ <!-- first column (data before first `tab`) -->
14190
+ <fo:table-cell>
14191
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
14192
+ <xsl:call-template name="insert_basic_link">
14193
+ <xsl:with-param name="element">
14194
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
14195
+ <xsl:for-each select="preceding-sibling::node()">
14196
+ <xsl:choose>
14197
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
14198
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
14199
+ </xsl:choose>
14200
+ </xsl:for-each>
14201
+ </fo:basic-link>
14202
+ </xsl:with-param>
14203
+ </xsl:call-template>
14204
+ </fo:block>
14205
+ </fo:table-cell>
14206
+ </xsl:if>
14207
+
13963
14208
  <xsl:variable name="current_id" select="generate-id()"/>
13964
14209
  <fo:table-cell>
13965
14210
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -14010,11 +14255,25 @@
14010
14255
 
14011
14256
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
14012
14257
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
14258
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
14013
14259
  <xsl:for-each select="*[local-name() = 'tab']">
14260
+ <xsl:if test="position() = 1">
14261
+ <td>
14262
+ <xsl:for-each select="preceding-sibling::node()">
14263
+ <xsl:choose>
14264
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
14265
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
14266
+ </xsl:choose>
14267
+ </xsl:for-each>
14268
+ </td>
14269
+ </xsl:if>
14014
14270
  <xsl:variable name="current_id" select="generate-id()"/>
14015
14271
  <td>
14016
14272
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
14017
- <xsl:copy-of select="."/>
14273
+ <xsl:choose>
14274
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
14275
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
14276
+ </xsl:choose>
14018
14277
  </xsl:for-each>
14019
14278
  </td>
14020
14279
  </xsl:for-each>
@@ -15408,6 +15667,7 @@
15408
15667
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
15409
15668
  </fn>
15410
15669
  -->
15670
+ <!-- fn in text -->
15411
15671
  <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">
15412
15672
  <xsl:variable name="p_fn_">
15413
15673
  <xsl:call-template name="get_fn_list"/>