metanorma-csa 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6d6202215af6a23391eb215247a12f24b368c68a2e6df5616f8fa63958caec1
4
- data.tar.gz: 508d7d26e15bd9d18c1c878370a3e4dac7fe67cd09a60fa8b79b3d59c9370cb1
3
+ metadata.gz: a5c2f957ab832578172d28571a1c318828151a4f8c51e501fb0246c99e04a757
4
+ data.tar.gz: c152ae7c4121b308c5e807393216a8caae83dc6d956ecabe4eb4f14208f66364
5
5
  SHA512:
6
- metadata.gz: 90b1e4a09c7e40f3c9c6b5618f7fe92b54b391d3341e1dd0bfe215c0d30912a4a272181d097759b56510724e894b695fc5aa3a9f14a0d59da0158a0e271b48f7
7
- data.tar.gz: accda9ef1d64a368043b7984abf7a3c2ee7eb618257191d009cb70ee508e33098eaa769459640e1ef43e0c398217b767ac7b0613f7274346775bf2bb3d0e866d
6
+ metadata.gz: 5a85298115a808b480a11d35ac39f437db60c73c0f972ba4c6473b03a3111a537b8c922feb743c2b9b491beb8c3af3eb386239ed5ba9e1c319789f0b3edf90ad
7
+ data.tar.gz: 501dc639b9d6e3d199e94c05e0fc1eb17d01a04a19dc459ce120c631eb4da4f67e4b1822d29295d2da7e56eab5142e6aae07b6458a1b2754a1ca2c0a60ccddae
@@ -68,11 +68,7 @@
68
68
 
69
69
  <!-- Cover Page -->
70
70
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
71
- <fo:static-content flow-name="xsl-footnote-separator">
72
- <fo:block>
73
- <fo:leader leader-pattern="rule" leader-length="30%"/>
74
- </fo:block>
75
- </fo:static-content>
71
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
76
72
  <fo:static-content flow-name="cover-page-header">
77
73
  <fo:block-container height="2.5mm" background-color="rgb(55, 243, 244)">
78
74
  <fo:block font-size="1pt"> </fo:block>
@@ -109,11 +105,8 @@
109
105
 
110
106
  <!-- Copyright, Content, Foreword, etc. pages -->
111
107
  <fo:page-sequence master-reference="document" initial-page-number="2" format="1" force-page-count="no-force">
112
- <fo:static-content flow-name="xsl-footnote-separator">
113
- <fo:block>
114
- <fo:leader leader-pattern="rule" leader-length="30%"/>
115
- </fo:block>
116
- </fo:static-content>
108
+
109
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
117
110
  <xsl:call-template name="insertHeaderFooter"/>
118
111
  <fo:flow flow-name="xsl-region-body">
119
112
 
@@ -230,11 +223,7 @@
230
223
  <xsl:call-template name="getPageSequenceOrientation"/>
231
224
  </xsl:attribute>
232
225
 
233
- <fo:static-content flow-name="xsl-footnote-separator">
234
- <fo:block>
235
- <fo:leader leader-pattern="rule" leader-length="30%"/>
236
- </fo:block>
237
- </fo:static-content>
226
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
238
227
  <xsl:call-template name="insertHeaderFooter"/>
239
228
  <fo:flow flow-name="xsl-region-body">
240
229
 
@@ -559,12 +548,6 @@
559
548
  </xsl:if>
560
549
  </xsl:template>
561
550
 
562
- <xsl:template match="csa:fn/csa:p">
563
- <fo:block>
564
- <xsl:apply-templates/>
565
- </fo:block>
566
- </xsl:template>
567
-
568
551
  <xsl:template match="csa:ul | csa:ol" mode="list" priority="2">
569
552
  <xsl:choose>
570
553
  <xsl:when test="not(ancestor::csa:ul) and not(ancestor::csa:ol)">
@@ -1462,12 +1445,16 @@
1462
1445
  </xsl:template>
1463
1446
 
1464
1447
  <xsl:attribute-set name="table-fn-number-style">
1465
- <xsl:attribute name="font-size">80%</xsl:attribute>
1466
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
1448
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
1467
1449
 
1468
1450
  </xsl:attribute-set> <!-- table-fn-number-style -->
1469
1451
 
1470
- <xsl:template name="refine_table-fn-number-style">
1452
+ <xsl:attribute-set name="table-fmt-fn-label-style">
1453
+ <xsl:attribute name="font-size">80%</xsl:attribute>
1454
+
1455
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
1456
+
1457
+ <xsl:template name="refine_table-fmt-fn-label-style">
1471
1458
 
1472
1459
  </xsl:template>
1473
1460
 
@@ -1482,11 +1469,18 @@
1482
1469
  </xsl:attribute-set>
1483
1470
 
1484
1471
  <xsl:attribute-set name="figure-fn-number-style">
1485
- <xsl:attribute name="font-size">80%</xsl:attribute>
1486
1472
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
1473
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
1474
+
1475
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
1476
+ <xsl:attribute name="font-size">80%</xsl:attribute>
1487
1477
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1488
1478
 
