metanorma-ogc 2.7.1 → 2.7.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.
@@ -674,12 +674,6 @@
674
674
  </xsl:if>
675
675
  </xsl:template>
676
676
 
677
- <xsl:template match="ogc:fn/ogc:p">
678
- <fo:block>
679
- <xsl:apply-templates/>
680
- </fo:block>
681
- </xsl:template>
682
-
683
677
  <xsl:template match="ogc:ul | ogc:ol" mode="list" priority="2">
684
678
  <fo:list-block xsl:use-attribute-sets="list-style">
685
679
  <xsl:if test="ancestor::ogc:ul | ancestor::ogc:ol">
@@ -705,11 +699,7 @@
705
699
 
706
700
  <xsl:template name="insertHeaderFooter">
707
701
 
708
- <fo:static-content flow-name="xsl-footnote-separator">
709
- <fo:block>
710
- <fo:leader leader-pattern="rule" leader-length="30%"/>
711
- </fo:block>
712
- </fo:static-content>
702
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
713
703
 
714
704
  <fo:static-content flow-name="header" role="artifact">
715
705
  <fo:block-container height="16.5mm" background-color="{$color}">
@@ -1639,14 +1629,18 @@
1639
1629
  </xsl:template>
1640
1630
 
1641
1631
  <xsl:attribute-set name="table-fn-number-style">
1632
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
1633
+
1634
+ </xsl:attribute-set> <!-- table-fn-number-style -->
1635
+
1636
+ <xsl:attribute-set name="table-fmt-fn-label-style">
1642
1637
  <xsl:attribute name="font-size">80%</xsl:attribute>
1643
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
1644
1638
 
1645
1639
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1646
1640
 
1647
- </xsl:attribute-set> <!-- table-fn-number-style -->
1641
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
1648
1642
 
1649
- <xsl:template name="refine_table-fn-number-style">
1643
+ <xsl:template name="refine_table-fmt-fn-label-style">
1650
1644
 
1651
1645
  </xsl:template>
1652
1646
 
@@ -1661,11 +1655,18 @@
1661
1655
  </xsl:attribute-set>
1662
1656
 
1663
1657
  <xsl:attribute-set name="figure-fn-number-style">
1664
- <xsl:attribute name="font-size">80%</xsl:attribute>
1665
1658
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
1659
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
1660
+
1661
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
1662
+ <xsl:attribute name="font-size">80%</xsl:attribute>
1666
1663
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1667
1664
 
1668
- </xsl:attribute-set>
1665
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
1666
+
1667
+ <xsl:template name="refine_figure-fmt-fn-label-style">
1668
+
1669
+ </xsl:template>
1669
1670
 
1670
1671
  <xsl:attribute-set name="figure-fn-body-style">
1671
1672
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -3247,9 +3248,13 @@
3247
3248
 
3248
3249
  <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']"/>
3249
3250
  <xsl:if test="$isNoteOrFnExist = 'true'">
3250
-
3251
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3252
-
3251
+ <!-- <xsl:choose>
3252
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
3253
+ <xsl:otherwise>
3254
+
3255
+ </xsl:otherwise>
3256
+ </xsl:choose> -->
3257
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3253
3258
  </xsl:if>
3254
3259
 
3255
3260
  <xsl:choose>
@@ -3296,7 +3301,7 @@
3296
3301
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3297
3302
  </xsl:when>
3298
3303
  <xsl:otherwise>
3299
- <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 -->
3304
+ <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 -->
3300
3305
  </xsl:otherwise>
3301
3306
  </xsl:choose>
3302
3307
 
@@ -3307,16 +3312,29 @@
3307
3312
 
3308
3313
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3309
3314
 
3310
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3311
- <xsl:call-template name="insertTableFooterInSeparateTable">
3312
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
3313
- <xsl:with-param name="colwidths" select="$colwidths"/>
3314
- <xsl:with-param name="colgroup" select="$colgroup"/>
3315
- </xsl:call-template>
3316
- </xsl:for-each>
3315
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
3316
+
3317
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3318
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3319
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3320
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3321
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3322
+ </xsl:call-template>
3323
+ </xsl:for-each>
3317
3324
 
3318
3325
  <xsl:apply-templates select="*[local-name()='name']"/>
3319
3326
 
3327
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
3328
+ <xsl:if test="$namespace = 'plateau'">
3329
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
3330
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
3331
+ <xsl:variable name="table_fn_block">
3332
+ <xsl:call-template name="table_fn_display" />
3333
+ </xsl:variable>
3334
+ <xsl:copy-of select="$table_fn_block"/>
3335
+ </xsl:for-each>
3336
+ </xsl:if> -->
3337
+
3320
3338
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
3321
3339
  <fo:block keep-with-previous="always" line-height="0.1">
3322
3340
  <xsl:for-each select="*[local-name()='bookmark']">
@@ -4098,6 +4116,8 @@
4098
4116
 
4099
4117
  <xsl:template name="setTableRowAttributes">
4100
4118
 
4119
+ <xsl:call-template name="setColors"/>
4120
+
4101
4121
  </xsl:template> <!-- setTableRowAttributes -->
4102
4122
  <!-- ===================== -->
4103
4123
  <!-- END Table's row processing -->
@@ -4149,6 +4169,7 @@
4149
4169
  </xsl:attribute>
4150
4170
  </xsl:if>
4151
4171
  <xsl:call-template name="display-align"/>
4172
+ <xsl:call-template name="setColors"/>
4152
4173
  </xsl:template>
4153
4174
 
4154
4175
  <xsl:template name="display-align">
@@ -4164,6 +4185,29 @@
4164
4185
  </xsl:if>
4165
4186
  </xsl:template>
4166
4187
 
