metanorma-bipm 2.6.1 → 2.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -617,6 +617,8 @@
617
617
  </xsl:element>
618
618
  </xsl:template>
619
619
 
620
+ <xsl:template match="*[local-name() = 'clause']/*[local-name() = 'fmt-footnote-container']" priority="3" mode="update_xml_pres"/>
621
+
620
622
  <!-- ================================= -->
621
623
  <!-- Flattening xml for fit notes at page sides (margins) -->
622
624
  <!-- ================================= -->
@@ -714,6 +716,8 @@
714
716
  <xsl:if test="local-name() = 'title' and @depth = 3 and ../bipm:clause/bipm:title/@depth = 4 and count(following-sibling::*[1][local-name() = 'note']) &gt; 0">
715
717
  <!-- then move here footnotes from clause level 4 -->
716
718
  <xsl:for-each select="../bipm:clause//bipm:fn[ancestor::bipm:quote or not(ancestor::bipm:table)]">
719
+ <!-- <debug><xsl:for-each select="ancestor::*"><xsl:value-of select="local-name()"/>@<xsl:value-of select="@id"/><xsl:text>/</xsl:text></xsl:for-each>
720
+ </debug> -->
717
721
  <xsl:call-template name="fn_to_note_side"/>
718
722
  </xsl:for-each>
719
723
  </xsl:if>
@@ -798,41 +802,17 @@
798
802
  <xsl:template match="bipm:fn" mode="fn_to_xref">
799
803
  <xsl:element name="xref" namespace="https://www.metanorma.org/ns/standoc">
800
804
 
801
- <xsl:attribute name="target">
802
- <xsl:call-template name="fn_reference_to_xref_target"/>
803
- </xsl:attribute>
804
-
805
- <xsl:variable name="curr_clause_id" select="normalize-space(ancestor::bipm:clause[1]/@id)"/>
806
- <xsl:variable name="curr_annex_id" select="normalize-space(ancestor::bipm:annex[1]/@id)"/>
807
-
808
- <xsl:variable name="number">
809
- <xsl:choose>
810
- <xsl:when test="$curr_clause_id != ''">
811
- <xsl:number count="bipm:fn[ancestor::bipm:clause[1]/@id = $curr_clause_id][ancestor::bipm:quote or not(ancestor::bipm:table)]" level="any"/>
812
- </xsl:when>
813
- <xsl:otherwise>
814
- <xsl:number count="bipm:fn[ancestor::bipm:annex[1]/@id = $curr_annex_id]"/>
815
- </xsl:otherwise>
816
- </xsl:choose>
817
- </xsl:variable>
805
+ <xsl:copy-of select="@target"/>
818
806
 
819
807
  <xsl:element name="sup_fn" namespace="https://www.metanorma.org/ns/standoc">
820
- <xsl:value-of select="concat('(',$number,')')"/>
808
+ <!-- <xsl:value-of select="concat('(',$number,')')"/> -->
809
+ <!-- https://github.com/metanorma/isodoc/issues/658#issuecomment-2726450824 -->
810
+ <xsl:apply-templates select="*[local-name() = 'fmt-fn-label']/node()" mode="flatxml"/>
821
811
  </xsl:element>
822
812
 
823
813
  </xsl:element>
824
814
  </xsl:template>
825
815
 
826
- <xsl:template name="fn_reference_to_xref_target">
827
- <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>
833
- <xsl:value-of select="concat($lang, '_footnote_', @reference, '_', $number, '_', $gen_id)"/>
834
- </xsl:template>
835
-
836
816
  <xsl:template match="bipm:preface/bipm:clause[not(@type = 'toc')][position() &gt; 1]" mode="flatxml">
837
817
  <xsl:copy-of select="."/>
838
818
  </xsl:template>
@@ -933,29 +913,20 @@
933
913
  <xsl:element name="note_side" namespace="https://www.metanorma.org/ns/standoc">
934
914
 
935
915
  <xsl:attribute name="id">
936
- <xsl:call-template name="fn_reference_to_xref_target"/>
916
+ <xsl:value-of select="@target"/>
937
917
  </xsl:attribute>
938
918
 
939
- <xsl:variable name="curr_clause_id" select="normalize-space(ancestor::bipm:clause[1]/@id)"/>
940
- <xsl:variable name="curr_annex_id" select="normalize-space(ancestor::bipm:annex[1]/@id)"/>
941
-
942
- <xsl:variable name="number">
943
- <xsl:choose>
944
- <xsl:when test="$curr_clause_id != ''">
945
- <xsl:number count="bipm:fn[ancestor::bipm:clause[1]/@id = $curr_clause_id][ancestor::bipm:quote or not(ancestor::bipm:table)]" level="any"/>
946
- </xsl:when>
947
- <xsl:otherwise>
948
- <xsl:number count="bipm:fn[ancestor::bipm:annex[1]/@id = $curr_annex_id]"/>
949
- </xsl:otherwise>
950
- </xsl:choose>
951
- </xsl:variable>
919
+ <xsl:variable name="curr_id" select="@target"/>
952
920
 
953
921
  <xsl:element name="sup_fn" namespace="https://www.metanorma.org/ns/standoc">
954
- <xsl:value-of select="concat('(',$number,')')"/>
922
+ <!-- <xsl:value-of select="concat('(',$number,')')"/> -->
923
+ <!-- https://github.com/metanorma/isodoc/issues/658#issuecomment-2726450824 -->
924
+ <xsl:apply-templates select="*[local-name() = 'fmt-fn-label']/node()" mode="flatxml"/>
955
925
  </xsl:element>
956
926
  <xsl:text> </xsl:text>
957
927
 
958
- <xsl:apply-templates mode="flatxml"/>
928
+ <!-- <xsl:apply-templates mode="flatxml"/> -->
929
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $curr_id]/node()" mode="flatxml"/>
959
930
  </xsl:element>
960
931
  </xsl:template>
961
932
 
@@ -984,6 +955,10 @@
984
955
  </xsl:if>
985
956
  </xsl:template>
986
957
 
958
+ <xsl:template match="*[local-name() = 'fn']/*[local-name() = 'fmt-fn-label']/*[local-name() = 'sup']" priority="5" mode="flatxml">
959
+ <xsl:apply-templates mode="flatxml"/>
960
+ </xsl:template>
961
+
987
962
  <!-- ================================= -->
988
963
  <!-- END: Flattening xml for fit notes at page sides (margins) -->
989
964
  <!-- ================================= -->
@@ -2800,6 +2775,9 @@
2800
2775
  <xsl:apply-templates select="."/>
2801
2776
  </xsl:template>
2802
2777
 