1489
- </xsl:attribute-set>
1479
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
1480
+
1481
+ <xsl:template name="refine_figure-fmt-fn-label-style">
1482
+
1483
+ </xsl:template>
1490
1484
 
1491
1485
  <xsl:attribute-set name="figure-fn-body-style">
1492
1486
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -2999,9 +2993,13 @@
2999
2993
 
3000
2994
  <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']"/>
3001
2995
  <xsl:if test="$isNoteOrFnExist = 'true'">
3002
-
3003
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3004
-
2996
+ <!-- <xsl:choose>
2997
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
2998
+ <xsl:otherwise>
2999
+
3000
+ </xsl:otherwise>
3001
+ </xsl:choose> -->
3002
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3005
3003
  </xsl:if>
3006
3004
 
3007
3005
  <xsl:choose>
@@ -3048,7 +3046,7 @@
3048
3046
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3049
3047
  </xsl:when>
3050
3048
  <xsl:otherwise>
3051
- <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 -->
3049
+ <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 -->
3052
3050
  </xsl:otherwise>
3053
3051
  </xsl:choose>
3054
3052
 
@@ -3059,13 +3057,26 @@
3059
3057
 
3060
3058
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3061
3059
 
3062
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3063
- <xsl:call-template name="insertTableFooterInSeparateTable">
3064
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
3065
- <xsl:with-param name="colwidths" select="$colwidths"/>
3066
- <xsl:with-param name="colgroup" select="$colgroup"/>
3067
- </xsl:call-template>
3068
- </xsl:for-each>
3060
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
3061
+
3062
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3063
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3064
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3065
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3066
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3067
+ </xsl:call-template>
3068
+ </xsl:for-each>
3069
+
3070
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
3071
+ <xsl:if test="$namespace = 'plateau'">
3072
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
3073
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
3074
+ <xsl:variable name="table_fn_block">
3075
+ <xsl:call-template name="table_fn_display" />
3076
+ </xsl:variable>
3077
+ <xsl:copy-of select="$table_fn_block"/>
3078
+ </xsl:for-each>
3079
+ </xsl:if> -->
3069
3080
 
3070
3081
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
3071
3082
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -3940,6 +3951,17 @@
3940
3951
  <xsl:attribute name="text-align">left</xsl:attribute>
3941
3952
  </xsl:if>
3942
3953
 
3954
+ <xsl:if test="$isGenerateTableIF = 'false'">
3955
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
3956
+ <xsl:attribute name="text-align">right</xsl:attribute>
3957
+ <xsl:attribute name="border">none</xsl:attribute>
3958
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3959
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
3960
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
3961
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
3962
+ </xsl:if>
3963
+ </xsl:if>
3964
+
3943
3965
  <fo:block role="SKIP">
3944
3966
 
3945
3967
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -3958,7 +3980,8 @@
3958
3980
  </fo:table-cell>
3959
3981
  </xsl:template> <!-- td -->
3960
3982
 
3961
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
3983
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
3984
+ <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">
3962
3985
 
3963
3986
  <fo:block xsl:use-attribute-sets="table-note-style">
3964
3987
  <xsl:copy-of select="@id"/>
@@ -3979,65 +4002,54 @@
3979
4002
 
3980
4003
  </xsl:template> <!-- table/note -->
3981
4004
 
3982
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
4005
+ <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">
3983
4006
  <xsl:apply-templates/>
3984
4007
  </xsl:template>
3985
4008
 
3986
4009
  <!-- ===================== -->
3987
4010
  <!-- Footnotes processing -->
3988
4011
  <!-- ===================== -->
4012
+
4013
+ <!-- document text (not figures, or tables) footnotes -->
4014
+ <xsl:variable name="footnotes_">
4015
+ <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 -->
4016
+ <!-- <xsl:copy-of select="."/> -->
4017
+ <xsl:variable name="update_xml_step1">
4018
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
4019
+ </xsl:variable>
4020
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
4021
+ </xsl:for-each>
4022
+ </xsl:variable>
4023
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
4024
+
3989
4025
  <!--
3990
4026
  <fn reference="1">
3991
4027
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
3992
4028
  </fn>
3993
4029
  -->
3994
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
4030
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
4031
+ <!-- fn in text -->
3995
4032
  <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">
3996
4033
 
3997
- <!-- list of footnotes to calculate actual footnotes number -->
4034
+ <!-- list of unique footnotes -->
3998
4035
  <xsl:variable name="p_fn_">
3999
4036
  <xsl:call-template name="get_fn_list"/>
4000
- <!-- <xsl:choose>
4001
- <xsl:when test="$namespace = 'jis'">
4002
- <xsl:call-template name="get_fn_list_for_element"/>
4003
- </xsl:when>
4004
- <xsl:otherwise>
4005
- <xsl:call-template name="get_fn_list"/>
4006
- </xsl:otherwise>
4007
- </xsl:choose> -->
4008
4037
  </xsl:variable>
4009
4038
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4010
4039
 
4011
4040
  <xsl:variable name="gen_id" select="generate-id(.)"/>
