metanorma-iho 1.1.1 → 1.1.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.
@@ -141,6 +141,12 @@
141
141
  <xsl:call-template name="updateXML"/>
142
142
  </xsl:variable>
143
143
 
144
+ <xsl:if test="$debug = 'true'">
145
+ <redirect:write file="updated_xml.xml">
146
+ <xsl:copy-of select="$updated_xml"/>
147
+ </redirect:write>
148
+ </xsl:if>
149
+
144
150
  <xsl:for-each select="xalan:nodeset($updated_xml)/*">
145
151
 
146
152
  <!-- =========================== -->
@@ -258,12 +264,6 @@
258
264
  <xsl:call-template name="processPrefaceAndMainSectionsIHO_items"/>
259
265
  </xsl:variable>
260
266
 
261
- <xsl:if test="$debug = 'true'">
262
- <redirect:write file="updated_xml_with_pages.xml">
263
- <xsl:copy-of select="$updated_xml_with_pages"/>
264
- </redirect:write>
265
- </xsl:if>
266
-
267
267
  <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
268
268
 
269
269
  <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'preface']][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
@@ -276,11 +276,7 @@
276
276
  <xsl:call-template name="getPageSequenceOrientation"/>
277
277
  </xsl:attribute>
278
278
 
279
- <fo:static-content flow-name="xsl-footnote-separator">
280
- <fo:block>
281
- <fo:leader leader-pattern="rule" leader-length="30%"/>
282
- </fo:block>
283
- </fo:static-content>
279
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
284
280
  <xsl:call-template name="insertHeaderFooter">
285
281
  <xsl:with-param name="font-weight">normal</xsl:with-param>
286
282
  </xsl:call-template>
@@ -322,11 +318,7 @@
322
318
  <xsl:call-template name="getPageSequenceOrientation"/>
323
319
  </xsl:attribute>
324
320
 
325
- <fo:static-content flow-name="xsl-footnote-separator">
326
- <fo:block>
327
- <fo:leader leader-pattern="rule" leader-length="30%"/>
328
- </fo:block>
329
- </fo:static-content>
321
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
330
322
  <xsl:call-template name="insertHeaderFooter">
331
323
  <xsl:with-param name="font-weight">normal</xsl:with-param>
332
324
  </xsl:call-template>
@@ -355,11 +347,7 @@
355
347
  <xsl:attribute name="initial-page-number">1</xsl:attribute>
356
348
  </xsl:if>
357
349
 
358
- <fo:static-content flow-name="xsl-footnote-separator">
359
- <fo:block>
360
- <fo:leader leader-pattern="rule" leader-length="30%"/>
361
- </fo:block>
362
- </fo:static-content>
350
+ <xsl:call-template name="insertFootnoteSeparatorCommon"/>
363
351
  <xsl:call-template name="insertHeaderFooter"/>
364
352
  <fo:flow flow-name="xsl-region-body">
365
353
  <fo:block-container>
@@ -859,10 +847,6 @@
859
847
  </xsl:if>
860
848
  </xsl:template>
861
849
 
862
- <xsl:template match="iho:p/iho:fn/iho:p">
863
- <xsl:apply-templates/>
864
- </xsl:template>
865
-
866
850
  <!-- note in list item -->
867
851
  <!-- <xsl:template match="iho:ul//iho:note | iho:ol//iho:note" priority="2">
868
852
  <fo:block id="{@id}">
@@ -1818,14 +1802,18 @@
1818
1802
  </xsl:template>
1819
1803
 
1820
1804
  <xsl:attribute-set name="table-fn-number-style">
1805
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
1806
+
1807
+ </xsl:attribute-set> <!-- table-fn-number-style -->
1808
+
1809
+ <xsl:attribute-set name="table-fmt-fn-label-style">
1821
1810
  <xsl:attribute name="font-size">80%</xsl:attribute>
1822
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
1823
1811
 
1824
1812
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1825
1813
 
1826
- </xsl:attribute-set> <!-- table-fn-number-style -->
1814
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
1827
1815
 
1828
- <xsl:template name="refine_table-fn-number-style">
1816
+ <xsl:template name="refine_table-fmt-fn-label-style">
1829
1817
 
1830
1818
  </xsl:template>
1831
1819
 
@@ -1840,11 +1828,18 @@
1840
1828
  </xsl:attribute-set>
1841
1829
 
1842
1830
  <xsl:attribute-set name="figure-fn-number-style">
1843
- <xsl:attribute name="font-size">80%</xsl:attribute>
1844
1831
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
1832
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
1833
+
1834
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
1835
+ <xsl:attribute name="font-size">80%</xsl:attribute>
1845
1836
  <xsl:attribute name="vertical-align">super</xsl:attribute>
1846
1837
 
1847
- </xsl:attribute-set>
1838
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
1839
+
1840
+ <xsl:template name="refine_figure-fmt-fn-label-style">
1841
+
1842
+ </xsl:template>
1848
1843
 
1849
1844
  <xsl:attribute-set name="figure-fn-body-style">
1850
1845
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -3359,9 +3354,13 @@
3359
3354
 
3360
3355
  <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']"/>
3361
3356
  <xsl:if test="$isNoteOrFnExist = 'true'">
3362
-
3363
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3364
-
3357
+ <!-- <xsl:choose>
3358
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
3359
+ <xsl:otherwise>
3360
+
3361
+ </xsl:otherwise>
3362
+ </xsl:choose> -->
3363
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3365
3364
  </xsl:if>
3366
3365
 
3367
3366
  <xsl:choose>
@@ -3408,7 +3407,7 @@
3408
3407
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3409
3408
  </xsl:when>
3410
3409
  <xsl:otherwise>
3411
- <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 -->
3410
+ <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 -->
3412
3411
  </xsl:otherwise>
3413
3412
  </xsl:choose>
3414
3413
 
@@ -3419,13 +3418,26 @@
3419
3418
 
3420
3419
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3421
3420
 
3422
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3423
- <xsl:call-template name="insertTableFooterInSeparateTable">
3424
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
3425
- <xsl:with-param name="colwidths" select="$colwidths"/>
3426
- <xsl:with-param name="colgroup" select="$colgroup"/>
3427
- </xsl:call-template>
3428
- </xsl:for-each>
3421
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
3422
+
3423
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3424
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3425
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3426
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3427
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3428
+ </xsl:call-template>
3429
+ </xsl:for-each>
3430
+
3431
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
3432
+ <xsl:if test="$namespace = 'plateau'">
3433
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
3434
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
3435
+ <xsl:variable name="table_fn_block">
3436
+ <xsl:call-template name="table_fn_display" />
3437
+ </xsl:variable>
3438
+ <xsl:copy-of select="$table_fn_block"/>
3439
+ </xsl:for-each>
3440
+ </xsl:if> -->
3429
3441
 
3430
3442
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
3431
3443
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -4212,6 +4224,8 @@
4212
4224
 
4213
4225
  <xsl:template name="setTableRowAttributes">
4214
4226
 
4227
+ <xsl:call-template name="setColors"/>
4228
+
4215
4229
  </xsl:template> <!-- setTableRowAttributes -->
4216
4230
  <!-- ===================== -->
4217
4231
  <!-- END Table's row processing -->
@@ -4263,6 +4277,7 @@
4263
4277
  </xsl:attribute>
4264
4278
  </xsl:if>
4265
4279
  <xsl:call-template name="display-align"/>
4280
+ <xsl:call-template name="setColors"/>
4266
4281
  </xsl:template>
4267
4282
 
4268
4283
  <xsl:template name="display-align">
@@ -4278,6 +4293,29 @@
4278
4293
  </xsl:if>
4279
4294
  </xsl:template>
4280
4295
 
4296
+ <xsl:template name="setColors">
4297
+ <xsl:variable name="styles__">
4298
+ <xsl:call-template name="split">
4299
+ <xsl:with-param name="pText" select="concat(@style,';')"/>
4300
+ <xsl:with-param name="sep" select="';'"/>
4301
+ </xsl:call-template>
4302
+ </xsl:variable>
4303
+ <xsl:variable name="quot">"</xsl:variable>
4304
+ <xsl:variable name="styles_">
4305
+ <xsl:for-each select="xalan:nodeset($styles__)/item">
4306
+ <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
4307
+ <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
4308
+ <xsl:if test="$key = 'color' or $key = 'background-color'">
4309
+ <style name="{$key}"><xsl:value-of select="$value"/></style>
4310
+ </xsl:if>
4311
+ </xsl:for-each>
4312
+ </xsl:variable>
4313
+ <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
4314
+ <xsl:for-each select="$styles/style">
4315
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
4316
+ </xsl:for-each>
4317
+ </xsl:template>
4318
+
4281
4319
  <!-- cell in table body, footer -->
4282
4320
  <xsl:template match="*[local-name()='td']" name="td">
4283
4321
  <fo:table-cell xsl:use-attribute-sets="table-cell-style"> <!-- text-align="{@align}" -->
@@ -4289,17 +4327,28 @@
4289
4327
 
4290
4328
  <xsl:call-template name="refine_table-cell-style"/>
4291
4329
 
4330
+ <xsl:call-template name="setTableCellAttributes"/>
4331
+
4292
4332
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
4293
4333
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4294
4334
  </xsl:if>
4295
4335
 
4296
- <xsl:call-template name="setTableCellAttributes"/>
4297
-
4298
4336
  <xsl:if test="$isGenerateTableIF = 'true'">
4299
4337
  <xsl:attribute name="border">1pt solid black</xsl:attribute> <!-- border is mandatory, to determine page width -->
4300
4338
  <xsl:attribute name="text-align">left</xsl:attribute>
4301
4339
  </xsl:if>
4302
4340
 
4341
+ <xsl:if test="$isGenerateTableIF = 'false'">
4342
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
4343
+ <xsl:attribute name="text-align">right</xsl:attribute>
4344
+ <xsl:attribute name="border">none</xsl:attribute>
4345
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4346
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
4347
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
4348
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
4349
+ </xsl:if>
4350
+ </xsl:if>
4351
+
4303
4352
  <fo:block role="SKIP">
4304
4353
 
4305
4354
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -4318,7 +4367,8 @@
4318
4367
  </fo:table-cell>
4319
4368
  </xsl:template> <!-- td -->
4320
4369
 
4321
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
4370
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
4371
+ <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">
4322
4372
 
4323
4373
  <fo:block xsl:use-attribute-sets="table-note-style">
4324
4374
  <xsl:copy-of select="@id"/>
@@ -4339,65 +4389,54 @@
4339
4389
 
4340
4390
  </xsl:template> <!-- table/note -->
4341
4391
 
4342
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
4392
+ <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">
4343
4393
  <xsl:apply-templates/>
4344
4394
  </xsl:template>
4345
4395
 
4346
4396
  <!-- ===================== -->
4347
4397
  <!-- Footnotes processing -->
4348
4398
  <!-- ===================== -->
4399
+
4400
+ <!-- document text (not figures, or tables) footnotes -->
4401
+ <xsl:variable name="footnotes_">
4402
+ <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 -->
4403
+ <!-- <xsl:copy-of select="."/> -->
4404
+ <xsl:variable name="update_xml_step1">
4405
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
4406
+ </xsl:variable>
4407
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
4408
+ </xsl:for-each>
4409
+ </xsl:variable>
4410
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
4411
+
4349
4412
  <!--
4350
4413
  <fn reference="1">
4351
4414
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
4352
4415
  </fn>
4353
4416
  -->
4354
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
4417
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
4418
+ <!-- fn in text -->
4355
4419
  <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">
4356
4420
 
4357
- <!-- list of footnotes to calculate actual footnotes number -->
4421
+ <!-- list of unique footnotes -->
4358
4422
  <xsl:variable name="p_fn_">
4359
4423
  <xsl:call-template name="get_fn_list"/>
4360
- <!-- <xsl:choose>
4361
- <xsl:when test="$namespace = 'jis'">
4362
- <xsl:call-template name="get_fn_list_for_element"/>
4363
- </xsl:when>
4364
- <xsl:otherwise>
4365
- <xsl:call-template name="get_fn_list"/>
4366
- </xsl:otherwise>
4367
- </xsl:choose> -->
4368
4424
  </xsl:variable>
4369
4425
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4370
4426
 
4371
4427
  <xsl:variable name="gen_id" select="generate-id(.)"/>
4372
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
4373
- <xsl:variable name="reference_">
4374
- <xsl:value-of select="@reference"/>
4375
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
4376
- </xsl:variable>
4377
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
4428
+
4378
4429
  <!-- fn sequence number in document -->
4379
- <xsl:variable name="current_fn_number">
4380
- <xsl:choose>
4381
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
4382
- <xsl:otherwise>
4383
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
4384
- </xsl:otherwise>
4385
- </xsl:choose>
4386
- </xsl:variable>
4430
+ <xsl:variable name="current_fn_number" select="@reference"/>
4431
+
4387
4432
  <xsl:variable name="current_fn_number_text">
4388
4433
 
4389
4434
  <xsl:value-of select="$current_fn_number"/>
4390
4435
 
4391
4436
  </xsl:variable>
4392
4437
 
4393
- <xsl:variable name="ref_id">
4394
- <xsl:choose>
4395
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
4396
- <xsl:otherwise>
4397
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
4398
- </xsl:otherwise>
4399
- </xsl:choose>
4400
- </xsl:variable>
4438
+ <xsl:variable name="ref_id" select="@target"/>
4439
+
4401
4440
  <xsl:variable name="footnote_inline">
4402
4441
  <fo:inline role="Reference">
4403
4442
 
@@ -4442,7 +4481,9 @@
4442
4481
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
4443
4482
  <xsl:copy-of select="$footnote_inline"/>
4444
4483
  </xsl:when>
4484
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
4445
4485
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
4486
+
4446
4487
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
4447
4488
  <xsl:copy-of select="$footnote_inline"/>
4448
4489
  <fo:footnote-body role="Note">
@@ -4459,7 +4500,10 @@
4459
4500
  <xsl:value-of select="$current_fn_number_text"/>
4460
4501
 
4461
4502
  </fo:inline>
4462
- <xsl:apply-templates/>
4503
+ <!-- <xsl:apply-templates /> -->
4504
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
4505
+ <here><xsl:copy-of select="$footnotes"/></here> -->
4506
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
4463
4507
  </xsl:variable>
4464
4508
 
4465
4509
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -4513,77 +4557,136 @@
4513
4557
  </xsl:choose>
4514
4558
  </xsl:template>
4515
4559
 
4516
- <xsl:template name="get_fn_list_for_element">
4517
- <xsl:choose>
4518
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
4519
- <fn gen_id="{generate-id(.)}">
4520
- <xsl:copy-of select="@*"/>
4521
- <xsl:copy-of select="node()"/>
4522
- </fn>
4523
- </xsl:when>
4524
- <xsl:otherwise>
4525
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
4526
- <xsl:variable name="element_id" select="@id"/>
4527
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4528
- <!-- copy unique fn -->
4529
- <fn gen_id="{generate-id(.)}">
4530
- <xsl:copy-of select="@*"/>
4531
- <xsl:copy-of select="node()"/>
4532
- </fn>
4533
- </xsl:for-each>
4534
- </xsl:for-each>
4535
- </xsl:otherwise>
4536
- </xsl:choose>
4537
- </xsl:template>
4538
4560
  <!-- ============================ -->
4539
4561
  <!-- table's footnotes rendering -->
4540
4562
  <!-- ============================ -->
4541
- <xsl:template name="table_fn_display">
4542
- <xsl:variable name="references">
4543
4563
 
4564
+ <!-- table/fmt-footnote-container -->
4565
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
4566
+
4567
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
4568
+ <xsl:for-each select=".">
4569
+ <xsl:call-template name="table_fn_display"/>
4570
+ </xsl:for-each>
4571
+ </xsl:template>
4572
+
4573
+ <xsl:template name="table_fn_display">
4574
+ <!-- <xsl:variable name="references">
4575
+ <xsl:if test="$namespace = 'bsi'">
4576
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
4577
+ <xsl:call-template name="create_fn" />
4578
+ </xsl:for-each>
4579
+ </xsl:if>
4544
4580
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
4545
- <xsl:call-template name="create_fn"/>
4581
+ <xsl:call-template name="create_fn" />
4546
4582
  </xsl:for-each>
4547
- </xsl:variable>
4548
-
4549
- <xsl:for-each select="xalan:nodeset($references)//fn">
4583
+ </xsl:variable> -->
4584
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
4550
4585
  <xsl:variable name="reference" select="@reference"/>
4551
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4586
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
4587
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4552
4588
 
4553
4589
  <fo:block xsl:use-attribute-sets="table-fn-style">
4590
+ <xsl:copy-of select="@id"/>
4554
4591
  <xsl:call-template name="refine_table-fn-style"/>
4555
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4556
- <xsl:call-template name="refine_table-fn-number-style"/>
4557
4592
 
4558
- <xsl:value-of select="@reference"/>
4559
-
4560
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4561
- <!-- <xsl:if test="$namespace = 'itu'">
4562
- <xsl:text>)</xsl:text>
4563
- </xsl:if> -->
4593
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
4594
+ <xsl:with-param name="process">true</xsl:with-param>
4595
+ </xsl:apply-templates>
4564
4596
 
