metanorma-bipm 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.
@@ -801,6 +801,7 @@
801
801
  <xsl:attribute name="target">
802
802
  <xsl:call-template name="fn_reference_to_xref_target"/>
803
803
  </xsl:attribute>
804
+ <!-- <xsl:copy-of select="@target"/> -->
804
805
 
805
806
  <xsl:variable name="curr_clause_id" select="normalize-space(ancestor::bipm:clause[1]/@id)"/>
806
807
  <xsl:variable name="curr_annex_id" select="normalize-space(ancestor::bipm:annex[1]/@id)"/>
@@ -818,18 +819,27 @@
818
819
 
819
820
  <xsl:element name="sup_fn" namespace="https://www.metanorma.org/ns/standoc">
820
821
  <xsl:value-of select="concat('(',$number,')')"/>
822
+ <!-- <xsl:value-of select="concat('(',normalize-space(./*[local-name() = 'fmt-fn-label']),')')"/> -->
823
+ <!-- https://github.com/metanorma/isodoc/issues/658#issuecomment-2726450824 -->
824
+ <!-- <xsl:apply-templates select="*[local-name() = 'fmt-fn-label']/node()" mode="flatxml"/> -->
821
825
  </xsl:element>
822
826
 
823
827
  </xsl:element>
824
828
  </xsl:template>
825
829
 
830
+ <!-- <xsl:template match="*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" mode="flatxml">
831
+ <xsl:element name="sup_fn" namespace="https://www.metanorma.org/ns/standoc">
832
+ <xsl:apply-templates mode="flatxml"/>
833
+ </xsl:element>
834
+ </xsl:template> -->
835
+
826
836
  <xsl:template name="fn_reference_to_xref_target">
827
837
  <xsl:variable name="lang" select="ancestor::bipm:metanorma/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
828
- <xsl:variable name="gen_id" select="generate-id()"/>
829
- <xsl:variable name="curr_clause_id" select="ancestor::bipm:clause[1]/@id"/>
830
- <xsl:variable name="number">
831
- <xsl:number count="bipm:fn[ancestor::bipm:clause[1]/@id = $curr_clause_id][ancestor::bipm:quote or not(ancestor::bipm:table)]" level="any"/>
832
- </xsl:variable>
838
+ <xsl:variable name="gen_id" select="generate-id()"/>
839
+ <xsl:variable name="curr_clause_id" select="ancestor::bipm:clause[1]/@id"/>
840
+ <xsl:variable name="number">
841
+ <xsl:number count="bipm:fn[ancestor::bipm:clause[1]/@id = $curr_clause_id][ancestor::bipm:quote or not(ancestor::bipm:table)]" level="any"/>
842
+ </xsl:variable>
833
843
  <xsl:value-of select="concat($lang, '_footnote_', @reference, '_', $number, '_', $gen_id)"/>
834
844
  </xsl:template>
835
845
 
@@ -934,8 +944,11 @@
934
944
 
935
945
  <xsl:attribute name="id">
936
946
  <xsl:call-template name="fn_reference_to_xref_target"/>
947
+ <!-- <xsl:value-of select="@target"/> -->
937
948
  </xsl:attribute>
938
949
 
950
+ <xsl:variable name="curr_id" select="@target"/>
951
+
939
952
  <xsl:variable name="curr_clause_id" select="normalize-space(ancestor::bipm:clause[1]/@id)"/>
940
953
  <xsl:variable name="curr_annex_id" select="normalize-space(ancestor::bipm:annex[1]/@id)"/>
941
954
 
@@ -952,10 +965,13 @@
952
965
 
953
966
  <xsl:element name="sup_fn" namespace="https://www.metanorma.org/ns/standoc">
954
967
  <xsl:value-of select="concat('(',$number,')')"/>
968
+ <!-- https://github.com/metanorma/isodoc/issues/658#issuecomment-2726450824 -->
969
+ <!-- <xsl:apply-templates select="*[local-name() = 'fmt-fn-label']/node()" mode="flatxml"/> -->
955
970
  </xsl:element>
956
971
  <xsl:text> </xsl:text>
957
972
 
958
- <xsl:apply-templates mode="flatxml"/>
973
+ <!-- <xsl:apply-templates mode="flatxml"/> -->
974
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $curr_id]/node()" mode="flatxml"/>
959
975
  </xsl:element>
960
976
  </xsl:template>
961
977
 
@@ -2800,6 +2816,9 @@
2800
2816
  <xsl:apply-templates select="."/>
2801
2817
  </xsl:template>
2802
2818
 
2819
+ <!-- note_side/fmt-fn-label in text -->
2820
+ <xsl:template match="*[local-name() = 'note_side']//*[local-name() = 'fmt-fn-label']"/>
2821
+
2803
2822
  <xsl:template match="*[local-name() = 'note_side']/*[local-name() = 'p']">
2804
2823
  <xsl:variable name="num"><xsl:number/></xsl:variable>
2805
2824
  <xsl:choose>
@@ -3140,12 +3159,28 @@
3140
3159
  <xsl:value-of select="."/>
3141
3160
  </xsl:template>
3142
3161
 
3162
+ <!-- <xsl:template match="*[local-name() = 'sup_fn']/*[local-name() = 'sup']"> -->
3143
3163
  <xsl:template match="*[local-name() = 'sup_fn']">
3144
3164
  <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
3145
3165
  <xsl:apply-templates/>
3146
3166
  </fo:inline>
3147
3167
  </xsl:template>
3148
3168
 