4012
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
4013
- <xsl:variable name="reference_">
4014
- <xsl:value-of select="@reference"/>
4015
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
4016
- </xsl:variable>
4017
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
4041
+
4018
4042
  <!-- fn sequence number in document -->
4019
- <xsl:variable name="current_fn_number">
4020
- <xsl:choose>
4021
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
4022
- <xsl:otherwise>
4023
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
4024
- </xsl:otherwise>
4025
- </xsl:choose>
4026
- </xsl:variable>
4043
+ <xsl:variable name="current_fn_number" select="@reference"/>
4044
+
4027
4045
  <xsl:variable name="current_fn_number_text">
4028
4046
 
4029
4047
  <xsl:value-of select="$current_fn_number"/>
4030
4048
 
4031
4049
  </xsl:variable>
4032
4050
 
4033
- <xsl:variable name="ref_id">
4034
- <xsl:choose>
4035
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
4036
- <xsl:otherwise>
4037
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4038
- </xsl:otherwise>
4039
- </xsl:choose>
4040
- </xsl:variable>
4051
+ <xsl:variable name="ref_id" select="@target"/>
4052
+
4041
4053
  <xsl:variable name="footnote_inline">
4042
4054
  <fo:inline role="Reference">
4043
4055
 
@@ -4082,7 +4094,9 @@
4082
4094
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
4083
4095
  <xsl:copy-of select="$footnote_inline"/>
4084
4096
  </xsl:when>
4097
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
4085
4098
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
4099
+
4086
4100
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
4087
4101
  <xsl:copy-of select="$footnote_inline"/>
4088
4102
  <fo:footnote-body role="Note">
@@ -4099,7 +4113,10 @@
4099
4113
  <xsl:value-of select="$current_fn_number_text"/>
4100
4114
 
4101
4115
  </fo:inline>
4102
- <xsl:apply-templates/>
4116
+ <!-- <xsl:apply-templates /> -->
4117
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
4118
+ <here><xsl:copy-of select="$footnotes"/></here> -->
4119
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
4103
4120
  </xsl:variable>
4104
4121
 
4105
4122
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -4153,77 +4170,136 @@
4153
4170
  </xsl:choose>
4154
4171
  </xsl:template>
4155
4172
 
4156
- <xsl:template name="get_fn_list_for_element">
4157
- <xsl:choose>
4158
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
4159
- <fn gen_id="{generate-id(.)}">
4160
- <xsl:copy-of select="@*"/>
4161
- <xsl:copy-of select="node()"/>
4162
- </fn>
4163
- </xsl:when>
4164
- <xsl:otherwise>
4165
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
4166
- <xsl:variable name="element_id" select="@id"/>
4167
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4168
- <!-- copy unique fn -->
4169
- <fn gen_id="{generate-id(.)}">
4170
- <xsl:copy-of select="@*"/>
4171
- <xsl:copy-of select="node()"/>
4172
- </fn>
4173
- </xsl:for-each>
4174
- </xsl:for-each>
4175
- </xsl:otherwise>
4176
- </xsl:choose>
4177
- </xsl:template>
4178
4173
  <!-- ============================ -->
4179
4174
  <!-- table's footnotes rendering -->
4180
4175
  <!-- ============================ -->
4181
- <xsl:template name="table_fn_display">
4182
- <xsl:variable name="references">
4183
4176
 
4177
+ <!-- table/fmt-footnote-container -->
4178
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
4179
+
4180
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
4181
+ <xsl:for-each select=".">
4182
+ <xsl:call-template name="table_fn_display"/>
4183
+ </xsl:for-each>
4184
+ </xsl:template>
4185
+
4186
+ <xsl:template name="table_fn_display">
4187
+ <!-- <xsl:variable name="references">
4188
+ <xsl:if test="$namespace = 'bsi'">
4189
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
4190
+ <xsl:call-template name="create_fn" />
4191
+ </xsl:for-each>
4192
+ </xsl:if>
4184
4193
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
4185
- <xsl:call-template name="create_fn"/>
4194
+ <xsl:call-template name="create_fn" />
4186
4195
  </xsl:for-each>
4187
- </xsl:variable>
4188
-
4189
- <xsl:for-each select="xalan:nodeset($references)//fn">
4196
+ </xsl:variable> -->
4197
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
4190
4198
  <xsl:variable name="reference" select="@reference"/>
4191
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4199
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
4200
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4192
4201
 
4193
4202
  <fo:block xsl:use-attribute-sets="table-fn-style">
4203
+ <xsl:copy-of select="@id"/>
4194
4204
  <xsl:call-template name="refine_table-fn-style"/>
4195
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4196
- <xsl:call-template name="refine_table-fn-number-style"/>
4197
-
4198
- <xsl:value-of select="@reference"/>
4199
4205
 
4200
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4201
- <!-- <xsl:if test="$namespace = 'itu'">
4202
- <xsl:text>)</xsl:text>
4203
- </xsl:if> -->
4206
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
4207
+ <xsl:with-param name="process">true</xsl:with-param>
4208
+ </xsl:apply-templates>
4204
4209
 
