metanorma-ogc 2.7.1 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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']">
@@ -4186,6 +4204,17 @@
4186
4204
  <xsl:attribute name="text-align">left</xsl:attribute>
4187
4205
  </xsl:if>
4188
4206
 
4207
+ <xsl:if test="$isGenerateTableIF = 'false'">
4208
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
4209
+ <xsl:attribute name="text-align">right</xsl:attribute>
4210
+ <xsl:attribute name="border">none</xsl:attribute>
4211
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4212
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
4213
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
4214
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
4215
+ </xsl:if>
4216
+ </xsl:if>
4217
+
4189
4218
  <fo:block role="SKIP">
4190
4219
 
4191
4220
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4204,7 +4233,8 @@
4204
4233
  </fo:table-cell>
4205
4234
  </xsl:template> <!-- td -->
4206
4235
 
4207
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
4236
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
4237
+ <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
4238
 
4209
4239
  <fo:block xsl:use-attribute-sets="table-note-style">
4210
4240
  <xsl:copy-of select="@id"/>
@@ -4225,65 +4255,54 @@
4225
4255
 
4226
4256
  </xsl:template> <!-- table/note -->
4227
4257
 
4228
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
4258
+ <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
4259
  <xsl:apply-templates/>
4230
4260
  </xsl:template>
4231
4261
 
4232
4262
  <!-- ===================== -->
4233
4263
  <!-- Footnotes processing -->
4234
4264
  <!-- ===================== -->
4265
+
4266
+ <!-- document text (not figures, or tables) footnotes -->
4267
+ <xsl:variable name="footnotes_">
4268
+ <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 -->
4269
+ <!-- <xsl:copy-of select="."/> -->
4270
+ <xsl:variable name="update_xml_step1">
4271
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
4272
+ </xsl:variable>
4273
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
4274
+ </xsl:for-each>
4275
+ </xsl:variable>
4276
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
4277
+
4235
4278
  <!--
4236
4279
  <fn reference="1">
4237
4280
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
4238
4281
  </fn>
4239
4282
  -->
4240
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
4283
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
4284
+ <!-- fn in text -->
4241
4285
  <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
4286
 
4243
- <!-- list of footnotes to calculate actual footnotes number -->
4287
+ <!-- list of unique footnotes -->
4244
4288
  <xsl:variable name="p_fn_">
4245
4289
  <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
4290
  </xsl:variable>
4255
4291
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4256
4292
 
4257
4293
  <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_)"/>
4294
+
4264
4295
  <!-- 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>
4296
+ <xsl:variable name="current_fn_number" select="@reference"/>
4297
+
4273
4298
  <xsl:variable name="current_fn_number_text">
4274
4299
 
4275
4300
  <xsl:value-of select="$current_fn_number"/>
4276
4301
 
4277
4302
  </xsl:variable>
4278
4303
 
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>
4304
+ <xsl:variable name="ref_id" select="@target"/>
4305
+
4287
4306
  <xsl:variable name="footnote_inline">
4288
4307
  <fo:inline role="Reference">
4289
4308
 
@@ -4328,7 +4347,9 @@
4328
4347
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
4329
4348
  <xsl:copy-of select="$footnote_inline"/>
4330
4349
  </xsl:when>
4350
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
4331
4351
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
4352
+
4332
4353
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
4333
4354
  <xsl:copy-of select="$footnote_inline"/>
4334
4355
  <fo:footnote-body role="Note">
@@ -4345,7 +4366,10 @@
4345
4366
  <xsl:value-of select="$current_fn_number_text"/>
4346
4367
 
4347
4368
  </fo:inline>
4348
- <xsl:apply-templates/>
4369
+ <!-- <xsl:apply-templates /> -->
4370
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
4371
+ <here><xsl:copy-of select="$footnotes"/></here> -->
4372
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
4349
4373
  </xsl:variable>
4350
4374
 
4351
4375
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -4399,83 +4423,136 @@
4399
4423
  </xsl:choose>
4400
4424
  </xsl:template>
4401
4425
 
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
4426
  <!-- ============================ -->
4425
4427
  <!-- table's footnotes rendering -->
4426
4428
  <!-- ============================ -->
4427
- <xsl:template name="table_fn_display">
4428
- <xsl:variable name="references">
4429
4429
 
4430
+ <!-- table/fmt-footnote-container -->
4431
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
4432
+
4433
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
4434
+ <xsl:for-each select=".">
4435
+ <xsl:call-template name="table_fn_display"/>
4436
+ </xsl:for-each>
4437
+ </xsl:template>
4438
+
4439
+ <xsl:template name="table_fn_display">
4440
+ <!-- <xsl:variable name="references">
4441
+ <xsl:if test="$namespace = 'bsi'">
4442
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
4443
+ <xsl:call-template name="create_fn" />
4444
+ </xsl:for-each>
4445
+ </xsl:if>
4430
4446
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
4431
- <xsl:call-template name="create_fn"/>
4447
+ <xsl:call-template name="create_fn" />
4432
4448
  </xsl:for-each>
4433
- </xsl:variable>
4434
-
4435
- <xsl:for-each select="xalan:nodeset($references)//fn">
4449
+ </xsl:variable> -->
4450
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
4436
4451
  <xsl:variable name="reference" select="@reference"/>
4437
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4452
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
4453
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4438
4454
 
4439
4455
  <fo:block xsl:use-attribute-sets="table-fn-style">
4456
+ <xsl:copy-of select="@id"/>
4440
4457
  <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
4458
 
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> -->
4459
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
4460
+ <xsl:with-param name="process">true</xsl:with-param>
4461
+ </xsl:apply-templates>
4450
4462
 
4451
- </fo:inline>
4452
4463
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4453
- <xsl:copy-of select="./node()"/>
4464
+ <!-- <xsl:copy-of select="./node()"/> -->
4465
+ <xsl:apply-templates/>
4454
4466
  </fo:inline>
4455
4467
 
4456
4468
  </fo:block>
4457
4469
 
4458
- </xsl:if>
4470
+ <!-- </xsl:if> -->
4459
4471
  </xsl:for-each>
4460
4472
  </xsl:template> <!-- table_fn_display -->
4461
4473
 
4474
+ <!-- fmt-fn-body/fmt-fn-label in text -->
4475
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
4476
+
4477
+ <!-- table//fmt-fn-body//fmt-fn-label -->
4478
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
4479
+ <xsl:param name="process">false</xsl:param>
4480
+ <xsl:if test="$process = 'true'">
4481
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
4482
+
4483
+ <!-- tab is padding-right -->
4484
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
4485
+ <xsl:with-param name="process">true</xsl:with-param>
4486
+ </xsl:apply-templates>
4487
+
4488
+ <!-- <xsl:if test="$namespace = 'bipm'">
4489
+ <fo:inline font-style="normal">(</fo:inline>
4490
+ </xsl:if> -->
4491
+
4492
+ <!-- <xsl:if test="$namespace = 'plateau'">
4493
+ <xsl:text>※</xsl:text>
4494
+ </xsl:if> -->
4495
+
4496
+ <!-- <xsl:value-of select="@reference"/> -->
4497
+ <!-- <xsl:value-of select="normalize-space()"/> -->
4498
+ <xsl:apply-templates/>
4499
+
4500
+ <!-- <xsl:if test="$namespace = 'bipm'">
4501
+ <fo:inline font-style="normal">)</fo:inline>
4502
+ </xsl:if> -->
4503
+
4504
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4505
+ <!-- <xsl:if test="$namespace = 'itu'">
4506
+ <xsl:text>)</xsl:text>
4507
+ </xsl:if> -->
4508
+
4509
+ <!-- <xsl:if test="$namespace = 'plateau'">
4510
+ <xsl:text>:</xsl:text>
4511
+ </xsl:if> -->
4512
+
4513
+ </fo:inline>
4514
+ </xsl:if>
4515
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
4516
+
4517
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
4518
+ <xsl:param name="process">false</xsl:param>
4519
+ <xsl:if test="$process = 'true'">
4520
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
4521
+
4522
+ </xsl:if>
4523
+ </xsl:template>
4524
+
4525
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
4526
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
4527
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
4528
+ <xsl:apply-templates/>
4529
+ </fo:inline>
4530
+ </xsl:template>
4531
+
4532
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
4533
+ <!--
4462
4534
  <xsl:template name="create_fn">
4463
4535
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4464
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4536
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
4465
4537
  <xsl:attribute name="id">
4466
4538
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4467
4539
  </xsl:attribute>
4468
4540
  </xsl:if>
4469
-
4541
+ <xsl:if test="$namespace = 'itu'">
4542
+ <xsl:if test="ancestor::*[local-name()='preface']">
4543
+ <xsl:attribute name="preface">true</xsl:attribute>
4544
+ </xsl:if>
4545
+ </xsl:if>
4546
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4470
4547
  <xsl:attribute name="id">
4471
4548
  <xsl:value-of select="@reference"/>
4472
4549
  <xsl:text>_</xsl:text>
4473
4550
  <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4474
4551
  </xsl:attribute>
4475
-
4476
- <xsl:apply-templates/>
4552
+ </xsl:if>
4553
+ <xsl:apply-templates />
4477
4554
  </fn>
4478
- </xsl:template>
4555
+ </xsl:template> -->
4479
4556
 
4480
4557
  <!-- footnotes for table's name rendering -->
4481
4558
  <xsl:template name="table_name_fn_display">
@@ -4494,123 +4571,171 @@
4494
4571
  <!-- ============================ -->
4495
4572
  <!-- figure's footnotes rendering -->
4496
4573
  <!-- ============================ -->
4497
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
4498
4574
 
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_)"/>
4575
+ <!-- figure/fmt-footnote-container -->
4576
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
4577
+
4578
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
4579
+ <xsl:template name="figure_fn_display">
4505
4580
 
4506
- <!-- all footnotes relates to the current figure -->
4507
4581
  <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>
4582
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4583
+ <xsl:variable name="curr_id" select="@id"/>
4584
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
4585
+ <curr><xsl:copy-of select="."/></curr>
4586
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
4587
+ <xsl:choose>
4588
+ <!-- skip figure/name/fn -->
4589
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
4590
+ <xsl:otherwise>
4591
+ <xsl:element name="figure" namespace="{$namespace_full}">
4592
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
4593
+ <xsl:copy-of select="."/>
4594
+ </xsl:element>
4595
+ </xsl:element>
4596
+ </xsl:otherwise>
4597
+ </xsl:choose>
4512
4598
  </xsl:for-each>
4513
4599
  </xsl:variable>
4600
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
4514
4601
 
4515
- <xsl:if test="xalan:nodeset($references)//fn">
4602
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
4516
4603
 
4517
4604
  <xsl:variable name="key_iso">
4518
4605
 
4519
4606
  </xsl:variable>
4520
4607
 
4521
4608
  <fo:block>
4609
+ <!-- current hierarchy is 'figure' element -->
4610
+ <xsl:variable name="following_dl_colwidths">
4611
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4612
+ <xsl:variable name="simple-table">
4613
+ <!-- <xsl:variable name="doc_ns">
4614
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4615
+ </xsl:variable>
4616
+ <xsl:variable name="ns">
4617
+ <xsl:choose>
4618
+ <xsl:when test="normalize-space($doc_ns) != ''">
4619
+ <xsl:value-of select="normalize-space($doc_ns)"/>
4620
+ </xsl:when>
4621
+ <xsl:otherwise>
4622
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
4623
+ </xsl:otherwise>
4624
+ </xsl:choose>
4625
+ </xsl:variable> -->
4522
4626
 
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
4627
  <xsl:for-each select="*[local-name() = 'dl'][1]">
4558
- <xsl:call-template name="getMaxLength_dt"/>
4628
+ <tbody>
4629
+ <xsl:apply-templates mode="dl"/>
4630
+ </tbody>
4559
4631
  </xsl:for-each>
4560
4632
  </xsl:variable>
4561
4633
 
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>
4634
+ <xsl:call-template name="calculate-column-widths">
4635
+ <xsl:with-param name="cols-count" select="2"/>
4636
+ <xsl:with-param name="table" select="$simple-table"/>
4637
+ </xsl:call-template>
4565
4638
 
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"/>
4639
+ </xsl:if>
4640
+ </xsl:variable>
4641
+
4642
+ <xsl:variable name="maxlength_dt">
4643
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4644
+ <xsl:call-template name="getMaxLength_dt"/>
4645
+ </xsl:for-each>
4646
+ </xsl:variable>
4647
+
4648
+ <fo:table width="95%" table-layout="fixed">
4649
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4650
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4651
+
4652
+ </xsl:if>
4653
+ <xsl:choose>
4654
+ <!-- if there 'dl', then set same columns width -->
4655
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4656
+ <xsl:call-template name="setColumnWidth_dl">
4657
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4658
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4659
+ </xsl:call-template>
4660
+ </xsl:when>
4661
+ <xsl:otherwise>
4662
+ <fo:table-column column-width="5%"/>
4663
+ <fo:table-column column-width="95%"/>
4664
+ </xsl:otherwise>
4665
+ </xsl:choose>
4666
+ <fo:table-body>
4667
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
4668
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
4669
+
4670
+ <xsl:variable name="reference" select="@reference"/>
4671
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
4672
+ <fo:table-row>
4673
+ <fo:table-cell>
4674
+ <fo:block>
4675
+
4676
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
4677
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
4678
+ <!-- <xsl:value-of select="@reference"/> -->
4679
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
4589
4680
  </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
4681
 
4596
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
4682
+ </fo:block>
4683
+ </fo:table-cell>
4684
+ <fo:table-cell>
4685
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4686
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4597
4687
 
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>
4688
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
4689
+
4690
+ </xsl:if>
4607
4691
 
4692
+ <!-- <xsl:copy-of select="./node()"/> -->
4693
+ <xsl:apply-templates/>
4694
+ </fo:block>
4695
+ </fo:table-cell>
4696
+ </fo:table-row>
4697
+ <!-- </xsl:if> -->
4698
+ </xsl:for-each>
4699
+ </fo:table-body>
4700
+ </fo:table>
4608
4701
  </fo:block>
4609
4702
  </xsl:if>
4610
- </xsl:template> <!-- fn_display_figure -->
4703
+ </xsl:template> <!-- figure_fn_display -->
4704
+
4705
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
4706
+ <xsl:param name="process">false</xsl:param>
4707
+ <xsl:if test="$process = 'true'">
4708
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
4709
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
4710
+
4711
+ <!-- tab is padding-right -->
4712
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
4713
+ <xsl:with-param name="process">true</xsl:with-param>
4714
+ </xsl:apply-templates>
4715
+
4716
+ <xsl:apply-templates/>
4717
+
4718
+ </fo:inline>
4719
+ </xsl:if>
4720
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
4721
+
4722
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
4723
+ <xsl:param name="process">false</xsl:param>
4724
+ <xsl:if test="$process = 'true'">
4725
+
4726
+ </xsl:if>
4727
+ </xsl:template>
4728
+
4729
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
4730
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
4731
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
4732
+ <xsl:apply-templates/>
4733
+ </fo:inline>
4734
+ </xsl:template>
4611
4735
 
4612
4736
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
4613
4737
  <!-- figure's footnote label -->
4738
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
4614
4739
  <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
4740
  <xsl:variable name="key_iso">
4616
4741
 
@@ -4619,7 +4744,7 @@
4619
4744
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4620
4745
 
4621
4746
  </xsl:if>
4622
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
4747
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
4623
4748
  <!-- <xsl:value-of select="@reference"/> -->
4624
4749
  <xsl:apply-templates/>
4625
4750
  </fo:inline>
@@ -4629,43 +4754,65 @@
4629
4754
  <!-- END: figure's footnotes rendering -->
4630
4755
  <!-- ============================ -->
4631
4756
 
4632
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
4757
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
4758
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
4633
4759
  <xsl:template match="*[local-name()='fn']">
4634
4760
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
4635
4761
 
4636
4762
  <xsl:call-template name="refine_fn-reference-style"/>
4637
4763
 
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">
4764
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4765
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4766
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4767
+ <!-- <xsl:attribute name="internal-destination">
4641
4768
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4642
4769
  </xsl:attribute>
4643
4770
  </xsl:if>
4644
-
4771
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4645
4772
  <xsl:attribute name="internal-destination">
4646
4773
  <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4647
4774
  <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4648
4775
  </xsl:attribute>
4776
+ </xsl:if> -->
4777
+ <!-- <xsl:if test="$namespace = 'plateau'">
4778
+ <xsl:text>※</xsl:text>
4779
+ </xsl:if> -->
4780
+ <!-- <xsl:value-of select="@reference"/> -->
4649
4781
 
4650
- <xsl:value-of select="@reference"/>
4782
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4651
4783
 
4784
+ <!-- <xsl:if test="$namespace = 'bsi'">
4785
+ <xsl:text>)</xsl:text>
4786
+ </xsl:if> -->
4652
4787
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4653
4788
  <!-- <xsl:if test="$namespace = 'jis'">
4654
4789
  <fo:inline font-weight="normal">)</fo:inline>
4655
4790
  </xsl:if> -->
4656
4791
  </fo:basic-link>
4657
4792
  </fo:inline>
4658
- </xsl:template>
4793
+ </xsl:template> <!-- fn -->
4659
4794
 
4795
+ <!-- fn/text() -->
4660
4796
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4661
4797
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
4662
4798
  </xsl:template>
4663
4799
 
4664
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
4800
+ <!-- fn//p fmt-fn-body//p -->
4801
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
4665
4802
  <fo:inline role="P">
4666
4803
  <xsl:apply-templates/>
4667
4804
  </fo:inline>
4668
4805
  </xsl:template>
4806
+
4807
+ <xsl:template name="insertFootnoteSeparatorCommon">
4808
+ <xsl:param name="leader_length">30%</xsl:param>
4809
+ <fo:static-content flow-name="xsl-footnote-separator">
4810
+ <fo:block>
4811
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
4812
+ </fo:block>
4813
+ </fo:static-content>
4814
+ </xsl:template>
4815
+
4669
4816
  <!-- ===================== -->
4670
4817
  <!-- END Footnotes processing -->
4671
4818
  <!-- ===================== -->
@@ -4942,11 +5089,11 @@
4942
5089
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
4943
5090
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4944
5091
 
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>
5092
+ <xsl:call-template name="setColumnWidth_dl">
5093
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5094
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5095
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
5096
+ </xsl:call-template>
4950
5097
 
4951
5098
  <fo:table-body>
4952
5099
 
@@ -4980,6 +5127,14 @@
4980
5127
 
4981
5128
  </xsl:template> <!-- END: dl -->
4982
5129
 
5130
+ <xsl:template match="@*|node()" mode="dt_clean">
5131
+ <xsl:copy>
5132
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
5133
+ </xsl:copy>
5134
+ </xsl:template>
5135
+
5136
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
5137
+
4983
5138
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
4984
5139
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
4985
5140
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -5009,10 +5164,12 @@
5009
5164
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5010
5165
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5011
5166
 
5167
+ <!-- dl/name -->
5012
5168
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5013
5169
  <xsl:param name="process">false</xsl:param>
5014
5170
  <xsl:if test="$process = 'true'">
5015
5171
  <fo:block xsl:use-attribute-sets="dl-name-style">
5172
+
5016
5173
  <xsl:apply-templates/>
5017
5174
  </fo:block>
5018
5175
  </xsl:if>
@@ -5026,6 +5183,10 @@
5026
5183
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
5027
5184
 
5028
5185
  <xsl:choose>
5186
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
5187
+ <fo:table-column column-width="10%"/>
5188
+ <fo:table-column column-width="90%"/>
5189
+ </xsl:when> -->
5029
5190
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
5030
5191
  <xsl:call-template name="insertTableColumnWidth">
5031
5192
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -7152,6 +7313,27 @@
7152
7313
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7153
7314
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7154
7315
  </xsl:when> -->
7316
+
7317
+ <!-- <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'))">
7318
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7319
+ <xsl:variable name="filename">
7320
+ <xsl:call-template name="substring-after-last">
7321
+ <xsl:with-param name="value" select="$target_"/>
7322
+ <xsl:with-param name="delimiter" select="'/'"/>
7323
+ </xsl:call-template>
7324
+ </xsl:variable>
7325
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
7326
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
7327
+ <xsl:choose>
7328
+ <xsl:when test="$file_exists = 'true'">
7329
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
7330
+ </xsl:when>
7331
+ <xsl:otherwise>
7332
+ <xsl:value-of select="normalize-space(@target)"/>
7333
+ </xsl:otherwise>
7334
+ </xsl:choose>
7335
+ </xsl:when> -->
7336
+
7155
7337
  <xsl:otherwise>
7156
7338
  <xsl:value-of select="normalize-space(@target)"/>
7157
7339
  </xsl:otherwise>
@@ -7456,7 +7638,7 @@
7456
7638
 
7457
7639
  <xsl:template name="refine_note_block_style">
7458
7640
 
7459
- </xsl:template>
7641
+ </xsl:template> <!-- refine_note_block_style -->
7460
7642
 
7461
7643
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
7462
7644
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -7648,10 +7830,21 @@
7648
7830
  </xsl:template>
7649
7831
 
7650
7832
  <xsl:template name="showFigureKey">
7651
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
7652
- <xsl:call-template name="note"/>
7833
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
7834
+ <xsl:choose>
7835
+ <xsl:when test="local-name() = 'note'">
7836
+ <xsl:call-template name="note"/>
7837
+ </xsl:when>
7838
+ <xsl:when test="local-name() = 'example'">
7839
+ <xsl:call-template name="example"/>
7840
+ </xsl:when>
7841
+ <xsl:otherwise>
7842
+ <xsl:apply-templates select="."/>
7843
+ </xsl:otherwise>
7844
+ </xsl:choose>
7653
7845
  </xsl:for-each>
7654
- <xsl:call-template name="fn_display_figure"/>
7846
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
7847
+ <xsl:call-template name="figure_fn_display"/>
7655
7848
  </xsl:template>
7656
7849
 
7657
7850
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -8545,10 +8738,10 @@
8545
8738
  <xsl:when test="@type = 'section-title'">
8546
8739
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
8547
8740
  <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')]"/>
8741
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
8549
8742
  </xsl:when>
8550
8743
  <xsl:otherwise>
8551
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
8744
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
8552
8745
  </xsl:otherwise>
8553
8746
  </xsl:choose>
8554
8747
  </xsl:when>
@@ -8845,9 +9038,15 @@
8845
9038
  </xsl:if>
8846
9039
  </xsl:template>
8847
9040
 
9041
+ <!-- figure/fn -->
8848
9042
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
8849
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
9043
+ <!-- figure/note -->
9044
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
9045
+ <!-- figure/example -->
9046
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
8850
9047
 
9048
+ <!-- figure/note[@type = 'units'] -->
9049
+ <!-- image/note[@type = 'units'] -->
8851
9050
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
8852
9051
  <fo:block text-align="right" keep-with-next="always">
8853
9052
  <xsl:apply-templates/>
@@ -8968,6 +9167,7 @@
8968
9167
  </xsl:choose>
8969
9168
  </xsl:template>
8970
9169
 
9170
+ <!-- fn -->
8971
9171
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
8972
9172
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
8973
9173
 
@@ -9890,7 +10090,7 @@
9890
10090
  text line 1
9891
10091
  text line 2
9892
10092
  -->
9893
- <xsl:template match="*[local-name() = 'example']">
10093
+ <xsl:template match="*[local-name() = 'example']" name="example">
9894
10094
 
9895
10095
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
9896
10096
 
@@ -9996,6 +10196,7 @@
9996
10196
 
9997
10197
  </xsl:template>
9998
10198
 
10199
+ <!-- example/name -->
9999
10200
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
10000
10201
  <xsl:param name="fo_element">block</xsl:param>
10001
10202
 
@@ -10021,7 +10222,8 @@
10021
10222
 
10022
10223
  </xsl:template>
10023
10224
 
10024
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
10225
+ <!-- table/example/name, table/tfoot//example/name -->
10226
+ <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
10227
  <fo:inline xsl:use-attribute-sets="example-name-style">
10026
10228
 
10027
10229
  <xsl:apply-templates/>
@@ -10386,6 +10588,8 @@
10386
10588
 
10387
10589
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'name']/*[local-name() = 'tab']" mode="tab">
10388
10590
 
10591
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
10592
+
10389
10593
  </xsl:template>
10390
10594
 
10391
10595
  <xsl:template name="insertNonBreakSpaces">
@@ -11662,8 +11866,33 @@
11662
11866
 
11663
11867
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
11664
11868
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11869
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11870
+ <!-- <test><xsl:copy-of select="."/></test> -->
11871
+
11665
11872
  <xsl:variable name="target" select="@target"/>
11873
+
11666
11874
  <xsl:for-each select="*[local-name() = 'tab']">
11875
+
11876
+ <xsl:if test="position() = 1">
11877
+ <!-- first column (data before first `tab`) -->
11878
+ <fo:table-cell>
11879
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
11880
+ <xsl:call-template name="insert_basic_link">
11881
+ <xsl:with-param name="element">
11882
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
11883
+ <xsl:for-each select="preceding-sibling::node()">
11884
+ <xsl:choose>
11885
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11886
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
11887
+ </xsl:choose>
11888
+ </xsl:for-each>
11889
+ </fo:basic-link>
11890
+ </xsl:with-param>
11891
+ </xsl:call-template>
11892
+ </fo:block>
11893
+ </fo:table-cell>
11894
+ </xsl:if>
11895
+
11667
11896
  <xsl:variable name="current_id" select="generate-id()"/>
11668
11897
  <fo:table-cell>
11669
11898
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -11714,11 +11943,25 @@
11714
11943
 
11715
11944
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
11716
11945
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11946
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11717
11947
  <xsl:for-each select="*[local-name() = 'tab']">
11948
+ <xsl:if test="position() = 1">
11949
+ <td>
11950
+ <xsl:for-each select="preceding-sibling::node()">
11951
+ <xsl:choose>
11952
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11953
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
11954
+ </xsl:choose>
11955
+ </xsl:for-each>
11956
+ </td>
11957
+ </xsl:if>
11718
11958
  <xsl:variable name="current_id" select="generate-id()"/>
11719
11959
  <td>
11720
11960
  <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="."/>
11961
+ <xsl:choose>
11962
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
11963
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
11964
+ </xsl:choose>
11722
11965
  </xsl:for-each>
11723
11966
  </td>
11724
11967
  </xsl:for-each>
@@ -13118,6 +13361,7 @@
13118
13361
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
13119
13362
  </fn>
13120
13363
  -->
13364
+ <!-- fn in text -->
13121
13365
  <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
13366
  <xsl:variable name="p_fn_">
13123
13367
  <xsl:call-template name="get_fn_list"/>