3169
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'sup_fn']">
3170
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style">
3171
+ <xsl:apply-templates/>
3172
+ </fo:inline>
3173
+ </xsl:template>
3174
+
3175
+ <!-- see <xsl:template match="*[local-name()='fn']"> -->
3176
+ <xsl:template match="*[local-name() = 'fn']/*[local-name() = 'fmt-fn-label']/*[local-name() = 'sup']" priority="5">
3177
+ <xsl:apply-templates/>
3178
+ </xsl:template>
3179
+ <!-- For: <fo:inline font-style="normal">(</fo:inline>a<fo:inline font-style="normal">)</fo:inline> -->
3180
+ <xsl:template match="*[local-name() = 'fmt-fn-label']//*[local-name() = 'span'][@class = 'fmt-label-delim']" priority="5">
3181
+ <fo:inline font-style="normal"><xsl:apply-templates/></fo:inline>
3182
+ </xsl:template>
3183
+
3149
3184
  <!-- DEBUG -->
3150
3185
  <!-- <xsl:template match="mathml:math" priority="10"/> -->
3151
3186
 
@@ -3391,13 +3426,27 @@
3391
3426
 
3392
3427
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width" priority="2">
3393
3428
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
3429
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
3394
3430
  <xsl:for-each select="*[local-name() = 'tab']">
3395
3431
  <xsl:variable name="pos" select="position()"/>
3396
3432
  <xsl:variable name="current_id" select="generate-id()"/>
3433
+
3434
+ <xsl:if test="$pos = 1">
3435
+ <td>
3436
+ <xsl:for-each select="preceding-sibling::node()">
3437
+ <xsl:choose>
3438
+ <xsl:when test="self::text()"><xsl:value-of select="translate(., ' ', ' ')"/></xsl:when>
3439
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
3440
+ </xsl:choose>
3441
+ </xsl:for-each>
3442
+ </td>
3443
+ </xsl:if>
3444
+
3397
3445
  <td>
3398
3446
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
3399
3447
  <xsl:choose>
3400
- <xsl:when test="$pos = 1 and self::text()"><xsl:value-of select="translate(., ' ', ' ')"/></xsl:when>
3448
+ <!-- <xsl:when test="$pos = 1 and self::text()"><xsl:value-of select="translate(., ' ', '&#xa0;')"/></xsl:when> -->
3449
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
3401
3450
  <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
3402
3451
  </xsl:choose>
3403
3452
  </xsl:for-each>
@@ -4834,15 +4883,19 @@
4834
4883
  </xsl:template>
4835
4884
 
4836
4885
  <xsl:attribute-set name="table-fn-number-style">
4837
- <xsl:attribute name="font-size">80%</xsl:attribute>
4838
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
4886
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
4839
4887
 
4840
4888
  <xsl:attribute name="font-style">italic</xsl:attribute>
4841
- <xsl:attribute name="padding-right">2.5mm</xsl:attribute>
4889
+ <!-- <xsl:attribute name="padding-right">2.5mm</xsl:attribute> -->
4842
4890
 
4843
4891
  </xsl:attribute-set> <!-- table-fn-number-style -->
4844
4892
 
4845
- <xsl:template name="refine_table-fn-number-style">
4893
+ <xsl:attribute-set name="table-fmt-fn-label-style">
4894
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4895
+
4896
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
4897
+
4898
+ <xsl:template name="refine_table-fmt-fn-label-style">
4846
4899
 
4847
4900
  </xsl:template>
4848
4901
 
@@ -4857,11 +4910,18 @@
4857
4910
  </xsl:attribute-set>
4858
4911
 
4859
4912
  <xsl:attribute-set name="figure-fn-number-style">
4860
- <xsl:attribute name="font-size">80%</xsl:attribute>
4861
4913
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
4914
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
4915
+
4916
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
4917
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4862
4918
  <xsl:attribute name="vertical-align">super</xsl:attribute>
4863
4919
 
4864
- </xsl:attribute-set>
4920
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
4921
+
4922
+ <xsl:template name="refine_figure-fmt-fn-label-style">
4923
+
4924
+ </xsl:template>
4865
4925
 
4866
4926
  <xsl:attribute-set name="figure-fn-body-style">
4867
4927
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -6391,9 +6451,13 @@
6391
6451
 
6392
6452
  <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']"/>
6393
6453
  <xsl:if test="$isNoteOrFnExist = 'true'">
6394
-
6395
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
6396
-
6454
+ <!-- <xsl:choose>
6455
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
6456
+ <xsl:otherwise>
6457
+
6458
+ </xsl:otherwise>
6459
+ </xsl:choose> -->
6460
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
6397
6461
  </xsl:if>
6398
6462
 
6399
6463
  <xsl:choose>
@@ -6440,7 +6504,7 @@
6440
6504
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
6441
6505
  </xsl:when>
6442
6506
  <xsl:otherwise>
6443
- <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 -->
6507
+ <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 -->
6444
6508
  </xsl:otherwise>
6445
6509
  </xsl:choose>
6446
6510
 
@@ -6451,13 +6515,26 @@
6451
6515
 
6452
6516
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
6453
6517
 
6454
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
6455
- <xsl:call-template name="insertTableFooterInSeparateTable">
6456
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
6457
- <xsl:with-param name="colwidths" select="$colwidths"/>
6458
- <xsl:with-param name="colgroup" select="$colgroup"/>
6459
- </xsl:call-template>
6460
- </xsl:for-each>
6518
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
6519
+
6520
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
6521
+ <xsl:call-template name="insertTableFooterInSeparateTable">
6522
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
6523
+ <xsl:with-param name="colwidths" select="$colwidths"/>
6524
+ <xsl:with-param name="colgroup" select="$colgroup"/>
6525
+ </xsl:call-template>
6526
+ </xsl:for-each>
6527
+
6528
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
6529
+ <xsl:if test="$namespace = 'plateau'">
6530
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
6531
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
6532
+ <xsl:variable name="table_fn_block">
6533
+ <xsl:call-template name="table_fn_display" />
6534
+ </xsl:variable>
6535
+ <xsl:copy-of select="$table_fn_block"/>
6536
+ </xsl:for-each>
6537
+ </xsl:if> -->
6461
6538
 