4205
- </fo:inline>
4206
4210
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4207
- <xsl:copy-of select="./node()"/>
4211
+ <!-- <xsl:copy-of select="./node()"/> -->
4212
+ <xsl:apply-templates/>
4208
4213
  </fo:inline>
4209
4214
 
4210
4215
  </fo:block>
4211
4216
 
4212
- </xsl:if>
4217
+ <!-- </xsl:if> -->
4213
4218
  </xsl:for-each>
4214
4219
  </xsl:template> <!-- table_fn_display -->
4215
4220
 
4221
+ <!-- fmt-fn-body/fmt-fn-label in text -->
4222
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
4223
+
4224
+ <!-- table//fmt-fn-body//fmt-fn-label -->
4225
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
4226
+ <xsl:param name="process">false</xsl:param>
4227
+ <xsl:if test="$process = 'true'">
4228
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
4229
+
4230
+ <!-- tab is padding-right -->
4231
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
4232
+ <xsl:with-param name="process">true</xsl:with-param>
4233
+ </xsl:apply-templates>
4234
+
4235
+ <!-- <xsl:if test="$namespace = 'bipm'">
4236
+ <fo:inline font-style="normal">(</fo:inline>
4237
+ </xsl:if> -->
4238
+
4239
+ <!-- <xsl:if test="$namespace = 'plateau'">
4240
+ <xsl:text>※</xsl:text>
4241
+ </xsl:if> -->
4242
+
4243
+ <!-- <xsl:value-of select="@reference"/> -->
4244
+ <!-- <xsl:value-of select="normalize-space()"/> -->
4245
+ <xsl:apply-templates/>
4246
+
4247
+ <!-- <xsl:if test="$namespace = 'bipm'">
4248
+ <fo:inline font-style="normal">)</fo:inline>
4249
+ </xsl:if> -->
4250
+
4251
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4252
+ <!-- <xsl:if test="$namespace = 'itu'">
4253
+ <xsl:text>)</xsl:text>
4254
+ </xsl:if> -->
4255
+
4256
+ <!-- <xsl:if test="$namespace = 'plateau'">
4257
+ <xsl:text>:</xsl:text>
4258
+ </xsl:if> -->
4259
+
4260
+ </fo:inline>
4261
+ </xsl:if>
4262
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
4263
+
4264
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
4265
+ <xsl:param name="process">false</xsl:param>
4266
+ <xsl:if test="$process = 'true'">
4267
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
4268
+
4269
+ </xsl:if>
4270
+ </xsl:template>
4271
+
4272
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
4273
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
4274
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
4275
+ <xsl:apply-templates/>
4276
+ </fo:inline>
4277
+ </xsl:template>
4278
+
4279
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
4280
+ <!--
4216
4281
  <xsl:template name="create_fn">
4217
4282
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4218
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4283
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
4219
4284
  <xsl:attribute name="id">
4220
4285
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4221
4286
  </xsl:attribute>
4222
4287
  </xsl:if>
4223
-
4224
- <xsl:apply-templates/>
4288
+ <xsl:if test="$namespace = 'itu'">
4289
+ <xsl:if test="ancestor::*[local-name()='preface']">
4290
+ <xsl:attribute name="preface">true</xsl:attribute>
4291
+ </xsl:if>
4292
+ </xsl:if>
4293
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4294
+ <xsl:attribute name="id">
4295
+ <xsl:value-of select="@reference"/>
4296
+ <xsl:text>_</xsl:text>
4297
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4298
+ </xsl:attribute>
4299
+ </xsl:if>
4300
+ <xsl:apply-templates />
4225
4301
  </fn>
4226
- </xsl:template>
4302
+ </xsl:template> -->
4227
4303
 
4228
4304
  <!-- footnotes for table's name rendering -->
4229
4305
  <xsl:template name="table_name_fn_display">
@@ -4242,123 +4318,171 @@
4242
4318
  <!-- ============================ -->
4243
4319
  <!-- figure's footnotes rendering -->
4244
4320
  <!-- ============================ -->
4245
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
4246
4321
 
4247
- <!-- current figure id -->
4248
- <xsl:variable name="figure_id_">
4249
- <xsl:value-of select="@id"/>
4250
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
4251
- </xsl:variable>
4252
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
4322
+ <!-- figure/fmt-footnote-container -->
4323
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
4324
+
4325
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
4326
+ <xsl:template name="figure_fn_display">
4253
4327
 
4254
- <!-- all footnotes relates to the current figure -->
4255
4328
  <xsl:variable name="references">
4256
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
4257
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4258
- <xsl:apply-templates/>
4259
- </fn>
4329
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4330
+ <xsl:variable name="curr_id" select="@id"/>
4331
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
4332
+ <curr><xsl:copy-of select="."/></curr>
4333
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
4334
+ <xsl:choose>
4335
+ <!-- skip figure/name/fn -->
4336
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
4337
+ <xsl:otherwise>
4338
+ <xsl:element name="figure" namespace="{$namespace_full}">
4339
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
4340
+ <xsl:copy-of select="."/>
4341
+ </xsl:element>
4342
+ </xsl:element>
4343
+ </xsl:otherwise>
4344
+ </xsl:choose>
4260
4345
  </xsl:for-each>
