metanorma-cc 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.
@@ -12,11 +12,12 @@
12
12
  <xsl:text> – All rights reserved</xsl:text>
13
13
  </xsl:variable>
14
14
 
15
- <xsl:variable name="header">
15
+ <!-- <xsl:variable name="header">
16
16
  <xsl:value-of select="/csd:metanorma/csd:bibdata/csd:docidentifier[@type = 'csd']"/>
17
17
  <xsl:text>:</xsl:text>
18
18
  <xsl:value-of select="/csd:metanorma/csd:bibdata/csd:copyright/csd:from"/>
19
- </xsl:variable>
19
+ </xsl:variable> -->
20
+ <xsl:variable name="header" select="/csd:metanorma/csd:bibdata/csd:docidentifier[@type = 'CalConnect']"/>
20
21
 
21
22
  <xsl:variable name="contents_">
22
23
  <contents>
@@ -166,11 +167,8 @@
166
167
 
167
168
  <!-- Cover Page -->
168
169
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
169
- <fo:static-content flow-name="xsl-footnote-separator">
170
- <fo:block>
171
- <fo:leader leader-pattern="rule" leader-length="30%"/>
172
- </fo:block>
173
- </fo:static-content>
170
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
171
+
174
172
  <fo:static-content flow-name="cover-page-header" font-size="10pt">
175
173
  <fo:block-container height="23.5mm" display-align="before">
176
174
  <fo:block padding-top="12.5mm">
@@ -260,11 +258,7 @@
260
258
  <xsl:attribute name="force-page-count">end-on-even</xsl:attribute>
261
259
  </xsl:if>
262
260
 
263
- <fo:static-content flow-name="xsl-footnote-separator">
264
- <fo:block>
265
- <fo:leader leader-pattern="rule" leader-length="30%"/>
266
- </fo:block>
267
- </fo:static-content>
261
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
268
262
  <xsl:call-template name="insertHeaderFooter"/>
269
263
  <fo:flow flow-name="xsl-region-body">
270
264
 
@@ -320,11 +314,7 @@
320
314
  <xsl:attribute name="initial-page-number">1</xsl:attribute>
321
315
  </xsl:if>
322
316
 
323
- <fo:static-content flow-name="xsl-footnote-separator">
324
- <fo:block>
325
- <fo:leader leader-pattern="rule" leader-length="30%"/>
326
- </fo:block>
327
- </fo:static-content>
317
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
328
318
  <xsl:call-template name="insertHeaderFooter"/>
329
319
  <fo:flow flow-name="xsl-region-body">
330
320
  <!-- <fo:block font-size="16pt" font-weight="bold" margin-bottom="17pt" role="H1">
@@ -606,10 +596,6 @@
606
596
  </xsl:if>
607
597
  </xsl:template>
608
598
 
609
- <xsl:template match="csd:p/csd:fn/csd:p">
610
- <xsl:apply-templates/>
611
- </xsl:template>
612
-
613
599
  <xsl:template match="csd:xref" priority="2">
614
600
  <xsl:call-template name="insert_basic_link">
615
601
  <xsl:with-param name="element">
@@ -1472,14 +1458,18 @@
1472
1458
  </xsl:template>
1473
1459
 
1474
1460
  <xsl:attribute-set name="table-fn-number-style">
1461
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
1462
+
1463
+ </xsl:attribute-set> <!-- table-fn-number-style -->
1464
+
1465
+ <xsl:attribute-set name="table-fmt-fn-label-style">
1475
1466
  <xsl:attribute name="font-size">80%</xsl:attribute>
1476
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
1477
1467
 
1478
1468
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1479
1469
 
1480
- </xsl:attribute-set> <!-- table-fn-number-style -->
1470
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
1481
1471
 
1482
- <xsl:template name="refine_table-fn-number-style">
1472
+ <xsl:template name="refine_table-fmt-fn-label-style">
1483
1473
 
1484
1474
  </xsl:template>
1485
1475
 
@@ -1494,11 +1484,18 @@
1494
1484
  </xsl:attribute-set>
1495
1485
 
1496
1486
  <xsl:attribute-set name="figure-fn-number-style">
1497
- <xsl:attribute name="font-size">80%</xsl:attribute>
1498
1487
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
1488
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
1489
+
1490
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
1491
+ <xsl:attribute name="font-size">80%</xsl:attribute>
1499
1492
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1500
1493
 
1501
- </xsl:attribute-set>
1494
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
1495
+
1496
+ <xsl:template name="refine_figure-fmt-fn-label-style">
1497
+
1498
+ </xsl:template>
1502
1499
 
1503
1500
  <xsl:attribute-set name="figure-fn-body-style">
1504
1501
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -2990,9 +2987,13 @@
2990
2987
 
2991
2988
  <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']"/>
2992
2989
  <xsl:if test="$isNoteOrFnExist = 'true'">
2993
-
2994
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2995
-
2990
+ <!-- <xsl:choose>
2991
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
2992
+ <xsl:otherwise>
2993
+
2994
+ </xsl:otherwise>
2995
+ </xsl:choose> -->
2996
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2996
2997
  </xsl:if>
2997
2998
 
2998
2999
  <xsl:choose>
@@ -3039,7 +3040,7 @@
3039
3040
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3040
3041
  </xsl:when>
3041
3042
  <xsl:otherwise>
3042
- <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 -->
3043
+ <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 -->
3043
3044
  </xsl:otherwise>
3044
3045
  </xsl:choose>
3045
3046
 
@@ -3050,13 +3051,26 @@
3050
3051
 
3051
3052
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3052
3053
 
3053
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3054
- <xsl:call-template name="insertTableFooterInSeparateTable">
3055
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
3056
- <xsl:with-param name="colwidths" select="$colwidths"/>
3057
- <xsl:with-param name="colgroup" select="$colgroup"/>
3058
- </xsl:call-template>
3059
- </xsl:for-each>
3054
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
3055
+
3056
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3057
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3058
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3059
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3060
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3061
+ </xsl:call-template>
3062
+ </xsl:for-each>
3063
+
3064
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
3065
+ <xsl:if test="$namespace = 'plateau'">
3066
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
3067
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
3068
+ <xsl:variable name="table_fn_block">
3069
+ <xsl:call-template name="table_fn_display" />
3070
+ </xsl:variable>
3071
+ <xsl:copy-of select="$table_fn_block"/>
3072
+ </xsl:for-each>
3073
+ </xsl:if> -->
3060
3074
 