6462
6539
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
6463
6540
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -7353,6 +7430,17 @@
7353
7430
  <xsl:attribute name="text-align">left</xsl:attribute>
7354
7431
  </xsl:if>
7355
7432
 
7433
+ <xsl:if test="$isGenerateTableIF = 'false'">
7434
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
7435
+ <xsl:attribute name="text-align">right</xsl:attribute>
7436
+ <xsl:attribute name="border">none</xsl:attribute>
7437
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
7438
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
7439
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
7440
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
7441
+ </xsl:if>
7442
+ </xsl:if>
7443
+
7356
7444
  <fo:block role="SKIP">
7357
7445
 
7358
7446
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -7380,7 +7468,8 @@
7380
7468
  </fo:table-cell>
7381
7469
  </xsl:template> <!-- td -->
7382
7470
 
7383
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
7471
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
7472
+ <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">
7384
7473
 
7385
7474
  <fo:block xsl:use-attribute-sets="table-note-style">
7386
7475
  <xsl:copy-of select="@id"/>
@@ -7405,65 +7494,54 @@
7405
7494
 
7406
7495
  </xsl:template> <!-- table/note -->
7407
7496
 
7408
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
7497
+ <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">
7409
7498
  <xsl:apply-templates/>
7410
7499
  </xsl:template>
7411
7500
 
7412
7501
  <!-- ===================== -->
7413
7502
  <!-- Footnotes processing -->
7414
7503
  <!-- ===================== -->
7504
+
7505
+ <!-- document text (not figures, or tables) footnotes -->
7506
+ <xsl:variable name="footnotes_">
7507
+ <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 -->
7508
+ <!-- <xsl:copy-of select="."/> -->
7509
+ <xsl:variable name="update_xml_step1">
7510
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7511
+ </xsl:variable>
7512
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
7513
+ </xsl:for-each>
7514
+ </xsl:variable>
7515
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
7516
+
7415
7517
  <!--
7416
7518
  <fn reference="1">
7417
7519
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
7418
7520
  </fn>
7419
7521
  -->
7420
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
7522
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
7523
+ <!-- fn in text -->
7421
7524
  <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">
7422
7525
 
7423
- <!-- list of footnotes to calculate actual footnotes number -->
7526
+ <!-- list of unique footnotes -->
7424
7527
  <xsl:variable name="p_fn_">
7425
7528
  <xsl:call-template name="get_fn_list"/>
7426
- <!-- <xsl:choose>
7427
- <xsl:when test="$namespace = 'jis'">
7428
- <xsl:call-template name="get_fn_list_for_element"/>
7429
- </xsl:when>
7430
- <xsl:otherwise>
7431
- <xsl:call-template name="get_fn_list"/>
7432
- </xsl:otherwise>
7433
- </xsl:choose> -->
7434
7529
  </xsl:variable>
7435
7530
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
7436
7531
 
7437
7532
  <xsl:variable name="gen_id" select="generate-id(.)"/>
7438
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
7439
- <xsl:variable name="reference_">
7440
- <xsl:value-of select="@reference"/>
7441
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
7442
- </xsl:variable>
7443
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
7533
+
7444
7534
  <!-- fn sequence number in document -->
7445
- <xsl:variable name="current_fn_number">
7446
- <xsl:choose>
7447
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
7448
- <xsl:otherwise>
7449
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
7450
- </xsl:otherwise>
7451
- </xsl:choose>
7452
- </xsl:variable>
7535
+ <xsl:variable name="current_fn_number" select="@reference"/>
7536
+
7453
7537
  <xsl:variable name="current_fn_number_text">
7454
7538
 
7455
7539
  <xsl:value-of select="$current_fn_number"/>
7456
7540
 
7457
7541
  </xsl:variable>
7458
7542
 
7459
- <xsl:variable name="ref_id">
7460
- <xsl:choose>
7461
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
7462
- <xsl:otherwise>
7463
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
7464
- </xsl:otherwise>
7465
- </xsl:choose>
7466
- </xsl:variable>
7543
+ <xsl:variable name="ref_id" select="@target"/>
7544
+
7467
7545
  <xsl:variable name="footnote_inline">
7468
7546
  <fo:inline role="Reference">
7469
7547
 
@@ -7508,7 +7586,9 @@
7508
7586
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
7509
7587
  <xsl:copy-of select="$footnote_inline"/>
7510
7588
  </xsl:when>
7589
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
7511
7590
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
7591
+
7512
7592
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
7513
7593
  <xsl:copy-of select="$footnote_inline"/>
7514
7594
  <fo:footnote-body role="Note">
@@ -7525,7 +7605,10 @@
7525
7605
  <xsl:value-of select="$current_fn_number_text"/>
7526
7606
 
7527
7607
  </fo:inline>
7528
- <xsl:apply-templates/>
7608
+ <!-- <xsl:apply-templates /> -->
7609
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
7610
+ <here><xsl:copy-of select="$footnotes"/></here> -->
7611
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
7529
7612
  </xsl:variable>
7530
7613
 
7531
7614
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -7579,81 +7662,138 @@
7579
7662
  </xsl:choose>
7580
7663
  </xsl:template>
7581
7664
 