4261
4346
  </xsl:variable>
4347
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
4262
4348
 
4263
- <xsl:if test="xalan:nodeset($references)//fn">
4349
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
4264
4350
 
4265
4351
  <xsl:variable name="key_iso">
4266
4352
 
4267
4353
  </xsl:variable>
4268
4354
 
4269
4355
  <fo:block>
4356
+ <!-- current hierarchy is 'figure' element -->
4357
+ <xsl:variable name="following_dl_colwidths">
4358
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4359
+ <xsl:variable name="simple-table">
4360
+ <!-- <xsl:variable name="doc_ns">
4361
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4362
+ </xsl:variable>
4363
+ <xsl:variable name="ns">
4364
+ <xsl:choose>
4365
+ <xsl:when test="normalize-space($doc_ns) != ''">
4366
+ <xsl:value-of select="normalize-space($doc_ns)"/>
4367
+ </xsl:when>
4368
+ <xsl:otherwise>
4369
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
4370
+ </xsl:otherwise>
4371
+ </xsl:choose>
4372
+ </xsl:variable> -->
4270
4373
 
4271
- <!-- current hierarchy is 'figure' element -->
4272
- <xsl:variable name="following_dl_colwidths">
4273
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4274
- <xsl:variable name="simple-table">
4275
- <!-- <xsl:variable name="doc_ns">
4276
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4277
- </xsl:variable>
4278
- <xsl:variable name="ns">
4279
- <xsl:choose>
4280
- <xsl:when test="normalize-space($doc_ns) != ''">
4281
- <xsl:value-of select="normalize-space($doc_ns)"/>
4282
- </xsl:when>
4283
- <xsl:otherwise>
4284
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4285
- </xsl:otherwise>
4286
- </xsl:choose>
4287
- </xsl:variable> -->
4288
-
4289
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4290
- <tbody>
4291
- <xsl:apply-templates mode="dl"/>
4292
- </tbody>
4293
- </xsl:for-each>
4294
- </xsl:variable>
4295
-
4296
- <xsl:call-template name="calculate-column-widths">
4297
- <xsl:with-param name="cols-count" select="2"/>
4298
- <xsl:with-param name="table" select="$simple-table"/>
4299
- </xsl:call-template>
4300
-
4301
- </xsl:if>
4302
- </xsl:variable>
4303
-
4304
- <xsl:variable name="maxlength_dt">
4305
4374
  <xsl:for-each select="*[local-name() = 'dl'][1]">
4306
- <xsl:call-template name="getMaxLength_dt"/>
4375
+ <tbody>
4376
+ <xsl:apply-templates mode="dl"/>
4377
+ </tbody>
4307
4378
  </xsl:for-each>
4308
4379
  </xsl:variable>
4309
4380
 
4310
- <fo:table width="95%" table-layout="fixed">
4311
- <xsl:if test="normalize-space($key_iso) = 'true'">
4312
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4381
+ <xsl:call-template name="calculate-column-widths">
4382
+ <xsl:with-param name="cols-count" select="2"/>
4383
+ <xsl:with-param name="table" select="$simple-table"/>
4384
+ </xsl:call-template>
4313
4385
 
4314
- </xsl:if>
4315
- <xsl:choose>
4316
- <!-- if there 'dl', then set same columns width -->
4317
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4318
- <xsl:call-template name="setColumnWidth_dl">
4319
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4320
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4321
- </xsl:call-template>
4322
- </xsl:when>
4323
- <xsl:otherwise>
4324
- <fo:table-column column-width="5%"/>
4325
- <fo:table-column column-width="95%"/>
4326
- </xsl:otherwise>
4327
- </xsl:choose>
4328
- <fo:table-body>
4329
- <xsl:for-each select="xalan:nodeset($references)//fn">
4330
- <xsl:variable name="reference" select="@reference"/>
4331
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4332
- <fo:table-row>
4333
- <fo:table-cell>
4334
- <fo:block>
4335
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4336
- <xsl:value-of select="@reference"/>
4386
+ </xsl:if>
4387
+ </xsl:variable>
4388
+
4389
+ <xsl:variable name="maxlength_dt">
4390
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4391
+ <xsl:call-template name="getMaxLength_dt"/>
4392
+ </xsl:for-each>
4393
+ </xsl:variable>
4394
+
4395
+ <fo:table width="95%" table-layout="fixed">
4396
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4397
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4398
+
4399
+ </xsl:if>
4400
+ <xsl:choose>
4401
+ <!-- if there 'dl', then set same columns width -->
4402
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4403
+ <xsl:call-template name="setColumnWidth_dl">
4404
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4405
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4406
+ </xsl:call-template>
4407
+ </xsl:when>
4408
+ <xsl:otherwise>
4409
+ <fo:table-column column-width="5%"/>
4410
+ <fo:table-column column-width="95%"/>
4411
+ </xsl:otherwise>
4412
+ </xsl:choose>
4413
+ <fo:table-body>
4414
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
4415
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
4416
+
4417
+ <xsl:variable name="reference" select="@reference"/>
4418
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
4419
+ <fo:table-row>
4420
+ <fo:table-cell>
4421
+ <fo:block>
4422
+
4423
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
4424
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
4425
+ <!-- <xsl:value-of select="@reference"/> -->
4426
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
4337
4427
  </fo:inline>