4565
- </fo:inline>
4566
4597
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
4567
- <xsl:copy-of select="./node()"/>
4598
+ <!-- <xsl:copy-of select="./node()"/> -->
4599
+ <xsl:apply-templates/>
4568
4600
  </fo:inline>
4569
4601
 
4570
4602
  </fo:block>
4571
4603
 
4572
- </xsl:if>
4604
+ <!-- </xsl:if> -->
4573
4605
  </xsl:for-each>
4574
4606
  </xsl:template> <!-- table_fn_display -->
4575
4607
 
4608
+ <!-- fmt-fn-body/fmt-fn-label in text -->
4609
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
4610
+
4611
+ <!-- table//fmt-fn-body//fmt-fn-label -->
4612
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
4613
+ <xsl:param name="process">false</xsl:param>
4614
+ <xsl:if test="$process = 'true'">
4615
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
4616
+
4617
+ <!-- tab is padding-right -->
4618
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
4619
+ <xsl:with-param name="process">true</xsl:with-param>
4620
+ </xsl:apply-templates>
4621
+
4622
+ <!-- <xsl:if test="$namespace = 'bipm'">
4623
+ <fo:inline font-style="normal">(</fo:inline>
4624
+ </xsl:if> -->
4625
+
4626
+ <!-- <xsl:if test="$namespace = 'plateau'">
4627
+ <xsl:text>※</xsl:text>
4628
+ </xsl:if> -->
4629
+
4630
+ <!-- <xsl:value-of select="@reference"/> -->
4631
+ <!-- <xsl:value-of select="normalize-space()"/> -->
4632
+ <xsl:apply-templates/>
4633
+
4634
+ <!-- <xsl:if test="$namespace = 'bipm'">
4635
+ <fo:inline font-style="normal">)</fo:inline>
4636
+ </xsl:if> -->
4637
+
4638
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
4639
+ <!-- <xsl:if test="$namespace = 'itu'">
4640
+ <xsl:text>)</xsl:text>
4641
+ </xsl:if> -->
4642
+
4643
+ <!-- <xsl:if test="$namespace = 'plateau'">
4644
+ <xsl:text>:</xsl:text>
4645
+ </xsl:if> -->
4646
+
4647
+ </fo:inline>
4648
+ </xsl:if>
4649
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
4650
+
4651
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
4652
+ <xsl:param name="process">false</xsl:param>
4653
+ <xsl:if test="$process = 'true'">
4654
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
4655
+
4656
+ </xsl:if>
4657
+ </xsl:template>
4658
+
4659
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
4660
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
4661
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
4662
+ <xsl:apply-templates/>
4663
+ </fo:inline>
4664
+ </xsl:template>
4665
+
4666
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
4667
+ <!--
4576
4668
  <xsl:template name="create_fn">