4188
+ <xsl:template name="setColors">
4189
+ <xsl:variable name="styles__">
4190
+ <xsl:call-template name="split">
4191
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
4192
+ <xsl:with-param name="sep" select="';'"/>
4193
+ </xsl:call-template>
4194
+ </xsl:variable>
4195
+ <xsl:variable name="quot">"</xsl:variable>
4196
+ <xsl:variable name="styles_">
4197
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
4198
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
4199
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
4200
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
4201
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
4202
+ </xsl:if>
4203
+ </xsl:for-each>
4204
+ </xsl:variable>
4205
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
4206
+ <xsl:for-each select="$styles/style">
4207
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4208
+ </xsl:for-each>
4209
+ </xsl:template>
4210
+
4167
4211
  <!-- cell in table body, footer -->
4168
4212
  <xsl:template match="*[local-name()='td']" name="td">
4169
4213
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -4175,17 +4219,28 @@
4175
4219
 
4176
4220
  <xsl:call-template name="refine_table-cell-style"/>
4177
4221
 
4222
+ <xsl:call-template name="setTableCellAttributes"/>
4223
+
4178
4224
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
4179
4225
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4180
4226
  </xsl:if>
4181
4227
 
4182
- <xsl:call-template name="setTableCellAttributes"/>
4183
-
4184
4228
  <xsl:if test="$isGenerateTableIF = 'true'">
4185
4229
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
4186
4230
  <xsl:attribute name="text-align">left</xsl:attribute>
4187
4231
  </xsl:if>
4188
4232
 
4233
+ <xsl:if test="$isGenerateTableIF = 'false'">
4234
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
4235
+ <xsl:attribute name="text-align">right</xsl:attribute>
4236
+ <xsl:attribute name="border">none</xsl:attribute>
4237
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4238
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
4239
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
4240
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
4241
+ </xsl:if>
4242
+ </xsl:if>
4243
+
4189
4244
  <fo:block role="SKIP">
4190
4245
 
4191
4246
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4204,7 +4259,8 @@
4204
4259
  </fo:table-cell>
4205
4260
  </xsl:template> <!-- td -->
4206
4261
 
4207
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
4262
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
4263
+ <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">
4208
4264
 
4209
4265
  <fo:block xsl:use-attribute-sets="table-note-style">
4210
4266
  <xsl:copy-of select="@id"/>
@@ -4225,65 +4281,54 @@
4225
4281
 
4226
4282
  </xsl:template> <!-- table/note -->
4227
4283
 
4228
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
4284
+ <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">
4229
4285
  <xsl:apply-templates/>
4230
4286
  </xsl:template>
4231
4287
 
4232
4288
  <!-- ===================== -->
4233
4289
  <!-- Footnotes processing -->
4234
4290
  <!-- ===================== -->
4291
+
4292
+ <!-- document text (not figures, or tables) footnotes -->
4293
+ <xsl:variable name="footnotes_">
4294
+ <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 -->
4295
+ <!-- <xsl:copy-of select="."/> -->
4296
+ <xsl:variable name="update_xml_step1">
4297
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
4298
+ </xsl:variable>
4299
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
4300
+ </xsl:for-each>
4301
+ </xsl:variable>
4302
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
4303
+
4235
4304
  <!--
4236
4305
  <fn reference="1">
4237
4306
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
4238
4307
  </fn>
4239
4308
  -->
4240
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
4309
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
4310
+ <!-- fn in text -->
4241
4311
  <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">
4242
4312
 
4243
- <!-- list of footnotes to calculate actual footnotes number -->
4313
+ <!-- list of unique footnotes -->
4244
4314
  <xsl:variable name="p_fn_">
4245
4315
  <xsl:call-template name="get_fn_list"/>
4246
- <!-- <xsl:choose>
4247
- <xsl:when test="$namespace = 'jis'">
4248
- <xsl:call-template name="get_fn_list_for_element"/>
4249
- </xsl:when>
4250
- <xsl:otherwise>
4251
- <xsl:call-template name="get_fn_list"/>
4252
- </xsl:otherwise>
4253
- </xsl:choose> -->
4254
4316
  </xsl:variable>
4255
4317
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4256
4318
 
4257
4319
  <xsl:variable name="gen_id" select="generate-id(.)"/>
4258
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
4259
- <xsl:variable name="reference_">
4260
- <xsl:value-of select="@reference"/>
4261
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
4262
- </xsl:variable>
4263
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
4320
+
4264
4321
  <!-- fn sequence number in document -->
4265
- <xsl:variable name="current_fn_number">
4266
- <xsl:choose>
4267
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
4268
- <xsl:otherwise>
4269
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
4270
- </xsl:otherwise>
4271
- </xsl:choose>
4272
- </xsl:variable>
4322
+ <xsl:variable name="current_fn_number" select="@reference"/>
4323
+
4273
4324
  <xsl:variable name="current_fn_number_text">
4274
4325
 
4275
4326
  <xsl:value-of select="$current_fn_number"/>
4276
4327
 
4277
4328
  </xsl:variable>
4278
4329
 
4279
- <xsl:variable name="ref_id">
4280
- <xsl:choose>
4281
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
4282
- <xsl:otherwise>
4283
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4284
- </xsl:otherwise>
4285
- </xsl:choose>
4286
- </xsl:variable>
4330
+ <xsl:variable name="ref_id" select="@target"/>
4331
+
4287
4332
  <xsl:variable name="footnote_inline">
4288
4333
  <fo:inline role="Reference">
4289
4334
 
@@ -4328,7 +4373,9 @@
4328
4373
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
4329
4374
  <xsl:copy-of select="$footnote_inline"/>
4330
4375
  </xsl:when>
4376
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
4331
4377
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
4378
+
4332
4379
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
4333
4380
  <xsl:copy-of select="$footnote_inline"/>
4334
4381
  <fo:footnote-body role="Note">
@@ -4345,7 +4392,10 @@
4345
4392
  <xsl:value-of select="$current_fn_number_text"/>
4346
4393
 
4347
4394
  </fo:inline>
4348
- <xsl:apply-templates/>
4395
+ <!-- <xsl:apply-templates /> -->
4396
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
4397
+ <here><xsl:copy-of select="$footnotes"/></here> -->
4398
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
4349
4399
  </xsl:variable>
4350
4400
 
4351
4401
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -4399,83 +4449,136 @@
4399
4449
  </xsl:choose>
4400
4450
  </xsl:template>
4401
4451
 
4402
- <xsl:template name="get_fn_list_for_element">
4403
- <xsl:choose>
4404
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
4405
- <fn gen_id="{generate-id(.)}">
4406
- <xsl:copy-of select="@*"/>
4407
- <xsl:copy-of select="node()"/>
4408
- </fn>
4409
- </xsl:when>
4410
- <xsl:otherwise>
4411
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
4412
- <xsl:variable name="element_id" select="@id"/>
4413
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4414
- <!-- copy unique fn -->
4415
- <fn gen_id="{generate-id(.)}">
4416
- <xsl:copy-of select="@*"/>
4417
- <xsl:copy-of select="node()"/>
4418
- </fn>
4419
- </xsl:for-each>
4420
- </xsl:for-each>
4421
- </xsl:otherwise>
4422
- </xsl:choose>
4423
- </xsl:template>
4424
4452
  <!-- ============================ -->
4425
4453
  <!-- table's footnotes rendering -->
4426
4454
  <!-- ============================ -->
4427
- <xsl:template name="table_fn_display">
4428
- <xsl:variable name="references">
4429
4455
 
4456
+ <!-- table/fmt-footnote-container -->
4457
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
4458
+
4459
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
4460
+ <xsl:for-each select=".">
4461
+ <xsl:call-template name="table_fn_display"/>
4462
+ </xsl:for-each>
4463
+ </xsl:template>
4464
+
4465
+ <xsl:template name="table_fn_display">
4466
+ <!-- <xsl:variable name="references">
4467
+ <xsl:if test="$namespace = 'bsi'">
4468
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
4469
+ <xsl:call-template name="create_fn" />
4470
+ </xsl:for-each>
4471
+ </xsl:if>
4430
4472
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
4431
- <xsl:call-template name="create_fn"/>
4473
+ <xsl:call-template name="create_fn" />
4432
4474
  </xsl:for-each>
4433
- </xsl:variable>
4434
-
4435
- <xsl:for-each select="xalan:nodeset($references)//fn">
4475
+ </xsl:variable> -->
4476
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
4436
4477
  <xsl:variable name="reference" select="@reference"/>
4437
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4478
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
4479
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4438
4480
 
4439
4481
  <fo:block xsl:use-attribute-sets="table-fn-style">
4482
+ <xsl:copy-of select="@id"/>
4440
4483
  <xsl:call-template name="refine_table-fn-style"/>
4441
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4442
- <xsl:call-template name="refine_table-fn-number-style"/>
4443
4484
 
4444
- <xsl:value-of select="@reference"/>
4445
-
4446
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4447
- <!-- <xsl:if test="$namespace = 'itu'">
4448
- <xsl:text>)</xsl:text>
4449
- </xsl:if> -->
4485
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
4486
+ <xsl:with-param name="process">true</xsl:with-param>
4487
+ </xsl:apply-templates>
4450
4488
 
4451
- </fo:inline>
4452
4489
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4453
- <xsl:copy-of select="./node()"/>
4490
+ <!-- <xsl:copy-of select="./node()"/> -->
4491
+ <xsl:apply-templates/>
4454
4492
  </fo:inline>
4455
4493
 
4456
4494
  </fo:block>
4457
4495
 
4458
- </xsl:if>
4496
+ <!-- </xsl:if> -->
4459
4497
  </xsl:for-each>
4460
4498
  </xsl:template> <!-- table_fn_display -->
4461
4499
 
4500
+ <!-- fmt-fn-body/fmt-fn-label in text -->
4501
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
4502
+
4503
+ <!-- table//fmt-fn-body//fmt-fn-label -->
4504
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
4505
+ <xsl:param name="process">false</xsl:param>
4506
+ <xsl:if test="$process = 'true'">
4507
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
4508
+
4509
+ <!-- tab is padding-right -->
4510
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
4511
+ <xsl:with-param name="process">true</xsl:with-param>
4512
+ </xsl:apply-templates>
4513
+
4514
+ <!-- <xsl:if test="$namespace = 'bipm'">
4515
+ <fo:inline font-style="normal">(</fo:inline>
4516
+ </xsl:if> -->
4517
+
4518
+ <!-- <xsl:if test="$namespace = 'plateau'">
4519
+ <xsl:text>※</xsl:text>
4520
+ </xsl:if> -->
4521
+
4522
+ <!-- <xsl:value-of select="@reference"/> -->
4523
+ <!-- <xsl:value-of select="normalize-space()"/> -->
4524
+ <xsl:apply-templates/>
4525
+
4526
+ <!-- <xsl:if test="$namespace = 'bipm'">
4527
+ <fo:inline font-style="normal">)</fo:inline>
4528
+ </xsl:if> -->
4529
+
4530
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4531
+ <!-- <xsl:if test="$namespace = 'itu'">
4532
+ <xsl:text>)</xsl:text>
4533
+ </xsl:if> -->
4534
+
4535
+ <!-- <xsl:if test="$namespace = 'plateau'">
4536
+ <xsl:text>:</xsl:text>
4537
+ </xsl:if> -->
4538
+
4539
+ </fo:inline>
4540
+ </xsl:if>
4541
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
4542
+
4543
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
4544
+ <xsl:param name="process">false</xsl:param>
4545
+ <xsl:if test="$process = 'true'">
4546
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
4547
+
4548
+ </xsl:if>
4549
+ </xsl:template>
4550
+
4551
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
4552
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
4553
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
4554
+ <xsl:apply-templates/>
4555
+ </fo:inline>
4556
+ </xsl:template>
4557
+
4558
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
4559
+ <!--
4462
4560
  <xsl:template name="create_fn">
4463
4561
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4464
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4562
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
4465
4563
  <xsl:attribute name="id">
4466
4564
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4467
4565
  </xsl:attribute>
4468
4566
  </xsl:if>
4469
-
4567
+ <xsl:if test="$namespace = 'itu'">
4568
+ <xsl:if test="ancestor::*[local-name()='preface']">
4569
+ <xsl:attribute name="preface">true</xsl:attribute>
4570
+ </xsl:if>
4571
+ </xsl:if>
4572
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4470
4573
  <xsl:attribute name="id">
4471
4574
  <xsl:value-of select="@reference"/>
4472
4575
  <xsl:text>_</xsl:text>
4473
4576
  <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4474
4577
  </xsl:attribute>
4475
-
4476
- <xsl:apply-templates/>
4578
+ </xsl:if>
4579
+ <xsl:apply-templates />
4477
4580
  </fn>
4478
- </xsl:template>
4581
+ </xsl:template> -->
4479
4582
 
4480
4583
  <!-- footnotes for table's name rendering -->
4481
4584
  <xsl:template name="table_name_fn_display">
@@ -4494,123 +4597,171 @@
4494
4597
  <!-- ============================ -->
4495
4598
  <!-- figure's footnotes rendering -->
4496
4599
  <!-- ============================ -->
4497
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
4498
4600
 
4499
- <!-- current figure id -->
4500
- <xsl:variable name="figure_id_">
4501
- <xsl:value-of select="@id"/>
4502
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
4503
- </xsl:variable>
4504
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
4601
+ <!-- figure/fmt-footnote-container -->
4602
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
4603
+
4604
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
4605
+ <xsl:template name="figure_fn_display">
4505
4606
 
4506
- <!-- all footnotes relates to the current figure -->
4507
4607
  <xsl:variable name="references">
4508
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
4509
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4510
- <xsl:apply-templates/>
4511
- </fn>
4608
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4609
+ <xsl:variable name="curr_id" select="@id"/>
4610
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
4611
+ <curr><xsl:copy-of select="."/></curr>
4612
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
4613
+ <xsl:choose>
4614
+ <!-- skip figure/name/fn -->
4615
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
4616
+ <xsl:otherwise>
4617
+ <xsl:element name="figure" namespace="{$namespace_full}">
4618
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
4619
+ <xsl:copy-of select="."/>
4620
+ </xsl:element>
4621
+ </xsl:element>
4622
+ </xsl:otherwise>
4623
+ </xsl:choose>
4512
4624
  </xsl:for-each>
4513
4625
  </xsl:variable>
4626
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
4514
4627
 
4515
- <xsl:if test="xalan:nodeset($references)//fn">
4628
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
4516
4629
 
4517
4630
  <xsl:variable name="key_iso">
4518
4631
 
4519
4632
  </xsl:variable>
4520
4633
 
4521
4634
  <fo:block>
4635
+ <!-- current hierarchy is 'figure' element -->
4636
+ <xsl:variable name="following_dl_colwidths">
4637
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4638
+ <xsl:variable name="simple-table">
4639
+ <!-- <xsl:variable name="doc_ns">
4640
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4641
+ </xsl:variable>
4642
+ <xsl:variable name="ns">
4643
+ <xsl:choose>
4644
+ <xsl:when test="normalize-space($doc_ns) != ''">
4645
+ <xsl:value-of select="normalize-space($doc_ns)"/>
4646
+ </xsl:when>
4647
+ <xsl:otherwise>
4648
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
4649
+ </xsl:otherwise>
4650
+ </xsl:choose>
4651
+ </xsl:variable> -->
4522
4652
 
4523
- <!-- current hierarchy is 'figure' element -->
4524
- <xsl:variable name="following_dl_colwidths">
4525
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4526
- <xsl:variable name="simple-table">
4527
- <!-- <xsl:variable name="doc_ns">
4528
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4529
- </xsl:variable>
4530
- <xsl:variable name="ns">
4531
- <xsl:choose>
4532
- <xsl:when test="normalize-space($doc_ns) != ''">
4533
- <xsl:value-of select="normalize-space($doc_ns)"/>
4534
- </xsl:when>
4535
- <xsl:otherwise>
4536
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4537
- </xsl:otherwise>
4538
- </xsl:choose>
4539
- </xsl:variable> -->
4540
-
4541
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4542
- <tbody>
4543
- <xsl:apply-templates mode="dl"/>
4544
- </tbody>
4545
- </xsl:for-each>
4546
- </xsl:variable>
4547
-
4548
- <xsl:call-template name="calculate-column-widths">
4549
- <xsl:with-param name="cols-count" select="2"/>
4550
- <xsl:with-param name="table" select="$simple-table"/>
4551
- </xsl:call-template>
4552
-
4553
- </xsl:if>
4554
- </xsl:variable>
4555
-
4556
- <xsl:variable name="maxlength_dt">
4557
4653
  <xsl:for-each select="*[local-name() = 'dl'][1]">
4558
- <xsl:call-template name="getMaxLength_dt"/>
4654
+ <tbody>
4655
+ <xsl:apply-templates mode="dl"/>
4656
+ </tbody>
4559
4657
  </xsl:for-each>
4560
4658
  </xsl:variable>
4561
4659
 
4562
- <fo:table width="95%" table-layout="fixed">
4563
- <xsl:if test="normalize-space($key_iso) = 'true'">
4564
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4660
+ <xsl:call-template name="calculate-column-widths">
4661
+ <xsl:with-param name="cols-count" select="2"/>
4662
+ <xsl:with-param name="table" select="$simple-table"/>
4663
+ </xsl:call-template>
4664
+
4665
+ </xsl:if>
4666
+ </xsl:variable>
4565
4667
 
4566
- </xsl:if>
4567
- <xsl:choose>
4568
- <!-- if there 'dl', then set same columns width -->
4569
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4570
- <xsl:call-template name="setColumnWidth_dl">
4571
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4572
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4573
- </xsl:call-template>
4574
- </xsl:when>
4575
- <xsl:otherwise>
4576
- <fo:table-column column-width="5%"/>
4577
- <fo:table-column column-width="95%"/>
4578
- </xsl:otherwise>
4579
- </xsl:choose>
4580
- <fo:table-body>
4581
- <xsl:for-each select="xalan:nodeset($references)//fn">
4582
- <xsl:variable name="reference" select="@reference"/>
4583
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4584
- <fo:table-row>
4585
- <fo:table-cell>
4586
- <fo:block>
4587
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4588
- <xsl:value-of select="@reference"/>
4668
+ <xsl:variable name="maxlength_dt">
4669
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4670
+ <xsl:call-template name="getMaxLength_dt"/>
4671
+ </xsl:for-each>
4672
+ </xsl:variable>
4673
+
4674
+ <fo:table width="95%" table-layout="fixed">
4675
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4676
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4677
+
4678
+ </xsl:if>
4679
+ <xsl:choose>
4680
+ <!-- if there 'dl', then set same columns width -->
4681
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4682
+ <xsl:call-template name="setColumnWidth_dl">
4683
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4684
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4685
+ </xsl:call-template>
4686
+ </xsl:when>
4687
+ <xsl:otherwise>
4688
+ <fo:table-column column-width="5%"/>
4689
+ <fo:table-column column-width="95%"/>
4690
+ </xsl:otherwise>
4691
+ </xsl:choose>
4692
+ <fo:table-body>
4693
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
4694
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
4695
+
4696
+ <xsl:variable name="reference" select="@reference"/>
4697
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
4698
+ <fo:table-row>
4699
+ <fo:table-cell>
4700
+ <fo:block>
4701
+
4702
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
4703
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
4704
+ <!-- <xsl:value-of select="@reference"/> -->
4705
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
4589
4706
  </fo:inline>
4590
- </fo:block>
4591
- </fo:table-cell>
4592
- <fo:table-cell>
4593
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4594
- <xsl:if test="normalize-space($key_iso) = 'true'">
4595
4707
 
4596
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
4708
+ </fo:block>
4709
+ </fo:table-cell>
4710
+ <fo:table-cell>
4711
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4712
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4597
4713
 
4598
- </xsl:if>
4599
- <xsl:copy-of select="./node()"/>
4600
- </fo:block>
4601
- </fo:table-cell>
4602
- </fo:table-row>
4603
- </xsl:if>
4604
- </xsl:for-each>
4605
- </fo:table-body>
4606
- </fo:table>
4714
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
4715
+
4716
+ </xsl:if>
4607
4717
 
4718
+ <!-- <xsl:copy-of select="./node()"/> -->
4719
+ <xsl:apply-templates/>
4720
+ </fo:block>
4721
+ </fo:table-cell>
4722
+ </fo:table-row>
4723
+ <!-- </xsl:if> -->
4724
+ </xsl:for-each>
4725
+ </fo:table-body>
4726
+ </fo:table>
4608
4727
  </fo:block>
4609
4728
  </xsl:if>
4610
- </xsl:template> <!-- fn_display_figure -->
4729
+ </xsl:template> <!-- figure_fn_display -->
4730
+
4731
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
4732
+ <xsl:param name="process">false</xsl:param>
4733
+ <xsl:if test="$process = 'true'">
4734
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
4735
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
4736
+
4737
+ <!-- tab is padding-right -->
4738
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
4739
+ <xsl:with-param name="process">true</xsl:with-param>
4740
+ </xsl:apply-templates>
4741
+
4742
+ <xsl:apply-templates/>
4743
+
4744
+ </fo:inline>
4745
+ </xsl:if>
4746
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
4747
+
4748
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
4749
+ <xsl:param name="process">false</xsl:param>
4750
+ <xsl:if test="$process = 'true'">
4751
+
4752
+ </xsl:if>
4753
+ </xsl:template>
4754
+
4755
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
4756
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
4757
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
4758
+ <xsl:apply-templates/>
4759
+ </fo:inline>
4760
+ </xsl:template>
4611
4761
 
4612
4762
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
4613
4763
  <!-- figure's footnote label -->
4764
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
4614
4765
  <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">
4615
4766
  <xsl:variable name="key_iso">
4616
4767
 
@@ -4619,7 +4770,7 @@
4619
4770
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4620
4771
 
4621
4772
  </xsl:if>
4622
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
4773
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
4623
4774
  <!-- <xsl:value-of select="@reference"/> -->
4624
4775
  <xsl:apply-templates/>
4625
4776
  </fo:inline>
@@ -4629,43 +4780,65 @@
4629
4780
  <!-- END: figure's footnotes rendering -->
4630
4781
  <!-- ============================ -->
4631
4782
 
4632
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
4783
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
4784
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
4633
4785
  <xsl:template match="*[local-name()='fn']">
4634
4786
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
4635
4787
 
4636
4788
  <xsl:call-template name="refine_fn-reference-style"/>
4637
4789
 
4638
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4639
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4640
- <xsl:attribute name="internal-destination">
4790
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4791
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4792
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4793
+ <!-- <xsl:attribute name="internal-destination">
4641
4794
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4642
4795
  </xsl:attribute>
4643
4796
  </xsl:if>
4644
-
4797
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4645
4798
  <xsl:attribute name="internal-destination">
4646
4799
  <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4647
4800
  <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4648
4801
  </xsl:attribute>
4802
+ </xsl:if> -->
4803
+ <!-- <xsl:if test="$namespace = 'plateau'">
4804
+ <xsl:text>※</xsl:text>
4805
+ </xsl:if> -->
4806
+ <!-- <xsl:value-of select="@reference"/> -->
4649
4807
 
4650
- <xsl:value-of select="@reference"/>
4808
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4651
4809
 
4810
+ <!-- <xsl:if test="$namespace = 'bsi'">
4811
+ <xsl:text>)</xsl:text>
4812
+ </xsl:if> -->
4652
4813
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4653
4814
  <!-- <xsl:if test="$namespace = 'jis'">
4654
4815
  <fo:inline font-weight="normal">)</fo:inline>
4655
4816
  </xsl:if> -->
4656
4817
  </fo:basic-link>
4657
4818
  </fo:inline>
4658
- </xsl:template>
4819
+ </xsl:template> <!-- fn -->
4659
4820
 
4821
+ <!-- fn/text() -->
4660
4822
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4661
4823
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
4662
4824
  </xsl:template>
4663
4825
 
4664
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
4826
+ <!-- fn//p fmt-fn-body//p -->
4827
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
4665
4828
  <fo:inline role="P">
4666
4829
  <xsl:apply-templates/>
4667
4830
  </fo:inline>
4668
4831
  </xsl:template>
4832
+
4833
+ <xsl:template name="insertFootnoteSeparatorCommon">
4834
+ <xsl:param name="leader_length">30%</xsl:param>
4835
+ <fo:static-content flow-name="xsl-footnote-separator">
4836
+ <fo:block>
4837
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
4838
+ </fo:block>
4839
+ </fo:static-content>
4840
+ </xsl:template>
4841
+
4669
4842
  <!-- ===================== -->
4670
4843
  <!-- END Footnotes processing -->
4671
4844
  <!-- ===================== -->
@@ -4942,11 +5115,11 @@
4942
5115
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4943
5116
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4944
5117
 
4945
- <xsl:call-template name="setColumnWidth_dl">
4946
- <xsl:with-param name="colwidths" select="$colwidths"/>
4947
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4948
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
4949
- </xsl:call-template>
5118
+ <xsl:call-template name="setColumnWidth_dl">
5119
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5120
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5121
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
5122
+ </xsl:call-template>
4950
5123
 
4951
5124
  <fo:table-body>
4952
5125
 
@@ -4980,6 +5153,14 @@
4980
5153
 
4981
5154
  </xsl:template> <!-- END: dl -->
4982
5155
 
5156
+ <xsl:template match="@*|node()" mode="dt_clean">
5157
+ <xsl:copy>
5158
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
5159
+ </xsl:copy>
5160
+ </xsl:template>
5161
+
5162
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
5163
+
4983
5164
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
4984
5165
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
4985
5166
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -5009,10 +5190,12 @@
5009
5190
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5010
5191
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5011
5192
 
5193
+ <!-- dl/name -->
5012
5194
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5013
5195
  <xsl:param name="process">false</xsl:param>
5014
5196
  <xsl:if test="$process = 'true'">
5015
5197
  <fo:block xsl:use-attribute-sets="dl-name-style">
5198
+
5016
5199
  <xsl:apply-templates/>
5017
5200
  </fo:block>
5018
5201
  </xsl:if>
@@ -5026,6 +5209,10 @@
5026
5209
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
5027
5210
 
5028
5211
  <xsl:choose>
5212
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
5213
+ <fo:table-column column-width="10%"/>
5214
+ <fo:table-column column-width="90%"/>
5215
+ </xsl:when> -->
5029
5216
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
5030
5217
  <xsl:call-template name="insertTableColumnWidth">
5031
5218
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -5824,7 +6011,7 @@
5824
6011
  <xsl:choose>
5825
6012
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
5826
6013
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
5827
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
6014
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
5828
6015
  </xsl:when>
5829
6016
  <xsl:otherwise>
5830
6017
  <xsl:apply-templates/>
@@ -5832,7 +6019,7 @@
5832
6019
  </xsl:choose>
5833
6020
  </xsl:template>
5834
6021
  <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">
5835
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
6022
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
5836
6023
  </xsl:template>
5837
6024
 
5838
6025
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -6872,24 +7059,26 @@
6872
7059
  <xsl:apply-templates select="." mode="mathml"/>
6873
7060
  </xsl:variable>
6874
7061
 
6875
- <fo:instream-foreign-object fox:alt-text="Math">
7062
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
6876
7063
 
6877
7064
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
6878
7065
 
6879
- <!-- put MathML in Actual Text -->
6880
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
6881
- <xsl:attribute name="fox:actual-text">
6882
- <xsl:value-of select="$mathml_content"/>
6883
- </xsl:attribute>
6884
-
6885
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
6886
- <xsl:if test="normalize-space($asciimath_text_) != ''">
6887
- <!-- put Mathin Alternate Text -->
6888
- <xsl:attribute name="fox:alt-text">
6889
- <xsl:value-of select="$asciimath_text_"/>
7066
+ <xsl:if test="$isGenerateTableIF = 'false'">
7067
+ <!-- put MathML in Actual Text -->
7068
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
7069
+ <xsl:attribute name="fox:actual-text">
7070
+ <xsl:value-of select="$mathml_content"/>
6890
7071
  </xsl:attribute>
7072
+
7073
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
7074
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
7075
+ <!-- put Mathin Alternate Text -->
7076
+ <xsl:attribute name="fox:alt-text">
7077
+ <xsl:value-of select="$asciimath_text_"/>
7078
+ </xsl:attribute>
7079
+ </xsl:if>
7080
+ <!-- </xsl:if> -->
6891
7081
  </xsl:if>
6892
- <!-- </xsl:if> -->
6893
7082
 
6894
7083
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
6895
7084
 
@@ -7152,6 +7341,27 @@
7152
7341
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7153
7342
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7154
7343
  </xsl:when> -->
7344
+
7345
+ <!-- <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'))">
7346
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7347
+ <xsl:variable name="filename">
7348
+ <xsl:call-template name="substring-after-last">
7349
+ <xsl:with-param name="value" select="$target_"/>
7350
+ <xsl:with-param name="delimiter" select="'/'"/>
7351
+ </xsl:call-template>
7352
+ </xsl:variable>
7353
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
7354
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
7355
+ <xsl:choose>
7356
+ <xsl:when test="$file_exists = 'true'">
7357
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
7358
+ </xsl:when>
7359
+ <xsl:otherwise>
7360
+ <xsl:value-of select="normalize-space(@target)"/>
7361
+ </xsl:otherwise>
7362
+ </xsl:choose>
7363
+ </xsl:when> -->
7364
+
7155
7365
  <xsl:otherwise>
7156
7366
  <xsl:value-of select="normalize-space(@target)"/>
7157
7367
  </xsl:otherwise>
@@ -7456,7 +7666,7 @@
7456
7666
 
7457
7667
  <xsl:template name="refine_note_block_style">
7458
7668
 
7459
- </xsl:template>
7669
+ </xsl:template> <!-- refine_note_block_style -->
7460
7670
 
7461
7671
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
7462
7672
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -7648,10 +7858,21 @@
7648
7858
  </xsl:template>
7649
7859
 
7650
7860
  <xsl:template name="showFigureKey">
7651
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
7652
- <xsl:call-template name="note"/>
7861
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
7862
+ <xsl:choose>
7863
+ <xsl:when test="local-name() = 'note'">
7864
+ <xsl:call-template name="note"/>
7865
+ </xsl:when>
7866
+ <xsl:when test="local-name() = 'example'">
7867
+ <xsl:call-template name="example"/>
7868
+ </xsl:when>
7869
+ <xsl:otherwise>
7870
+ <xsl:apply-templates select="."/>
7871
+ </xsl:otherwise>
7872
+ </xsl:choose>
7653
7873
  </xsl:for-each>
7654
- <xsl:call-template name="fn_display_figure"/>
7874
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
7875
+ <xsl:call-template name="figure_fn_display"/>
7655
7876
  </xsl:template>
7656
7877
 
7657
7878
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -8545,10 +8766,10 @@
8545
8766
  <xsl:when test="@type = 'section-title'">
8546
8767
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
8547
8768
  <xsl:text>: </xsl:text>
8548
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
8769
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
8549
8770
  </xsl:when>
8550
8771
  <xsl:otherwise>
8551
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
8772
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
8552
8773
  </xsl:otherwise>
8553
8774
  </xsl:choose>
8554
8775
  </xsl:when>
@@ -8613,6 +8834,8 @@
8613
8834
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
8614
8835
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
8615
8836
 
8837
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
8838
+
8616
8839
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
8617
8840
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
8618
8841
  <xsl:apply-templates mode="bookmarks"/>
@@ -8634,6 +8857,8 @@
8634
8857
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
8635
8858
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
8636
8859
 
8860
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
8861
+
8637
8862
  <!-- Bookmarks -->
8638
8863
  <xsl:template name="addBookmarks">
8639
8864
  <xsl:param name="contents"/>
@@ -8845,9 +9070,15 @@
8845
9070
  </xsl:if>
8846
9071
  </xsl:template>
8847
9072
 
9073
+ <!-- figure/fn -->
8848
9074
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
8849
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
9075
+ <!-- figure/note -->
9076
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
9077
+ <!-- figure/example -->
9078
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
8850
9079
 
9080
+ <!-- figure/note[@type = 'units'] -->
9081
+ <!-- image/note[@type = 'units'] -->
8851
9082
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
8852
9083
  <fo:block text-align="right" keep-with-next="always">
8853
9084
  <xsl:apply-templates/>
@@ -8968,6 +9199,7 @@
8968
9199
  </xsl:choose>
8969
9200
  </xsl:template>
8970
9201
 
9202
+ <!-- fn -->
8971
9203
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
8972
9204
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
8973
9205
 
@@ -9890,7 +10122,7 @@
9890
10122
  text line 1
9891
10123
  text line 2
9892
10124
  -->
9893
- <xsl:template match="*[local-name() = 'example']">
10125
+ <xsl:template match="*[local-name() = 'example']" name="example">
9894
10126
 
9895
10127
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
9896
10128
 
@@ -9996,6 +10228,7 @@
9996
10228
 
9997
10229
  </xsl:template>
9998
10230
 
10231
+ <!-- example/name -->
9999
10232
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
10000
10233
  <xsl:param name="fo_element">block</xsl:param>
10001
10234
 
@@ -10021,7 +10254,8 @@
10021
10254
 
10022
10255
  </xsl:template>
10023
10256
 
10024
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
10257
+ <!-- table/example/name, table/tfoot//example/name -->
10258
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
10025
10259
  <fo:inline xsl:use-attribute-sets="example-name-style">
10026
10260
 
10027
10261
  <xsl:apply-templates/>
@@ -10386,6 +10620,8 @@
10386
10620
 
10387
10621
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
10388
10622
 
10623
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
10624
+
10389
10625
  </xsl:template>
10390
10626
 
10391
10627
  <xsl:template name="insertNonBreakSpaces">
@@ -10502,21 +10738,32 @@
10502
10738
  <!-- ========== -->
10503
10739
 
10504
10740
  <xsl:variable name="reviews_">
10505
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
10741
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
10506
10742
  <xsl:copy>
10507
10743
  <xsl:copy-of select="@from"/>
10508
10744
  <xsl:copy-of select="@id"/>
10509
10745
  </xsl:copy>
10510
10746
  </xsl:for-each>
10747
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
10748
+ <xsl:copy>
10749
+ <xsl:copy-of select="@source"/>
10750
+ <xsl:copy-of select="@id"/>
10751
+ </xsl:copy>
10752
+ </xsl:for-each>
10511
10753
  </xsl:variable>
10512
10754
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
10513
10755
 
10514
10756
  <xsl:template name="addReviewHelper">
10515
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
10516
- <xsl:variable name="curr_id" select="@id"/>
10517
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
10518
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
10519
- <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>
10757
+ <xsl:if test="$isGenerateTableIF = 'false'">
10758
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
10759
+ <xsl:variable name="curr_id" select="@id"/>
10760
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
10761
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
10762
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
10763
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
10764
+ <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>
10765
+ </xsl:if>
10766
+ </xsl:for-each>
10520
10767
  </xsl:if>
10521
10768
  <!-- <fo:block>
10522
10769
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -10658,14 +10905,61 @@
10658
10905
 
10659
10906
  </xsl:template>
10660
10907
 
10661
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10908
+ <!-- document text (not figures, or tables) footnotes -->
10909
+ <xsl:variable name="reviews_container_">
10910
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
10911
+ <xsl:variable name="update_xml_step1">
10912
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
10913
+ </xsl:variable>
10914
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
10915
+ </xsl:for-each>
10916
+ </xsl:variable>
10917
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
10918
+
10919
+ <xsl:template match="*[local-name() = 'review-container']"/>
10920
+
10921
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
10922
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10923
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
10924
+ <xsl:if test="$isGenerateTableIF = 'false'">
10925
+ <xsl:choose>
10926
+ <!-- if there isn't the attribute '@from', then -->
10927
+ <xsl:when test="$id_from = ''">
10928
+ <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>
10929
+ </xsl:when>
10930
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
10931
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
10932
+ <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>
10933
+ </xsl:when>
10934
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10935
+ <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>
10936
+ </xsl:when>
10937
+ </xsl:choose>
10938
+ </xsl:if>
10939
+ </xsl:template>
10940
+
10941
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
10942
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10662
10943
  <!-- comment 2019-11-29 -->
10663
10944
  <!-- <fo:block font-weight="bold">Review:</fo:block>
10664
10945
  <xsl:apply-templates /> -->
10665
10946
 
10666
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
10947
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
10667
10948
 
10668
- <xsl:if test="1 = 1">
10949
+ <xsl:variable name="source" select="normalize-space(@source)"/>
10950
+
10951
+ <xsl:if test="$isGenerateTableIF = 'false'">
10952
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
10953
+
10954
+ <!-- <xsl:if test="@source = @end"> -->
10955
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
10956
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
10957
+ <!-- <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> -->
10958
+ <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>
10959
+ <!-- </xsl:if> -->
10960
+ </xsl:if>
10961
+
10962
+ <xsl:if test="1 = 2">
10669
10963
  <xsl:choose>
10670
10964
  <!-- if there isn't the attribute '@from', then -->
10671
10965
  <xsl:when test="$id_from = ''">
@@ -10673,10 +10967,10 @@
10673
10967
  </xsl:when>
10674
10968
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
10675
10969
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
10676
- <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>
10970
+ <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>
10677
10971
  </xsl:when>
10678
10972
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10679
- <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>
10973
+ <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>
10680
10974
  </xsl:when>
10681
10975
  </xsl:choose>
10682
10976
  </xsl:if>
@@ -10725,16 +11019,21 @@
10725
11019
  <xsl:variable name="list_level">
10726
11020
  <xsl:choose>
10727
11021
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
10728
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
11022
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
11023
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
11024
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
10729
11025
  </xsl:choose>
10730
11026
  </xsl:variable>
10731
11027
  <xsl:choose>
10732
11028
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
10733
11029
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
10734
11030
  </xsl:when>
10735
- <xsl:when test="$list_level mod 3 = 0">
11031
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
10736
11032
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
10737
11033
  </xsl:when>
11034
+ <xsl:when test="$list_level mod 3 = 0">
11035
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
11036
+ </xsl:when>
10738
11037
  <xsl:when test="$list_level mod 2 = 0">
10739
11038
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
10740
11039
  </xsl:when>
@@ -11277,10 +11576,22 @@
11277
11576
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
11278
11577
 
11279
11578
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
11280
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11281
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
11282
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11283
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11579
+ <xsl:variable name="bookmark_id" select="@id"/>
11580
+ <xsl:choose>
11581
+ <!-- Example:
11582
+ <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"/>
11583
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
11584
+ <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"/> -->
11585
+ <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]">
11586
+ <!-- skip here, see the template 'fmt-review-start' -->
11587
+ </xsl:when>
11588
+ <xsl:otherwise>
11589
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11590
+ <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>
11591
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11592
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11593
+ </xsl:otherwise>
11594
+ </xsl:choose>
11284
11595
  </xsl:template>
11285
11596
  <!-- =================== -->
11286
11597
  <!-- End of Index processing -->
@@ -11662,8 +11973,33 @@
11662
11973
 
11663
11974
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
11664
11975
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11976
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11977
+ <!-- <test><xsl:copy-of select="."/></test> -->
11978
+
11665
11979
  <xsl:variable name="target" select="@target"/>
11980
+
11666
11981
  <xsl:for-each select="*[local-name() = 'tab']">
11982
+
11983
+ <xsl:if test="position() = 1">
11984
+ <!-- first column (data before first `tab`) -->
11985
+ <fo:table-cell>
11986
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
11987
+ <xsl:call-template name="insert_basic_link">
11988
+ <xsl:with-param name="element">
11989
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11990
+ <xsl:for-each select="preceding-sibling::node()">
11991
+ <xsl:choose>
11992
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11993
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11994
+ </xsl:choose>
11995
+ </xsl:for-each>
11996
+ </fo:basic-link>
11997
+ </xsl:with-param>
11998
+ </xsl:call-template>
11999
+ </fo:block>
12000
+ </fo:table-cell>
12001
+ </xsl:if>
12002
+
11667
12003
  <xsl:variable name="current_id" select="generate-id()"/>
11668
12004
  <fo:table-cell>
11669
12005
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -11714,11 +12050,25 @@
11714
12050
 
11715
12051
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
11716
12052
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12053
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11717
12054
  <xsl:for-each select="*[local-name() = 'tab']">
12055
+ <xsl:if test="position() = 1">
12056
+ <td>
12057
+ <xsl:for-each select="preceding-sibling::node()">
12058
+ <xsl:choose>
12059
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12060
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
12061
+ </xsl:choose>
12062
+ </xsl:for-each>
12063
+ </td>
12064
+ </xsl:if>
11718
12065
  <xsl:variable name="current_id" select="generate-id()"/>
11719
12066
  <td>
11720
12067
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11721
- <xsl:copy-of select="."/>
12068
+ <xsl:choose>
12069
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12070
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
12071
+ </xsl:choose>
11722
12072
  </xsl:for-each>
11723
12073
  </td>
11724
12074
  </xsl:for-each>
@@ -12595,6 +12945,9 @@
12595
12945
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
12596
12946
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
12597
12947
 
12948
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
12949
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
12950
+
12598
12951
  <!-- END: update new Presentation XML -->
12599
12952
 
12600
12953
  <!-- =========================================================================== -->
@@ -13118,6 +13471,7 @@
13118
13471
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
13119
13472
  </fn>
13120
13473
  -->
13474
+ <!-- fn in text -->
13121
13475
  <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">
13122
13476
  <xsl:variable name="p_fn_">
13123
13477
  <xsl:call-template name="get_fn_list"/>