3061
3075
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
3062
3076
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -3843,6 +3857,8 @@
3843
3857
 
3844
3858
  <xsl:template name="setTableRowAttributes">
3845
3859
 
3860
+ <xsl:call-template name="setColors"/>
3861
+
3846
3862
  </xsl:template> <!-- setTableRowAttributes -->
3847
3863
  <!-- ===================== -->
3848
3864
  <!-- END Table's row processing -->
@@ -3894,6 +3910,7 @@
3894
3910
  </xsl:attribute>
3895
3911
  </xsl:if>
3896
3912
  <xsl:call-template name="display-align"/>
3913
+ <xsl:call-template name="setColors"/>
3897
3914
  </xsl:template>
3898
3915
 
3899
3916
  <xsl:template name="display-align">
@@ -3909,6 +3926,29 @@
3909
3926
  </xsl:if>
3910
3927
  </xsl:template>
3911
3928
 
3929
+ <xsl:template name="setColors">
3930
+ <xsl:variable name="styles__">
3931
+ <xsl:call-template name="split">
3932
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
3933
+ <xsl:with-param name="sep" select="';'"/>
3934
+ </xsl:call-template>
3935
+ </xsl:variable>
3936
+ <xsl:variable name="quot">"</xsl:variable>
3937
+ <xsl:variable name="styles_">
3938
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
3939
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
3940
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
3941
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
3942
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
3943
+ </xsl:if>
3944
+ </xsl:for-each>
3945
+ </xsl:variable>
3946
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
3947
+ <xsl:for-each select="$styles/style">
3948
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
3949
+ </xsl:for-each>
3950
+ </xsl:template>
3951
+
3912
3952
  <!-- cell in table body, footer -->
3913
3953
  <xsl:template match="*[local-name()='td']" name="td">
3914
3954
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -3920,17 +3960,28 @@
3920
3960
 
3921
3961
  <xsl:call-template name="refine_table-cell-style"/>
3922
3962
 
3963
+ <xsl:call-template name="setTableCellAttributes"/>
3964
+
3923
3965
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
3924
3966
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3925
3967
  </xsl:if>
3926
3968
 
3927
- <xsl:call-template name="setTableCellAttributes"/>
3928
-
3929
3969
  <xsl:if test="$isGenerateTableIF = 'true'">
3930
3970
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
3931
3971
  <xsl:attribute name="text-align">left</xsl:attribute>
3932
3972
  </xsl:if>
3933
3973
 
3974
+ <xsl:if test="$isGenerateTableIF = 'false'">
3975
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
3976
+ <xsl:attribute name="text-align">right</xsl:attribute>
3977
+ <xsl:attribute name="border">none</xsl:attribute>
3978
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
3979
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
3980
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
3981
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
3982
+ </xsl:if>
3983
+ </xsl:if>
3984
+
3934
3985
  <fo:block role="SKIP">
3935
3986
 
3936
3987
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -3949,7 +4000,8 @@
3949
4000
  </fo:table-cell>
3950
4001
  </xsl:template> <!-- td -->
3951
4002
 
3952
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
4003
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
4004
+ <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">
3953
4005
 
3954
4006
  <fo:block xsl:use-attribute-sets="table-note-style">
3955
4007
  <xsl:copy-of select="@id"/>
@@ -3970,65 +4022,54 @@
3970
4022
 
3971
4023
  </xsl:template> <!-- table/note -->
3972
4024
 
3973
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
4025
+ <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">
3974
4026
  <xsl:apply-templates/>
3975
4027
  </xsl:template>
3976
4028
 
3977
4029
  <!-- ===================== -->
3978
4030
  <!-- Footnotes processing -->
3979
4031
  <!-- ===================== -->
4032
+
4033
+ <!-- document text (not figures, or tables) footnotes -->
4034
+ <xsl:variable name="footnotes_">
4035
+ <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 -->
4036
+ <!-- <xsl:copy-of select="."/> -->
4037
+ <xsl:variable name="update_xml_step1">
4038
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
4039
+ </xsl:variable>
4040
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
4041
+ </xsl:for-each>
4042
+ </xsl:variable>
4043
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
4044
+
3980
4045
  <!--
3981
4046
  <fn reference="1">
3982
4047
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
3983
4048
  </fn>
3984
4049
  -->
3985
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
4050
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
4051
+ <!-- fn in text -->
3986
4052
  <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">
3987
4053
 
3988
- <!-- list of footnotes to calculate actual footnotes number -->
4054
+ <!-- list of unique footnotes -->
3989
4055
  <xsl:variable name="p_fn_">
3990
4056
  <xsl:call-template name="get_fn_list"/>
3991
- <!-- <xsl:choose>
3992
- <xsl:when test="$namespace = 'jis'">
3993
- <xsl:call-template name="get_fn_list_for_element"/>
3994
- </xsl:when>
3995
- <xsl:otherwise>
3996
- <xsl:call-template name="get_fn_list"/>
3997
- </xsl:otherwise>
3998
- </xsl:choose> -->
3999
4057
  </xsl:variable>
4000
4058
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4001
4059
 
4002
4060
  <xsl:variable name="gen_id" select="generate-id(.)"/>
4003
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
4004
- <xsl:variable name="reference_">
4005
- <xsl:value-of select="@reference"/>
4006
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
4007
- </xsl:variable>
4008
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
4061
+
4009
4062
  <!-- fn sequence number in document -->
4010
- <xsl:variable name="current_fn_number">
4011
- <xsl:choose>
4012
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
4013
- <xsl:otherwise>
4014
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
4015
- </xsl:otherwise>
4016
- </xsl:choose>
4017
- </xsl:variable>
4063
+ <xsl:variable name="current_fn_number" select="@reference"/>
4064
+
4018
4065
  <xsl:variable name="current_fn_number_text">
4019
4066
 
4020
4067
  <xsl:value-of select="$current_fn_number"/>
4021
4068
 
4022
4069
  </xsl:variable>
4023
4070
 
4024
- <xsl:variable name="ref_id">
4025
- <xsl:choose>
4026
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
4027
- <xsl:otherwise>
4028
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4029
- </xsl:otherwise>
4030
- </xsl:choose>
4031
- </xsl:variable>
4071
+ <xsl:variable name="ref_id" select="@target"/>
4072
+
4032
4073
  <xsl:variable name="footnote_inline">
4033
4074
  <fo:inline role="Reference">
4034
4075
 
@@ -4073,7 +4114,9 @@
4073
4114
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
4074
4115
  <xsl:copy-of select="$footnote_inline"/>
4075
4116
  </xsl:when>
4117
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
4076
4118
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
4119
+
4077
4120
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
4078
4121
  <xsl:copy-of select="$footnote_inline"/>
4079
4122
  <fo:footnote-body role="Note">
@@ -4090,7 +4133,10 @@
4090
4133
  <xsl:value-of select="$current_fn_number_text"/>
4091
4134
 
4092
4135
  </fo:inline>
4093
- <xsl:apply-templates/>
4136
+ <!-- <xsl:apply-templates /> -->
4137
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
4138
+ <here><xsl:copy-of select="$footnotes"/></here> -->
4139
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
4094
4140
  </xsl:variable>
4095
4141
 
4096
4142
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -4144,77 +4190,136 @@
4144
4190
  </xsl:choose>
4145
4191
  </xsl:template>
4146
4192
 
4147
- <xsl:template name="get_fn_list_for_element">
4148
- <xsl:choose>
4149
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
4150
- <fn gen_id="{generate-id(.)}">
4151
- <xsl:copy-of select="@*"/>
4152
- <xsl:copy-of select="node()"/>
4153
- </fn>
4154
- </xsl:when>
4155
- <xsl:otherwise>
4156
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
4157
- <xsl:variable name="element_id" select="@id"/>
4158
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4159
- <!-- copy unique fn -->
4160
- <fn gen_id="{generate-id(.)}">
4161
- <xsl:copy-of select="@*"/>
4162
- <xsl:copy-of select="node()"/>
4163
- </fn>
4164
- </xsl:for-each>
4165
- </xsl:for-each>
4166
- </xsl:otherwise>
4167
- </xsl:choose>
4168
- </xsl:template>
4169
4193
  <!-- ============================ -->
4170
4194
  <!-- table's footnotes rendering -->
4171
4195
  <!-- ============================ -->
4172
- <xsl:template name="table_fn_display">
4173
- <xsl:variable name="references">
4174
4196
 
4197
+ <!-- table/fmt-footnote-container -->
4198
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
4199
+
4200
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
4201
+ <xsl:for-each select=".">
4202
+ <xsl:call-template name="table_fn_display"/>
4203
+ </xsl:for-each>
4204
+ </xsl:template>
4205
+
4206
+ <xsl:template name="table_fn_display">
4207
+ <!-- <xsl:variable name="references">
4208
+ <xsl:if test="$namespace = 'bsi'">
4209
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
4210
+ <xsl:call-template name="create_fn" />
4211
+ </xsl:for-each>
4212
+ </xsl:if>
4175
4213
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
4176
- <xsl:call-template name="create_fn"/>
4214
+ <xsl:call-template name="create_fn" />
4177
4215
  </xsl:for-each>
4178
- </xsl:variable>
4179
-
4180
- <xsl:for-each select="xalan:nodeset($references)//fn">
4216
+ </xsl:variable> -->
4217
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
4181
4218
  <xsl:variable name="reference" select="@reference"/>
4182
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4219
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
4220
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4183
4221
 
4184
4222
  <fo:block xsl:use-attribute-sets="table-fn-style">
4223
+ <xsl:copy-of select="@id"/>
4185
4224
  <xsl:call-template name="refine_table-fn-style"/>
4186
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4187
- <xsl:call-template name="refine_table-fn-number-style"/>
4188
-
4189
- <xsl:value-of select="@reference"/>
4190
4225
 
4191
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4192
- <!-- <xsl:if test="$namespace = 'itu'">
4193
- <xsl:text>)</xsl:text>
4194
- </xsl:if> -->
4226
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
4227
+ <xsl:with-param name="process">true</xsl:with-param>
4228
+ </xsl:apply-templates>
4195
4229
 
4196
- </fo:inline>
4197
4230
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4198
- <xsl:copy-of select="./node()"/>
4231
+ <!-- <xsl:copy-of select="./node()"/> -->
4232
+ <xsl:apply-templates/>
4199
4233
  </fo:inline>
4200
4234
 
4201
4235
  </fo:block>
4202
4236
 
4203
- </xsl:if>
4237
+ <!-- </xsl:if> -->
4204
4238
  </xsl:for-each>
4205
4239
  </xsl:template> <!-- table_fn_display -->
4206
4240
 
4241
+ <!-- fmt-fn-body/fmt-fn-label in text -->
4242
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
4243
+
4244
+ <!-- table//fmt-fn-body//fmt-fn-label -->
4245
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
4246
+ <xsl:param name="process">false</xsl:param>
4247
+ <xsl:if test="$process = 'true'">
4248
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
4249
+
4250
+ <!-- tab is padding-right -->
4251
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
4252
+ <xsl:with-param name="process">true</xsl:with-param>
4253
+ </xsl:apply-templates>
4254
+
4255
+ <!-- <xsl:if test="$namespace = 'bipm'">
4256
+ <fo:inline font-style="normal">(</fo:inline>
4257
+ </xsl:if> -->
4258
+
4259
+ <!-- <xsl:if test="$namespace = 'plateau'">
4260
+ <xsl:text>※</xsl:text>
4261
+ </xsl:if> -->
4262
+
4263
+ <!-- <xsl:value-of select="@reference"/> -->
4264
+ <!-- <xsl:value-of select="normalize-space()"/> -->
4265
+ <xsl:apply-templates/>
4266
+
4267
+ <!-- <xsl:if test="$namespace = 'bipm'">
4268
+ <fo:inline font-style="normal">)</fo:inline>
4269
+ </xsl:if> -->
4270
+
4271
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4272
+ <!-- <xsl:if test="$namespace = 'itu'">
4273
+ <xsl:text>)</xsl:text>
4274
+ </xsl:if> -->
4275
+
4276
+ <!-- <xsl:if test="$namespace = 'plateau'">
4277
+ <xsl:text>:</xsl:text>
4278
+ </xsl:if> -->
4279
+
4280
+ </fo:inline>
4281
+ </xsl:if>
4282
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
4283
+
4284
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
4285
+ <xsl:param name="process">false</xsl:param>
4286
+ <xsl:if test="$process = 'true'">
4287
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
4288
+
4289
+ </xsl:if>
4290
+ </xsl:template>
4291
+
4292
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
4293
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
4294
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
4295
+ <xsl:apply-templates/>
4296
+ </fo:inline>
4297
+ </xsl:template>
4298
+
4299
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
4300
+ <!--
4207
4301
  <xsl:template name="create_fn">
4208
4302
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4209
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4303
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
4210
4304
  <xsl:attribute name="id">
4211
4305
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4212
4306
  </xsl:attribute>
4213
4307
  </xsl:if>
4214
-
4215
- <xsl:apply-templates/>
4308
+ <xsl:if test="$namespace = 'itu'">
4309
+ <xsl:if test="ancestor::*[local-name()='preface']">
4310
+ <xsl:attribute name="preface">true</xsl:attribute>
4311
+ </xsl:if>
4312
+ </xsl:if>
4313
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4314
+ <xsl:attribute name="id">
4315
+ <xsl:value-of select="@reference"/>
4316
+ <xsl:text>_</xsl:text>
4317
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4318
+ </xsl:attribute>
4319
+ </xsl:if>
4320
+ <xsl:apply-templates />
4216
4321
  </fn>
4217
- </xsl:template>
4322
+ </xsl:template> -->
4218
4323
 
4219
4324
  <!-- footnotes for table's name rendering -->
4220
4325
  <xsl:template name="table_name_fn_display">
@@ -4233,123 +4338,171 @@
4233
4338
  <!-- ============================ -->
4234
4339
  <!-- figure's footnotes rendering -->
4235
4340
  <!-- ============================ -->
4236
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
4237
4341
 
4238
- <!-- current figure id -->
4239
- <xsl:variable name="figure_id_">
4240
- <xsl:value-of select="@id"/>
4241
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
4242
- </xsl:variable>
4243
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
4342
+ <!-- figure/fmt-footnote-container -->
4343
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
4344
+
4345
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
4346
+ <xsl:template name="figure_fn_display">
4244
4347
 
4245
- <!-- all footnotes relates to the current figure -->
4246
4348
  <xsl:variable name="references">
4247
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
4248
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4249
- <xsl:apply-templates/>
4250
- </fn>
4349
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4350
+ <xsl:variable name="curr_id" select="@id"/>
4351
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
4352
+ <curr><xsl:copy-of select="."/></curr>
4353
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
4354
+ <xsl:choose>
4355
+ <!-- skip figure/name/fn -->
4356
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
4357
+ <xsl:otherwise>
4358
+ <xsl:element name="figure" namespace="{$namespace_full}">
4359
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
4360
+ <xsl:copy-of select="."/>
4361
+ </xsl:element>
4362
+ </xsl:element>
4363
+ </xsl:otherwise>
4364
+ </xsl:choose>
4251
4365
  </xsl:for-each>
4252
4366
  </xsl:variable>
4367
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
4253
4368
 
4254
- <xsl:if test="xalan:nodeset($references)//fn">
4369
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
4255
4370
 
4256
4371
  <xsl:variable name="key_iso">
4257
4372
 
4258
4373
  </xsl:variable>
4259
4374
 
4260
4375
  <fo:block>
4376
+ <!-- current hierarchy is 'figure' element -->
4377
+ <xsl:variable name="following_dl_colwidths">
4378
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4379
+ <xsl:variable name="simple-table">
4380
+ <!-- <xsl:variable name="doc_ns">
4381
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4382
+ </xsl:variable>
4383
+ <xsl:variable name="ns">
4384
+ <xsl:choose>
4385
+ <xsl:when test="normalize-space($doc_ns) != ''">
4386
+ <xsl:value-of select="normalize-space($doc_ns)"/>
4387
+ </xsl:when>
4388
+ <xsl:otherwise>
4389
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
4390
+ </xsl:otherwise>
4391
+ </xsl:choose>
4392
+ </xsl:variable> -->
4261
4393
 
4262
- <!-- current hierarchy is 'figure' element -->
4263
- <xsl:variable name="following_dl_colwidths">
4264
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4265
- <xsl:variable name="simple-table">
4266
- <!-- <xsl:variable name="doc_ns">
4267
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4268
- </xsl:variable>
4269
- <xsl:variable name="ns">
4270
- <xsl:choose>
4271
- <xsl:when test="normalize-space($doc_ns) != ''">
4272
- <xsl:value-of select="normalize-space($doc_ns)"/>
4273
- </xsl:when>
4274
- <xsl:otherwise>
4275
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4276
- </xsl:otherwise>
4277
- </xsl:choose>
4278
- </xsl:variable> -->
4279
-
4280
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4281
- <tbody>
4282
- <xsl:apply-templates mode="dl"/>
4283
- </tbody>
4284
- </xsl:for-each>
4285
- </xsl:variable>
4286
-
4287
- <xsl:call-template name="calculate-column-widths">
4288
- <xsl:with-param name="cols-count" select="2"/>
4289
- <xsl:with-param name="table" select="$simple-table"/>
4290
- </xsl:call-template>
4291
-
4292
- </xsl:if>
4293
- </xsl:variable>
4294
-
4295
- <xsl:variable name="maxlength_dt">
4296
4394
  <xsl:for-each select="*[local-name() = 'dl'][1]">
4297
- <xsl:call-template name="getMaxLength_dt"/>
4395
+ <tbody>
4396
+ <xsl:apply-templates mode="dl"/>
4397
+ </tbody>
4298
4398
  </xsl:for-each>
4299
4399
  </xsl:variable>
4300
4400
 
4301
- <fo:table width="95%" table-layout="fixed">
4302
- <xsl:if test="normalize-space($key_iso) = 'true'">
4303
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4401
+ <xsl:call-template name="calculate-column-widths">
4402
+ <xsl:with-param name="cols-count" select="2"/>
4403
+ <xsl:with-param name="table" select="$simple-table"/>
4404
+ </xsl:call-template>
4304
4405
 
4305
- </xsl:if>
4306
- <xsl:choose>
4307
- <!-- if there 'dl', then set same columns width -->
4308
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4309
- <xsl:call-template name="setColumnWidth_dl">
4310
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4311
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4312
- </xsl:call-template>
4313
- </xsl:when>
4314
- <xsl:otherwise>
4315
- <fo:table-column column-width="5%"/>
4316
- <fo:table-column column-width="95%"/>
4317
- </xsl:otherwise>
4318
- </xsl:choose>
4319
- <fo:table-body>
4320
- <xsl:for-each select="xalan:nodeset($references)//fn">
4321
- <xsl:variable name="reference" select="@reference"/>
4322
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4323
- <fo:table-row>
4324
- <fo:table-cell>
4325
- <fo:block>
4326
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4327
- <xsl:value-of select="@reference"/>
4406
+ </xsl:if>
4407
+ </xsl:variable>
4408
+
4409
+ <xsl:variable name="maxlength_dt">
4410
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4411
+ <xsl:call-template name="getMaxLength_dt"/>
4412
+ </xsl:for-each>
4413
+ </xsl:variable>
4414
+
4415
+ <fo:table width="95%" table-layout="fixed">
4416
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4417
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4418
+
4419
+ </xsl:if>
4420
+ <xsl:choose>
4421
+ <!-- if there 'dl', then set same columns width -->
4422
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4423
+ <xsl:call-template name="setColumnWidth_dl">
4424
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4425
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4426
+ </xsl:call-template>
4427
+ </xsl:when>
4428
+ <xsl:otherwise>
4429
+ <fo:table-column column-width="5%"/>
4430
+ <fo:table-column column-width="95%"/>
4431
+ </xsl:otherwise>
4432
+ </xsl:choose>
4433
+ <fo:table-body>
4434
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
4435
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
4436
+
4437
+ <xsl:variable name="reference" select="@reference"/>
4438
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
4439
+ <fo:table-row>
4440
+ <fo:table-cell>
4441
+ <fo:block>
4442
+
4443
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
4444
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
4445
+ <!-- <xsl:value-of select="@reference"/> -->
4446
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
4328
4447
  </fo:inline>
4329
- </fo:block>
4330
- </fo:table-cell>
4331
- <fo:table-cell>
4332
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4333
- <xsl:if test="normalize-space($key_iso) = 'true'">
4334
4448
 
4335
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
4449
+ </fo:block>
4450
+ </fo:table-cell>
4451
+ <fo:table-cell>
4452
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4453
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4336
4454
 
4337
- </xsl:if>
4338
- <xsl:copy-of select="./node()"/>
4339
- </fo:block>
4340
- </fo:table-cell>
4341
- </fo:table-row>
4342
- </xsl:if>
4343
- </xsl:for-each>
4344
- </fo:table-body>
4345
- </fo:table>
4455
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
4346
4456
 
4457
+ </xsl:if>
4458
+
4459
+ <!-- <xsl:copy-of select="./node()"/> -->
4460
+ <xsl:apply-templates/>
4461
+ </fo:block>
4462
+ </fo:table-cell>
4463
+ </fo:table-row>
4464
+ <!-- </xsl:if> -->
4465
+ </xsl:for-each>
4466
+ </fo:table-body>
4467
+ </fo:table>
4347
4468
  </fo:block>
4348
4469
  </xsl:if>
4349
- </xsl:template> <!-- fn_display_figure -->
4470
+ </xsl:template> <!-- figure_fn_display -->
4471
+
4472
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
4473
+ <xsl:param name="process">false</xsl:param>
4474
+ <xsl:if test="$process = 'true'">
4475
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
4476
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
4477
+
4478
+ <!-- tab is padding-right -->
4479
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
4480
+ <xsl:with-param name="process">true</xsl:with-param>
4481
+ </xsl:apply-templates>
4482
+
4483
+ <xsl:apply-templates/>
4484
+
4485
+ </fo:inline>
4486
+ </xsl:if>
4487
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
4488
+
4489
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
4490
+ <xsl:param name="process">false</xsl:param>
4491
+ <xsl:if test="$process = 'true'">
4492
+
4493
+ </xsl:if>
4494
+ </xsl:template>
4495
+
4496
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
4497
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
4498
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
4499
+ <xsl:apply-templates/>
4500
+ </fo:inline>
4501
+ </xsl:template>
4350
4502
 
4351
4503
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
4352
4504
  <!-- figure's footnote label -->
4505
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
4353
4506
  <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">
4354
4507
  <xsl:variable name="key_iso">
4355
4508
 
@@ -4358,7 +4511,7 @@
4358
4511
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4359
4512
 
4360
4513
  </xsl:if>
4361
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
4514
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
4362
4515
  <!-- <xsl:value-of select="@reference"/> -->
4363
4516
  <xsl:apply-templates/>
4364
4517
  </fo:inline>
@@ -4368,38 +4521,65 @@
4368
4521
  <!-- END: figure's footnotes rendering -->
4369
4522
  <!-- ============================ -->
4370
4523
 
4371
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
4524
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
4525
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
4372
4526
  <xsl:template match="*[local-name()='fn']">
4373
4527
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
4374
4528
 
4375
4529
  <xsl:call-template name="refine_fn-reference-style"/>
4376
4530
 
4377
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4378
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4379
- <xsl:attribute name="internal-destination">
4531
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4532
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4533
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4534
+ <!-- <xsl:attribute name="internal-destination">
4380
4535
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4381
4536
  </xsl:attribute>
4382
4537
  </xsl:if>
4538
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4539
+ <xsl:attribute name="internal-destination">
4540
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4541
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4542
+ </xsl:attribute>
4543
+ </xsl:if> -->
4544
+ <!-- <xsl:if test="$namespace = 'plateau'">
4545
+ <xsl:text>※</xsl:text>
4546
+ </xsl:if> -->
4547
+ <!-- <xsl:value-of select="@reference"/> -->
4383
4548
 
4384
- <xsl:value-of select="@reference"/>
4549
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4385
4550
 
4551
+ <!-- <xsl:if test="$namespace = 'bsi'">
4552
+ <xsl:text>)</xsl:text>
4553
+ </xsl:if> -->
4386
4554
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4387
4555
  <!-- <xsl:if test="$namespace = 'jis'">
4388
4556
  <fo:inline font-weight="normal">)</fo:inline>
4389
4557
  </xsl:if> -->
4390
4558
  </fo:basic-link>
4391
4559
  </fo:inline>
4392
- </xsl:template>
4560
+ </xsl:template> <!-- fn -->
4393
4561
 
4562
+ <!-- fn/text() -->
4394
4563
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4395
4564
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
4396
4565
  </xsl:template>
4397
4566
 
4398
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
4567
+ <!-- fn//p fmt-fn-body//p -->
4568
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
4399
4569
  <fo:inline role="P">
4400
4570
  <xsl:apply-templates/>
4401
4571
  </fo:inline>
4402
4572
  </xsl:template>
4573
+
4574
+ <xsl:template name="insertFootnoteSeparatorCommon">
4575
+ <xsl:param name="leader_length">30%</xsl:param>
4576
+ <fo:static-content flow-name="xsl-footnote-separator">
4577
+ <fo:block>
4578
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
4579
+ </fo:block>
4580
+ </fo:static-content>
4581
+ </xsl:template>
4582
+
4403
4583
  <!-- ===================== -->
4404
4584
  <!-- END Footnotes processing -->
4405
4585
  <!-- ===================== -->
@@ -4676,11 +4856,11 @@
4676
4856
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4677
4857
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4678
4858
 
4679
- <xsl:call-template name="setColumnWidth_dl">
4680
- <xsl:with-param name="colwidths" select="$colwidths"/>
4681
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4682
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4683
- </xsl:call-template>
4859
+ <xsl:call-template name="setColumnWidth_dl">
4860
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4861
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4862
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4863
+ </xsl:call-template>
4684
4864
 
4685
4865
  <fo:table-body>
4686
4866
 
@@ -4714,6 +4894,14 @@
4714
4894
 
4715
4895
  </xsl:template> <!-- END: dl -->
4716
4896
 
4897
+ <xsl:template match="@*|node()" mode="dt_clean">
4898
+ <xsl:copy>
4899
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
4900
+ </xsl:copy>
4901
+ </xsl:template>
4902
+
4903
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
4904
+
4717
4905
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
4718
4906
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
4719
4907
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -4743,10 +4931,12 @@
4743
4931
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
4744
4932
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
4745
4933
 
4934
+ <!-- dl/name -->
4746
4935
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
4747
4936
  <xsl:param name="process">false</xsl:param>
4748
4937
  <xsl:if test="$process = 'true'">
4749
4938
  <fo:block xsl:use-attribute-sets="dl-name-style">
4939
+
4750
4940
  <xsl:apply-templates/>
4751
4941
  </fo:block>
4752
4942
  </xsl:if>
@@ -4760,6 +4950,10 @@
4760
4950
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
4761
4951
 
4762
4952
  <xsl:choose>
4953
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
4954
+ <fo:table-column column-width="10%"/>
4955
+ <fo:table-column column-width="90%"/>
4956
+ </xsl:when> -->
4763
4957
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
4764
4958
  <xsl:call-template name="insertTableColumnWidth">
4765
4959
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -5556,7 +5750,7 @@
5556
5750
  <xsl:choose>
5557
5751
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
5558
5752
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
5559
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
5753
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
5560
5754
  </xsl:when>
5561
5755
  <xsl:otherwise>
5562
5756
  <xsl:apply-templates/>
@@ -5564,7 +5758,7 @@
5564
5758
  </xsl:choose>
5565
5759
  </xsl:template>
5566
5760
  <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">
5567
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
5761
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
5568
5762
  </xsl:template>
5569
5763
 
5570
5764
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -6604,24 +6798,26 @@
6604
6798
  <xsl:apply-templates select="." mode="mathml"/>
6605
6799
  </xsl:variable>
6606
6800
 
6607
- <fo:instream-foreign-object fox:alt-text="Math">
6801
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
6608
6802
 
6609
6803
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
6610
6804
 
6611
- <!-- put MathML in Actual Text -->
6612
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
6613
- <xsl:attribute name="fox:actual-text">
6614
- <xsl:value-of select="$mathml_content"/>
6615
- </xsl:attribute>
6616
-
6617
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
6618
- <xsl:if test="normalize-space($asciimath_text_) != ''">
6619
- <!-- put Mathin Alternate Text -->
6620
- <xsl:attribute name="fox:alt-text">
6621
- <xsl:value-of select="$asciimath_text_"/>
6805
+ <xsl:if test="$isGenerateTableIF = 'false'">
6806
+ <!-- put MathML in Actual Text -->
6807
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
6808
+ <xsl:attribute name="fox:actual-text">
6809
+ <xsl:value-of select="$mathml_content"/>
6622
6810
  </xsl:attribute>
6811
+
6812
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
6813
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
6814
+ <!-- put Mathin Alternate Text -->
6815
+ <xsl:attribute name="fox:alt-text">
6816
+ <xsl:value-of select="$asciimath_text_"/>
6817
+ </xsl:attribute>
6818
+ </xsl:if>
6819
+ <!-- </xsl:if> -->
6623
6820
  </xsl:if>
6624
- <!-- </xsl:if> -->
6625
6821
 
6626
6822
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
6627
6823
 
@@ -6884,6 +7080,27 @@
6884
7080
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6885
7081
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6886
7082
  </xsl:when> -->
7083
+
7084
+ <!-- <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'))">
7085
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7086
+ <xsl:variable name="filename">
7087
+ <xsl:call-template name="substring-after-last">
7088
+ <xsl:with-param name="value" select="$target_"/>
7089
+ <xsl:with-param name="delimiter" select="'/'"/>
7090
+ </xsl:call-template>
7091
+ </xsl:variable>
7092
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
7093
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
7094
+ <xsl:choose>
7095
+ <xsl:when test="$file_exists = 'true'">
7096
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
7097
+ </xsl:when>
7098
+ <xsl:otherwise>
7099
+ <xsl:value-of select="normalize-space(@target)"/>
7100
+ </xsl:otherwise>
7101
+ </xsl:choose>
7102
+ </xsl:when> -->
7103
+
6887
7104
  <xsl:otherwise>
6888
7105
  <xsl:value-of select="normalize-space(@target)"/>
6889
7106
  </xsl:otherwise>
@@ -7188,7 +7405,7 @@
7188
7405
 
7189
7406
  <xsl:template name="refine_note_block_style">
7190
7407
 
7191
- </xsl:template>
7408
+ </xsl:template> <!-- refine_note_block_style -->
7192
7409
 
7193
7410
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
7194
7411
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -7380,10 +7597,21 @@
7380
7597
  </xsl:template>
7381
7598
 
7382
7599
  <xsl:template name="showFigureKey">
7383
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
7384
- <xsl:call-template name="note"/>
7600
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
7601
+ <xsl:choose>
7602
+ <xsl:when test="local-name() = 'note'">
7603
+ <xsl:call-template name="note"/>
7604
+ </xsl:when>
7605
+ <xsl:when test="local-name() = 'example'">
7606
+ <xsl:call-template name="example"/>
7607
+ </xsl:when>
7608
+ <xsl:otherwise>
7609
+ <xsl:apply-templates select="."/>
7610
+ </xsl:otherwise>
7611
+ </xsl:choose>
7385
7612
  </xsl:for-each>
7386
- <xsl:call-template name="fn_display_figure"/>
7613
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
7614
+ <xsl:call-template name="figure_fn_display"/>
7387
7615
  </xsl:template>
7388
7616
 
7389
7617
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -8277,10 +8505,10 @@
8277
8505
  <xsl:when test="@type = 'section-title'">
8278
8506
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
8279
8507
  <xsl:text>: </xsl:text>
8280
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
8508
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
8281
8509
  </xsl:when>
8282
8510
  <xsl:otherwise>
8283
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
8511
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
8284
8512
  </xsl:otherwise>
8285
8513
  </xsl:choose>
8286
8514
  </xsl:when>
@@ -8345,6 +8573,8 @@
8345
8573
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
8346
8574
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
8347
8575
 
8576
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
8577
+
8348
8578
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
8349
8579
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
8350
8580
  <xsl:apply-templates mode="bookmarks"/>
@@ -8366,6 +8596,8 @@
8366
8596
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
8367
8597
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
8368
8598
 
8599
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
8600
+
8369
8601
  <!-- Bookmarks -->
8370
8602
  <xsl:template name="addBookmarks">
8371
8603
  <xsl:param name="contents"/>
@@ -8611,9 +8843,15 @@
8611
8843
  </xsl:if>
8612
8844
  </xsl:template>
8613
8845
 
8846
+ <!-- figure/fn -->
8614
8847
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
8615
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
8848
+ <!-- figure/note -->
8849
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
8850
+ <!-- figure/example -->
8851
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
8616
8852
 
8853
+ <!-- figure/note[@type = 'units'] -->
8854
+ <!-- image/note[@type = 'units'] -->
8617
8855
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
8618
8856
  <fo:block text-align="right" keep-with-next="always">
8619
8857
  <xsl:apply-templates/>
@@ -8734,6 +8972,7 @@
8734
8972
  </xsl:choose>
8735
8973
  </xsl:template>
8736
8974
 
8975
+ <!-- fn -->
8737
8976
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
8738
8977
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
8739
8978
 
@@ -9632,7 +9871,7 @@
9632
9871
  text line 1
9633
9872
  text line 2
9634
9873
  -->
9635
- <xsl:template match="*[local-name() = 'example']">
9874
+ <xsl:template match="*[local-name() = 'example']" name="example">
9636
9875
 
9637
9876
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
9638
9877
 
@@ -9738,6 +9977,7 @@
9738
9977
 
9739
9978
  </xsl:template>
9740
9979
 
9980
+ <!-- example/name -->
9741
9981
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
9742
9982
  <xsl:param name="fo_element">block</xsl:param>
9743
9983
 
@@ -9763,7 +10003,8 @@
9763
10003
 
9764
10004
  </xsl:template>
9765
10005
 
9766
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
10006
+ <!-- table/example/name, table/tfoot//example/name -->
10007
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
9767
10008
  <fo:inline xsl:use-attribute-sets="example-name-style">
9768
10009
 
9769
10010
  <xsl:apply-templates/>
@@ -10242,21 +10483,32 @@
10242
10483
  <!-- ========== -->
10243
10484
 
10244
10485
  <xsl:variable name="reviews_">
10245
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
10486
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
10246
10487
  <xsl:copy>
10247
10488
  <xsl:copy-of select="@from"/>
10248
10489
  <xsl:copy-of select="@id"/>
10249
10490
  </xsl:copy>
10250
10491
  </xsl:for-each>
10492
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
10493
+ <xsl:copy>
10494
+ <xsl:copy-of select="@source"/>
10495
+ <xsl:copy-of select="@id"/>
10496
+ </xsl:copy>
10497
+ </xsl:for-each>
10251
10498
  </xsl:variable>
10252
10499
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
10253
10500
 
10254
10501
  <xsl:template name="addReviewHelper">
10255
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
10256
- <xsl:variable name="curr_id" select="@id"/>
10257
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
10258
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
10259
- <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>
10502
+ <xsl:if test="$isGenerateTableIF = 'false'">
10503
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
10504
+ <xsl:variable name="curr_id" select="@id"/>
10505
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
10506
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
10507
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
10508
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
10509
+ <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>
10510
+ </xsl:if>
10511
+ </xsl:for-each>
10260
10512
  </xsl:if>
10261
10513
  <!-- <fo:block>
10262
10514
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -10398,14 +10650,61 @@
10398
10650
 
10399
10651
  </xsl:template>
10400
10652
 
10401
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10653
+ <!-- document text (not figures, or tables) footnotes -->
10654
+ <xsl:variable name="reviews_container_">
10655
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
10656
+ <xsl:variable name="update_xml_step1">
10657
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
10658
+ </xsl:variable>
10659
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
10660
+ </xsl:for-each>
10661
+ </xsl:variable>
10662
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
10663
+
10664
+ <xsl:template match="*[local-name() = 'review-container']"/>
10665
+
10666
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
10667
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10668
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
10669
+ <xsl:if test="$isGenerateTableIF = 'false'">
10670
+ <xsl:choose>
10671
+ <!-- if there isn't the attribute '@from', then -->
10672
+ <xsl:when test="$id_from = ''">
10673
+ <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>
10674
+ </xsl:when>
10675
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
10676
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
10677
+ <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>
10678
+ </xsl:when>
10679
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10680
+ <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>
10681
+ </xsl:when>
10682
+ </xsl:choose>
10683
+ </xsl:if>
10684
+ </xsl:template>
10685
+
10686
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
10687
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10402
10688
  <!-- comment 2019-11-29 -->
10403
10689
  <!-- <fo:block font-weight="bold">Review:</fo:block>
10404
10690
  <xsl:apply-templates /> -->
10405
10691
 
10406
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
10692
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
10407
10693
 
10408
- <xsl:if test="1 = 1">
10694
+ <xsl:variable name="source" select="normalize-space(@source)"/>
10695
+
10696
+ <xsl:if test="$isGenerateTableIF = 'false'">
10697
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
10698
+
10699
+ <!-- <xsl:if test="@source = @end"> -->
10700
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
10701
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
10702
+ <!-- <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> -->
10703
+ <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>
10704
+ <!-- </xsl:if> -->
10705
+ </xsl:if>
10706
+
10707
+ <xsl:if test="1 = 2">
10409
10708
  <xsl:choose>
10410
10709
  <!-- if there isn't the attribute '@from', then -->
10411
10710
  <xsl:when test="$id_from = ''">
@@ -10413,10 +10712,10 @@
10413
10712
  </xsl:when>
10414
10713
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
10415
10714
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
10416
- <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>
10715
+ <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>
10417
10716
  </xsl:when>
10418
10717
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10419
- <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>
10718
+ <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>
10420
10719
  </xsl:when>
10421
10720
  </xsl:choose>
10422
10721
  </xsl:if>
@@ -10465,16 +10764,21 @@
10465
10764
  <xsl:variable name="list_level">
10466
10765
  <xsl:choose>
10467
10766
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
10468
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
10767
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
10768
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
10769
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
10469
10770
  </xsl:choose>
10470
10771
  </xsl:variable>
10471
10772
  <xsl:choose>
10472
10773
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
10473
10774
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
10474
10775
  </xsl:when>
10475
- <xsl:when test="$list_level mod 3 = 0">
10776
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
10476
10777
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
10477
10778
  </xsl:when>
10779
+ <xsl:when test="$list_level mod 3 = 0">
10780
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
10781
+ </xsl:when>
10478
10782
  <xsl:when test="$list_level mod 2 = 0">
10479
10783
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
10480
10784
  </xsl:when>
@@ -11017,10 +11321,22 @@
11017
11321
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
11018
11322
 
11019
11323
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
11020
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11021
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
11022
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11023
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11324
+ <xsl:variable name="bookmark_id" select="@id"/>
11325
+ <xsl:choose>
11326
+ <!-- Example:
11327
+ <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"/>
11328
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
11329
+ <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"/> -->
11330
+ <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]">
11331
+ <!-- skip here, see the template 'fmt-review-start' -->
11332
+ </xsl:when>
11333
+ <xsl:otherwise>
11334
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11335
+ <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>
11336
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11337
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11338
+ </xsl:otherwise>
11339
+ </xsl:choose>
11024
11340
  </xsl:template>
11025
11341
  <!-- =================== -->
11026
11342
  <!-- End of Index processing -->
@@ -11402,8 +11718,33 @@
11402
11718
 
11403
11719
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
11404
11720
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11721
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11722
+ <!-- <test><xsl:copy-of select="."/></test> -->
11723
+
11405
11724
  <xsl:variable name="target" select="@target"/>
11725
+
11406
11726
  <xsl:for-each select="*[local-name() = 'tab']">
11727
+
11728
+ <xsl:if test="position() = 1">
11729
+ <!-- first column (data before first `tab`) -->
11730
+ <fo:table-cell>
11731
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
11732
+ <xsl:call-template name="insert_basic_link">
11733
+ <xsl:with-param name="element">
11734
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11735
+ <xsl:for-each select="preceding-sibling::node()">
11736
+ <xsl:choose>
11737
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11738
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11739
+ </xsl:choose>
11740
+ </xsl:for-each>
11741
+ </fo:basic-link>
11742
+ </xsl:with-param>
11743
+ </xsl:call-template>
11744
+ </fo:block>
11745
+ </fo:table-cell>
11746
+ </xsl:if>
11747
+
11407
11748
  <xsl:variable name="current_id" select="generate-id()"/>
11408
11749
  <fo:table-cell>
11409
11750
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -11454,11 +11795,25 @@
11454
11795
 
11455
11796
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
11456
11797
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11798
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11457
11799
  <xsl:for-each select="*[local-name() = 'tab']">
11800
+ <xsl:if test="position() = 1">
11801
+ <td>
11802
+ <xsl:for-each select="preceding-sibling::node()">
11803
+ <xsl:choose>
11804
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11805
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
11806
+ </xsl:choose>
11807
+ </xsl:for-each>
11808
+ </td>
11809
+ </xsl:if>
11458
11810
  <xsl:variable name="current_id" select="generate-id()"/>
11459
11811
  <td>
11460
11812
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11461
- <xsl:copy-of select="."/>
11813
+ <xsl:choose>
11814
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11815
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
11816
+ </xsl:choose>
11462
11817
  </xsl:for-each>
11463
11818
  </td>
11464
11819
  </xsl:for-each>
@@ -12333,6 +12688,9 @@
12333
12688
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
12334
12689
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
12335
12690
 
12691
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
12692
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
12693
+
12336
12694
  <!-- END: update new Presentation XML -->
12337
12695
 
12338
12696
  <!-- =========================================================================== -->
@@ -12856,6 +13214,7 @@
12856
13214
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
12857
13215
  </fn>
12858
13216
  -->
13217
+ <!-- fn in text -->
12859
13218
  <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">
12860
13219
  <xsl:variable name="p_fn_">
12861
13220
  <xsl:call-template name="get_fn_list"/>