2778
+ <!-- note_side/fmt-fn-label in text -->
2779
+ <xsl:template match="*[local-name() = 'note_side']//*[local-name() = 'fmt-fn-label']"/>
2780
+
2803
2781
  <xsl:template match="*[local-name() = 'note_side']/*[local-name() = 'p']">
2804
2782
  <xsl:variable name="num"><xsl:number/></xsl:variable>
2805
2783
  <xsl:choose>
@@ -3140,12 +3118,28 @@
3140
3118
  <xsl:value-of select="."/>
3141
3119
  </xsl:template>
3142
3120
 
3121
+ <!-- <xsl:template match="*[local-name() = 'sup_fn']/*[local-name() = 'sup']"> -->
3143
3122
  <xsl:template match="*[local-name() = 'sup_fn']">
3144
3123
  <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
3145
3124
  <xsl:apply-templates/>
3146
3125
  </fo:inline>
3147
3126
  </xsl:template>
3148
3127
 
3128
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'sup_fn']">
3129
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style">
3130
+ <xsl:apply-templates/>
3131
+ </fo:inline>
3132
+ </xsl:template>
3133
+
3134
+ <!-- see <xsl:template match="*[local-name()='fn']"> -->
3135
+ <xsl:template match="*[local-name() = 'fn']/*[local-name() = 'fmt-fn-label']/*[local-name() = 'sup']" priority="5">
3136
+ <xsl:apply-templates/>
3137
+ </xsl:template>
3138
+ <!-- For: <fo:inline font-style="normal">(</fo:inline>a<fo:inline font-style="normal">)</fo:inline> -->
3139
+ <xsl:template match="*[local-name() = 'fmt-fn-label']//*[local-name() = 'span'][@class = 'fmt-label-delim']" priority="5">
3140
+ <fo:inline font-style="normal"><xsl:apply-templates/></fo:inline>
3141
+ </xsl:template>
3142
+
3149
3143
  <!-- DEBUG -->
3150
3144
  <!-- <xsl:template match="mathml:math" priority="10"/> -->
3151
3145
 
@@ -3391,13 +3385,27 @@
3391
3385
 
3392
3386
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width" priority="2">
3393
3387
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
3388
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
3394
3389
  <xsl:for-each select="*[local-name() = 'tab']">
3395
3390
  <xsl:variable name="pos" select="position()"/>
3396
3391
  <xsl:variable name="current_id" select="generate-id()"/>
3392
+
3393
+ <xsl:if test="$pos = 1">
3394
+ <td>
3395
+ <xsl:for-each select="preceding-sibling::node()">
3396
+ <xsl:choose>
3397
+ <xsl:when test="self::text()"><xsl:value-of select="translate(., ' ', ' ')"/></xsl:when>
3398
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
3399
+ </xsl:choose>
3400
+ </xsl:for-each>
3401
+ </td>
3402
+ </xsl:if>
3403
+
3397
3404
  <td>
3398
3405
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
3399
3406
  <xsl:choose>
3400
- <xsl:when test="$pos = 1 and self::text()"><xsl:value-of select="translate(., ' ', ' ')"/></xsl:when>
3407
+ <!-- <xsl:when test="$pos = 1 and self::text()"><xsl:value-of select="translate(., ' ', '&#xa0;')"/></xsl:when> -->
3408
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
3401
3409
  <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
3402
3410
  </xsl:choose>
3403
3411
  </xsl:for-each>
@@ -4834,15 +4842,19 @@
4834
4842
  </xsl:template>
4835
4843
 
4836
4844
  <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>
4845
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
4839
4846
 
4840
4847
  <xsl:attribute name="font-style">italic</xsl:attribute>
4841
- <xsl:attribute name="padding-right">2.5mm</xsl:attribute>
4848
+ <!-- <xsl:attribute name="padding-right">2.5mm</xsl:attribute> -->
4842
4849
 
4843
4850
  </xsl:attribute-set> <!-- table-fn-number-style -->
4844
4851
 
4845
- <xsl:template name="refine_table-fn-number-style">
4852
+ <xsl:attribute-set name="table-fmt-fn-label-style">
4853
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4854
+
4855
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
4856
+
4857
+ <xsl:template name="refine_table-fmt-fn-label-style">
4846
4858
 
4847
4859
  </xsl:template>
4848
4860
 
@@ -4857,11 +4869,18 @@
4857
4869
  </xsl:attribute-set>
4858
4870
 
4859
4871
  <xsl:attribute-set name="figure-fn-number-style">
4860
- <xsl:attribute name="font-size">80%</xsl:attribute>
4861
4872
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
4873
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
4874
+
4875
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
4876
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4862
4877
  <xsl:attribute name="vertical-align">super</xsl:attribute>
4863
4878
 
4864
- </xsl:attribute-set>
4879
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
4880
+
4881
+ <xsl:template name="refine_figure-fmt-fn-label-style">
4882
+
4883
+ </xsl:template>
4865
4884
 
4866
4885
  <xsl:attribute-set name="figure-fn-body-style">
4867
4886
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -6391,9 +6410,13 @@
6391
6410
 
6392
6411
  <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
6412
  <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
-
6413
+ <!-- <xsl:choose>
6414
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
6415
+ <xsl:otherwise>
6416
+
6417
+ </xsl:otherwise>
6418
+ </xsl:choose> -->
6419
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
6397
6420
  </xsl:if>
6398
6421
 
6399
6422
  <xsl:choose>
@@ -6440,7 +6463,7 @@
6440
6463
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
6441
6464
  </xsl:when>
6442
6465
  <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 -->
6466
+ <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
6467
  </xsl:otherwise>
6445
6468
  </xsl:choose>
6446
6469
 
@@ -6451,13 +6474,26 @@
6451
6474
 
6452
6475
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
6453
6476
 
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>
6477
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
6478
+
6479
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
6480
+ <xsl:call-template name="insertTableFooterInSeparateTable">
6481
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
6482
+ <xsl:with-param name="colwidths" select="$colwidths"/>
6483
+ <xsl:with-param name="colgroup" select="$colgroup"/>
6484
+ </xsl:call-template>
6485
+ </xsl:for-each>
6486
+
6487
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
6488
+ <xsl:if test="$namespace = 'plateau'">
6489
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
6490
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
6491
+ <xsl:variable name="table_fn_block">
6492
+ <xsl:call-template name="table_fn_display" />
6493
+ </xsl:variable>
6494
+ <xsl:copy-of select="$table_fn_block"/>
6495
+ </xsl:for-each>
6496
+ </xsl:if> -->
6461
6497
 
6462
6498
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
6463
6499
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -7265,6 +7301,8 @@
7265
7301
  <xsl:attribute name="min-height">5mm</xsl:attribute>
7266
7302
  </xsl:if>
7267
7303
 
7304
+ <xsl:call-template name="setColors"/>
7305
+
7268
7306
  </xsl:template> <!-- setTableRowAttributes -->