4338
- </fo:block>
4339
- </fo:table-cell>
4340
- <fo:table-cell>
4341
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4342
- <xsl:if test="normalize-space($key_iso) = 'true'">
4343
4428
 
4344
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
4429
+ </fo:block>
4430
+ </fo:table-cell>
4431
+ <fo:table-cell>
4432
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4433
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4345
4434
 
4346
- </xsl:if>
4347
- <xsl:copy-of select="./node()"/>
4348
- </fo:block>
4349
- </fo:table-cell>
4350
- </fo:table-row>
4351
- </xsl:if>
4352
- </xsl:for-each>
4353
- </fo:table-body>
4354
- </fo:table>
4435
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
4355
4436
 
4437
+ </xsl:if>
4438
+
4439
+ <!-- <xsl:copy-of select="./node()"/> -->
4440
+ <xsl:apply-templates/>
4441
+ </fo:block>
4442
+ </fo:table-cell>
4443
+ </fo:table-row>
4444
+ <!-- </xsl:if> -->
4445
+ </xsl:for-each>
4446
+ </fo:table-body>
4447
+ </fo:table>
4356
4448
  </fo:block>
4357
4449
  </xsl:if>
4358
- </xsl:template> <!-- fn_display_figure -->
4450
+ </xsl:template> <!-- figure_fn_display -->
4451
+
4452
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
4453
+ <xsl:param name="process">false</xsl:param>
4454
+ <xsl:if test="$process = 'true'">
4455
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
4456
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
4457
+
4458
+ <!-- tab is padding-right -->
4459
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
4460
+ <xsl:with-param name="process">true</xsl:with-param>
4461
+ </xsl:apply-templates>
4462
+
4463
+ <xsl:apply-templates/>
4464
+
4465
+ </fo:inline>
4466
+ </xsl:if>
4467
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
4468
+
4469
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
4470
+ <xsl:param name="process">false</xsl:param>
4471
+ <xsl:if test="$process = 'true'">
4472
+
4473
+ </xsl:if>
4474
+ </xsl:template>
4475
+
4476
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
4477
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
4478
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
4479
+ <xsl:apply-templates/>
4480
+ </fo:inline>
4481
+ </xsl:template>
4359
4482
 
4360
4483
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
4361
4484
  <!-- figure's footnote label -->
4485
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
4362
4486
  <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">
4363
4487
  <xsl:variable name="key_iso">
4364
4488
 
@@ -4367,7 +4491,7 @@
4367
4491
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4368
4492
 
4369
4493
  </xsl:if>
4370
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
4494
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
4371
4495
  <!-- <xsl:value-of select="@reference"/> -->
4372
4496
  <xsl:apply-templates/>
4373
4497
  </fo:inline>
@@ -4377,38 +4501,65 @@
4377
4501
  <!-- END: figure's footnotes rendering -->
4378
4502
  <!-- ============================ -->
4379
4503
 
4380
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
4504
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
4505
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
4381
4506
  <xsl:template match="*[local-name()='fn']">
4382
4507
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
4383
4508
 
4384
4509
  <xsl:call-template name="refine_fn-reference-style"/>
4385
4510
 
4386
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4387
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4388
- <xsl:attribute name="internal-destination">
4511
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4512
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4513
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4514
+ <!-- <xsl:attribute name="internal-destination">
4389
4515
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4390
4516
  </xsl:attribute>
4391
4517
  </xsl:if>
4518
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4519
+ <xsl:attribute name="internal-destination">
4520
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4521
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4522
+ </xsl:attribute>
4523
+ </xsl:if> -->
4524
+ <!-- <xsl:if test="$namespace = 'plateau'">
4525
+ <xsl:text>※</xsl:text>
4526
+ </xsl:if> -->
4527
+ <!-- <xsl:value-of select="@reference"/> -->
4392
4528
 
4393
- <xsl:value-of select="@reference"/>
4529
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4394
4530
 
4531
+ <!-- <xsl:if test="$namespace = 'bsi'">
4532
+ <xsl:text>)</xsl:text>
4533
+ </xsl:if> -->
4395
4534
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4396
4535
  <!-- <xsl:if test="$namespace = 'jis'">
4397
4536
  <fo:inline font-weight="normal">)</fo:inline>
4398
4537
  </xsl:if> -->
4399
4538
  </fo:basic-link>
4400
4539
  </fo:inline>
4401
- </xsl:template>
4540
+ </xsl:template> <!-- fn -->
4402
4541
 
4542
+ <!-- fn/text() -->
4403
4543
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4404
4544
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
4405
4545
  </xsl:template>
4406
4546
 
4407
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
4547
+ <!-- fn//p fmt-fn-body//p -->
4548
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
4408
4549
  <fo:inline role="P">