7582
- <xsl:template name="get_fn_list_for_element">
7583
- <xsl:choose>
7584
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
7585
- <fn gen_id="{generate-id(.)}">
7586
- <xsl:copy-of select="@*"/>
7587
- <xsl:copy-of select="node()"/>
7588
- </fn>
7589
- </xsl:when>
7590
- <xsl:otherwise>
7591
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
7592
- <xsl:variable name="element_id" select="@id"/>
7593
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
7594
- <!-- copy unique fn -->
7595
- <fn gen_id="{generate-id(.)}">
7596
- <xsl:copy-of select="@*"/>
7597
- <xsl:copy-of select="node()"/>
7598
- </fn>
7599
- </xsl:for-each>
7600
- </xsl:for-each>
7601
- </xsl:otherwise>
7602
- </xsl:choose>
7603
- </xsl:template>
7604
7665
  <!-- ============================ -->
7605
7666
  <!-- table's footnotes rendering -->
7606
7667
  <!-- ============================ -->
7607
- <xsl:template name="table_fn_display">
7608
- <xsl:variable name="references">
7609
7668
 
7669
+ <!-- table/fmt-footnote-container -->
7670
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
7671
+
7672
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
7673
+ <xsl:for-each select=".">
7674
+ <xsl:call-template name="table_fn_display"/>
7675
+ </xsl:for-each>
7676
+ </xsl:template>
7677
+
7678
+ <xsl:template name="table_fn_display">
7679
+ <!-- <xsl:variable name="references">
7680
+ <xsl:if test="$namespace = 'bsi'">
7681
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
7682
+ <xsl:call-template name="create_fn" />
7683
+ </xsl:for-each>
7684
+ </xsl:if>
7610
7685
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
7611
- <xsl:call-template name="create_fn"/>
7686
+ <xsl:call-template name="create_fn" />
7612
7687
  </xsl:for-each>
7613
- </xsl:variable>
7614
-
7615
- <xsl:for-each select="xalan:nodeset($references)//fn">
7688
+ </xsl:variable> -->
7689
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
7616
7690
  <xsl:variable name="reference" select="@reference"/>
7617
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
7691
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
7692
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
7618
7693
 
7619
7694
  <fo:block xsl:use-attribute-sets="table-fn-style">
7695
+ <xsl:copy-of select="@id"/>
7620
7696
  <xsl:call-template name="refine_table-fn-style"/>
7621
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
7622
- <xsl:call-template name="refine_table-fn-number-style"/>
7623
-
7624
- <fo:inline font-style="normal">(</fo:inline>
7625
7697
 
7626
- <xsl:value-of select="@reference"/>
7627
-
7628
- <fo:inline font-style="normal">)</fo:inline>
7629
-
7630
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
7631
- <!-- <xsl:if test="$namespace = 'itu'">
7632
- <xsl:text>)</xsl:text>
7633
- </xsl:if> -->
7698
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
7699
+ <xsl:with-param name="process">true</xsl:with-param>
7700
+ </xsl:apply-templates>
7634
7701
 
7635
- </fo:inline>
7636
7702
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
7637
- <xsl:copy-of select="./node()"/>
7703
+ <!-- <xsl:copy-of select="./node()"/> -->
7704
+ <xsl:apply-templates/>
7638
7705
  </fo:inline>
7639
7706
 
7640
7707
  </fo:block>
7641
7708
 
7642
- </xsl:if>
7709
+ <!-- </xsl:if> -->
7643
7710
  </xsl:for-each>
7644
7711
  </xsl:template> <!-- table_fn_display -->
7645
7712
 
7713
+ <!-- fmt-fn-body/fmt-fn-label in text -->
7714
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
7715
+
7716
+ <!-- table//fmt-fn-body//fmt-fn-label -->
7717
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
7718
+ <xsl:param name="process">false</xsl:param>
7719
+ <xsl:if test="$process = 'true'">
7720
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
7721
+
7722
+ <!-- tab is padding-right -->
7723
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
7724
+ <xsl:with-param name="process">true</xsl:with-param>
7725
+ </xsl:apply-templates>
7726
+
7727
+ <!-- <xsl:if test="$namespace = 'bipm'">
7728
+ <fo:inline font-style="normal">(</fo:inline>
7729
+ </xsl:if> -->
7730
+
7731
+ <!-- <xsl:if test="$namespace = 'plateau'">
7732
+ <xsl:text>※</xsl:text>
7733
+ </xsl:if> -->
7734
+
7735
+ <!-- <xsl:value-of select="@reference"/> -->
7736
+ <!-- <xsl:value-of select="normalize-space()"/> -->
7737
+ <xsl:apply-templates/>
7738
+
7739
+ <!-- <xsl:if test="$namespace = 'bipm'">
7740
+ <fo:inline font-style="normal">)</fo:inline>
7741
+ </xsl:if> -->
7742
+
7743
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
7744
+ <!-- <xsl:if test="$namespace = 'itu'">
7745
+ <xsl:text>)</xsl:text>
7746
+ </xsl:if> -->
7747
+
7748
+ <!-- <xsl:if test="$namespace = 'plateau'">
7749
+ <xsl:text>:</xsl:text>
7750
+ </xsl:if> -->
7751
+
7752
+ </fo:inline>
7753
+ </xsl:if>
7754
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
7755
+
7756
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
7757
+ <xsl:param name="process">false</xsl:param>
7758
+ <xsl:if test="$process = 'true'">
7759
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
7760
+
7761
+ <xsl:attribute name="padding-right">2.5mm</xsl:attribute>
7762
+
7763
+ </xsl:if>
7764
+ </xsl:template>
7765
+
7766
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
7767
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
7768
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
7769
+ <xsl:apply-templates/>
7770
+ </fo:inline>
7771
+ </xsl:template>
7772
+
7773
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
7774
+ <!--
7646
7775
  <xsl:template name="create_fn">
7647
7776
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
7648
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
7777
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
7649
7778
  <xsl:attribute name="id">
7650
7779
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
7651
7780
  </xsl:attribute>
7652
7781
  </xsl:if>
7653
-
7654
- <xsl:apply-templates/>
7782
+ <xsl:if test="$namespace = 'itu'">
7783
+ <xsl:if test="ancestor::*[local-name()='preface']">
7784
+ <xsl:attribute name="preface">true</xsl:attribute>
7785
+ </xsl:if>
7786
+ </xsl:if>
7787
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
7788
+ <xsl:attribute name="id">
7789
+ <xsl:value-of select="@reference"/>
7790
+ <xsl:text>_</xsl:text>
7791
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
7792
+ </xsl:attribute>
7793
+ </xsl:if>
7794
+ <xsl:apply-templates />
7655
7795
  </fn>
7656
- </xsl:template>
7796
+ </xsl:template> -->
7657
7797
 
7658
7798
  <!-- footnotes for table's name rendering -->
7659
7799
  <xsl:template name="table_name_fn_display">
@@ -7672,123 +7812,171 @@
7672
7812
  <!-- ============================ -->
7673
7813
  <!-- figure's footnotes rendering -->
7674
7814
  <!-- ============================ -->
7675
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
7676
7815
 
7677
- <!-- current figure id -->
7678
- <xsl:variable name="figure_id_">
7679
- <xsl:value-of select="@id"/>
7680
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
7681
- </xsl:variable>
7682
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
7816
+ <!-- figure/fmt-footnote-container -->
7817
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
7818
+
7819
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
7820
+ <xsl:template name="figure_fn_display">
7683
7821
 
7684
- <!-- all footnotes relates to the current figure -->
7685
7822
  <xsl:variable name="references">
7686
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
7687
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
7688
- <xsl:apply-templates/>
7689
- </fn>
7823
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
7824
+ <xsl:variable name="curr_id" select="@id"/>
7825
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
7826
+ <curr><xsl:copy-of select="."/></curr>
7827
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
7828
+ <xsl:choose>
7829
+ <!-- skip figure/name/fn -->
7830
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
7831
+ <xsl:otherwise>
7832
+ <xsl:element name="figure" namespace="{$namespace_full}">
7833
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
7834
+ <xsl:copy-of select="."/>
7835
+ </xsl:element>
7836
+ </xsl:element>
7837
+ </xsl:otherwise>
7838
+ </xsl:choose>
7690
7839
  </xsl:for-each>
7691
7840
  </xsl:variable>
7841
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
7692
7842
 
7693
- <xsl:if test="xalan:nodeset($references)//fn">
7843
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
7694
7844
 
7695
7845
  <xsl:variable name="key_iso">
7696
7846
 
7697
7847
  </xsl:variable>
7698
7848
 
7699
7849
  <fo:block>
7850
+ <!-- current hierarchy is 'figure' element -->
7851
+ <xsl:variable name="following_dl_colwidths">
7852
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
7853
+ <xsl:variable name="simple-table">
7854
+ <!-- <xsl:variable name="doc_ns">
7855
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
7856
+ </xsl:variable>
7857
+ <xsl:variable name="ns">
7858
+ <xsl:choose>
7859
+ <xsl:when test="normalize-space($doc_ns) != ''">
7860
+ <xsl:value-of select="normalize-space($doc_ns)"/>
7861
+ </xsl:when>
7862
+ <xsl:otherwise>
7863
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
7864
+ </xsl:otherwise>
7865
+ </xsl:choose>
7866
+ </xsl:variable> -->
7700
7867
 
7701
- <!-- current hierarchy is 'figure' element -->
7702
- <xsl:variable name="following_dl_colwidths">
7703
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
7704
- <xsl:variable name="simple-table">
7705
- <!-- <xsl:variable name="doc_ns">
7706
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
7707
- </xsl:variable>
7708
- <xsl:variable name="ns">
7709
- <xsl:choose>
7710
- <xsl:when test="normalize-space($doc_ns) != ''">
7711
- <xsl:value-of select="normalize-space($doc_ns)"/>
7712
- </xsl:when>
7713
- <xsl:otherwise>
7714
- <xsl:value-of select="substring-before(name(/*), '-')"/>
7715
- </xsl:otherwise>
7716
- </xsl:choose>
7717
- </xsl:variable> -->
7868
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
7869
+ <tbody>
7870
+ <xsl:apply-templates mode="dl"/>
7871
+ </tbody>
7872
+ </xsl:for-each>
7873
+ </xsl:variable>
7718
7874
 
7719
- <xsl:for-each select="*[local-name() = 'dl'][1]">
7720
- <tbody>
7721
- <xsl:apply-templates mode="dl"/>
7722
- </tbody>
7723
- </xsl:for-each>
7724
- </xsl:variable>
7875
+ <xsl:call-template name="calculate-column-widths">
7876
+ <xsl:with-param name="cols-count" select="2"/>
7877
+ <xsl:with-param name="table" select="$simple-table"/>
7878
+ </xsl:call-template>
7725
7879
 
7726
- <xsl:call-template name="calculate-column-widths">
7727
- <xsl:with-param name="cols-count" select="2"/>
7728
- <xsl:with-param name="table" select="$simple-table"/>
7729
- </xsl:call-template>
7880
+ </xsl:if>
7881
+ </xsl:variable>
7730
7882
 
7731
- </xsl:if>
7732
- </xsl:variable>
7883
+ <xsl:variable name="maxlength_dt">
7884
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
7885
+ <xsl:call-template name="getMaxLength_dt"/>
7886
+ </xsl:for-each>
7887
+ </xsl:variable>
7733
7888
 
7734
- <xsl:variable name="maxlength_dt">
7735
- <xsl:for-each select="*[local-name() = 'dl'][1]">
7736
- <xsl:call-template name="getMaxLength_dt"/>
7737
- </xsl:for-each>
7738
- </xsl:variable>
7889
+ <fo:table width="95%" table-layout="fixed">
7890
+ <xsl:if test="normalize-space($key_iso) = 'true'">
7891
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
7892
+
7893
+ </xsl:if>
7894
+ <xsl:choose>
7895
+ <!-- if there 'dl', then set same columns width -->
7896
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
7897
+ <xsl:call-template name="setColumnWidth_dl">
7898
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
7899
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
7900
+ </xsl:call-template>
7901
+ </xsl:when>
7902
+ <xsl:otherwise>
7903
+ <fo:table-column column-width="5%"/>
7904
+ <fo:table-column column-width="95%"/>
7905
+ </xsl:otherwise>
7906
+ </xsl:choose>
7907
+ <fo:table-body>
7908
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
7909
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
7739
7910
 
7740
- <fo:table width="95%" table-layout="fixed">
7741
- <xsl:if test="normalize-space($key_iso) = 'true'">
7742
- <xsl:attribute name="font-size">10pt</xsl:attribute>
7911
+ <xsl:variable name="reference" select="@reference"/>
7912
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
7913
+ <fo:table-row>
7914
+ <fo:table-cell>
7915
+ <fo:block>
7743
7916
 
7744
- </xsl:if>
7745
- <xsl:choose>
7746
- <!-- if there 'dl', then set same columns width -->
7747
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
7748
- <xsl:call-template name="setColumnWidth_dl">
7749
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
7750
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
7751
- </xsl:call-template>
7752
- </xsl:when>
7753
- <xsl:otherwise>
7754
- <fo:table-column column-width="5%"/>
7755
- <fo:table-column column-width="95%"/>
7756
- </xsl:otherwise>
7757
- </xsl:choose>
7758
- <fo:table-body>
7759
- <xsl:for-each select="xalan:nodeset($references)//fn">
7760
- <xsl:variable name="reference" select="@reference"/>
7761
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
7762
- <fo:table-row>
7763
- <fo:table-cell>
7764
- <fo:block>
7765
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
7766
- <xsl:value-of select="@reference"/>
7917
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
7918
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
7919
+ <!-- <xsl:value-of select="@reference"/> -->
7920
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
7767
7921
  </fo:inline>
7768
- </fo:block>
7769
- </fo:table-cell>
7770
- <fo:table-cell>
7771
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
7772
- <xsl:if test="normalize-space($key_iso) = 'true'">
7773
7922
 
7774
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
7923
+ </fo:block>
7924
+ </fo:table-cell>
7925
+ <fo:table-cell>
7926
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
7927
+ <xsl:if test="normalize-space($key_iso) = 'true'">
7928
+
7929
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
7775
7930
 
7776
- </xsl:if>
7777
- <xsl:copy-of select="./node()"/>
7778
- </fo:block>
7779
- </fo:table-cell>
7780
- </fo:table-row>
7781
- </xsl:if>
7782
- </xsl:for-each>
7783
- </fo:table-body>
7784
- </fo:table>
7931
+ </xsl:if>
7785
7932
 
7933
+ <!-- <xsl:copy-of select="./node()"/> -->
7934
+ <xsl:apply-templates/>
7935
+ </fo:block>
7936
+ </fo:table-cell>
7937
+ </fo:table-row>
7938
+ <!-- </xsl:if> -->
7939
+ </xsl:for-each>
7940
+ </fo:table-body>
7941
+ </fo:table>
7786
7942
  </fo:block>
7787
7943
  </xsl:if>
7788
- </xsl:template> <!-- fn_display_figure -->
7944
+ </xsl:template> <!-- figure_fn_display -->
7945
+
7946
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
7947
+ <xsl:param name="process">false</xsl:param>
7948
+ <xsl:if test="$process = 'true'">
7949
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
7950
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
7951
+
7952
+ <!-- tab is padding-right -->
7953
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
7954
+ <xsl:with-param name="process">true</xsl:with-param>
7955
+ </xsl:apply-templates>
7956
+
7957
+ <xsl:apply-templates/>
7958
+
7959
+ </fo:inline>
7960
+ </xsl:if>
7961
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
7962
+
7963
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
7964
+ <xsl:param name="process">false</xsl:param>
7965
+ <xsl:if test="$process = 'true'">
7966
+
7967
+ </xsl:if>
7968
+ </xsl:template>
7969
+
7970
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
7971
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
7972
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
7973
+ <xsl:apply-templates/>
7974
+ </fo:inline>
7975
+ </xsl:template>
7789
7976
 
7790
7977
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
7791
7978
  <!-- figure's footnote label -->
7979
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
7792
7980
  <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">
7793
7981
  <xsl:variable name="key_iso">
7794
7982
 
@@ -7797,7 +7985,7 @@
7797
7985
  <xsl:attribute name="font-size">10pt</xsl:attribute>
7798
7986
 
7799
7987
  </xsl:if>
7800
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
7988
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
7801
7989
  <!-- <xsl:value-of select="@reference"/> -->
7802
7990
  <xsl:apply-templates/>
7803
7991
  </fo:inline>
@@ -7807,42 +7995,68 @@
7807
7995
  <!-- END: figure's footnotes rendering -->
7808
7996
  <!-- ============================ -->
7809
7997
 
7810
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
7998
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
7999
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
7811
8000
  <xsl:template match="*[local-name()='fn']">
7812
8001
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
7813
8002
 
7814
8003
  <xsl:call-template name="refine_fn-reference-style"/>
7815
8004
 
7816
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7817
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
7818
- <xsl:attribute name="internal-destination">
8005
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
8006
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
8007
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
8008
+ <!-- <xsl:attribute name="internal-destination">
7819
8009
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
7820
8010
  </xsl:attribute>
7821
8011
  </xsl:if>
8012
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
8013
+ <xsl:attribute name="internal-destination">
8014
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
8015
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
8016
+ </xsl:attribute>
8017
+ </xsl:if> -->
8018
+ <!-- <xsl:if test="$namespace = 'plateau'">
8019
+ <xsl:text>※</xsl:text>
8020
+ </xsl:if> -->
8021
+ <!-- <xsl:value-of select="@reference"/> -->
7822
8022
 
7823
- <fo:inline font-style="normal"> (</fo:inline>
7824
-
7825
- <xsl:value-of select="@reference"/>
7826
-
7827
- <fo:inline font-style="normal">)</fo:inline>
8023
+ <fo:inline font-style="normal"> </fo:inline>
8024
+ <!-- Example: <fmt-fn-label><sup><span class="fmt-label-delim">(</span>a<span class="fmt-label-delim">)</span></sup></fmt-fn-label> -->
8025
+ <!-- to <fo:inline font-style="normal">(</fo:inline> ... -->
8026
+ <xsl:apply-templates select="*[local-name() = 'fmt-fn-label']/node()"/>
7828
8027
 
8028
+ <!-- <xsl:if test="$namespace = 'bsi'">
8029
+ <xsl:text>)</xsl:text>
8030
+ </xsl:if> -->
7829
8031
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
7830
8032
  <!-- <xsl:if test="$namespace = 'jis'">
7831
8033
  <fo:inline font-weight="normal">)</fo:inline>
7832
8034
  </xsl:if> -->
7833
8035
  </fo:basic-link>
7834
8036
  </fo:inline>
7835
- </xsl:template>
8037
+ </xsl:template> <!-- fn -->
7836
8038
 
8039
+ <!-- fn/text() -->
7837
8040
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
7838
8041
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
7839
8042
  </xsl:template>
7840
8043
 
7841
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
8044
+ <!-- fn//p fmt-fn-body//p -->
8045
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
7842
8046
  <fo:inline role="P">
7843
8047
  <xsl:apply-templates/>
7844
8048
  </fo:inline>
7845
8049
  </xsl:template>
8050
+
8051
+ <xsl:template name="insertFootnoteSeparatorCommon">
8052
+ <xsl:param name="leader_length">30%</xsl:param>
8053
+ <fo:static-content flow-name="xsl-footnote-separator">
8054
+ <fo:block>
8055
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
8056
+ </fo:block>
8057
+ </fo:static-content>
8058
+ </xsl:template>
8059
+
7846
8060
  <!-- ===================== -->
7847
8061
  <!-- END Footnotes processing -->
7848
8062
  <!-- ===================== -->
@@ -8120,11 +8334,11 @@
8120
8334
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
8121
8335
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
8122
8336
 
8123
- <xsl:call-template name="setColumnWidth_dl">
8124
- <xsl:with-param name="colwidths" select="$colwidths"/>
8125
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
8126
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
8127
- </xsl:call-template>
8337
+ <xsl:call-template name="setColumnWidth_dl">
8338
+ <xsl:with-param name="colwidths" select="$colwidths"/>
8339
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
8340
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
8341
+ </xsl:call-template>
8128
8342
 
8129
8343
  <fo:table-body>
8130
8344
 
@@ -8158,6 +8372,14 @@
8158
8372
 
8159
8373
  </xsl:template> <!-- END: dl -->
8160
8374
 
8375
+ <xsl:template match="@*|node()" mode="dt_clean">
8376
+ <xsl:copy>
8377
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
8378
+ </xsl:copy>
8379
+ </xsl:template>
8380
+
8381
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
8382
+
8161
8383
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
8162
8384
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
8163
8385
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -8187,10 +8409,12 @@
8187
8409
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
8188
8410
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
8189
8411
 
8412
+ <!-- dl/name -->
8190
8413
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
8191
8414
  <xsl:param name="process">false</xsl:param>
8192
8415
  <xsl:if test="$process = 'true'">
8193
8416
  <fo:block xsl:use-attribute-sets="dl-name-style">
8417
+
8194
8418
  <xsl:apply-templates/>
8195
8419
  </fo:block>
8196
8420
  </xsl:if>
@@ -8204,6 +8428,10 @@
8204
8428
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
8205
8429
 
8206
8430
  <xsl:choose>
8431
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
8432
+ <fo:table-column column-width="10%"/>
8433
+ <fo:table-column column-width="90%"/>
8434
+ </xsl:when> -->
8207
8435
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
8208
8436
  <xsl:call-template name="insertTableColumnWidth">
8209
8437
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -10357,6 +10585,27 @@
10357
10585
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
10358
10586
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
10359
10587
  </xsl:when> -->
10588
+
10589
+ <!-- <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'))">
10590
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
10591
+ <xsl:variable name="filename">
10592
+ <xsl:call-template name="substring-after-last">
10593
+ <xsl:with-param name="value" select="$target_"/>
10594
+ <xsl:with-param name="delimiter" select="'/'"/>
10595
+ </xsl:call-template>
10596
+ </xsl:variable>
10597
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
10598
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
10599
+ <xsl:choose>
10600
+ <xsl:when test="$file_exists = 'true'">
10601
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
10602
+ </xsl:when>
10603
+ <xsl:otherwise>
10604
+ <xsl:value-of select="normalize-space(@target)"/>
10605
+ </xsl:otherwise>
10606
+ </xsl:choose>
10607
+ </xsl:when> -->
10608
+
10360
10609
  <xsl:otherwise>
10361
10610
  <xsl:value-of select="normalize-space(@target)"/>
10362
10611
  </xsl:otherwise>
@@ -10668,7 +10917,7 @@
10668
10917
  <xsl:attribute name="text-align">justify</xsl:attribute>
10669
10918
  </xsl:if>
10670
10919
 
10671
- </xsl:template>
10920
+ </xsl:template> <!-- refine_note_block_style -->
10672
10921
 
10673
10922
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
10674
10923
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -10874,10 +11123,21 @@
10874
11123
  </xsl:template>
10875
11124
 
10876
11125
  <xsl:template name="showFigureKey">
10877
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
10878
- <xsl:call-template name="note"/>
11126
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
11127
+ <xsl:choose>
11128
+ <xsl:when test="local-name() = 'note'">
11129
+ <xsl:call-template name="note"/>
11130
+ </xsl:when>
11131
+ <xsl:when test="local-name() = 'example'">
11132
+ <xsl:call-template name="example"/>
11133
+ </xsl:when>
11134
+ <xsl:otherwise>
11135
+ <xsl:apply-templates select="."/>
11136
+ </xsl:otherwise>
11137
+ </xsl:choose>
10879
11138
  </xsl:for-each>
10880
- <xsl:call-template name="fn_display_figure"/>
11139
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
11140
+ <xsl:call-template name="figure_fn_display"/>
10881
11141
  </xsl:template>
10882
11142
 
10883
11143
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -11771,10 +12031,10 @@
11771
12031
  <xsl:when test="@type = 'section-title'">
11772
12032
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
11773
12033
  <xsl:text>: </xsl:text>
11774
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
12034
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
11775
12035
  </xsl:when>
11776
12036
  <xsl:otherwise>
11777
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
12037
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
11778
12038
  </xsl:otherwise>
11779
12039
  </xsl:choose>
11780
12040
  </xsl:when>
@@ -12119,9 +12379,15 @@
12119
12379
  </xsl:if>
12120
12380
  </xsl:template>
12121
12381
 
12382
+ <!-- figure/fn -->
12122
12383
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
12123
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
12384
+ <!-- figure/note -->
12385
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
12386
+ <!-- figure/example -->
12387
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
12124
12388
 
12389
+ <!-- figure/note[@type = 'units'] -->
12390
+ <!-- image/note[@type = 'units'] -->
12125
12391
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
12126
12392
  <fo:block text-align="right" keep-with-next="always">
12127
12393
  <xsl:apply-templates/>
@@ -12242,6 +12508,7 @@
12242
12508
  </xsl:choose>
12243
12509
  </xsl:template>
12244
12510
 
12511
+ <!-- fn -->
12245
12512
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
12246
12513
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
12247
12514
 
@@ -13137,7 +13404,7 @@
13137
13404
  text line 1
13138
13405
  text line 2
13139
13406
  -->
13140
- <xsl:template match="*[local-name() = 'example']">
13407
+ <xsl:template match="*[local-name() = 'example']" name="example">
13141
13408
 
13142
13409
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
13143
13410
 
@@ -13243,6 +13510,7 @@
13243
13510
 
13244
13511
  </xsl:template>
13245
13512
 
13513
+ <!-- example/name -->
13246
13514
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
13247
13515
  <xsl:param name="fo_element">block</xsl:param>
13248
13516
 
@@ -13268,7 +13536,8 @@
13268
13536
 
13269
13537
  </xsl:template>
13270
13538
 
13271
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
13539
+ <!-- table/example/name, table/tfoot//example/name -->
13540
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
13272
13541
  <fo:inline xsl:use-attribute-sets="example-name-style">
13273
13542
 
13274
13543
  <xsl:apply-templates/>
@@ -14904,8 +15173,33 @@
14904
15173
 
14905
15174
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
14906
15175
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
15176
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
15177
+ <!-- <test><xsl:copy-of select="."/></test> -->
15178
+
14907
15179
  <xsl:variable name="target" select="@target"/>
15180
+
14908
15181
  <xsl:for-each select="*[local-name() = 'tab']">
15182
+
15183
+ <xsl:if test="position() = 1">
15184
+ <!-- first column (data before first `tab`) -->
15185
+ <fo:table-cell>
15186
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
15187
+ <xsl:call-template name="insert_basic_link">
15188
+ <xsl:with-param name="element">
15189
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
15190
+ <xsl:for-each select="preceding-sibling::node()">
15191
+ <xsl:choose>
15192
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
15193
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
15194
+ </xsl:choose>
15195
+ </xsl:for-each>
15196
+ </fo:basic-link>
15197
+ </xsl:with-param>
15198
+ </xsl:call-template>
15199
+ </fo:block>
15200
+ </fo:table-cell>
15201
+ </xsl:if>
15202
+
14909
15203
  <xsl:variable name="current_id" select="generate-id()"/>
14910
15204
  <fo:table-cell>
14911
15205
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -14956,11 +15250,25 @@
14956
15250
 
14957
15251
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
14958
15252
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
15253
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
14959
15254
  <xsl:for-each select="*[local-name() = 'tab']">
15255
+ <xsl:if test="position() = 1">
15256
+ <td>
15257
+ <xsl:for-each select="preceding-sibling::node()">
15258
+ <xsl:choose>
15259
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
15260
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
15261
+ </xsl:choose>
15262
+ </xsl:for-each>
15263
+ </td>
15264
+ </xsl:if>
14960
15265
  <xsl:variable name="current_id" select="generate-id()"/>
14961
15266
  <td>
14962
15267
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
14963
- <xsl:copy-of select="."/>
15268
+ <xsl:choose>
15269
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
15270
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
15271
+ </xsl:choose>
14964
15272
  </xsl:for-each>
14965
15273
  </td>
14966
15274
  </xsl:for-each>
@@ -16354,6 +16662,7 @@
16354
16662
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
16355
16663
  </fn>
16356
16664
  -->
16665
+ <!-- fn in text -->
16357
16666
  <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">
16358
16667
  <xsl:variable name="p_fn_">
16359
16668
  <xsl:call-template name="get_fn_list"/>