7269
7307
  <!-- ===================== -->
7270
7308
  <!-- END Table's row processing -->
@@ -7316,6 +7354,7 @@
7316
7354
  </xsl:attribute>
7317
7355
  </xsl:if>
7318
7356
  <xsl:call-template name="display-align"/>
7357
+ <xsl:call-template name="setColors"/>
7319
7358
  </xsl:template>
7320
7359
 
7321
7360
  <xsl:template name="display-align">
@@ -7331,6 +7370,29 @@
7331
7370
  </xsl:if>
7332
7371
  </xsl:template>
7333
7372
 
7373
+ <xsl:template name="setColors">
7374
+ <xsl:variable name="styles__">
7375
+ <xsl:call-template name="split">
7376
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
7377
+ <xsl:with-param name="sep" select="';'"/>
7378
+ </xsl:call-template>
7379
+ </xsl:variable>
7380
+ <xsl:variable name="quot">"</xsl:variable>
7381
+ <xsl:variable name="styles_">
7382
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
7383
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
7384
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
7385
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
7386
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
7387
+ </xsl:if>
7388
+ </xsl:for-each>
7389
+ </xsl:variable>
7390
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
7391
+ <xsl:for-each select="$styles/style">
7392
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
7393
+ </xsl:for-each>
7394
+ </xsl:template>
7395
+
7334
7396
  <!-- cell in table body, footer -->
7335
7397
  <xsl:template match="*[local-name()='td']" name="td">
7336
7398
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -7342,17 +7404,28 @@
7342
7404
 
7343
7405
  <xsl:call-template name="refine_table-cell-style"/>
7344
7406
 
7407
+ <xsl:call-template name="setTableCellAttributes"/>
7408
+
7345
7409
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
7346
7410
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
7347
7411
  </xsl:if>
7348
7412
 
7349
- <xsl:call-template name="setTableCellAttributes"/>
7350
-
7351
7413
  <xsl:if test="$isGenerateTableIF = 'true'">
7352
7414
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
7353
7415
  <xsl:attribute name="text-align">left</xsl:attribute>
7354
7416
  </xsl:if>
7355
7417
 
7418
+ <xsl:if test="$isGenerateTableIF = 'false'">
7419
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
7420
+ <xsl:attribute name="text-align">right</xsl:attribute>
7421
+ <xsl:attribute name="border">none</xsl:attribute>
7422
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
7423
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
7424
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
7425
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
7426
+ </xsl:if>
7427
+ </xsl:if>
7428
+
7356
7429
  <fo:block role="SKIP">
7357
7430
 
7358
7431
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -7380,7 +7453,8 @@
7380
7453
  </fo:table-cell>
7381
7454
  </xsl:template> <!-- td -->
7382
7455
 
7383
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
7456
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
7457
+ <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
7458
 
7385
7459
  <fo:block xsl:use-attribute-sets="table-note-style">
7386
7460
  <xsl:copy-of select="@id"/>
@@ -7405,65 +7479,54 @@
7405
7479
 
7406
7480
  </xsl:template> <!-- table/note -->
7407
7481
 
7408
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
7482
+ <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
7483
  <xsl:apply-templates/>
7410
7484
  </xsl:template>
7411
7485
 
7412
7486
  <!-- ===================== -->
7413
7487
  <!-- Footnotes processing -->
7414
7488
  <!-- ===================== -->
7489
+
7490
+ <!-- document text (not figures, or tables) footnotes -->
7491
+ <xsl:variable name="footnotes_">
7492
+ <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 -->
7493
+ <!-- <xsl:copy-of select="."/> -->
7494
+ <xsl:variable name="update_xml_step1">
7495
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
7496
+ </xsl:variable>
7497
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
7498
+ </xsl:for-each>
7499
+ </xsl:variable>
7500
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
7501
+
7415
7502
  <!--
7416
7503
  <fn reference="1">
7417
7504
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
7418
7505
  </fn>
7419
7506
  -->
7420
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
7507
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
7508
+ <!-- fn in text -->
7421
7509
  <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
7510
 
7423
- <!-- list of footnotes to calculate actual footnotes number -->
7511
+ <!-- list of unique footnotes -->
7424
7512
  <xsl:variable name="p_fn_">
7425
7513
  <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
7514
  </xsl:variable>
7435
7515
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
7436
7516
 
7437
7517
  <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_)"/>
7518
+
7444
7519
  <!-- 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>
7520
+ <xsl:variable name="current_fn_number" select="@reference"/>
7521
+
7453
7522
  <xsl:variable name="current_fn_number_text">
7454
7523
 
7455
7524
  <xsl:value-of select="$current_fn_number"/>
7456
7525
 
7457
7526
  </xsl:variable>
7458
7527
 
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>
7528
+ <xsl:variable name="ref_id" select="@target"/>
7529
+
7467
7530
  <xsl:variable name="footnote_inline">
7468
7531
  <fo:inline role="Reference">
7469
7532
 
@@ -7508,7 +7571,9 @@
7508
7571
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
7509
7572
  <xsl:copy-of select="$footnote_inline"/>
7510
7573
  </xsl:when>
7574
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
7511
7575
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
7576
+
7512
7577
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
7513
7578
  <xsl:copy-of select="$footnote_inline"/>
7514
7579
  <fo:footnote-body role="Note">
@@ -7525,7 +7590,10 @@
7525
7590
  <xsl:value-of select="$current_fn_number_text"/>
7526
7591
 
7527
7592
  </fo:inline>
7528
- <xsl:apply-templates/>
7593
+ <!-- <xsl:apply-templates /> -->
7594
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
7595
+ <here><xsl:copy-of select="$footnotes"/></here> -->
7596
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
7529
7597
  </xsl:variable>
7530
7598
 
7531
7599
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -7579,81 +7647,138 @@
7579
7647
  </xsl:choose>
7580
7648
  </xsl:template>
7581
7649
 
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
7650
  <!-- ============================ -->
7605
7651
  <!-- table's footnotes rendering -->
7606
7652
  <!-- ============================ -->
7607
- <xsl:template name="table_fn_display">
7608
- <xsl:variable name="references">
7609
7653
 
7654
+ <!-- table/fmt-footnote-container -->
7655
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
7656
+
7657
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
7658
+ <xsl:for-each select=".">
7659
+ <xsl:call-template name="table_fn_display"/>
7660
+ </xsl:for-each>
7661
+ </xsl:template>
7662
+
7663
+ <xsl:template name="table_fn_display">
7664
+ <!-- <xsl:variable name="references">
7665
+ <xsl:if test="$namespace = 'bsi'">
7666
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
7667
+ <xsl:call-template name="create_fn" />
7668
+ </xsl:for-each>
7669
+ </xsl:if>
7610
7670
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
7611
- <xsl:call-template name="create_fn"/>
7671
+ <xsl:call-template name="create_fn" />
7612
7672
  </xsl:for-each>