4409
4550
  <xsl:apply-templates/>
4410
4551
  </fo:inline>
4411
4552
  </xsl:template>
4553
+
4554
+ <xsl:template name="insertFootnoteSeparatorCommon">
4555
+ <xsl:param name="leader_length">30%</xsl:param>
4556
+ <fo:static-content flow-name="xsl-footnote-separator">
4557
+ <fo:block>
4558
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
4559
+ </fo:block>
4560
+ </fo:static-content>
4561
+ </xsl:template>
4562
+
4412
4563
  <!-- ===================== -->
4413
4564
  <!-- END Footnotes processing -->
4414
4565
  <!-- ===================== -->
@@ -4685,11 +4836,11 @@
4685
4836
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4686
4837
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4687
4838
 
4688
- <xsl:call-template name="setColumnWidth_dl">
4689
- <xsl:with-param name="colwidths" select="$colwidths"/>
4690
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4691
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4692
- </xsl:call-template>
4839
+ <xsl:call-template name="setColumnWidth_dl">
4840
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4841
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4842
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4843
+ </xsl:call-template>
4693
4844
 
4694
4845
  <fo:table-body>
4695
4846
 
@@ -4723,6 +4874,14 @@
4723
4874
 
4724
4875
  </xsl:template> <!-- END: dl -->
4725
4876
 
4877
+ <xsl:template match="@*|node()" mode="dt_clean">
4878
+ <xsl:copy>
4879
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
4880
+ </xsl:copy>
4881
+ </xsl:template>
4882
+
4883
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
4884
+
4726
4885
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
4727
4886
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
4728
4887
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -4752,10 +4911,12 @@
4752
4911
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4753
4912
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4754
4913
 
4914
+ <!-- dl/name -->
4755
4915
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4756
4916
  <xsl:param name="process">false</xsl:param>
4757
4917
  <xsl:if test="$process = 'true'">
4758
4918
  <fo:block xsl:use-attribute-sets="dl-name-style">
4919
+
4759
4920
  <xsl:apply-templates/>
4760
4921
  </fo:block>
4761
4922
  </xsl:if>
@@ -4769,6 +4930,10 @@
4769
4930
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
4770
4931
 
4771
4932
  <xsl:choose>
4933
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
4934
+ <fo:table-column column-width="10%"/>
4935
+ <fo:table-column column-width="90%"/>
4936
+ </xsl:when> -->
4772
4937
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4773
4938
  <xsl:call-template name="insertTableColumnWidth">
4774
4939
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -6892,6 +7057,27 @@
6892
7057
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6893
7058
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6894
7059
  </xsl:when> -->
7060
+
7061
+ <!-- <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'))">
7062
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7063
+ <xsl:variable name="filename">
7064
+ <xsl:call-template name="substring-after-last">
7065
+ <xsl:with-param name="value" select="$target_"/>
7066
+ <xsl:with-param name="delimiter" select="'/'"/>
7067
+ </xsl:call-template>
7068
+ </xsl:variable>
7069
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
7070
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
7071
+ <xsl:choose>
7072
+ <xsl:when test="$file_exists = 'true'">
7073
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
7074
+ </xsl:when>
7075
+ <xsl:otherwise>
7076
+ <xsl:value-of select="normalize-space(@target)"/>
7077
+ </xsl:otherwise>
7078
+ </xsl:choose>
7079
+ </xsl:when> -->
7080
+
6895
7081
  <xsl:otherwise>
6896
7082
  <xsl:value-of select="normalize-space(@target)"/>
6897
7083
  </xsl:otherwise>
@@ -7200,7 +7386,7 @@
7200
7386
 
7201
7387
  <xsl:template name="refine_note_block_style">
7202
7388
 
7203
- </xsl:template>
7389
+ </xsl:template> <!-- refine_note_block_style -->
7204
7390
 
7205
7391
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
7206
7392
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -7392,10 +7578,21 @@
7392
7578
  </xsl:template>
7393
7579
 
7394
7580
  <xsl:template name="showFigureKey">
7395
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
7396
- <xsl:call-template name="note"/>
7581
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
7582
+ <xsl:choose>
7583
+ <xsl:when test="local-name() = 'note'">
7584
+ <xsl:call-template name="note"/>
7585
+ </xsl:when>
7586
+ <xsl:when test="local-name() = 'example'">
7587
+ <xsl:call-template name="example"/>
7588
+ </xsl:when>
7589
+ <xsl:otherwise>
7590
+ <xsl:apply-templates select="."/>
7591
+ </xsl:otherwise>
7592
+ </xsl:choose>
7397
7593
  </xsl:for-each>
7398
- <xsl:call-template name="fn_display_figure"/>
7594
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
7595
+ <xsl:call-template name="figure_fn_display"/>
7399
7596
  </xsl:template>
7400
7597
 
7401
7598
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -8289,10 +8486,10 @@
8289
8486
  <xsl:when test="@type = 'section-title'">
8290
8487
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
8291
8488
  <xsl:text>: </xsl:text>