4577
4669
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4578
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4670
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
4579
4671
  <xsl:attribute name="id">
4580
4672
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4581
4673
  </xsl:attribute>
4582
4674
  </xsl:if>
4583
-
4584
- <xsl:apply-templates/>
4675
+ <xsl:if test="$namespace = 'itu'">
4676
+ <xsl:if test="ancestor::*[local-name()='preface']">
4677
+ <xsl:attribute name="preface">true</xsl:attribute>
4678
+ </xsl:if>
4679
+ </xsl:if>
4680
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4681
+ <xsl:attribute name="id">
4682
+ <xsl:value-of select="@reference"/>
4683
+ <xsl:text>_</xsl:text>
4684
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4685
+ </xsl:attribute>
4686
+ </xsl:if>
4687
+ <xsl:apply-templates />
4585
4688
  </fn>
4586
- </xsl:template>
4689
+ </xsl:template> -->
4587
4690
 
4588
4691
  <!-- footnotes for table's name rendering -->
4589
4692
  <xsl:template name="table_name_fn_display">
@@ -4602,123 +4705,171 @@
4602
4705
  <!-- ============================ -->
4603
4706
  <!-- figure's footnotes rendering -->
4604
4707
  <!-- ============================ -->
4605
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
4606
4708
 
4607
- <!-- current figure id -->
4608
- <xsl:variable name="figure_id_">
4609
- <xsl:value-of select="@id"/>
4610
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
4611
- </xsl:variable>
4612
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
4709
+ <!-- figure/fmt-footnote-container -->
4710
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
4711
+
4712
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
4713
+ <xsl:template name="figure_fn_display">
4613
4714
 
4614
- <!-- all footnotes relates to the current figure -->
4615
4715
  <xsl:variable name="references">
4616
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
4617
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
4618
- <xsl:apply-templates/>
4619
- </fn>
4716
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
4717
+ <xsl:variable name="curr_id" select="@id"/>
4718
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
4719
+ <curr><xsl:copy-of select="."/></curr>
4720
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
4721
+ <xsl:choose>
4722
+ <!-- skip figure/name/fn -->
4723
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
4724
+ <xsl:otherwise>
4725
+ <xsl:element name="figure" namespace="{$namespace_full}">
4726
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
4727
+ <xsl:copy-of select="."/>
4728
+ </xsl:element>
4729
+ </xsl:element>
4730
+ </xsl:otherwise>
4731
+ </xsl:choose>
4620
4732
  </xsl:for-each>
4621
4733
  </xsl:variable>
4734
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
4622
4735
 
4623
- <xsl:if test="xalan:nodeset($references)//fn">
4736
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
4624
4737
 
4625
4738
  <xsl:variable name="key_iso">
4626
4739
 
4627
4740
  </xsl:variable>
4628
4741
 
4629
4742
  <fo:block>
4743
+ <!-- current hierarchy is 'figure' element -->
4744
+ <xsl:variable name="following_dl_colwidths">
4745
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4746
+ <xsl:variable name="simple-table">
4747
+ <!-- <xsl:variable name="doc_ns">
4748
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4749
+ </xsl:variable>
4750
+ <xsl:variable name="ns">
4751
+ <xsl:choose>
4752
+ <xsl:when test="normalize-space($doc_ns) != ''">
4753
+ <xsl:value-of select="normalize-space($doc_ns)"/>
4754
+ </xsl:when>
4755
+ <xsl:otherwise>
4756
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
4757
+ </xsl:otherwise>
4758
+ </xsl:choose>
4759
+ </xsl:variable> -->
4630
4760
 
4631
- <!-- current hierarchy is 'figure' element -->
4632
- <xsl:variable name="following_dl_colwidths">
4633
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
4634
- <xsl:variable name="simple-table">
4635
- <!-- <xsl:variable name="doc_ns">
4636
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
4637
- </xsl:variable>
4638
- <xsl:variable name="ns">
4639
- <xsl:choose>
4640
- <xsl:when test="normalize-space($doc_ns) != ''">
4641
- <xsl:value-of select="normalize-space($doc_ns)"/>
4642
- </xsl:when>
4643
- <xsl:otherwise>
4644
- <xsl:value-of select="substring-before(name(/*), '-')"/>
4645
- </xsl:otherwise>
4646
- </xsl:choose>
4647
- </xsl:variable> -->
4648
-
4649
- <xsl:for-each select="*[local-name() = 'dl'][1]">
4650
- <tbody>
4651
- <xsl:apply-templates mode="dl"/>
4652
- </tbody>
4653
- </xsl:for-each>
4654
- </xsl:variable>
4655
-
4656
- <xsl:call-template name="calculate-column-widths">
4657
- <xsl:with-param name="cols-count" select="2"/>
4658
- <xsl:with-param name="table" select="$simple-table"/>
4659
- </xsl:call-template>
4660
-
4661
- </xsl:if>
4662
- </xsl:variable>
4663
-
4664
- <xsl:variable name="maxlength_dt">
4665
4761
  <xsl:for-each select="*[local-name() = 'dl'][1]">
4666
- <xsl:call-template name="getMaxLength_dt"/>
4762
+ <tbody>
4763
+ <xsl:apply-templates mode="dl"/>
4764
+ </tbody>
4667
4765
  </xsl:for-each>
4668
4766
  </xsl:variable>
4669
4767
 
4670
- <fo:table width="95%" table-layout="fixed">
4671
- <xsl:if test="normalize-space($key_iso) = 'true'">
4672
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4768
+ <xsl:call-template name="calculate-column-widths">
4769
+ <xsl:with-param name="cols-count" select="2"/>
4770
+ <xsl:with-param name="table" select="$simple-table"/>
4771
+ </xsl:call-template>
4673
4772
 
4674
- </xsl:if>
4675
- <xsl:choose>
4676
- <!-- if there 'dl', then set same columns width -->
4677
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4678
- <xsl:call-template name="setColumnWidth_dl">
4679
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4680
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4681
- </xsl:call-template>
4682
- </xsl:when>
4683
- <xsl:otherwise>
4684
- <fo:table-column column-width="5%"/>
4685
- <fo:table-column column-width="95%"/>
4686
- </xsl:otherwise>
4687
- </xsl:choose>
4688
- <fo:table-body>
4689
- <xsl:for-each select="xalan:nodeset($references)//fn">
4690
- <xsl:variable name="reference" select="@reference"/>
4691
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
4692
- <fo:table-row>
4693
- <fo:table-cell>
4694
- <fo:block>
4695
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
4696
- <xsl:value-of select="@reference"/>
4773
+ </xsl:if>
4774
+ </xsl:variable>
4775
+
4776
+ <xsl:variable name="maxlength_dt">
4777
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
4778
+ <xsl:call-template name="getMaxLength_dt"/>
4779
+ </xsl:for-each>
4780
+ </xsl:variable>
4781
+
4782
+ <fo:table width="95%" table-layout="fixed">
4783
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4784
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4785
+
4786
+ </xsl:if>
4787
+ <xsl:choose>
4788
+ <!-- if there 'dl', then set same columns width -->
4789
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
4790
+ <xsl:call-template name="setColumnWidth_dl">
4791
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
4792
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4793
+ </xsl:call-template>
4794
+ </xsl:when>
4795
+ <xsl:otherwise>
4796
+ <fo:table-column column-width="5%"/>
4797
+ <fo:table-column column-width="95%"/>
4798
+ </xsl:otherwise>
4799
+ </xsl:choose>
4800
+ <fo:table-body>
4801
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
4802
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
4803
+
4804
+ <xsl:variable name="reference" select="@reference"/>
4805
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
4806
+ <fo:table-row>
4807
+ <fo:table-cell>
4808
+ <fo:block>
4809
+
4810
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
4811
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
4812
+ <!-- <xsl:value-of select="@reference"/> -->
4813
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
4697
4814
  </fo:inline>