7613
- </xsl:variable>
7614
-
7615
- <xsl:for-each select="xalan:nodeset($references)//fn">
7673
+ </xsl:variable> -->
7674
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
7616
7675
  <xsl:variable name="reference" select="@reference"/>
7617
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
7676
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
7677
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
7618
7678
 
7619
7679
  <fo:block xsl:use-attribute-sets="table-fn-style">
7680
+ <xsl:copy-of select="@id"/>
7620
7681
  <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
-
7626
- <xsl:value-of select="@reference"/>
7627
-
7628
- <fo:inline font-style="normal">)</fo:inline>
7629
7682
 
7630
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
7631
- <!-- <xsl:if test="$namespace = 'itu'">
7632
- <xsl:text>)</xsl:text>
7633
- </xsl:if> -->
7683
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
7684
+ <xsl:with-param name="process">true</xsl:with-param>
7685
+ </xsl:apply-templates>
7634
7686
 
7635
- </fo:inline>
7636
7687
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
7637
- <xsl:copy-of select="./node()"/>
7688
+ <!-- <xsl:copy-of select="./node()"/> -->
7689
+ <xsl:apply-templates/>
7638
7690
  </fo:inline>
7639
7691
 
7640
7692
  </fo:block>
7641
7693
 
7642
- </xsl:if>
7694
+ <!-- </xsl:if> -->
7643
7695
  </xsl:for-each>
7644
7696
  </xsl:template> <!-- table_fn_display -->
7645
7697
 
7698
+ <!-- fmt-fn-body/fmt-fn-label in text -->
7699
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
7700
+
7701
+ <!-- table//fmt-fn-body//fmt-fn-label -->
7702
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
7703
+ <xsl:param name="process">false</xsl:param>
7704
+ <xsl:if test="$process = 'true'">
7705
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
7706
+
7707
+ <!-- tab is padding-right -->
7708
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
7709
+ <xsl:with-param name="process">true</xsl:with-param>
7710
+ </xsl:apply-templates>
7711
+
7712
+ <!-- <xsl:if test="$namespace = 'bipm'">
7713
+ <fo:inline font-style="normal">(</fo:inline>
7714
+ </xsl:if> -->
7715
+
7716
+ <!-- <xsl:if test="$namespace = 'plateau'">
7717
+ <xsl:text>※</xsl:text>
7718
+ </xsl:if> -->
7719
+
7720
+ <!-- <xsl:value-of select="@reference"/> -->
7721
+ <!-- <xsl:value-of select="normalize-space()"/> -->
7722
+ <xsl:apply-templates/>
7723
+
7724
+ <!-- <xsl:if test="$namespace = 'bipm'">
7725
+ <fo:inline font-style="normal">)</fo:inline>
7726
+ </xsl:if> -->
7727
+
7728
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
7729
+ <!-- <xsl:if test="$namespace = 'itu'">
7730
+ <xsl:text>)</xsl:text>
7731
+ </xsl:if> -->
7732
+
7733
+ <!-- <xsl:if test="$namespace = 'plateau'">
7734
+ <xsl:text>:</xsl:text>
7735
+ </xsl:if> -->
7736
+
7737
+ </fo:inline>
7738
+ </xsl:if>
7739
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
7740
+
7741
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
7742
+ <xsl:param name="process">false</xsl:param>
7743
+ <xsl:if test="$process = 'true'">
7744
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
7745
+
7746
+ <xsl:attribute name="padding-right">2.5mm</xsl:attribute>
7747
+
7748
+ </xsl:if>
7749
+ </xsl:template>
7750
+
7751
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
7752
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
7753
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
7754
+ <xsl:apply-templates/>
7755
+ </fo:inline>
7756
+ </xsl:template>
7757
+
7758
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
7759
+ <!--
7646
7760
  <xsl:template name="create_fn">
7647
7761
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
7648
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
7762
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
7649
7763
  <xsl:attribute name="id">
7650
7764
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
7651
7765
  </xsl:attribute>
7652
7766
  </xsl:if>
7653
-
7654
- <xsl:apply-templates/>
7767
+ <xsl:if test="$namespace = 'itu'">
7768
+ <xsl:if test="ancestor::*[local-name()='preface']">
7769
+ <xsl:attribute name="preface">true</xsl:attribute>
7770
+ </xsl:if>
7771
+ </xsl:if>
7772
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
7773
+ <xsl:attribute name="id">
7774
+ <xsl:value-of select="@reference"/>
7775
+ <xsl:text>_</xsl:text>
7776
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
7777
+ </xsl:attribute>
7778
+ </xsl:if>
7779
+ <xsl:apply-templates />
7655
7780
  </fn>
7656
- </xsl:template>
7781
+ </xsl:template> -->
7657
7782
 
7658
7783
  <!-- footnotes for table's name rendering -->
7659
7784
  <xsl:template name="table_name_fn_display">
@@ -7672,123 +7797,171 @@
7672
7797
  <!-- ============================ -->
7673
7798
  <!-- figure's footnotes rendering -->
7674
7799
  <!-- ============================ -->
7675
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
7676
7800
 
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_)"/>
7801
+ <!-- figure/fmt-footnote-container -->
7802
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
7803
+
7804
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
7805
+ <xsl:template name="figure_fn_display">
7683
7806
 
7684
- <!-- all footnotes relates to the current figure -->
7685
7807
  <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>
7808
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
7809
+ <xsl:variable name="curr_id" select="@id"/>
7810
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
7811
+ <curr><xsl:copy-of select="."/></curr>
7812
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
7813
+ <xsl:choose>
7814
+ <!-- skip figure/name/fn -->
7815
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
7816
+ <xsl:otherwise>
7817
+ <xsl:element name="figure" namespace="{$namespace_full}">
7818
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
7819
+ <xsl:copy-of select="."/>
7820
+ </xsl:element>
7821
+ </xsl:element>
7822
+ </xsl:otherwise>
7823
+ </xsl:choose>
7690
7824
  </xsl:for-each>
7691
7825
  </xsl:variable>
7826
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
7692
7827
 
7693
- <xsl:if test="xalan:nodeset($references)//fn">
7828
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
7694
7829
 
7695
7830
  <xsl:variable name="key_iso">
7696
7831
 
7697
7832
  </xsl:variable>
7698
7833
 
7699
7834
  <fo:block>
7835
+ <!-- current hierarchy is 'figure' element -->
7836
+ <xsl:variable name="following_dl_colwidths">
7837
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
7838
+ <xsl:variable name="simple-table">
7839
+ <!-- <xsl:variable name="doc_ns">
7840
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
7841
+ </xsl:variable>
7842
+ <xsl:variable name="ns">
7843
+ <xsl:choose>
7844
+ <xsl:when test="normalize-space($doc_ns) != ''">
7845
+ <xsl:value-of select="normalize-space($doc_ns)"/>
7846
+ </xsl:when>
7847
+ <xsl:otherwise>
7848
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
7849
+ </xsl:otherwise>
7850
+ </xsl:choose>
7851
+ </xsl:variable> -->
7700
7852
 
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> -->
7853
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
7854
+ <tbody>
7855
+ <xsl:apply-templates mode="dl"/>
7856
+ </tbody>
7857
+ </xsl:for-each>
7858
+ </xsl:variable>
7718
7859
 
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>
7860
+ <xsl:call-template name="calculate-column-widths">
7861
+ <xsl:with-param name="cols-count" select="2"/>
7862
+ <xsl:with-param name="table" select="$simple-table"/>
7863
+ </xsl:call-template>
7725
7864
 
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>
7865
+ </xsl:if>
7866
+ </xsl:variable>
7730
7867
 
7731
- </xsl:if>
7732
- </xsl:variable>
7868
+ <xsl:variable name="maxlength_dt">
7869
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
7870
+ <xsl:call-template name="getMaxLength_dt"/>
7871
+ </xsl:for-each>
7872
+ </xsl:variable>
7733
7873
 
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>
7874
+ <fo:table width="95%" table-layout="fixed">
7875
+ <xsl:if test="normalize-space($key_iso) = 'true'">
7876
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
7739
7877
 
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>
7878
+ </xsl:if>
7879
+ <xsl:choose>
7880
+ <!-- if there 'dl', then set same columns width -->
7881
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
7882
+ <xsl:call-template name="setColumnWidth_dl">
7883
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
7884
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
7885
+ </xsl:call-template>
7886
+ </xsl:when>
7887
+ <xsl:otherwise>
7888
+ <fo:table-column column-width="5%"/>
7889
+ <fo:table-column column-width="95%"/>
7890
+ </xsl:otherwise>
7891
+ </xsl:choose>
7892
+ <fo:table-body>
7893
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
7894
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
7743
7895
 
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"/>
7896
+ <xsl:variable name="reference" select="@reference"/>
7897
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
7898
+ <fo:table-row>
7899
+ <fo:table-cell>
7900
+ <fo:block>
7901
+
7902
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
7903
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
7904
+ <!-- <xsl:value-of select="@reference"/> -->
7905
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
7767
7906
  </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
7907
 
7774
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
7908
+ </fo:block>
7909
+ </fo:table-cell>
7910
+ <fo:table-cell>
7911
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
7912
+ <xsl:if test="normalize-space($key_iso) = 'true'">
7913
+
7914
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
7775
7915
 
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>
7916
+ </xsl:if>
7785
7917
 
7918
+ <!-- <xsl:copy-of select="./node()"/> -->
7919
+ <xsl:apply-templates/>
7920
+ </fo:block>
7921
+ </fo:table-cell>
7922
+ </fo:table-row>
7923
+ <!-- </xsl:if> -->
7924
+ </xsl:for-each>
7925
+ </fo:table-body>
7926
+ </fo:table>
7786
7927
  </fo:block>
7787
7928
  </xsl:if>
7788
- </xsl:template> <!-- fn_display_figure -->
7929
+ </xsl:template> <!-- figure_fn_display -->
7930
+
7931
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
7932
+ <xsl:param name="process">false</xsl:param>
7933
+ <xsl:if test="$process = 'true'">
7934
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
7935
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
7936
+
7937
+ <!-- tab is padding-right -->
7938
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
7939
+ <xsl:with-param name="process">true</xsl:with-param>
7940
+ </xsl:apply-templates>
7941
+
7942
+ <xsl:apply-templates/>
7943
+
7944
+ </fo:inline>
7945
+ </xsl:if>
7946
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
7947
+
7948
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
7949
+ <xsl:param name="process">false</xsl:param>
7950
+ <xsl:if test="$process = 'true'">
7951
+
7952
+ </xsl:if>
7953
+ </xsl:template>
7954
+
7955
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
7956
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
7957
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
7958
+ <xsl:apply-templates/>
7959
+ </fo:inline>
7960
+ </xsl:template>
7789
7961
 
7790
7962
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
7791
7963
  <!-- figure's footnote label -->
7964
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
7792
7965
  <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
7966
  <xsl:variable name="key_iso">
7794
7967
 
@@ -7797,7 +7970,7 @@
7797
7970
  <xsl:attribute name="font-size">10pt</xsl:attribute>
7798
7971
 
7799
7972
  </xsl:if>
7800
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
7973
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
7801
7974
  <!-- <xsl:value-of select="@reference"/> -->
7802
7975
  <xsl:apply-templates/>
7803
7976
  </fo:inline>
@@ -7807,42 +7980,68 @@
7807
7980
  <!-- END: figure's footnotes rendering -->
7808
7981
  <!-- ============================ -->
7809
7982
 
7810
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
7983
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
7984
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
7811
7985
  <xsl:template match="*[local-name()='fn']">
7812
7986
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
7813
7987
 
7814
7988
  <xsl:call-template name="refine_fn-reference-style"/>
7815
7989
 
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">
7990
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7991
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
7992
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
7993
+ <!-- <xsl:attribute name="internal-destination">
7819
7994
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
7820
7995
  </xsl:attribute>
7821
7996
  </xsl:if>
7997
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
7998
+ <xsl:attribute name="internal-destination">
7999
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
8000
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
8001
+ </xsl:attribute>
8002
+ </xsl:if> -->
8003
+ <!-- <xsl:if test="$namespace = 'plateau'">
8004
+ <xsl:text>※</xsl:text>
8005
+ </xsl:if> -->
8006
+ <!-- <xsl:value-of select="@reference"/> -->
7822
8007
 
7823
- <fo:inline font-style="normal"> (</fo:inline>
7824
-
7825
- <xsl:value-of select="@reference"/>
7826
-
7827
- <fo:inline font-style="normal">)</fo:inline>
8008
+ <fo:inline font-style="normal"> </fo:inline>
8009
+ <!-- Example: <fmt-fn-label><sup><span class="fmt-label-delim">(</span>a<span class="fmt-label-delim">)</span></sup></fmt-fn-label> -->
8010
+ <!-- to <fo:inline font-style="normal">(</fo:inline> ... -->
8011
+ <xsl:apply-templates select="*[local-name() = 'fmt-fn-label']/node()"/>
7828
8012
 
8013
+ <!-- <xsl:if test="$namespace = 'bsi'">
8014
+ <xsl:text>)</xsl:text>
8015
+ </xsl:if> -->
7829
8016
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
7830
8017
  <!-- <xsl:if test="$namespace = 'jis'">
7831
8018
  <fo:inline font-weight="normal">)</fo:inline>
7832
8019
  </xsl:if> -->
7833
8020
  </fo:basic-link>
7834
8021
  </fo:inline>
7835
- </xsl:template>
8022
+ </xsl:template> <!-- fn -->
7836
8023
 
8024
+ <!-- fn/text() -->
7837
8025
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
7838
8026
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
7839
8027
  </xsl:template>
7840
8028
 
7841
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
8029
+ <!-- fn//p fmt-fn-body//p -->
8030
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
7842
8031
  <fo:inline role="P">
7843
8032
  <xsl:apply-templates/>
7844
8033
  </fo:inline>
7845
8034
  </xsl:template>
8035
+
8036
+ <xsl:template name="insertFootnoteSeparatorCommon">
8037
+ <xsl:param name="leader_length">30%</xsl:param>
8038
+ <fo:static-content flow-name="xsl-footnote-separator">
8039
+ <fo:block>
8040
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
8041
+ </fo:block>
8042
+ </fo:static-content>
8043
+ </xsl:template>
8044
+
7846
8045
  <!-- ===================== -->
7847
8046
  <!-- END Footnotes processing -->
7848
8047
  <!-- ===================== -->
@@ -8120,11 +8319,11 @@
8120
8319
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
8121
8320
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
8122
8321
 
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>
8322
+ <xsl:call-template name="setColumnWidth_dl">
8323
+ <xsl:with-param name="colwidths" select="$colwidths"/>
8324
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
8325
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
8326
+ </xsl:call-template>
8128
8327
 
8129
8328
  <fo:table-body>
8130
8329
 
@@ -8158,6 +8357,14 @@
8158
8357
 
8159
8358
  </xsl:template> <!-- END: dl -->
8160
8359
 
8360
+ <xsl:template match="@*|node()" mode="dt_clean">
8361
+ <xsl:copy>
8362
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
8363
+ </xsl:copy>
8364
+ </xsl:template>
8365
+
8366
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
8367
+
8161
8368
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
8162
8369
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
8163
8370
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -8187,10 +8394,12 @@
8187
8394
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
8188
8395
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
8189
8396
 
8397
+ <!-- dl/name -->
8190
8398
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
8191
8399
  <xsl:param name="process">false</xsl:param>
8192
8400
  <xsl:if test="$process = 'true'">
8193
8401
  <fo:block xsl:use-attribute-sets="dl-name-style">
8402
+
8194
8403
  <xsl:apply-templates/>
8195
8404
  </fo:block>
8196
8405
  </xsl:if>
@@ -8204,6 +8413,10 @@
8204
8413
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
8205
8414
 
8206
8415
  <xsl:choose>
8416
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
8417
+ <fo:table-column column-width="10%"/>
8418
+ <fo:table-column column-width="90%"/>
8419
+ </xsl:when> -->
8207
8420
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
8208
8421
  <xsl:call-template name="insertTableColumnWidth">
8209
8422
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -8997,7 +9210,7 @@
8997
9210
  <xsl:choose>
8998
9211
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
8999
9212
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
9000
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
9213
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
9001
9214
  </xsl:when>
9002
9215
  <xsl:otherwise>
9003
9216
  <xsl:apply-templates/>
@@ -9005,7 +9218,7 @@
9005
9218
  </xsl:choose>
9006
9219
  </xsl:template>
9007
9220
  <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
9008
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
9221
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
9009
9222
  </xsl:template>
9010
9223
 
9011
9224
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -10070,24 +10283,26 @@
10070
10283
  <xsl:apply-templates select="." mode="mathml"/>
10071
10284
  </xsl:variable>
10072
10285
 
10073
- <fo:instream-foreign-object fox:alt-text="Math">
10286
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
10074
10287
 
10075
10288
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
10076
10289
 
10077
- <!-- put MathML in Actual Text -->
10078
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
10079
- <xsl:attribute name="fox:actual-text">
10080
- <xsl:value-of select="$mathml_content"/>
10081
- </xsl:attribute>
10082
-
10083
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
10084
- <xsl:if test="normalize-space($asciimath_text_) != ''">
10085
- <!-- put Mathin Alternate Text -->
10086
- <xsl:attribute name="fox:alt-text">
10087
- <xsl:value-of select="$asciimath_text_"/>
10290
+ <xsl:if test="$isGenerateTableIF = 'false'">
10291
+ <!-- put MathML in Actual Text -->
10292
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
10293
+ <xsl:attribute name="fox:actual-text">
10294
+ <xsl:value-of select="$mathml_content"/>
10088
10295
  </xsl:attribute>
10296
+
10297
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
10298
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
10299
+ <!-- put Mathin Alternate Text -->
10300
+ <xsl:attribute name="fox:alt-text">
10301
+ <xsl:value-of select="$asciimath_text_"/>
10302
+ </xsl:attribute>
10303
+ </xsl:if>
10304
+ <!-- </xsl:if> -->
10089
10305
  </xsl:if>
10090
- <!-- </xsl:if> -->
10091
10306
 
10092
10307
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
10093
10308
 
@@ -10357,6 +10572,27 @@
10357
10572
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
10358
10573
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
10359
10574
  </xsl:when> -->
10575
+
10576
+ <!-- <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'))">
10577
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
10578
+ <xsl:variable name="filename">
10579
+ <xsl:call-template name="substring-after-last">
10580
+ <xsl:with-param name="value" select="$target_"/>
10581
+ <xsl:with-param name="delimiter" select="'/'"/>
10582
+ </xsl:call-template>
10583
+ </xsl:variable>
10584
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
10585
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
10586
+ <xsl:choose>
10587
+ <xsl:when test="$file_exists = 'true'">
10588
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
10589
+ </xsl:when>
10590
+ <xsl:otherwise>
10591
+ <xsl:value-of select="normalize-space(@target)"/>
10592
+ </xsl:otherwise>
10593
+ </xsl:choose>
10594
+ </xsl:when> -->
10595
+
10360
10596
  <xsl:otherwise>
10361
10597
  <xsl:value-of select="normalize-space(@target)"/>
10362
10598
  </xsl:otherwise>
@@ -10668,7 +10904,7 @@
10668
10904
  <xsl:attribute name="text-align">justify</xsl:attribute>
10669
10905
  </xsl:if>
10670
10906
 
10671
- </xsl:template>
10907
+ </xsl:template> <!-- refine_note_block_style -->
10672
10908
 
10673
10909
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
10674
10910
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -10874,10 +11110,21 @@
10874
11110
  </xsl:template>
10875
11111
 
10876
11112
  <xsl:template name="showFigureKey">
10877
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
10878
- <xsl:call-template name="note"/>
11113
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
11114
+ <xsl:choose>
11115
+ <xsl:when test="local-name() = 'note'">
11116
+ <xsl:call-template name="note"/>
11117
+ </xsl:when>
11118
+ <xsl:when test="local-name() = 'example'">
11119
+ <xsl:call-template name="example"/>
11120
+ </xsl:when>
11121
+ <xsl:otherwise>
11122
+ <xsl:apply-templates select="."/>
11123
+ </xsl:otherwise>
11124
+ </xsl:choose>
10879
11125
  </xsl:for-each>
10880
- <xsl:call-template name="fn_display_figure"/>
11126
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
11127
+ <xsl:call-template name="figure_fn_display"/>
10881
11128
  </xsl:template>
10882
11129
 
10883
11130
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -11771,10 +12018,10 @@
11771
12018
  <xsl:when test="@type = 'section-title'">
11772
12019
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
11773
12020
  <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')]"/>
12021
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
11775
12022
  </xsl:when>
11776
12023
  <xsl:otherwise>
11777
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
12024
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
11778
12025
  </xsl:otherwise>
11779
12026
  </xsl:choose>
11780
12027
  </xsl:when>
@@ -11839,6 +12086,8 @@
11839
12086
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
11840
12087
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
11841
12088
 
12089
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
12090
+
11842
12091
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
11843
12092
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
11844
12093
  <xsl:apply-templates mode="bookmarks"/>
@@ -11860,6 +12109,8 @@
11860
12109
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
11861
12110
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
11862
12111
 
12112
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
12113
+
11863
12114
  <!-- Bookmarks -->
11864
12115
  <xsl:template name="addBookmarks">
11865
12116
  <xsl:param name="contents"/>
@@ -12119,9 +12370,15 @@
12119
12370
  </xsl:if>
12120
12371
  </xsl:template>
12121
12372
 
12373
+ <!-- figure/fn -->
12122
12374
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
12123
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
12375
+ <!-- figure/note -->
12376
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
12377
+ <!-- figure/example -->
12378
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
12124
12379
 
12380
+ <!-- figure/note[@type = 'units'] -->
12381
+ <!-- image/note[@type = 'units'] -->
12125
12382
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
12126
12383
  <fo:block text-align="right" keep-with-next="always">
12127
12384
  <xsl:apply-templates/>
@@ -12242,6 +12499,7 @@
12242
12499
  </xsl:choose>
12243
12500
  </xsl:template>
12244
12501
 
12502
+ <!-- fn -->
12245
12503
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
12246
12504
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
12247
12505
 
@@ -13137,7 +13395,7 @@
13137
13395
  text line 1
13138
13396
  text line 2
13139
13397
  -->
13140
- <xsl:template match="*[local-name() = 'example']">
13398
+ <xsl:template match="*[local-name() = 'example']" name="example">
13141
13399
 
13142
13400
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
13143
13401
 
@@ -13243,6 +13501,7 @@
13243
13501
 
13244
13502
  </xsl:template>
13245
13503
 
13504
+ <!-- example/name -->
13246
13505
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
13247
13506
  <xsl:param name="fo_element">block</xsl:param>
13248
13507
 
@@ -13268,7 +13527,8 @@
13268
13527
 
13269
13528
  </xsl:template>
13270
13529
 
13271
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
13530
+ <!-- table/example/name, table/tfoot//example/name -->
13531
+ <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
13532
  <fo:inline xsl:use-attribute-sets="example-name-style">
13273
13533
 
13274
13534
  <xsl:apply-templates/>
@@ -13745,21 +14005,32 @@
13745
14005
  <!-- ========== -->
13746
14006
 
13747
14007
  <xsl:variable name="reviews_">
13748
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
14008
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
13749
14009
  <xsl:copy>
13750
14010
  <xsl:copy-of select="@from"/>
13751
14011
  <xsl:copy-of select="@id"/>
13752
14012
  </xsl:copy>
13753
14013
  </xsl:for-each>
14014
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
14015
+ <xsl:copy>
14016
+ <xsl:copy-of select="@source"/>
14017
+ <xsl:copy-of select="@id"/>
14018
+ </xsl:copy>
14019
+ </xsl:for-each>
13754
14020
  </xsl:variable>
13755
14021
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
13756
14022
 
13757
14023
  <xsl:template name="addReviewHelper">
13758
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
13759
- <xsl:variable name="curr_id" select="@id"/>
13760
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
13761
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
13762
- <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
14024
+ <xsl:if test="$isGenerateTableIF = 'false'">
14025
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
14026
+ <xsl:variable name="curr_id" select="@id"/>
14027
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
14028
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
14029
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
14030
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
14031
+ <fo:block keep-with-next="always" line-height="0.1" id="{$review_id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$review_id}" fox:alt-text="Annot___{$review_id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
14032
+ </xsl:if>
14033
+ </xsl:for-each>
13763
14034
  </xsl:if>
13764
14035
  <!-- <fo:block>
13765
14036
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -13898,14 +14169,61 @@
13898
14169
 
13899
14170
  </xsl:template>
13900
14171
 
13901
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
14172
+ <!-- document text (not figures, or tables) footnotes -->
14173
+ <xsl:variable name="reviews_container_">
14174
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
14175
+ <xsl:variable name="update_xml_step1">
14176
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
14177
+ </xsl:variable>
14178
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
14179
+ </xsl:for-each>
14180
+ </xsl:variable>
14181
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
14182
+
14183
+ <xsl:template match="*[local-name() = 'review-container']"/>
14184
+
14185
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
14186
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
14187
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
14188
+ <xsl:if test="$isGenerateTableIF = 'false'">
14189
+ <xsl:choose>
14190
+ <!-- if there isn't the attribute '@from', then -->
14191
+ <xsl:when test="$id_from = ''">
14192
+ <fo:block id="{@id}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
14193
+ </xsl:when>
14194
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
14195
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
14196
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
14197
+ </xsl:when>
14198
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
14199
+ <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
14200
+ </xsl:when>
14201
+ </xsl:choose>
14202
+ </xsl:if>
14203
+ </xsl:template>
14204
+
14205
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
14206
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
13902
14207
  <!-- comment 2019-11-29 -->
13903
14208
  <!-- <fo:block font-weight="bold">Review:</fo:block>
13904
14209
  <xsl:apply-templates /> -->
13905
14210
 
13906
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
14211
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
13907
14212
 
13908
- <xsl:if test="1 = 1">
14213
+ <xsl:variable name="source" select="normalize-space(@source)"/>
14214
+
14215
+ <xsl:if test="$isGenerateTableIF = 'false'">
14216
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
14217
+
14218
+ <!-- <xsl:if test="@source = @end"> -->
14219
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
14220
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
14221
+ <!-- <fo:block id="{$source}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$source}" fox:alt-text="Annot___{$source}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block> -->
14222
+ <fo:block id="{@id}" font-size="1pt" role="SKIP" keep-with-next="always" line-height="0.1"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@id}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
14223
+ <!-- </xsl:if> -->
14224
+ </xsl:if>
14225
+
14226
+ <xsl:if test="1 = 2">
13909
14227
  <xsl:choose>
13910
14228
  <!-- if there isn't the attribute '@from', then -->
13911
14229
  <xsl:when test="$id_from = ''">
@@ -13913,10 +14231,10 @@
13913
14231
  </xsl:when>
13914
14232
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
13915
14233
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
13916
- <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
14234
+ <fo:block id="{$id_from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$id_from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
13917
14235
  </xsl:when>
13918
14236
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
13919
- <fo:block id="{@from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{@from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
14237
+ <fo:block id="{$id_from}" font-size="1pt" role="SKIP"><xsl:value-of select="$hair_space"/><fo:basic-link internal-destination="{$id_from}" fox:alt-text="Annot___{@id}" role="Annot"><xsl:value-of select="$hair_space"/></fo:basic-link></fo:block>
13920
14238
  </xsl:when>
13921
14239
  </xsl:choose>
13922
14240
  </xsl:if>
@@ -13967,16 +14285,21 @@
13967
14285
  <xsl:variable name="list_level">
13968
14286
  <xsl:choose>
13969
14287
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
13970
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
14288
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
14289
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
14290
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
13971
14291
  </xsl:choose>
13972
14292
  </xsl:variable>
13973
14293
  <xsl:choose>
13974
14294
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
13975
14295
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
13976
14296
  </xsl:when>
13977
- <xsl:when test="$list_level mod 3 = 0">
14297
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
13978
14298
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
13979
14299
  </xsl:when>
14300
+ <xsl:when test="$list_level mod 3 = 0">
14301
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
14302
+ </xsl:when>
13980
14303
  <xsl:when test="$list_level mod 2 = 0">
13981
14304
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
13982
14305
  </xsl:when>
@@ -14521,10 +14844,22 @@
14521
14844
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
14522
14845
 
14523
14846
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
14524
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
14525
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
14526
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
14527
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
14847
+ <xsl:variable name="bookmark_id" select="@id"/>
14848
+ <xsl:choose>
14849
+ <!-- Example:
14850
+ <fmt-review-start id="_7ef81cf7-3f6c-4ed4-9c1f-1ba092052bbd" source="_dda23915-8574-ef1e-29a1-822d465a5b97" target="_ecfb2210-3b1b-46a2-b63a-8b8505be6686" end="_dda23915-8574-ef1e-29a1-822d465a5b97" author="" date="2025-03-24T00:00:00Z"/>
14851
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
14852
+ <fmt-review-end id="_f336a8d0-08a8-4b7f-a1aa-b04688ed40c1" source="_dda23915-8574-ef1e-29a1-822d465a5b97" target="_ecfb2210-3b1b-46a2-b63a-8b8505be6686" start="_dda23915-8574-ef1e-29a1-822d465a5b97" author="" date="2025-03-24T00:00:00Z"/> -->
14853
+ <xsl:when test="1 = 2 and preceding-sibling::node()[local-name() = 'fmt-review-start'][@source = $bookmark_id] and following-sibling::node()[local-name() = 'fmt-review-end'][@source = $bookmark_id]">
14854
+ <!-- skip here, see the template 'fmt-review-start' -->
14855
+ </xsl:when>
14856
+ <xsl:otherwise>
14857
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
14858
+ <fo:inline id="{@id}" font-size="1pt"><xsl:if test="preceding-sibling::node()[local-name() = 'fmt-review-start'][@source = $bookmark_id] and following-sibling::node()[local-name() = 'fmt-review-end'][@source = $bookmark_id]"><xsl:attribute name="line-height">0.1</xsl:attribute></xsl:if><xsl:value-of select="$hair_space"/></fo:inline>
14859
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
14860
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
14861
+ </xsl:otherwise>
14862
+ </xsl:choose>
14528
14863
  </xsl:template>
14529
14864
  <!-- =================== -->
14530
14865
  <!-- End of Index processing -->
@@ -14904,8 +15239,33 @@
14904
15239
 
14905
15240
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
14906
15241
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
15242
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
15243
+ <!-- <test><xsl:copy-of select="."/></test> -->
15244
+
14907
15245
  <xsl:variable name="target" select="@target"/>
15246
+
14908
15247
  <xsl:for-each select="*[local-name() = 'tab']">
15248
+
15249
+ <xsl:if test="position() = 1">
15250
+ <!-- first column (data before first `tab`) -->
15251
+ <fo:table-cell>
15252
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
15253
+ <xsl:call-template name="insert_basic_link">
15254
+ <xsl:with-param name="element">
15255
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
15256
+ <xsl:for-each select="preceding-sibling::node()">
15257
+ <xsl:choose>
15258
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
15259
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
15260
+ </xsl:choose>
15261
+ </xsl:for-each>
15262
+ </fo:basic-link>
15263
+ </xsl:with-param>
15264
+ </xsl:call-template>
15265
+ </fo:block>
15266
+ </fo:table-cell>
15267
+ </xsl:if>
15268
+
14909
15269
  <xsl:variable name="current_id" select="generate-id()"/>
14910
15270
  <fo:table-cell>
14911
15271
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -14956,11 +15316,25 @@
14956
15316
 
14957
15317
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
14958
15318
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
15319
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
14959
15320
  <xsl:for-each select="*[local-name() = 'tab']">
15321
+ <xsl:if test="position() = 1">
15322
+ <td>
15323
+ <xsl:for-each select="preceding-sibling::node()">
15324
+ <xsl:choose>
15325
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
15326
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
15327
+ </xsl:choose>
15328
+ </xsl:for-each>
15329
+ </td>
15330
+ </xsl:if>
14960
15331
  <xsl:variable name="current_id" select="generate-id()"/>
14961
15332
  <td>
14962
15333
  <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="."/>
15334
+ <xsl:choose>
15335
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
15336
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
15337
+ </xsl:choose>
14964
15338
  </xsl:for-each>
14965
15339
  </td>
14966
15340
  </xsl:for-each>
@@ -15831,6 +16205,9 @@
15831
16205
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
15832
16206
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
15833
16207
 
16208
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
16209
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
16210
+
15834
16211
  <!-- END: update new Presentation XML -->
15835
16212
 
15836
16213
  <!-- =========================================================================== -->
@@ -16354,6 +16731,7 @@
16354
16731
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
16355
16732
  </fn>
16356
16733
  -->
16734
+ <!-- fn in text -->
16357
16735
  <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
16736
  <xsl:variable name="p_fn_">
16359
16737
  <xsl:call-template name="get_fn_list"/>