8292
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
8489
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
8293
8490
  </xsl:when>
8294
8491
  <xsl:otherwise>
8295
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
8492
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
8296
8493
  </xsl:otherwise>
8297
8494
  </xsl:choose>
8298
8495
  </xsl:when>
@@ -8623,9 +8820,15 @@
8623
8820
  </xsl:if>
8624
8821
  </xsl:template>
8625
8822
 
8823
+ <!-- figure/fn -->
8626
8824
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
8627
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
8825
+ <!-- figure/note -->
8826
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
8827
+ <!-- figure/example -->
8828
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
8628
8829
 
8830
+ <!-- figure/note[@type = 'units'] -->
8831
+ <!-- image/note[@type = 'units'] -->
8629
8832
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
8630
8833
  <fo:block text-align="right" keep-with-next="always">
8631
8834
  <xsl:apply-templates/>
@@ -8746,6 +8949,7 @@
8746
8949
  </xsl:choose>
8747
8950
  </xsl:template>
8748
8951
 
8952
+ <!-- fn -->
8749
8953
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
8750
8954
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
8751
8955
 
@@ -9643,7 +9847,7 @@
9643
9847
  text line 1
9644
9848
  text line 2
9645
9849
  -->
9646
- <xsl:template match="*[local-name() = 'example']">
9850
+ <xsl:template match="*[local-name() = 'example']" name="example">
9647
9851
 
9648
9852
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
9649
9853
 
@@ -9749,6 +9953,7 @@
9749
9953
 
9750
9954
  </xsl:template>
9751
9955
 
9956
+ <!-- example/name -->
9752
9957
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
9753
9958
  <xsl:param name="fo_element">block</xsl:param>
9754
9959
 
@@ -9774,7 +9979,8 @@
9774
9979
 
9775
9980
  </xsl:template>
9776
9981
 
9777
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
9982
+ <!-- table/example/name, table/tfoot//example/name -->
9983
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
9778
9984
  <fo:inline xsl:use-attribute-sets="example-name-style">
9779
9985
 
9780
9986
  <xsl:apply-templates/>
@@ -11390,8 +11596,33 @@
11390
11596
 
11391
11597
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
11392
11598
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11599
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11600
+ <!-- <test><xsl:copy-of select="."/></test> -->
11601
+
11393
11602
  <xsl:variable name="target" select="@target"/>
11603
+
11394
11604
  <xsl:for-each select="*[local-name() = 'tab']">
11605
+
11606
+ <xsl:if test="position() = 1">
11607
+ <!-- first column (data before first `tab`) -->
11608
+ <fo:table-cell>
11609
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
11610
+ <xsl:call-template name="insert_basic_link">
11611
+ <xsl:with-param name="element">
11612
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11613
+ <xsl:for-each select="preceding-sibling::node()">
11614
+ <xsl:choose>
11615
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11616
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11617
+ </xsl:choose>
11618
+ </xsl:for-each>
11619
+ </fo:basic-link>
11620
+ </xsl:with-param>
11621
+ </xsl:call-template>
11622
+ </fo:block>
11623
+ </fo:table-cell>
11624
+ </xsl:if>
11625
+
11395
11626
  <xsl:variable name="current_id" select="generate-id()"/>
11396
11627
  <fo:table-cell>
11397
11628
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -11442,11 +11673,25 @@
11442
11673
 
11443
11674
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
11444
11675
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11676
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11445
11677
  <xsl:for-each select="*[local-name() = 'tab']">
11678
+ <xsl:if test="position() = 1">
11679
+ <td>
11680
+ <xsl:for-each select="preceding-sibling::node()">
11681
+ <xsl:choose>
11682
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11683
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
11684
+ </xsl:choose>
11685
+ </xsl:for-each>
11686
+ </td>
11687
+ </xsl:if>
11446
11688
  <xsl:variable name="current_id" select="generate-id()"/>
11447
11689
  <td>
11448
11690
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11449
- <xsl:copy-of select="."/>
11691
+ <xsl:choose>
11692
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11693
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
11694
+ </xsl:choose>
11450
11695
  </xsl:for-each>
11451
11696
  </td>
11452
11697
  </xsl:for-each>
@@ -12836,6 +13081,7 @@
12836
13081
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
12837
13082
  </fn>
12838
13083
  -->
13084
+ <!-- fn in text -->
12839
13085
  <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">
12840
13086
  <xsl:variable name="p_fn_">
12841
13087
  <xsl:call-template name="get_fn_list"/>
@@ -33,6 +33,15 @@
33
33
  </zeroOrMore>
34
34
  </element>
35
35
  </define>
36
+ <define name="fn" combine="interleave">
37
+ <optional>
38
+ <attribute name="hiddenref">
39
+ <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
40
+ This is done if the footnote reference is already presented in some other form, e.g. within a figure image.</a:documentation>
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ </define>
36
45
  <define name="index-primary">
37
46
  <element name="primary">
38
47
  <oneOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "2.6.1".freeze
3
+ VERSION = "2.6.2".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csa
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-04 00:00:00.000000000 Z
11
+ date: 2025-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic