metanorma-iso 3.0.1 → 3.0.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.
@@ -4410,10 +4410,6 @@
4410
4410
 
4411
4411
  </xsl:template>
4412
4412
 
4413
- <xsl:template match="iso:p/iso:fn/iso:p">
4414
- <xsl:apply-templates/>
4415
- </xsl:template>
4416
-
4417
4413
  <!-- For express listings PDF attachments -->
4418
4414
  <xsl:template match="*[local-name() = 'eref'][java:endsWith(java:java.lang.String.new(@bibitemid),'.exp')]" priority="2">
4419
4415
  <fo:inline xsl:use-attribute-sets="eref-style">
@@ -6633,14 +6629,18 @@
6633
6629
  </xsl:template>
6634
6630
 
6635
6631
  <xsl:attribute-set name="table-fn-number-style">
6632
+ <!-- <xsl:attribute name="padding-right">5mm</xsl:attribute> -->
6633
+
6634
+ </xsl:attribute-set> <!-- table-fn-number-style -->
6635
+
6636
+ <xsl:attribute-set name="table-fmt-fn-label-style">
6636
6637
  <xsl:attribute name="font-size">80%</xsl:attribute>
6637
- <xsl:attribute name="padding-right">5mm</xsl:attribute>
6638
6638
 
6639
6639
  <xsl:attribute name="alignment-baseline">hanging</xsl:attribute>
6640
6640
 
6641
- </xsl:attribute-set> <!-- table-fn-number-style -->
6641
+ </xsl:attribute-set> <!-- table-fmt-fn-label-style -->
6642
6642
 
6643
- <xsl:template name="refine_table-fn-number-style">
6643
+ <xsl:template name="refine_table-fmt-fn-label-style">
6644
6644
 
6645
6645
  <xsl:if test="$layoutVersion = '2024'">
6646
6646
  <xsl:attribute name="alignment-baseline">auto</xsl:attribute>
@@ -6660,11 +6660,18 @@
6660
6660
  </xsl:attribute-set>
6661
6661
 
6662
6662
  <xsl:attribute-set name="figure-fn-number-style">
6663
- <xsl:attribute name="font-size">80%</xsl:attribute>
6664
6663
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
6664
+ </xsl:attribute-set> <!-- figure-fn-number-style -->
6665
+
6666
+ <xsl:attribute-set name="figure-fmt-fn-label-style">
6667
+ <xsl:attribute name="font-size">80%</xsl:attribute>
6665
6668
  <xsl:attribute name="vertical-align">super</xsl:attribute>
6666
6669
 
6667
- </xsl:attribute-set>
6670
+ </xsl:attribute-set> <!-- figure-fmt-fn-label-style -->
6671
+
6672
+ <xsl:template name="refine_figure-fmt-fn-label-style">
6673
+
6674
+ </xsl:template>
6668
6675
 
6669
6676
  <xsl:attribute-set name="figure-fn-body-style">
6670
6677
  <xsl:attribute name="text-align">justify</xsl:attribute>
@@ -8267,9 +8274,13 @@
8267
8274
 
8268
8275
  <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']"/>
8269
8276
  <xsl:if test="$isNoteOrFnExist = 'true'">
8270
-
8271
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
8272
-
8277
+ <!-- <xsl:choose>
8278
+ <xsl:when test="$namespace = 'plateau'"></xsl:when>
8279
+ <xsl:otherwise>
8280
+
8281
+ </xsl:otherwise>
8282
+ </xsl:choose> -->
8283
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
8273
8284
  </xsl:if>
8274
8285
 
8275
8286
  <xsl:choose>
@@ -8316,7 +8327,7 @@
8316
8327
  <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
8317
8328
  </xsl:when>
8318
8329
  <xsl:otherwise>
8319
- <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 -->
8330
+ <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 -->
8320
8331
  </xsl:otherwise>
8321
8332
  </xsl:choose>
8322
8333
 
@@ -8327,13 +8338,26 @@
8327
8338
 
8328
8339
  <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
8329
8340
 
8330
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
8331
- <xsl:call-template name="insertTableFooterInSeparateTable">
8332
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
8333
- <xsl:with-param name="colwidths" select="$colwidths"/>
8334
- <xsl:with-param name="colgroup" select="$colgroup"/>
8335
- </xsl:call-template>
8336
- </xsl:for-each>
8341
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171 -->
8342
+
8343
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
8344
+ <xsl:call-template name="insertTableFooterInSeparateTable">
8345
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
8346
+ <xsl:with-param name="colwidths" select="$colwidths"/>
8347
+ <xsl:with-param name="colgroup" select="$colgroup"/>
8348
+ </xsl:call-template>
8349
+ </xsl:for-each>
8350
+
8351
+ <!-- https://github.com/metanorma/metanorma-plateau/issues/171
8352
+ <xsl:if test="$namespace = 'plateau'">
8353
+ <xsl:apply-templates select="*[not(local-name()='thead') and not(local-name()='tbody') and not(local-name()='tfoot') and not(local-name()='name')]" />
8354
+ <xsl:for-each select="*[local-name()='tbody']"> - select context to tbody -
8355
+ <xsl:variable name="table_fn_block">
8356
+ <xsl:call-template name="table_fn_display" />
8357
+ </xsl:variable>
8358
+ <xsl:copy-of select="$table_fn_block"/>
8359
+ </xsl:for-each>
8360
+ </xsl:if> -->
8337
8361
 
8338
8362
  <xsl:if test="*[local-name()='bookmark']"> <!-- special case: table/bookmark -->
8339
8363
  <fo:block keep-with-previous="always" line-height="0.1">
@@ -9048,6 +9072,7 @@
9048
9072
  <xsl:with-param name="key">continued</xsl:with-param>
9049
9073
  </xsl:call-template>
9050
9074
  </xsl:variable>
9075
+
9051
9076
  <xsl:variable name="title_continued_in_parenthesis" select="concat('(',$title_continued_,')')"/>
9052
9077
  <xsl:variable name="title_continued">
9053
9078
  <xsl:value-of select="$title_continued_in_parenthesis"/>
@@ -9289,6 +9314,17 @@
9289
9314
  <xsl:attribute name="text-align">left</xsl:attribute>
9290
9315
  </xsl:if>
9291
9316
 
9317
+ <xsl:if test="$isGenerateTableIF = 'false'">
9318
+ <xsl:if test="@colspan and *[local-name() = 'note'][@type = 'units']">
9319
+ <xsl:attribute name="text-align">right</xsl:attribute>
9320
+ <xsl:attribute name="border">none</xsl:attribute>
9321
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
9322
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
9323
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
9324
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
9325
+ </xsl:if>
9326
+ </xsl:if>
9327
+
9292
9328
  <fo:block role="SKIP">
9293
9329
 
9294
9330
  <xsl:if test="$isGenerateTableIF = 'true'">
@@ -9307,7 +9343,8 @@
9307
9343
  </fo:table-cell>
9308
9344
  </xsl:template> <!-- td -->
9309
9345
 
9310
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
9346
+ <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
9347
+ <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">
9311
9348
 
9312
9349
  <fo:block xsl:use-attribute-sets="table-note-style">
9313
9350
  <xsl:copy-of select="@id"/>
@@ -9328,51 +9365,46 @@
9328
9365
 
9329
9366
  </xsl:template> <!-- table/note -->
9330
9367
 
9331
- <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name()='example']/*[local-name()='p']" priority="2">
9368
+ <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">
9332
9369
  <xsl:apply-templates/>
9333
9370
  </xsl:template>
9334
9371
 
9335
9372
  <!-- ===================== -->
9336
9373
  <!-- Footnotes processing -->
9337
9374
  <!-- ===================== -->
9375
+
9376
+ <!-- document text (not figures, or tables) footnotes -->
9377
+ <xsl:variable name="footnotes_">
9378
+ <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 -->
9379
+ <!-- <xsl:copy-of select="."/> -->
9380
+ <xsl:variable name="update_xml_step1">
9381
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
9382
+ </xsl:variable>
9383
+ <xsl:apply-templates select="xalan:nodeset($update_xml_step1)" mode="update_xml_enclose_keep-together_within-line"/>
9384
+ </xsl:for-each>
9385
+ </xsl:variable>
9386
+ <xsl:variable name="footnotes" select="xalan:nodeset($footnotes_)"/>
9387
+
9338
9388
  <!--
9339
9389
  <fn reference="1">
9340
9390
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
9341
9391
  </fn>
9342
9392
  -->
9343
- <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
9393
+ <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
9394
+ <!-- fn in text -->
9344
9395
  <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">
9345
9396
 
9346
- <!-- list of footnotes to calculate actual footnotes number -->
9397
+ <!-- list of unique footnotes -->
9347
9398
  <xsl:variable name="p_fn_">
9348
9399
  <xsl:call-template name="get_fn_list"/>
9349
- <!-- <xsl:choose>
9350
- <xsl:when test="$namespace = 'jis'">
9351
- <xsl:call-template name="get_fn_list_for_element"/>
9352
- </xsl:when>
9353
- <xsl:otherwise>
9354
- <xsl:call-template name="get_fn_list"/>
9355
- </xsl:otherwise>
9356
- </xsl:choose> -->
9357
9400
  </xsl:variable>
9358
9401
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
9359
9402
 
9360
9403
  <xsl:variable name="gen_id" select="generate-id(.)"/>
9361
- <xsl:variable name="lang" select="ancestor::*[local-name() = 'metanorma']/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
9362
- <xsl:variable name="reference_">
9363
- <xsl:value-of select="@reference"/>
9364
- <xsl:if test="normalize-space(@reference) = ''"><xsl:value-of select="$gen_id"/></xsl:if>
9365
- </xsl:variable>
9366
- <xsl:variable name="reference" select="normalize-space($reference_)"/>
9404
+
9367
9405
  <!-- fn sequence number in document -->
9368
- <xsl:variable name="current_fn_number">
9369
- <xsl:choose>
9370
- <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
9371
- <xsl:otherwise>
9372
- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
9373
- </xsl:otherwise>
9374
- </xsl:choose>
9375
- </xsl:variable>
9406
+ <xsl:variable name="current_fn_number" select="@reference"/>
9407
+
9376
9408
  <xsl:variable name="current_fn_number_text">
9377
9409
 
9378
9410
  <xsl:choose>
@@ -9383,19 +9415,13 @@
9383
9415
  <xsl:with-param name="count" select="$current_fn_number"/>
9384
9416
  </xsl:call-template>
9385
9417
  </xsl:when>
9386
- <xsl:otherwise><xsl:value-of select="$current_fn_number"/><xsl:text>)</xsl:text></xsl:otherwise>
9418
+ <xsl:otherwise><xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/></xsl:otherwise>
9387
9419
  </xsl:choose>
9388
9420
 
9389
9421
  </xsl:variable>
9390
9422
 
9391
- <xsl:variable name="ref_id">
9392
- <xsl:choose>
9393
- <xsl:when test="normalize-space(@ref_id) != ''"><xsl:value-of select="@ref_id"/></xsl:when>
9394
- <xsl:otherwise>
9395
- <xsl:value-of select="concat('footnote_', $lang, '_', $reference, '_', $current_fn_number)"/>
9396
- </xsl:otherwise>
9397
- </xsl:choose>
9398
- </xsl:variable>
9423
+ <xsl:variable name="ref_id" select="@target"/>
9424
+
9399
9425
  <xsl:variable name="footnote_inline">
9400
9426
  <fo:inline role="Reference">
9401
9427
 
@@ -9444,7 +9470,9 @@
9444
9470
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
9445
9471
  <xsl:copy-of select="$footnote_inline"/>
9446
9472
  </xsl:when>
9473
+ <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
9447
9474
  <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
9475
+
9448
9476
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
9449
9477
  <xsl:copy-of select="$footnote_inline"/>
9450
9478
  <fo:footnote-body role="Note">
@@ -9461,7 +9489,10 @@
9461
9489
  <xsl:value-of select="$current_fn_number_text"/>
9462
9490
 
9463
9491
  </fo:inline>
9464
- <xsl:apply-templates/>
9492
+ <!-- <xsl:apply-templates /> -->
9493
+ <!-- <ref_id><xsl:value-of select="$ref_id"/></ref_id>
9494
+ <here><xsl:copy-of select="$footnotes"/></here> -->
9495
+ <xsl:apply-templates select="$footnotes/*[local-name() = 'fmt-fn-body'][@id = $ref_id]"/>
9465
9496
  </xsl:variable>
9466
9497
 
9467
9498
  <fo:block xsl:use-attribute-sets="fn-body-style" role="SKIP">
@@ -9515,77 +9546,136 @@
9515
9546
  </xsl:choose>
9516
9547
  </xsl:template>
9517
9548
 
9518
- <xsl:template name="get_fn_list_for_element">
9519
- <xsl:choose>
9520
- <xsl:when test="@current_fn_number"> <!-- footnote reference number calculated already -->
9521
- <fn gen_id="{generate-id(.)}">
9522
- <xsl:copy-of select="@*"/>
9523
- <xsl:copy-of select="node()"/>
9524
- </fn>
9525
- </xsl:when>
9526
- <xsl:otherwise>
9527
- <xsl:for-each select="ancestor::*[local-name() = 'ul' or local-name() = 'ol'][1]">
9528
- <xsl:variable name="element_id" select="@id"/>
9529
- <xsl:for-each select=".//*[local-name() = 'fn'][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
9530
- <!-- copy unique fn -->
9531
- <fn gen_id="{generate-id(.)}">
9532
- <xsl:copy-of select="@*"/>
9533
- <xsl:copy-of select="node()"/>
9534
- </fn>
9535
- </xsl:for-each>
9536
- </xsl:for-each>
9537
- </xsl:otherwise>
9538
- </xsl:choose>
9539
- </xsl:template>
9540
9549
  <!-- ============================ -->
9541
9550
  <!-- table's footnotes rendering -->
9542
9551
  <!-- ============================ -->
9543
- <xsl:template name="table_fn_display">
9544
- <xsl:variable name="references">
9545
9552
 
9553
+ <!-- table/fmt-footnote-container -->
9554
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'fmt-footnote-container']"/>
9555
+
9556
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'fmt-footnote-container']">
9557
+ <xsl:for-each select=".">
9558
+ <xsl:call-template name="table_fn_display"/>
9559
+ </xsl:for-each>
9560
+ </xsl:template>
9561
+
9562
+ <xsl:template name="table_fn_display">
9563
+ <!-- <xsl:variable name="references">
9564
+ <xsl:if test="$namespace = 'bsi'">
9565
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) = 'name']">
9566
+ <xsl:call-template name="create_fn" />
9567
+ </xsl:for-each>
9568
+ </xsl:if>
9546
9569
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
9547
- <xsl:call-template name="create_fn"/>
9570
+ <xsl:call-template name="create_fn" />
9548
9571
  </xsl:for-each>
9549
- </xsl:variable>
9550
-
9551
- <xsl:for-each select="xalan:nodeset($references)//fn">
9572
+ </xsl:variable> -->
9573
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn">
9552
9574
  <xsl:variable name="reference" select="@reference"/>
9553
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
9575
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
9576
+ <xsl:for-each select="..//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
9554
9577
 
9555
9578
  <fo:block xsl:use-attribute-sets="table-fn-style">
9579
+ <xsl:copy-of select="@id"/>
9556
9580
  <xsl:call-template name="refine_table-fn-style"/>
9557
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
9558
- <xsl:call-template name="refine_table-fn-number-style"/>
9559
9581
 
9560
- <xsl:value-of select="@reference"/>
9561
-
9562
- <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
9563
- <!-- <xsl:if test="$namespace = 'itu'">
9564
- <xsl:text>)</xsl:text>
9565
- </xsl:if> -->
9582
+ <xsl:apply-templates select=".//*[local-name() = 'fmt-fn-label']">
9583
+ <xsl:with-param name="process">true</xsl:with-param>
9584
+ </xsl:apply-templates>
9566
9585
 
9567
- </fo:inline>
9568
9586
  <fo:inline xsl:use-attribute-sets="table-fn-body-style">
9569
- <xsl:copy-of select="./node()"/>
9587
+ <!-- <xsl:copy-of select="./node()"/> -->
9588
+ <xsl:apply-templates/>
9570
9589
  </fo:inline>
9571
9590
 
9572
9591
  </fo:block>
9573
9592
 
9574
- </xsl:if>
9593
+ <!-- </xsl:if> -->
9575
9594
  </xsl:for-each>
9576
9595
  </xsl:template> <!-- table_fn_display -->
9577
9596
 
9597
+ <!-- fmt-fn-body/fmt-fn-label in text -->
9598
+ <xsl:template match="*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"/>
9599
+
9600
+ <!-- table//fmt-fn-body//fmt-fn-label -->
9601
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
9602
+ <xsl:param name="process">false</xsl:param>
9603
+ <xsl:if test="$process = 'true'">
9604
+ <fo:inline xsl:use-attribute-sets="table-fn-number-style" role="SKIP">
9605
+
9606
+ <!-- tab is padding-right -->
9607
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
9608
+ <xsl:with-param name="process">true</xsl:with-param>
9609
+ </xsl:apply-templates>
9610
+
9611
+ <!-- <xsl:if test="$namespace = 'bipm'">
9612
+ <fo:inline font-style="normal">(</fo:inline>
9613
+ </xsl:if> -->
9614
+
9615
+ <!-- <xsl:if test="$namespace = 'plateau'">
9616
+ <xsl:text>※</xsl:text>
9617
+ </xsl:if> -->
9618
+
9619
+ <!-- <xsl:value-of select="@reference"/> -->
9620
+ <!-- <xsl:value-of select="normalize-space()"/> -->
9621
+ <xsl:apply-templates/>
9622
+
9623
+ <!-- <xsl:if test="$namespace = 'bipm'">
9624
+ <fo:inline font-style="normal">)</fo:inline>
9625
+ </xsl:if> -->
9626
+
9627
+ <!-- commented https://github.com/metanorma/isodoc/issues/614 -->
9628
+ <!-- <xsl:if test="$namespace = 'itu'">
9629
+ <xsl:text>)</xsl:text>
9630
+ </xsl:if> -->
9631
+
9632
+ <!-- <xsl:if test="$namespace = 'plateau'">
9633
+ <xsl:text>:</xsl:text>
9634
+ </xsl:if> -->
9635
+
9636
+ </fo:inline>
9637
+ </xsl:if>
9638
+ </xsl:template> <!-- fmt-fn-body//fmt-fn-label -->
9639
+
9640
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
9641
+ <xsl:param name="process">false</xsl:param>
9642
+ <xsl:if test="$process = 'true'">
9643
+ <xsl:attribute name="padding-right">5mm</xsl:attribute>
9644
+
9645
+ </xsl:if>
9646
+ </xsl:template>
9647
+
9648
+ <xsl:template match="*[local-name() = 'table']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
9649
+ <fo:inline xsl:use-attribute-sets="table-fmt-fn-label-style" role="SKIP">
9650
+ <xsl:call-template name="refine_table-fmt-fn-label-style"/>
9651
+ <xsl:apply-templates/>
9652
+ </fo:inline>
9653
+ </xsl:template>
9654
+
9655
+ <!-- <xsl:template match="*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']"/> -->
9656
+ <!--
9578
9657
  <xsl:template name="create_fn">
9579
9658
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
9580
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
9659
+ <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> - for footnotes in tables -
9581
9660
  <xsl:attribute name="id">
9582
9661
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9583
9662
  </xsl:attribute>
9584
9663
  </xsl:if>
9585
-
9586
- <xsl:apply-templates/>
9664
+ <xsl:if test="$namespace = 'itu'">
9665
+ <xsl:if test="ancestor::*[local-name()='preface']">
9666
+ <xsl:attribute name="preface">true</xsl:attribute>
9667
+ </xsl:if>
9668
+ </xsl:if>
9669
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9670
+ <xsl:attribute name="id">
9671
+ <xsl:value-of select="@reference"/>
9672
+ <xsl:text>_</xsl:text>
9673
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9674
+ </xsl:attribute>
9675
+ </xsl:if>
9676
+ <xsl:apply-templates />
9587
9677
  </fn>
9588
- </xsl:template>
9678
+ </xsl:template> -->
9589
9679
 
9590
9680
  <!-- footnotes for table's name rendering -->
9591
9681
  <xsl:template name="table_name_fn_display">
@@ -9604,123 +9694,171 @@
9604
9694
  <!-- ============================ -->
9605
9695
  <!-- figure's footnotes rendering -->
9606
9696
  <!-- ============================ -->
9607
- <xsl:template name="fn_display_figure"> <!-- figure_fn_display -->
9608
9697
 
9609
- <!-- current figure id -->
9610
- <xsl:variable name="figure_id_">
9611
- <xsl:value-of select="@id"/>
9612
- <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
9613
- </xsl:variable>
9614
- <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
9698
+ <!-- figure/fmt-footnote-container -->
9699
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-footnote-container']"/>
9700
+
9701
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
9702
+ <xsl:template name="figure_fn_display">
9615
9703
 
9616
- <!-- all footnotes relates to the current figure -->
9617
9704
  <xsl:variable name="references">
9618
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
9619
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
9620
- <xsl:apply-templates/>
9621
- </fn>
9705
+ <xsl:for-each select="./*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body']">
9706
+ <xsl:variable name="curr_id" select="@id"/>
9707
+ <!-- <curr_id><xsl:value-of select="$curr_id"/></curr_id>
9708
+ <curr><xsl:copy-of select="."/></curr>
9709
+ <ancestor><xsl:copy-of select="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn']]]"/></ancestor> -->
9710
+ <xsl:choose>
9711
+ <!-- skip figure/name/fn -->
9712
+ <xsl:when test="ancestor::*[local-name() = 'figure'][.//*[local-name() = 'name'][.//*[local-name() = 'fn'][@target = $curr_id]]]"><!-- skip --></xsl:when>
9713
+ <xsl:otherwise>
9714
+ <xsl:element name="figure" namespace="{$namespace_full}">
9715
+ <xsl:element name="fmt-footnote-container" namespace="{$namespace_full}">
9716
+ <xsl:copy-of select="."/>
9717
+ </xsl:element>
9718
+ </xsl:element>
9719
+ </xsl:otherwise>
9720
+ </xsl:choose>
9622
9721
  </xsl:for-each>
9623
9722
  </xsl:variable>
9723
+ <!-- <references><xsl:copy-of select="$references"/></references> -->
9624
9724
 
9625
- <xsl:if test="xalan:nodeset($references)//fn">
9725
+ <xsl:if test="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
9626
9726
 
9627
9727
  <xsl:variable name="key_iso">
9628
9728
  true
9629
9729
  </xsl:variable>
9630
9730
 
9631
9731
  <fo:block>
9732
+ <!-- current hierarchy is 'figure' element -->
9733
+ <xsl:variable name="following_dl_colwidths">
9734
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
9735
+ <xsl:variable name="simple-table">
9736
+ <!-- <xsl:variable name="doc_ns">
9737
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
9738
+ </xsl:variable>
9739
+ <xsl:variable name="ns">
9740
+ <xsl:choose>
9741
+ <xsl:when test="normalize-space($doc_ns) != ''">
9742
+ <xsl:value-of select="normalize-space($doc_ns)"/>
9743
+ </xsl:when>
9744
+ <xsl:otherwise>
9745
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
9746
+ </xsl:otherwise>
9747
+ </xsl:choose>
9748
+ </xsl:variable> -->
9632
9749
 
9633
- <!-- current hierarchy is 'figure' element -->
9634
- <xsl:variable name="following_dl_colwidths">
9635
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
9636
- <xsl:variable name="simple-table">
9637
- <!-- <xsl:variable name="doc_ns">
9638
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
9639
- </xsl:variable>
9640
- <xsl:variable name="ns">
9641
- <xsl:choose>
9642
- <xsl:when test="normalize-space($doc_ns) != ''">
9643
- <xsl:value-of select="normalize-space($doc_ns)"/>
9644
- </xsl:when>
9645
- <xsl:otherwise>
9646
- <xsl:value-of select="substring-before(name(/*), '-')"/>
9647
- </xsl:otherwise>
9648
- </xsl:choose>
9649
- </xsl:variable> -->
9750
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
9751
+ <tbody>
9752
+ <xsl:apply-templates mode="dl"/>
9753
+ </tbody>
9754
+ </xsl:for-each>
9755
+ </xsl:variable>
9650
9756
 
9651
- <xsl:for-each select="*[local-name() = 'dl'][1]">
9652
- <tbody>
9653
- <xsl:apply-templates mode="dl"/>
9654
- </tbody>
9655
- </xsl:for-each>
9656
- </xsl:variable>
9757
+ <xsl:call-template name="calculate-column-widths">
9758
+ <xsl:with-param name="cols-count" select="2"/>
9759
+ <xsl:with-param name="table" select="$simple-table"/>
9760
+ </xsl:call-template>
9657
9761
 
9658
- <xsl:call-template name="calculate-column-widths">
9659
- <xsl:with-param name="cols-count" select="2"/>
9660
- <xsl:with-param name="table" select="$simple-table"/>
9661
- </xsl:call-template>
9762
+ </xsl:if>
9763
+ </xsl:variable>
9662
9764
 
9663
- </xsl:if>
9664
- </xsl:variable>
9765
+ <xsl:variable name="maxlength_dt">
9766
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
9767
+ <xsl:call-template name="getMaxLength_dt"/>
9768
+ </xsl:for-each>
9769
+ </xsl:variable>
9665
9770
 
9666
- <xsl:variable name="maxlength_dt">
9667
- <xsl:for-each select="*[local-name() = 'dl'][1]">
9668
- <xsl:call-template name="getMaxLength_dt"/>
9669
- </xsl:for-each>
9670
- </xsl:variable>
9771
+ <fo:table width="95%" table-layout="fixed">
9772
+ <xsl:if test="normalize-space($key_iso) = 'true'">
9773
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
9671
9774
 
9672
- <fo:table width="95%" table-layout="fixed">
9673
- <xsl:if test="normalize-space($key_iso) = 'true'">
9674
- <xsl:attribute name="font-size">10pt</xsl:attribute>
9775
+ </xsl:if>
9776
+ <xsl:choose>
9777
+ <!-- if there 'dl', then set same columns width -->
9778
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
9779
+ <xsl:call-template name="setColumnWidth_dl">
9780
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
9781
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
9782
+ </xsl:call-template>
9783
+ </xsl:when>
9784
+ <xsl:otherwise>
9785
+ <fo:table-column column-width="5%"/>
9786
+ <fo:table-column column-width="95%"/>
9787
+ </xsl:otherwise>
9788
+ </xsl:choose>
9789
+ <fo:table-body>
9790
+ <!-- <xsl:for-each select="xalan:nodeset($references)//fn"> -->
9791
+ <xsl:for-each select="xalan:nodeset($references)//*[local-name() = 'fmt-fn-body']">
9675
9792
 
9676
- </xsl:if>
9677
- <xsl:choose>
9678
- <!-- if there 'dl', then set same columns width -->
9679
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
9680
- <xsl:call-template name="setColumnWidth_dl">
9681
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
9682
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
9683
- </xsl:call-template>
9684
- </xsl:when>
9685
- <xsl:otherwise>
9686
- <fo:table-column column-width="5%"/>
9687
- <fo:table-column column-width="95%"/>
9688
- </xsl:otherwise>
9689
- </xsl:choose>
9690
- <fo:table-body>
9691
- <xsl:for-each select="xalan:nodeset($references)//fn">
9692
- <xsl:variable name="reference" select="@reference"/>
9693
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
9694
- <fo:table-row>
9695
- <fo:table-cell>
9696
- <fo:block>
9697
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
9698
- <xsl:value-of select="@reference"/>
9793
+ <xsl:variable name="reference" select="@reference"/>
9794
+ <!-- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> --> <!-- only unique reference puts in note-->
9795
+ <fo:table-row>
9796
+ <fo:table-cell>
9797
+ <fo:block>
9798
+
9799
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fmt-fn-label-style">
9800
+ <!-- <xsl:attribute name="padding-right">0mm</xsl:attribute> -->
9801
+ <!-- <xsl:value-of select="@reference"/> -->
9802
+ <xsl:value-of select="normalize-space(.//*[local-name() = 'fmt-fn-label'])"/>
9699
9803
  </fo:inline>
9700
- </fo:block>
9701
- </fo:table-cell>
9702
- <fo:table-cell>
9703
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
9704
- <xsl:if test="normalize-space($key_iso) = 'true'">
9705
9804
 
9706
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
9805
+ </fo:block>
9806
+ </fo:table-cell>
9807
+ <fo:table-cell>
9808
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
9809
+ <xsl:if test="normalize-space($key_iso) = 'true'">
9707
9810
 
9708
- </xsl:if>
9709
- <xsl:copy-of select="./node()"/>
9710
- </fo:block>
9711
- </fo:table-cell>
9712
- </fo:table-row>
9713
- </xsl:if>
9714
- </xsl:for-each>
9715
- </fo:table-body>
9716
- </fo:table>
9811
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
9812
+
9813
+ </xsl:if>
9717
9814
 
9815
+ <!-- <xsl:copy-of select="./node()"/> -->
9816
+ <xsl:apply-templates/>
9817
+ </fo:block>
9818
+ </fo:table-cell>
9819
+ </fo:table-row>
9820
+ <!-- </xsl:if> -->
9821
+ </xsl:for-each>
9822
+ </fo:table-body>
9823
+ </fo:table>
9718
9824
  </fo:block>
9719
9825
  </xsl:if>
9720
- </xsl:template> <!-- fn_display_figure -->
9826
+ </xsl:template> <!-- figure_fn_display -->
9827
+
9828
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']"> <!-- *[local-name() = 'fmt-footnote-container']/ -->
9829
+ <xsl:param name="process">false</xsl:param>
9830
+ <xsl:if test="$process = 'true'">
9831
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style" role="SKIP">
9832
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
9833
+
9834
+ <!-- tab is padding-right -->
9835
+ <xsl:apply-templates select=".//*[local-name() = 'tab']">
9836
+ <xsl:with-param name="process">true</xsl:with-param>
9837
+ </xsl:apply-templates>
9838
+
9839
+ <xsl:apply-templates/>
9840
+
9841
+ </fo:inline>
9842
+ </xsl:if>
9843
+ </xsl:template> <!-- figure//fmt-fn-body//fmt-fn-label -->
9844
+
9845
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'tab']" priority="5">
9846
+ <xsl:param name="process">false</xsl:param>
9847
+ <xsl:if test="$process = 'true'">
9848
+
9849
+ </xsl:if>
9850
+ </xsl:template>
9851
+
9852
+ <xsl:template match="*[local-name() = 'figure']//*[local-name() = 'fmt-fn-body']//*[local-name() = 'fmt-fn-label']//*[local-name() = 'sup']" priority="5">
9853
+ <fo:inline xsl:use-attribute-sets="figure-fmt-fn-label-style" role="SKIP">
9854
+ <xsl:call-template name="refine_figure-fmt-fn-label-style"/>
9855
+ <xsl:apply-templates/>
9856
+ </fo:inline>
9857
+ </xsl:template>
9721
9858
 
9722
9859
  <!-- added for https://github.com/metanorma/isodoc/issues/607 -->
9723
9860
  <!-- figure's footnote label -->
9861
+ <!-- figure/dl[@key = 'true']/dt/p/sup -->
9724
9862
  <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">
9725
9863
  <xsl:variable name="key_iso">
9726
9864
  true
@@ -9729,7 +9867,7 @@
9729
9867
  <xsl:attribute name="font-size">10pt</xsl:attribute>
9730
9868
 
9731
9869
  </xsl:if>
9732
- <fo:inline xsl:use-attribute-sets="figure-fn-number-style"> <!-- id="{@id}" -->
9870
+ <fo:inline xsl:use-attribute-sets="figure-fn-number-style figure-fmt-fn-label-style"> <!-- id="{@id}" -->
9733
9871
  <!-- <xsl:value-of select="@reference"/> -->
9734
9872
  <xsl:apply-templates/>
9735
9873
  </fo:inline>
@@ -9739,38 +9877,65 @@
9739
9877
  <!-- END: figure's footnotes rendering -->
9740
9878
  <!-- ============================ -->
9741
9879
 
9742
- <!-- fn reference in the text rendering (for instance, 'some text 1) some text' ) -->
9880
+ <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
9881
+ <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
9743
9882
  <xsl:template match="*[local-name()='fn']">
9744
9883
  <fo:inline xsl:use-attribute-sets="fn-reference-style">
9745
9884
 
9746
9885
  <xsl:call-template name="refine_fn-reference-style"/>
9747
9886
 
9748
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9749
- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
9750
- <xsl:attribute name="internal-destination">
9887
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9888
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
9889
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
9890
+ <!-- <xsl:attribute name="internal-destination">
9751
9891
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9752
9892
  </xsl:attribute>
9753
9893
  </xsl:if>
9894
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9895
+ <xsl:attribute name="internal-destination">
9896
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
9897
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9898
+ </xsl:attribute>
9899
+ </xsl:if> -->
9900
+ <!-- <xsl:if test="$namespace = 'plateau'">
9901
+ <xsl:text>※</xsl:text>
9902
+ </xsl:if> -->
9903
+ <!-- <xsl:value-of select="@reference"/> -->
9754
9904
 
9755
- <xsl:value-of select="@reference"/>
9905
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
9756
9906
 
9907
+ <!-- <xsl:if test="$namespace = 'bsi'">
9908
+ <xsl:text>)</xsl:text>
9909
+ </xsl:if> -->
9757
9910
  <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9758
9911
  <!-- <xsl:if test="$namespace = 'jis'">
9759
9912
  <fo:inline font-weight="normal">)</fo:inline>
9760
9913
  </xsl:if> -->
9761
9914
  </fo:basic-link>
9762
9915
  </fo:inline>
9763
- </xsl:template>
9916
+ </xsl:template> <!-- fn -->
9764
9917
 
9918
+ <!-- fn/text() -->
9765
9919
  <xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
9766
9920
  <fo:inline role="SKIP"><xsl:value-of select="."/></fo:inline>
9767
9921
  </xsl:template>
9768
9922
 
9769
- <xsl:template match="*[local-name()='fn']//*[local-name()='p']">
9923
+ <!-- fn//p fmt-fn-body//p -->
9924
+ <xsl:template match="*[local-name()='fn']//*[local-name()='p'] | *[local-name() = 'fmt-fn-body']//*[local-name()='p']">
9770
9925
  <fo:inline role="P">
9771
9926
  <xsl:apply-templates/>
9772
9927
  </fo:inline>
9773
9928
  </xsl:template>
9929
+
9930
+ <xsl:template name="insertFootnoteSeparatorCommon">
9931
+ <xsl:param name="leader_length">30%</xsl:param>
9932
+ <fo:static-content flow-name="xsl-footnote-separator">
9933
+ <fo:block>
9934
+ <fo:leader leader-pattern="rule" leader-length="{$leader_length}"/>
9935
+ </fo:block>
9936
+ </fo:static-content>
9937
+ </xsl:template>
9938
+
9774
9939
  <!-- ===================== -->
9775
9940
  <!-- END Footnotes processing -->
9776
9941
  <!-- ===================== -->
@@ -10055,11 +10220,11 @@
10055
10220
  <xsl:variable name="isContainsKeepTogetherTag" select="normalize-space($isContainsKeepTogetherTag_)"/>
10056
10221
  <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
10057
10222
 
10058
- <xsl:call-template name="setColumnWidth_dl">
10059
- <xsl:with-param name="colwidths" select="$colwidths"/>
10060
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
10061
- <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
10062
- </xsl:call-template>
10223
+ <xsl:call-template name="setColumnWidth_dl">
10224
+ <xsl:with-param name="colwidths" select="$colwidths"/>
10225
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
10226
+ <xsl:with-param name="isContainsKeepTogetherTag" select="$isContainsKeepTogetherTag"/>
10227
+ </xsl:call-template>
10063
10228
 
10064
10229
  <fo:table-body>
10065
10230
 
@@ -10093,6 +10258,14 @@
10093
10258
 
10094
10259
  </xsl:template> <!-- END: dl -->
10095
10260
 
10261
+ <xsl:template match="@*|node()" mode="dt_clean">
10262
+ <xsl:copy>
10263
+ <xsl:apply-templates select="@*|node()" mode="dt_clean"/>
10264
+ </xsl:copy>
10265
+ </xsl:template>
10266
+
10267
+ <xsl:template match="*[local-name() = 'asciimath']" mode="dt_clean"/>
10268
+
10096
10269
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
10097
10270
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
10098
10271
  <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
@@ -10132,10 +10305,12 @@
10132
10305
  <!-- ignore 'p' with 'where' in formula, before 'dl' -->
10133
10306
  <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
10134
10307
 
10308
+ <!-- dl/name -->
10135
10309
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
10136
10310
  <xsl:param name="process">false</xsl:param>
10137
10311
  <xsl:if test="$process = 'true'">
10138
10312
  <fo:block xsl:use-attribute-sets="dl-name-style">
10313
+
10139
10314
  <xsl:apply-templates/>
10140
10315
  </fo:block>
10141
10316
  </xsl:if>
@@ -10149,6 +10324,10 @@
10149
10324
  <!-- <colwidths><xsl:copy-of select="$colwidths"/></colwidths> -->
10150
10325
 
10151
10326
  <xsl:choose>
10327
+ <!-- <xsl:when test="@class = 'formula_dl' and local-name(..) = 'figure'">
10328
+ <fo:table-column column-width="10%"/>
10329
+ <fo:table-column column-width="90%"/>
10330
+ </xsl:when> -->
10152
10331
  <xsl:when test="xalan:nodeset($colwidths)/autolayout">
10153
10332
  <xsl:call-template name="insertTableColumnWidth">
10154
10333
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -12362,6 +12541,27 @@
12362
12541
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
12363
12542
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
12364
12543
  </xsl:when> -->
12544
+
12545
+ <!-- <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'))">
12546
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
12547
+ <xsl:variable name="filename">
12548
+ <xsl:call-template name="substring-after-last">
12549
+ <xsl:with-param name="value" select="$target_"/>
12550
+ <xsl:with-param name="delimiter" select="'/'"/>
12551
+ </xsl:call-template>
12552
+ </xsl:variable>
12553
+ <xsl:variable name="target_filepath" select="concat($inputxml_basepath, @target)"/>
12554
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($target_filepath)))"/>
12555
+ <xsl:choose>
12556
+ <xsl:when test="$file_exists = 'true'">
12557
+ <xsl:value-of select="concat('url(embedded-file:', $filename, ')')"/>
12558
+ </xsl:when>
12559
+ <xsl:otherwise>
12560
+ <xsl:value-of select="normalize-space(@target)"/>
12561
+ </xsl:otherwise>
12562
+ </xsl:choose>
12563
+ </xsl:when> -->
12564
+
12365
12565
  <xsl:otherwise>
12366
12566
  <xsl:value-of select="normalize-space(@target)"/>
12367
12567
  </xsl:otherwise>
@@ -12691,7 +12891,7 @@
12691
12891
  </xsl:if>
12692
12892
  </xsl:if>
12693
12893
 
12694
- </xsl:template>
12894
+ </xsl:template> <!-- refine_note_block_style -->
12695
12895
 
12696
12896
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']">
12697
12897
  <xsl:variable name="num"><xsl:number/></xsl:variable>
@@ -12889,10 +13089,21 @@
12889
13089
  </xsl:template>
12890
13090
 
12891
13091
  <xsl:template name="showFigureKey">
12892
- <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
12893
- <xsl:call-template name="note"/>
13092
+ <xsl:for-each select="*[(local-name() = 'note' and not(@type = 'units')) or local-name() = 'example']">
13093
+ <xsl:choose>
13094
+ <xsl:when test="local-name() = 'note'">
13095
+ <xsl:call-template name="note"/>
13096
+ </xsl:when>
13097
+ <xsl:when test="local-name() = 'example'">
13098
+ <xsl:call-template name="example"/>
13099
+ </xsl:when>
13100
+ <xsl:otherwise>
13101
+ <xsl:apply-templates select="."/>
13102
+ </xsl:otherwise>
13103
+ </xsl:choose>
12894
13104
  </xsl:for-each>
12895
- <xsl:call-template name="fn_display_figure"/>
13105
+ <!-- TO DO: remove, now the figure fn in figure/dl/... https://github.com/metanorma/isodoc/issues/658 -->
13106
+ <xsl:call-template name="figure_fn_display"/>
12896
13107
  </xsl:template>
12897
13108
 
12898
13109
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
@@ -13786,10 +13997,10 @@
13786
13997
  <xsl:when test="@type = 'section-title'">
13787
13998
  <xsl:value-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/preceding-sibling::node()"/>
13788
13999
  <xsl:text>: </xsl:text>
13789
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
14000
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
13790
14001
  </xsl:when>
13791
14002
  <xsl:otherwise>
13792
- <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name = 'fmt-xref-label')]"/>
14003
+ <xsl:copy-of select="*[local-name() = 'span'][@class = 'fmt-caption-delim'][1]/following-sibling::node()[not(local-name() = 'fmt-xref-label')]"/>
13793
14004
  </xsl:otherwise>
13794
14005
  </xsl:choose>
13795
14006
  </xsl:when>
@@ -14120,9 +14331,15 @@
14120
14331
  </xsl:if>
14121
14332
  </xsl:template>
14122
14333
 
14334
+ <!-- figure/fn -->
14123
14335
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
14124
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
14336
+ <!-- figure/note -->
14337
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
14338
+ <!-- figure/example -->
14339
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
14125
14340
 
14341
+ <!-- figure/note[@type = 'units'] -->
14342
+ <!-- image/note[@type = 'units'] -->
14126
14343
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
14127
14344
  <fo:block text-align="right" keep-with-next="always">
14128
14345
  <xsl:apply-templates/>
@@ -14243,6 +14460,7 @@
14243
14460
  </xsl:choose>
14244
14461
  </xsl:template>
14245
14462
 
14463
+ <!-- fn -->
14246
14464
  <xsl:template match="*[local-name() = 'fn']" mode="contents"/>
14247
14465
  <xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/>
14248
14466
 
@@ -15140,7 +15358,7 @@
15140
15358
  text line 1
15141
15359
  text line 2
15142
15360
  -->
15143
- <xsl:template match="*[local-name() = 'example']">
15361
+ <xsl:template match="*[local-name() = 'example']" name="example">
15144
15362
 
15145
15363
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
15146
15364
 
@@ -15251,6 +15469,7 @@
15251
15469
 
15252
15470
  </xsl:template>
15253
15471
 
15472
+ <!-- example/name -->
15254
15473
  <xsl:template match="*[local-name() = 'example']/*[local-name() = 'name']">
15255
15474
  <xsl:param name="fo_element">block</xsl:param>
15256
15475
 
@@ -15276,7 +15495,8 @@
15276
15495
 
15277
15496
  </xsl:template>
15278
15497
 
15279
- <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
15498
+ <!-- table/example/name, table/tfoot//example/name -->
15499
+ <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'tfoot']//*[local-name() = 'example']/*[local-name() = 'name']">
15280
15500
  <fo:inline xsl:use-attribute-sets="example-name-style">
15281
15501
 
15282
15502
  <xsl:apply-templates/>
@@ -16977,8 +17197,33 @@
16977
17197
 
16978
17198
  <xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
16979
17199
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
17200
+ <!-- New format: one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
17201
+ <!-- <test><xsl:copy-of select="."/></test> -->
17202
+
16980
17203
  <xsl:variable name="target" select="@target"/>
17204
+
16981
17205
  <xsl:for-each select="*[local-name() = 'tab']">
17206
+
17207
+ <xsl:if test="position() = 1">
17208
+ <!-- first column (data before first `tab`) -->
17209
+ <fo:table-cell>
17210
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
17211
+ <xsl:call-template name="insert_basic_link">
17212
+ <xsl:with-param name="element">
17213
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
17214
+ <xsl:for-each select="preceding-sibling::node()">
17215
+ <xsl:choose>
17216
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
17217
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
17218
+ </xsl:choose>
17219
+ </xsl:for-each>
17220
+ </fo:basic-link>
17221
+ </xsl:with-param>
17222
+ </xsl:call-template>
17223
+ </fo:block>
17224
+ </fo:table-cell>
17225
+ </xsl:if>
17226
+
16982
17227
  <xsl:variable name="current_id" select="generate-id()"/>
16983
17228
  <fo:table-cell>
16984
17229
  <fo:block line-height-shift-adjustment="disregard-shifts" role="SKIP">
@@ -17029,11 +17274,25 @@
17029
17274
 
17030
17275
  <xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
17031
17276
  <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
17277
+ <!-- New format - one tab <xref target="cgpm9th1948r6">&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
17032
17278
  <xsl:for-each select="*[local-name() = 'tab']">
17279
+ <xsl:if test="position() = 1">
17280
+ <td>
17281
+ <xsl:for-each select="preceding-sibling::node()">
17282
+ <xsl:choose>
17283
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
17284
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
17285
+ </xsl:choose>
17286
+ </xsl:for-each>
17287
+ </td>
17288
+ </xsl:if>
17033
17289
  <xsl:variable name="current_id" select="generate-id()"/>
17034
17290
  <td>
17035
17291
  <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
17036
- <xsl:copy-of select="."/>
17292
+ <xsl:choose>
17293
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
17294
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
17295
+ </xsl:choose>
17037
17296
  </xsl:for-each>
17038
17297
  </td>
17039
17298
  </xsl:for-each>
@@ -18553,6 +18812,7 @@
18553
18812
  <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
18554
18813
  </fn>
18555
18814
  -->
18815
+ <!-- fn in text -->
18556
18816
  <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">
18557
18817
  <xsl:variable name="p_fn_">
18558
18818
  <xsl:call-template name="get_fn_list"/>