4698
- </fo:block>
4699
- </fo:table-cell>
4700
- <fo:table-cell>
4701
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4702
- <xsl:if test="normalize-space($key_iso) = 'true'">
4703
4815
 
4704
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
4816
+ </fo:block>
4817
+ </fo:table-cell>
4818
+ <fo:table-cell>
4819
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
4820
+ <xsl:if test="normalize-space($key_iso) = 'true'">
4705
4821
 
4706
- </xsl:if>
4707
- <xsl:copy-of select="./node()"/>
4708
- </fo:block>
4709
- </fo:table-cell>
4710
- </fo:table-row>
4711
- </xsl:if>
4712
- </xsl:for-each>
4713
- </fo:table-body>
4714
- </fo:table>
4822
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
4715
4823
 
4824
+ </xsl:if>
4825
+
4826
+ <!-- <xsl:copy-of select="./node()"/> -->
4827
+ <xsl:apply-templates/>
4828
+ </fo:block>
4829
+ </fo:table-cell>
4830
+ </fo:table-row>
4831
+ <!-- </xsl:if> -->
4832
+ </xsl:for-each>
4833
+ </fo:table-body>
4834
+ </fo:table>
4716
4835
  </fo:block>
4717
4836
  </xsl:if>
4718
- </xsl:template> <!-- fn_display_figure -->
4837
+ </xsl:template> <!-- figure_fn_display -->
4838
+
4839
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
4840
+ <xsl:param name="process">false</xsl:param>
4841
+ <xsl:if test="$process = 'true'">
4842
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
4843
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
4844
+
4845
+ <!-- tab is padding-right -->
4846
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
4847
+ <xsl:with-param name="process">true</xsl:with-param>
4848
+ </xsl:apply-templates>
4849
+
4850
+ <xsl:apply-templates/>
4851
+
4852
+ </fo:inline>
4853
+ </xsl:if>
4854
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
4855
+
4856
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
4857
+ <xsl:param name="process">false</xsl:param>
4858
+ <xsl:if test="$process = 'true'">
4859
+
4860
+ </xsl:if>
4861
+ </xsl:template>
4862
+
4863
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
4864
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
4865
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
4866
+ <xsl:apply-templates/>
4867
+ </fo:inline>
4868
+ </xsl:template>
4719
4869
 
4720
4870
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
4721
4871
  <!-- figure's footnote label -->
4872
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
4722
4873
  <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">
4723
4874
  <xsl:variable name="key_iso">
4724
4875
 
@@ -4727,7 +4878,7 @@
4727
4878
  <xsl:attribute name="font-size">10pt</xsl:attribute>
4728
4879
 
4729
4880
  </xsl:if>
4730
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
4881
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
4731
4882
  <!-- <xsl:value-of select="@reference"/> -->
4732
4883
  <xsl:apply-templates/>
4733
4884
  </fo:inline>
@@ -4737,38 +4888,65 @@
4737
4888
  <!-- END: figure's footnotes rendering -->
4738
4889
  <!-- ============================ -->
4739
4890
 
4740
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
4891
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
4892
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
4741
4893
  <xsl:template match="*[local-name()='fn']">
4742
4894
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
4743
4895
 
4744
4896
  <xsl:call-template name="refine_fn-reference-style"/>
4745
4897
 
4746
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4747
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
4748
- <xsl:attribute name="internal-destination">
4898
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4899
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
4900
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
4901
+ <!-- <xsl:attribute name="internal-destination">
4749
4902
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
4750
4903
  </xsl:attribute>
4751
4904
  </xsl:if>
4905
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
4906
+ <xsl:attribute name="internal-destination">
4907
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
4908
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
4909
+ </xsl:attribute>
4910
+ </xsl:if> -->
4911
+ <!-- <xsl:if test="$namespace = 'plateau'">
4912
+ <xsl:text>※</xsl:text>
4913
+ </xsl:if> -->
4914
+ <!-- <xsl:value-of select="@reference"/> -->
4752
4915
 
4753
- <xsl:value-of select="@reference"/>
4916
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
4754
4917
 
4918
+ <!-- <xsl:if test="$namespace = 'bsi'">
4919
+ <xsl:text>)</xsl:text>
4920
+ </xsl:if> -->
4755
4921
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
4756
4922
  <!-- <xsl:if test="$namespace = 'jis'">
4757
4923
  <fo:inline font-weight="normal">)</fo:inline>
4758
4924
  </xsl:if> -->
4759
4925
  </fo:basic-link>
4760
4926
  </fo:inline>
4761
- </xsl:template>
4927
+ </xsl:template> <!-- fn -->
4762
4928
 
4929
+ <!-- fn/text() -->
4763
4930
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4764
4931
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
4765
4932
  </xsl:template>
4766
4933
 
4767
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
4934
+ <!-- fn//p fmt-fn-body//p -->
4935
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
4768
4936
  <fo:inline role="P">
4769
4937
  <xsl:apply-templates/>
4770
4938
  </fo:inline>
4771
4939
  </xsl:template>
4940
+
4941
+ <xsl:template name="insertFootnoteSeparatorCommon">
4942
+ <xsl:param name="leader_length">30%</xsl:param>
4943
+ <fo:static-content flow-name="xsl-footnote-separator">
4944
+ <fo:block>
4945
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
4946
+ </fo:block>
4947
+ </fo:static-content>
4948
+ </xsl:template>
4949
+
4772
4950
  <!-- ===================== -->
4773
4951
  <!-- END Footnotes processing -->
4774
4952
  <!-- ===================== -->
@@ -5047,11 +5225,11 @@
5047
5225
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
5048
5226
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
5049
5227
 
5050
- <xsl:call-template name="setColumnWidth_dl">
5051
- <xsl:with-param name="colwidths" select="$colwidths"/>
5052
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5053
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
5054
- </xsl:call-template>
5228
+ <xsl:call-template name="setColumnWidth_dl">
5229
+ <xsl:with-param name="colwidths" select="$colwidths"/>
5230
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
5231
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
5232
+ </xsl:call-template>
5055
5233
 
5056
5234
  <fo:table-body>
5057
5235
 
@@ -5085,6 +5263,14 @@
5085
5263
 
5086
5264
  </xsl:template> <!-- END: dl -->
5087
5265
 
5266
+ <xsl:template match="@*|node()" mode="dt_clean">
5267
+ <xsl:copy>
5268
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
5269
+ </xsl:copy>
5270
+ </xsl:template>
5271
+
5272
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
5273
+
5088
5274
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
5089
5275
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
5090
5276
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -5118,10 +5304,12 @@
5118
5304
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
5119
5305
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
5120
5306
 
5307
+ <!-- dl/name -->
5121
5308
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
5122
5309
  <xsl:param name="process">false</xsl:param>
5123
5310
  <xsl:if test="$process = 'true'">
5124
5311
  <fo:block xsl:use-attribute-sets="dl-name-style">
5312
+
5125
5313
  <xsl:apply-templates/>
5126
5314
  </fo:block>
5127
5315
  </xsl:if>
@@ -5135,6 +5323,10 @@
5135
5323
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
5136
5324
 
5137
5325
  <xsl:choose>
5326
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
5327
+ <fo:table-column column-width="10%"/>
5328
+ <fo:table-column column-width="90%"/>
5329
+ </xsl:when> -->
5138
5330
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
5139
5331
  <xsl:call-template name="insertTableColumnWidth">
5140
5332
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -6000,7 +6192,7 @@
6000
6192
  <xsl:choose>
6001
6193
  <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
6002
6194
  <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
6003
- <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
6195
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:apply-templates/></fo:inline>
6004
6196
  </xsl:when>
6005
6197
  <xsl:otherwise>
6006
6198
  <xsl:apply-templates/>
@@ -6008,7 +6200,7 @@
6008
6200
  </xsl:choose>
6009
6201
  </xsl:template>
6010
6202
  <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">
6011
- <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
6203
+ <fo:inline keep-with-next.within-line="always" role="SKIP"><xsl:value-of select="."/></fo:inline>
6012
6204
  </xsl:template>
6013
6205
 
6014
6206
  <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
@@ -7048,24 +7240,26 @@
7048
7240
  <xsl:apply-templates select="." mode="mathml"/>
7049
7241
  </xsl:variable>
7050
7242
 
7051
- <fo:instream-foreign-object fox:alt-text="Math">
7243
+ <fo:instream-foreign-object fox:alt-text="Math" fox:actual-text="Math">
7052
7244
 
7053
7245
  <xsl:call-template name="refine_mathml_insteam_object_style"/>
7054
7246
 
7055
- <!-- put MathML in Actual Text -->
7056
- <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
7057
- <xsl:attribute name="fox:actual-text">
7058
- <xsl:value-of select="$mathml_content"/>
7059
- </xsl:attribute>
7060
-
7061
- <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
7062
- <xsl:if test="normalize-space($asciimath_text_) != ''">
7063
- <!-- put Mathin Alternate Text -->
7064
- <xsl:attribute name="fox:alt-text">
7065
- <xsl:value-of select="$asciimath_text_"/>
7247
+ <xsl:if test="$isGenerateTableIF = 'false'">
7248
+ <!-- put MathML in Actual Text -->
7249
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
7250
+ <xsl:attribute name="fox:actual-text">
7251
+ <xsl:value-of select="$mathml_content"/>
7066
7252
  </xsl:attribute>
7253
+
7254
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
7255
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
7256
+ <!-- put Mathin Alternate Text -->
7257
+ <xsl:attribute name="fox:alt-text">
7258
+ <xsl:value-of select="$asciimath_text_"/>
7259
+ </xsl:attribute>
7260
+ </xsl:if>
7261
+ <!-- </xsl:if> -->
7067
7262
  </xsl:if>
7068
- <!-- </xsl:if> -->
7069
7263
 
7070
7264
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
7071
7265
 
@@ -7328,6 +7522,27 @@
7328
7522
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7329
7523
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7330
7524
  </xsl:when> -->
7525
+
7526
+ <!-- <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'))">
7527
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7528
+ <xsl:variable name="filename">
7529
+ <xsl:call-template name="substring-after-last">
7530
+ <xsl:with-param name="value" select="$target_"/>
7531
+ <xsl:with-param name="delimiter" select="'/'"/>
7532
+ </xsl:call-template>
7533
+ </xsl:variable>
7534
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
7535
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
7536
+ <xsl:choose>
7537
+ <xsl:when test="$file_exists = 'true'">
7538
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
7539
+ </xsl:when>
7540
+ <xsl:otherwise>
7541
+ <xsl:value-of select="normalize-space(@target)"/>
7542
+ </xsl:otherwise>
7543
+ </xsl:choose>
7544
+ </xsl:when> -->
7545
+
7331
7546
  <xsl:otherwise>
7332
7547
  <xsl:value-of select="normalize-space(@target)"/>
7333
7548
  </xsl:otherwise>
@@ -7632,7 +7847,7 @@
7632
7847
 
7633
7848
  <xsl:template name="refine_note_block_style">
7634
7849
 
7635
- </xsl:template>
7850
+ </xsl:template> <!-- refine_note_block_style -->
7636
7851
 
7637
7852
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
7638
7853
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -7824,10 +8039,21 @@
7824
8039
  </xsl:template>
7825
8040
 
7826
8041
  <xsl:template name="showFigureKey">
7827
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
7828
- <xsl:call-template name="note"/>
8042
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
8043
+ <xsl:choose>
8044
+ <xsl:when test="local-name() = 'note'">
8045
+ <xsl:call-template name="note"/>
8046
+ </xsl:when>
8047
+ <xsl:when test="local-name() = 'example'">
8048
+ <xsl:call-template name="example"/>
8049
+ </xsl:when>
8050
+ <xsl:otherwise>
8051
+ <xsl:apply-templates select="."/>
8052
+ </xsl:otherwise>
8053
+ </xsl:choose>
7829
8054
  </xsl:for-each>
7830
- <xsl:call-template name="fn_display_figure"/>
8055
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
8056
+ <xsl:call-template name="figure_fn_display"/>
7831
8057
  </xsl:template>
7832
8058
 
7833
8059
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -8721,10 +8947,10 @@
8721
8947
  <xsl:when test="@type = 'section-title'">
8722
8948
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
8723
8949
  <xsl:text>: </xsl:text>
8724
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
8950
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
8725
8951
  </xsl:when>
8726
8952
  <xsl:otherwise>
8727
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
8953
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
8728
8954
  </xsl:otherwise>
8729
8955
  </xsl:choose>
8730
8956
  </xsl:when>
@@ -8789,6 +9015,8 @@
8789
9015
  <xsl:template match="*[local-name() = 'origin']" mode="contents"/>
8790
9016
  <xsl:template match="*[local-name() = 'erefstack ']" mode="contents"/>
8791
9017
 
9018
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="contents" priority="3"/>
9019
+
8792
9020
  <xsl:template match="*[local-name() = 'stem']" mode="bookmarks"/>
8793
9021
  <xsl:template match="*[local-name() = 'fmt-stem']" mode="bookmarks">
8794
9022
  <xsl:apply-templates mode="bookmarks"/>
@@ -8810,6 +9038,8 @@
8810
9038
  <xsl:template match="*[local-name() = 'origin']" mode="bookmarks"/>
8811
9039
  <xsl:template match="*[local-name() = 'erefstack ']" mode="bookmarks"/>
8812
9040
 
9041
+ <xsl:template match="*[local-name() = 'requirement'] | *[local-name() = 'recommendation'] | *[local-name() = 'permission']" mode="bookmarks" priority="3"/>
9042
+
8813
9043
  <!-- Bookmarks -->
8814
9044
  <xsl:template name="addBookmarks">
8815
9045
  <xsl:param name="contents"/>
@@ -9055,9 +9285,15 @@
9055
9285
  </xsl:if>
9056
9286
  </xsl:template>
9057
9287
 
9288
+ <!-- figure/fn -->
9058
9289
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
9059
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
9290
+ <!-- figure/note -->
9291
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
9292
+ <!-- figure/example -->
9293
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
9060
9294
 
9295
+ <!-- figure/note[@type = 'units'] -->
9296
+ <!-- image/note[@type = 'units'] -->
9061
9297
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
9062
9298
  <fo:block text-align="right" keep-with-next="always">
9063
9299
  <xsl:apply-templates/>
@@ -9178,6 +9414,7 @@
9178
9414
  </xsl:choose>
9179
9415
  </xsl:template>
9180
9416
 
9417
+ <!-- fn -->
9181
9418
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
9182
9419
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
9183
9420
 
@@ -10074,7 +10311,7 @@
10074
10311
  text line 1
10075
10312
  text line 2
10076
10313
  -->
10077
- <xsl:template match="*[local-name() = 'example']">
10314
+ <xsl:template match="*[local-name() = 'example']" name="example">
10078
10315
 
10079
10316
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
10080
10317
 
@@ -10180,6 +10417,7 @@
10180
10417
 
10181
10418
  </xsl:template>
10182
10419
 
10420
+ <!-- example/name -->
10183
10421
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
10184
10422
  <xsl:param name="fo_element">block</xsl:param>
10185
10423
 
@@ -10205,7 +10443,8 @@
10205
10443
 
10206
10444
  </xsl:template>
10207
10445
 
10208
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
10446
+ <!-- table/example/name, table/tfoot//example/name -->
10447
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
10209
10448
  <fo:inline xsl:use-attribute-sets="example-name-style">
10210
10449
 
10211
10450
  <xsl:apply-templates/>
@@ -10679,21 +10918,32 @@
10679
10918
  <!-- ========== -->
10680
10919
 
10681
10920
  <xsl:variable name="reviews_">
10682
- <xsl:for-each select="//*[local-name() = 'review'][@from]">
10921
+ <xsl:for-each select="//*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])][@from]">
10683
10922
  <xsl:copy>
10684
10923
  <xsl:copy-of select="@from"/>
10685
10924
  <xsl:copy-of select="@id"/>
10686
10925
  </xsl:copy>
10687
10926
  </xsl:for-each>
10927
+ <xsl:for-each select="//*[local-name() = 'fmt-review-start'][@source]">
10928
+ <xsl:copy>
10929
+ <xsl:copy-of select="@source"/>
10930
+ <xsl:copy-of select="@id"/>
10931
+ </xsl:copy>
10932
+ </xsl:for-each>
10688
10933
  </xsl:variable>
10689
10934
  <xsl:variable name="reviews" select="xalan:nodeset($reviews_)"/>
10690
10935
 
10691
10936
  <xsl:template name="addReviewHelper">
10692
- <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
10693
- <xsl:variable name="curr_id" select="@id"/>
10694
- <xsl:variable name="review_id" select="normalize-space($reviews//*[local-name() = 'review'][@from = $curr_id]/@id)"/>
10695
- <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
10696
- <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>
10937
+ <xsl:if test="$isGenerateTableIF = 'false'">
10938
+ <!-- if there is review with from="...", then add small helper block for Annot tag adding, see 'review' template -->
10939
+ <xsl:variable name="curr_id" select="@id"/>
10940
+ <!-- <xsl:variable name="review_id" select="normalize-space(/@id)"/> -->
10941
+ <xsl:for-each select="$reviews//*[local-name() = 'review'][@from = $curr_id]"> <!-- $reviews//*[local-name() = 'fmt-review-start'][@source = $curr_id] -->
10942
+ <xsl:variable name="review_id" select="normalize-space(@id)"/>
10943
+ <xsl:if test="$review_id != ''"> <!-- i.e. if review found -->
10944
+ <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>
10945
+ </xsl:if>
10946
+ </xsl:for-each>
10697
10947
  </xsl:if>
10698
10948
  <!-- <fo:block>
10699
10949
  <curr_id><xsl:value-of select="$curr_id"/></curr_id>
@@ -10830,14 +11080,61 @@
10830
11080
 
10831
11081
  </xsl:template>
10832
11082
 
10833
- <xsl:template match="*[local-name() = 'review']"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11083
+ <!-- document text (not figures, or tables) footnotes -->
11084
+ <xsl:variable name="reviews_container_">
11085
+ <xsl:for-each select="//*[local-name() = 'review-container']/*[local-name() = 'fmt-review-body']">
11086
+ <xsl:variable name="update_xml_step1">
11087
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
11088
+ </xsl:variable>
11089
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
11090
+ </xsl:for-each>
11091
+ </xsl:variable>
11092
+ <xsl:variable name="reviews_container" select="xalan:nodeset($reviews_container_)"/>
11093
+
11094
+ <xsl:template match="*[local-name() = 'review-container']"/>
11095
+
11096
+ <!-- for old Presentation XML (before https://github.com/metanorma/isodoc/issues/670) -->
11097
+ <xsl:template match="*[local-name() = 'review'][not(parent::*[local-name() = 'review-container'])]"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
11098
+ <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
11099
+ <xsl:if test="$isGenerateTableIF = 'false'">
11100
+ <xsl:choose>
11101
+ <!-- if there isn't the attribute '@from', then -->
11102
+ <xsl:when test="$id_from = ''">
11103
+ <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>
11104
+ </xsl:when>
11105
+ <!-- if there isn't element with id 'from', then create 'bookmark' here -->
11106
+ <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
11107
+ <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>
11108
+ </xsl:when>
11109
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
11110
+ <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>
11111
+ </xsl:when>
11112
+ </xsl:choose>
11113
+ </xsl:if>
11114
+ </xsl:template>
11115
+
11116
+ <!-- for new Presentation XML (https://github.com/metanorma/isodoc/issues/670) -->
11117
+ <xsl:template match="*[local-name() = 'fmt-review-start']" name="fmt-review-start"> <!-- 'review' will be processed in mn2pdf/review.xsl -->
10834
11118
  <!-- comment 2019-11-29 -->
10835
11119
  <!-- <fo:block font-weight="bold">Review:</fo:block>
10836
11120
  <xsl:apply-templates /> -->
10837
11121
 
10838
- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/>
11122
+ <xsl:variable name="id_from" select="normalize-space(current()/@source)"/>
10839
11123
 
10840
- <xsl:if test="1 = 1">
11124
+ <xsl:variable name="source" select="normalize-space(@source)"/>
11125
+
11126
+ <xsl:if test="$isGenerateTableIF = 'false'">
11127
+ <!-- <xsl:variable name="id_from" select="normalize-space(current()/@from)"/> -->
11128
+
11129
+ <!-- <xsl:if test="@source = @end"> -->
11130
+ <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
11131
+ following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
11132
+ <!-- <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> -->
11133
+ <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>
11134
+ <!-- </xsl:if> -->
11135
+ </xsl:if>
11136
+
11137
+ <xsl:if test="1 = 2">
10841
11138
  <xsl:choose>
10842
11139
  <!-- if there isn't the attribute '@from', then -->
10843
11140
  <xsl:when test="$id_from = ''">
@@ -10845,10 +11142,10 @@
10845
11142
  </xsl:when>
10846
11143
  <!-- if there isn't element with id 'from', then create 'bookmark' here -->
10847
11144
  <xsl:when test="ancestor::*[local-name() = 'metanorma'] and not(ancestor::*[local-name() = 'metanorma']//*[@id = $id_from])">
10848
- <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>
11145
+ <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>
10849
11146
  </xsl:when>
10850
11147
  <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
10851
- <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>
11148
+ <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>
10852
11149
  </xsl:when>
10853
11150
  </xsl:choose>
10854
11151
  </xsl:if>
@@ -10900,16 +11197,21 @@
10900
11197
  <xsl:variable name="list_level">
10901
11198
  <xsl:choose>
10902
11199
  <xsl:when test="$list_level_ &lt;= 3"><xsl:value-of select="$list_level_"/></xsl:when>
10903
- <xsl:otherwise><xsl:value-of select="$list_level_ mod 3"/></xsl:otherwise>
11200
+ <xsl:when test="$ul_labels/label[@level = 3]"><xsl:value-of select="$list_level_ mod 3"/></xsl:when>
11201
+ <xsl:when test="$list_level_ mod 2 = 0">2</xsl:when>
11202
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 2"/></xsl:otherwise>
10904
11203
  </xsl:choose>
10905
11204
  </xsl:variable>
10906
11205
  <xsl:choose>
10907
11206
  <xsl:when test="$ul_labels/label[not(@level)]"> <!-- one label for all levels -->
10908
11207
  <xsl:apply-templates select="$ul_labels/label[not(@level)]" mode="ul_labels"/>
10909
11208
  </xsl:when>
10910
- <xsl:when test="$list_level mod 3 = 0">
11209
+ <xsl:when test="$list_level mod 3 = 0 and $ul_labels/label[@level = 3]">
10911
11210
  <xsl:apply-templates select="$ul_labels/label[@level = 3]" mode="ul_labels"/>
10912
11211
  </xsl:when>
11212
+ <xsl:when test="$list_level mod 3 = 0">
11213
+ <xsl:apply-templates select="$ul_labels/label[@level = 1]" mode="ul_labels"/>
11214
+ </xsl:when>
10913
11215
  <xsl:when test="$list_level mod 2 = 0">
10914
11216
  <xsl:apply-templates select="$ul_labels/label[@level = 2]" mode="ul_labels"/>
10915
11217
  </xsl:when>
@@ -11452,10 +11754,22 @@
11452
11754
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'bookmark']" priority="2"/>
11453
11755
 
11454
11756
  <xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
11455
- <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11456
- <fo:inline id="{@id}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:inline>
11457
- <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11458
- <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11757
+ <xsl:variable name="bookmark_id" select="@id"/>
11758
+ <xsl:choose>
11759
+ <!-- Example:
11760
+ <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"/>
11761
+ <bookmark id="_dda23915-8574-ef1e-29a1-822d465a5b97"/>
11762
+ <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"/> -->
11763
+ <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]">
11764
+ <!-- skip here, see the template 'fmt-review-start' -->
11765
+ </xsl:when>
11766
+ <xsl:otherwise>
11767
+ <!-- <fo:inline id="{@id}" font-size="1pt"/> -->
11768
+ <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>
11769
+ <!-- we need to add zero-width space, otherwise this fo:inline is missing in IF xml -->
11770
+ <xsl:if test="not(following-sibling::node()[normalize-space() != ''])"><fo:inline font-size="1pt"> </fo:inline></xsl:if>
11771
+ </xsl:otherwise>
11772
+ </xsl:choose>
11459
11773
  </xsl:template>
11460
11774
  <!-- =================== -->
11461
11775
  <!-- End of Index processing -->
@@ -11842,8 +12156,33 @@
11842
12156
 
11843
12157
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
11844
12158
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12159
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12160
+ <!-- <test><xsl:copy-of select="."/></test> -->
12161
+
11845
12162
  <xsl:variable name="target" select="@target"/>
12163
+
11846
12164
  <xsl:for-each select="*[local-name() = 'tab']">
12165
+
12166
+ <xsl:if test="position() = 1">
12167
+ <!-- first column (data before first `tab`) -->
12168
+ <fo:table-cell>
12169
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
12170
+ <xsl:call-template name="insert_basic_link">
12171
+ <xsl:with-param name="element">
12172
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
12173
+ <xsl:for-each select="preceding-sibling::node()">
12174
+ <xsl:choose>
12175
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12176
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
12177
+ </xsl:choose>
12178
+ </xsl:for-each>
12179
+ </fo:basic-link>
12180
+ </xsl:with-param>
12181
+ </xsl:call-template>
12182
+ </fo:block>
12183
+ </fo:table-cell>
12184
+ </xsl:if>
12185
+
11847
12186
  <xsl:variable name="current_id" select="generate-id()"/>
11848
12187
  <fo:table-cell>
11849
12188
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -11894,11 +12233,25 @@
11894
12233
 
11895
12234
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
11896
12235
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
12236
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
11897
12237
  <xsl:for-each select="*[local-name() = 'tab']">
12238
+ <xsl:if test="position() = 1">
12239
+ <td>
12240
+ <xsl:for-each select="preceding-sibling::node()">
12241
+ <xsl:choose>
12242
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12243
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
12244
+ </xsl:choose>
12245
+ </xsl:for-each>
12246
+ </td>
12247
+ </xsl:if>
11898
12248
  <xsl:variable name="current_id" select="generate-id()"/>
11899
12249
  <td>
11900
12250
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
11901
- <xsl:copy-of select="."/>
12251
+ <xsl:choose>
12252
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
12253
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
12254
+ </xsl:choose>
11902
12255
  </xsl:for-each>
11903
12256
  </td>
11904
12257
  </xsl:for-each>
@@ -12766,6 +13119,9 @@
12766
13119
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_step1"/>
12767
13120
  <xsl:template match="*[local-name() = 'svgmap']" mode="update_xml_pres"/>
12768
13121
 
13122
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_step1"/>
13123
+ <xsl:template match="*[local-name() = 'review-container']" mode="update_xml_pres"/>
13124
+
12769
13125
  <!-- END: update new Presentation XML -->
12770
13126
 
12771
13127
  <!-- =========================================================================== -->
@@ -13289,6 +13645,7 @@
13289
13645
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
13290
13646
  </fn>
13291
13647
  -->
13648
+ <!-- fn in text -->
13292
13649
  <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">
13293
13650
  <xsl:variable name="p_fn_">
13294
13651
  <xsl:call-template name="get_fn_list"/>