metanorma-bipm 2.6.5 → 2.6.7

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.
@@ -1793,6 +1793,16 @@
1793
1793
  <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'source']" mode="flatxml_step1"/>
1794
1794
  <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'author']" mode="flatxml_step1"/>
1795
1795
  <xsl:template match="*[local-name() = 'amend']" mode="flatxml_step1"/>
1796
+ <!-- https://github.com/metanorma/isodoc/issues/687 -->
1797
+ <xsl:template match="*[local-name() = 'source']" mode="flatxml_step1"/>
1798
+
1799
+ <xsl:template match="*[local-name() = 'fmt-source']"/>
1800
+ <xsl:template match="*[local-name() = 'fmt-source']" mode="flatxml_step1">
1801
+ <xsl:element name="source" namespace="{$namespace_full}">
1802
+ <xsl:copy-of select="@*"/>
1803
+ <xsl:apply-templates mode="flatxml_step1"/>
1804
+ </xsl:element>
1805
+ </xsl:template>
1796
1806
 
1797
1807
  <xsl:template name="setCrossAlignAttributes">
1798
1808
  <xsl:variable name="is_cross_aligned">
@@ -4289,8 +4299,14 @@
4289
4299
  </xsl:choose>
4290
4300
  </xsl:variable>
4291
4301
 
4302
+ <xsl:call-template name="setNamedDestination"/>
4303
+
4292
4304
  <fo:block-container xsl:use-attribute-sets="table-container-style" role="SKIP">
4293
4305
 
4306
+ <xsl:for-each select="*[local-name() = 'name']">
4307
+ <xsl:call-template name="setIDforNamedDestination"/>
4308
+ </xsl:for-each>
4309
+
4294
4310
  <xsl:call-template name="refine_table-container-style">
4295
4311
  <xsl:with-param name="margin-side" select="$margin-side"/>
4296
4312
  </xsl:call-template>
@@ -4495,6 +4511,7 @@
4495
4511
  <!-- table/name-->
4496
4512
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
4497
4513
  <xsl:param name="continued"/>
4514
+ <xsl:param name="cols-count"/>
4498
4515
  <xsl:if test="normalize-space() != ''">
4499
4516
 
4500
4517
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -4518,9 +4535,30 @@
4518
4535
 
4519
4536
  <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
4520
4537
  <xsl:if test="$continued = 'true'">
4521
- <fo:block text-align="right">
4522
- <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
4523
- </fo:block>
4538
+
4539
+ <!-- to prevent the error 'THead element may contain only TR elements' -->
4540
+
4541
+ <xsl:choose>
4542
+ <xsl:when test="string(number($cols-count)) != 'NaN'">
4543
+ <fo:table width="100%" table-layout="fixed" role="SKIP">
4544
+ <fo:table-body role="SKIP">
4545
+ <fo:table-row>
4546
+ <fo:table-cell role="TH" number-columns-spanned="{$cols-count}">
4547
+ <fo:block text-align="right" role="SKIP">
4548
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
4549
+ </fo:block>
4550
+ </fo:table-cell>
4551
+ </fo:table-row>
4552
+ </fo:table-body>
4553
+ </fo:table>
4554
+ </xsl:when>
4555
+ <xsl:otherwise>
4556
+ <fo:block text-align="right">
4557
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
4558
+ </fo:block>
4559
+ </xsl:otherwise>
4560
+ </xsl:choose>
4561
+
4524
4562
  </xsl:if>
4525
4563
  <!-- </xsl:if> -->
4526
4564
 
@@ -4917,6 +4955,7 @@
4917
4955
 
4918
4956
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
4919
4957
  <xsl:with-param name="continued">true</xsl:with-param>
4958
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4920
4959
  </xsl:apply-templates>
4921
4960
 
4922
4961
  <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='name'])"> <!-- to prevent empty fo:table-cell in case of missing table's name -->
@@ -5095,7 +5134,10 @@
5095
5134
 
5096
5135
  <!-- if there isn't 'thead' and there is a table's title -->
5097
5136
  <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='thead']) and ancestor::*[local-name()='table']/*[local-name()='name']">
5098
- <fo:table-header role="Caption">
5137
+ <fo:table-header>
5138
+
5139
+ <xsl:attribute name="role">Caption</xsl:attribute>
5140
+
5099
5141
  <xsl:call-template name="table-header-title">
5100
5142
  <xsl:with-param name="cols-count" select="$cols-count"/>
5101
5143
  </xsl:call-template>
@@ -5349,8 +5391,8 @@
5349
5391
  <xsl:for-each select="xalan:nodeset($styles__)/item">
5350
5392
  <xsl:variable name="key" select="normalize-space(substring-before(., ':'))"/>
5351
5393
  <xsl:variable name="value" select="normalize-space(substring-after(translate(.,$quot,''), ':'))"/>
5352
- <xsl:if test="$key = 'color' or $key = 'background-color'">
5353
- <style name="{$key}"><xsl:value-of select="$value"/></style>
5394
+ <xsl:if test="$key = 'color' or $key = 'background-color' or $key = 'border' or $key = 'border-top' or $key = 'border-right' or $key = 'border-left' or $key = 'border-bottom' or $key = 'border-style' or $key = 'border-width' or $key = 'border-color' or $key = 'border-top-style' or $key = 'border-top-width' or $key = 'border-top-color' or $key = 'border-right-style' or $key = 'border-right-width' or $key = 'border-right-color' or $key = 'border-left-style' or $key = 'border-left-width' or $key = 'border-left-color' or $key = 'border-bottom-style' or $key = 'border-bottom-width' or $key = 'border-bottom-color'">
5395
+ <style name="{$key}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($value), 'currentColor', 'inherit')"/></style>
5354
5396
  </xsl:if>
5355
5397
  </xsl:for-each>
5356
5398
  </xsl:variable>
@@ -5414,6 +5456,7 @@
5414
5456
  <!-- table/note, table/example, table/tfoot//note, table/tfoot//example -->
5415
5457
  <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">
5416
5458
 
5459
+ <xsl:call-template name="setNamedDestination"/>
5417
5460
  <fo:block xsl:use-attribute-sets="table-note-style">
5418
5461
  <xsl:copy-of select="@id"/>
5419
5462
 
@@ -5939,7 +5982,7 @@
5939
5982
  <xsl:variable name="target" select="@target"/>
5940
5983
  <xsl:choose>
5941
5984
  <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
5942
- <xsl:when test="not(ancestor::*[local-name() = 'table'][1]/*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body'][@id = $target]) and $footnotes/*[local-name() = 'fmt-fn-body'][@id = $target]">
5985
+ <xsl:when test="not(ancestor::*[local-name() = 'table'][1]//*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body'][@id = $target]) and $footnotes/*[local-name() = 'fmt-fn-body'][@id = $target]">
5943
5986
  <xsl:call-template name="fn">
5944
5987
  <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
5945
5988
  </xsl:call-template>
@@ -6035,6 +6078,10 @@
6035
6078
  <!-- <dl><xsl:copy-of select="."/></dl> -->
6036
6079
  <fo:block-container xsl:use-attribute-sets="dl-block-style" role="SKIP">
6037
6080
 
6081
+ <xsl:if test="@key = 'true' and ancestor::*[local-name() = 'figure']">
6082
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
6083
+ </xsl:if>
6084
+
6038
6085
  <xsl:call-template name="setBlockSpanAll"/>
6039
6086
 
6040
6087
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -6332,7 +6379,7 @@
6332
6379
 
6333
6380
  <!-- caption for figure key and another caption, https://github.com/metanorma/isodoc/issues/607 -->
6334
6381
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'p'][@keep-with-next = 'true' and *[local-name() = 'strong']]" priority="3">
6335
- <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always">
6382
+ <fo:block text-align="left" margin-bottom="12pt" keep-with-next="always" keep-with-previous="always">
6336
6383
  <xsl:call-template name="refine_figure_key_style"/>
6337
6384
  <xsl:apply-templates/>
6338
6385
  </fo:block>
@@ -6593,6 +6640,7 @@
6593
6640
 
6594
6641
  <xsl:call-template name="refine_dt-cell-style"/>
6595
6642
 
6643
+ <xsl:call-template name="setNamedDestination"/>
6596
6644
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
6597
6645
 
6598
6646
  <xsl:choose>
@@ -7030,7 +7078,7 @@
7030
7078
  <!-- ================= -->
7031
7079
 
7032
7080
  <!-- highlight text -->
7033
- <xsl:template match="*[local-name()='hi']">
7081
+ <xsl:template match="*[local-name()='hi'] | *[local-name() = 'span'][@class = 'fmt-hi']" priority="3">
7034
7082
  <fo:inline background-color="yellow">
7035
7083
  <xsl:apply-templates/>
7036
7084
  </fo:inline>
@@ -8632,6 +8680,7 @@
8632
8680
  <!-- Appendix processing -->
8633
8681
  <!-- ======================== -->
8634
8682
  <xsl:template match="*[local-name()='appendix']">
8683
+ <xsl:call-template name="setNamedDestination"/>
8635
8684
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
8636
8685
  <xsl:apply-templates select="*[local-name()='title']"/>
8637
8686
  </fo:block>
@@ -8642,13 +8691,14 @@
8642
8691
  <xsl:variable name="level">
8643
8692
  <xsl:call-template name="getLevel"/>
8644
8693
  </xsl:variable>
8645
- <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
8694
+ <fo:inline role="H{$level}"><xsl:call-template name="setIDforNamedDestination"/><xsl:apply-templates/></fo:inline>
8646
8695
  </xsl:template>
8647
8696
  <!-- ======================== -->
8648
8697
  <!-- END Appendix processing -->
8649
8698
  <!-- ======================== -->
8650
8699
 
8651
8700
  <xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
8701
+ <xsl:call-template name="setNamedDestination"/>
8652
8702
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
8653
8703
  <xsl:apply-templates select="*[local-name()='name']"/>
8654
8704
  </fo:block>
@@ -8678,6 +8728,7 @@
8678
8728
  <xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
8679
8729
  <xsl:param name="callout"/>
8680
8730
  <fo:inline id="{@id}">
8731
+ <xsl:call-template name="setNamedDestination"/>
8681
8732
  <!-- for first p in annotation, put <x> -->
8682
8733
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
8683
8734
  <xsl:apply-templates/>
@@ -8724,6 +8775,7 @@
8724
8775
 
8725
8776
  </xsl:if>
8726
8777
  <fo:block-container margin-left="0mm" role="SKIP">
8778
+ <xsl:call-template name="setNamedDestination"/>
8727
8779
  <fo:block id="{@id}">
8728
8780
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
8729
8781
  </fo:block>
@@ -8769,8 +8821,13 @@
8769
8821
  </fo:block>
8770
8822
  </fo:table-cell>
8771
8823
  <fo:table-cell display-align="center">
8824
+
8772
8825
  <fo:block xsl:use-attribute-sets="formula-stem-number-style" role="SKIP">
8773
8826
 
8827
+ <xsl:for-each select="../*[local-name() = 'name']">
8828
+ <xsl:call-template name="setIDforNamedDestination"/>
8829
+ </xsl:for-each>
8830
+
8774
8831
  <xsl:call-template name="refine_formula-stem-number-style"/>
8775
8832
 
8776
8833
  <xsl:apply-templates select="../*[local-name() = 'name']"/>
@@ -8805,6 +8862,8 @@
8805
8862
 
8806
8863
  <xsl:template match="*[local-name() = 'note']" name="note">
8807
8864
 
8865
+ <xsl:call-template name="setNamedDestination"/>
8866
+
8808
8867
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
8809
8868
 
8810
8869
  <xsl:call-template name="setBlockSpanAll"/>
@@ -8869,6 +8928,7 @@
8869
8928
  </xsl:template>
8870
8929
 
8871
8930
  <xsl:template match="*[local-name() = 'termnote']">
8931
+ <xsl:call-template name="setNamedDestination"/>
8872
8932
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
8873
8933
 
8874
8934
  <xsl:call-template name="setBlockSpanAll"/>
@@ -8975,12 +9035,14 @@
8975
9035
 
8976
9036
  <xsl:template match="*[local-name() = 'terms']">
8977
9037
  <!-- <xsl:message>'terms' <xsl:number/> processing...</xsl:message> -->
9038
+ <xsl:call-template name="setNamedDestination"/>
8978
9039
  <fo:block id="{@id}">
8979
9040
  <xsl:apply-templates/>
8980
9041
  </fo:block>
8981
9042
  </xsl:template>
8982
9043
 
8983
9044
  <xsl:template match="*[local-name() = 'term']">
9045
+ <xsl:call-template name="setNamedDestination"/>
8984
9046
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
8985
9047
 
8986
9048
  <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'term'])">
@@ -9012,6 +9074,7 @@
9012
9074
  <xsl:template match="*[local-name() = 'figure']" name="figure">
9013
9075
  <xsl:variable name="isAdded" select="@added"/>
9014
9076
  <xsl:variable name="isDeleted" select="@deleted"/>
9077
+ <xsl:call-template name="setNamedDestination"/>
9015
9078
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
9016
9079
  <xsl:call-template name="refine_figure-block-style"/>
9017
9080
 
@@ -9028,6 +9091,11 @@
9028
9091
  </xsl:variable>
9029
9092
 
9030
9093
  <fo:block xsl:use-attribute-sets="figure-style" role="SKIP">
9094
+
9095
+ <xsl:for-each select="*[local-name() = 'name']"> <!-- set context -->
9096
+ <xsl:call-template name="setIDforNamedDestination"/>
9097
+ </xsl:for-each>
9098
+
9031
9099
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
9032
9100
  </fo:block>
9033
9101
 
@@ -9060,6 +9128,7 @@
9060
9128
  </xsl:template>
9061
9129
 
9062
9130
  <xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
9131
+ <xsl:call-template name="setNamedDestination"/>
9063
9132
  <fo:block id="{@id}">
9064
9133
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9065
9134
  </fo:block>
@@ -9073,6 +9142,7 @@
9073
9142
  </xsl:template>
9074
9143
 
9075
9144
  <!-- SOURCE: ... -->
9145
+ <!-- figure/source -->
9076
9146
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'source']" priority="2">
9077
9147
 
9078
9148
  <xsl:call-template name="termsource"/>
@@ -10305,6 +10375,7 @@
10305
10375
  <xsl:template match="title" mode="bookmark"/>
10306
10376
  <xsl:template match="text()" mode="bookmark"/>
10307
10377
 
10378
+ <!-- figure/name -->
10308
10379
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']">
10309
10380
  <xsl:if test="normalize-space() != ''">
10310
10381
  <fo:block xsl:use-attribute-sets="figure-name-style">
@@ -10317,11 +10388,11 @@
10317
10388
  </xsl:template>
10318
10389
 
10319
10390
  <!-- figure/fn -->
10320
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
10391
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'fn']" priority="2"/>
10321
10392
  <!-- figure/note -->
10322
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']" priority="2"/>
10393
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'note']" priority="2"/>
10323
10394
  <!-- figure/example -->
10324
- <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'example']" priority="2"/>
10395
+ <xsl:template match="*[local-name() = 'figure'][not(@class = 'pseudocode')]/*[local-name() = 'example']" priority="2"/>
10325
10396
 
10326
10397
  <!-- figure/note[@type = 'units'] -->
10327
10398
  <!-- image/note[@type = 'units'] -->
@@ -11020,6 +11091,7 @@
11020
11091
  <!-- permission -->
11021
11092
  <!-- ========== -->
11022
11093
  <xsl:template match="*[local-name() = 'permission']">
11094
+ <xsl:call-template name="setNamedDestination"/>
11023
11095
  <fo:block id="{@id}" xsl:use-attribute-sets="permission-style">
11024
11096
  <xsl:apply-templates select="*[local-name()='name']"/>
11025
11097
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -11028,10 +11100,12 @@
11028
11100
 
11029
11101
  <xsl:template match="*[local-name() = 'permission']/*[local-name() = 'name']">
11030
11102
  <xsl:if test="normalize-space() != ''">
11031
- <fo:block xsl:use-attribute-sets="permission-name-style">
11032
- <xsl:apply-templates/>
11033
11103
 
11034
- </fo:block>
11104
+ <fo:block xsl:use-attribute-sets="permission-name-style">
11105
+ <xsl:apply-templates/>
11106
+
11107
+ </fo:block>
11108
+
11035
11109
  </xsl:if>
11036
11110
  </xsl:template>
11037
11111
 
@@ -11047,6 +11121,7 @@
11047
11121
  <!-- requirement -->
11048
11122
  <!-- ========== -->
11049
11123
  <xsl:template match="*[local-name() = 'requirement']">
11124
+ <xsl:call-template name="setNamedDestination"/>
11050
11125
  <fo:block id="{@id}" xsl:use-attribute-sets="requirement-style">
11051
11126
  <xsl:apply-templates select="*[local-name()='name']"/>
11052
11127
  <xsl:apply-templates select="*[local-name()='label']"/>
@@ -11058,11 +11133,13 @@
11058
11133
 
11059
11134
  <xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'name']">
11060
11135
  <xsl:if test="normalize-space() != ''">
11061
- <fo:block xsl:use-attribute-sets="requirement-name-style">
11062
11136
 
11063
- <xsl:apply-templates/>
11137
+ <fo:block xsl:use-attribute-sets="requirement-name-style">
11138
+
11139
+ <xsl:apply-templates/>
11140
+
11141
+ </fo:block>
11064
11142
 
11065
- </fo:block>
11066
11143
  </xsl:if>
11067
11144
  </xsl:template>
11068
11145
 
@@ -11091,6 +11168,7 @@
11091
11168
  <!-- recommendation -->
11092
11169
  <!-- ========== -->
11093
11170
  <xsl:template match="*[local-name() = 'recommendation']">
11171
+ <xsl:call-template name="setNamedDestination"/>
11094
11172
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
11095
11173
  <xsl:apply-templates select="*[local-name()='name']"/>
11096
11174
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
@@ -11099,10 +11177,12 @@
11099
11177
 
11100
11178
  <xsl:template match="*[local-name() = 'recommendation']/*[local-name() = 'name']">
11101
11179
  <xsl:if test="normalize-space() != ''">
11102
- <fo:block xsl:use-attribute-sets="recommendation-name-style">
11103
- <xsl:apply-templates/>
11104
11180
 
11105
- </fo:block>
11181
+ <fo:block xsl:use-attribute-sets="recommendation-name-style">
11182
+ <xsl:apply-templates/>
11183
+
11184
+ </fo:block>
11185
+
11106
11186
  </xsl:if>
11107
11187
  </xsl:template>
11108
11188
 
@@ -11181,6 +11261,7 @@
11181
11261
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
11182
11262
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
11183
11263
  </xsl:if>
11264
+ <xsl:call-template name="setNamedDestination"/>
11184
11265
  <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
11185
11266
  <fo:table id="{@id}" table-layout="fixed" width="100%"> <!-- border="1pt solid black" -->
11186
11267
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -11290,6 +11371,7 @@
11290
11371
  <!-- termexample -->
11291
11372
  <!-- ====== -->
11292
11373
  <xsl:template match="*[local-name() = 'termexample']">
11374
+ <xsl:call-template name="setNamedDestination"/>
11293
11375
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
11294
11376
  <xsl:call-template name="refine_termexample-style"/>
11295
11377
  <xsl:call-template name="setBlockSpanAll"/>
@@ -11344,6 +11426,7 @@
11344
11426
  -->
11345
11427
  <xsl:template match="*[local-name() = 'example']" name="example">
11346
11428
 
11429
+ <xsl:call-template name="setNamedDestination"/>
11347
11430
  <fo:block-container id="{@id}" xsl:use-attribute-sets="example-style" role="SKIP">
11348
11431
 
11349
11432
  <xsl:call-template name="setBlockSpanAll"/>
@@ -11869,8 +11952,13 @@
11869
11952
  <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
11870
11953
 
11871
11954
  <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
11955
+
11872
11956
  <fo:block xsl:use-attribute-sets="term-name-style" role="SKIP">
11873
11957
 
11958
+ <xsl:for-each select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"><!-- change context -->
11959
+ <xsl:call-template name="setIDforNamedDestination"/>
11960
+ </xsl:for-each>
11961
+
11874
11962
  <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
11875
11963
  </fo:block>
11876
11964
  </xsl:if>
@@ -11990,6 +12078,7 @@
11990
12078
  <!-- main sections -->
11991
12079
  <xsl:template match="/*/*[local-name() = 'sections']/*" name="sections_node" priority="2">
11992
12080
 
12081
+ <xsl:call-template name="setNamedDestination"/>
11993
12082
  <fo:block>
11994
12083
  <xsl:call-template name="setId"/>
11995
12084
 
@@ -12033,6 +12122,7 @@
12033
12122
 
12034
12123
  <xsl:template match="//*[local-name() = 'metanorma']/*[local-name() = 'preface']/*" priority="2" name="preface_node"> <!-- /*/*[local-name() = 'preface']/* -->
12035
12124
 
12125
+ <xsl:call-template name="setNamedDestination"/>
12036
12126
  <fo:block>
12037
12127
  <xsl:call-template name="setId"/>
12038
12128
  <xsl:call-template name="addReviewHelper"/>
@@ -12061,6 +12151,7 @@
12061
12151
  </xsl:template>
12062
12152
 
12063
12153
  <xsl:template match="*[local-name() = 'clause'][normalize-space() != '' or *[local-name() = 'figure'] or @id]" name="template_clause"> <!-- if clause isn't empty -->
12154
+ <xsl:call-template name="setNamedDestination"/>
12064
12155
  <fo:block>
12065
12156
  <xsl:if test="parent::*[local-name() = 'copyright-statement']">
12066
12157
  <xsl:attribute name="role">SKIP</xsl:attribute>
@@ -12087,6 +12178,7 @@
12087
12178
  </xsl:template> <!-- refine_clause_style -->
12088
12179
 
12089
12180
  <xsl:template match="*[local-name() = 'definitions']">
12181
+ <xsl:call-template name="setNamedDestination"/>
12090
12182
  <fo:block id="{@id}">
12091
12183
  <xsl:apply-templates/>
12092
12184
  </fo:block>
@@ -12102,6 +12194,8 @@
12102
12194
  <xsl:otherwise>
12103
12195
 
12104
12196
  <fo:block break-after="page"/>
12197
+ <xsl:call-template name="setNamedDestination"/>
12198
+
12105
12199
  <fo:block id="{@id}">
12106
12200
 
12107
12201
  <xsl:call-template name="setBlockSpanAll"/>
@@ -12173,6 +12267,7 @@
12173
12267
  <!-- following-sibling::node()[1][local-name() = 'bookmark'][@id = $source] and
12174
12268
  following-sibling::node()[2][local-name() = 'fmt-review-end'][@source = $source] -->
12175
12269
  <!-- <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> -->
12270
+ <xsl:call-template name="setNamedDestination"/>
12176
12271
  <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>
12177
12272
  <!-- </xsl:if> -->
12178
12273
  </xsl:if>
@@ -12890,6 +12985,7 @@
12890
12985
  <!-- Normative references -->
12891
12986
  <xsl:template match="*[local-name() = 'references'][@normative='true']" priority="2">
12892
12987
 
12988
+ <xsl:call-template name="setNamedDestination"/>
12893
12989
  <fo:block id="{@id}">
12894
12990
  <xsl:apply-templates/>
12895
12991
 
@@ -12910,6 +13006,7 @@
12910
13006
  </xsl:if>
12911
13007
  </xsl:if> -->
12912
13008
 
13009
+ <xsl:call-template name="setNamedDestination"/>
12913
13010
  <fo:block id="{@id}"/>
12914
13011
 
12915
13012
  <xsl:apply-templates select="*[local-name() = 'title'][@columns = 1]"/>
@@ -12929,6 +13026,7 @@
12929
13026
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
12930
13027
  <xsl:param name="skip" select="normalize-space(preceding-sibling::*[1][local-name() = 'bibitem'] and 1 = 1)"/> <!-- current bibiitem is non-first -->
12931
13028
 
13029
+ <xsl:call-template name="setNamedDestination"/>
12932
13030
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
12933
13031
 
12934
13032
  <xsl:call-template name="processBibitem"/>
@@ -12942,6 +13040,7 @@
12942
13040
  <!-- $namespace = 'csd' or $namespace = 'gb' or $namespace = 'iec' or $namespace = 'ieee' or $namespace = 'iso' or $namespace = 'jcgm' or $namespace = 'm3d' or
12943
13041
  $namespace = 'mpfd' or $namespace = 'ogc' or $namespace = 'ogc-white-paper' -->
12944
13042
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
13043
+ <xsl:call-template name="setNamedDestination"/>
12945
13044
  <fo:list-block id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-style">
12946
13045
 
12947
13046
  <fo:list-item>
@@ -12971,6 +13070,7 @@
12971
13070
  <xsl:choose>
12972
13071
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
12973
13072
  <xsl:otherwise>
13073
+ <xsl:call-template name="setNamedDestination"/>
12974
13074
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
12975
13075
 
12976
13076
  <fo:list-item-label end-indent="label-end()">
@@ -13630,7 +13730,7 @@
13630
13730
  </xsl:template>
13631
13731
 
13632
13732
  <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
13633
- <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear' or @class = 'horizontal' or @class = 'norotate' or @class = 'halffontsize']" mode="update_xml_step1" priority="2">
13733
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear' or @class = 'fmt-hi' or @class = 'horizontal' or @class = 'norotate' or @class = 'halffontsize']" mode="update_xml_step1" priority="2">
13634
13734
  <xsl:copy>
13635
13735
  <xsl:copy-of select="@*"/>
13636
13736
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -13662,28 +13762,56 @@
13662
13762
  <xsl:template match="*[local-name() = 'stem']" mode="update_xml_step1"/>
13663
13763
  <xsl:template match="*[local-name() = 'stem']" mode="update_xml_pres"/>
13664
13764
 
13665
- <xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="update_xml_step1">
13765
+ <xsl:template match="*[local-name() = 'fmt-stem']" mode="update_xml_step1">
13666
13766
  <xsl:element name="stem" namespace="{$namespace_full}">
13667
13767
  <xsl:copy-of select="@*"/>
13668
13768
  <xsl:choose>
13669
13769
  <xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
13670
- <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
13770
+ <xsl:choose>
13771
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
13772
+ <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
13773
+ </xsl:when>
13774
+ <xsl:otherwise>
13775
+ <xsl:apply-templates select="*[local-name() = 'semx']/node()" mode="update_xml_step1"/>
13776
+ </xsl:otherwise>
13777
+ </xsl:choose>
13671
13778
  </xsl:when>
13672
13779
  <xsl:otherwise>
13673
- <xsl:copy-of select="node()"/>
13780
+ <xsl:choose>
13781
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
13782
+ <xsl:copy-of select="node()"/>
13783
+ </xsl:when>
13784
+ <xsl:otherwise>
13785
+ <xsl:apply-templates select="node()" mode="update_xml_step1"/>
13786
+ </xsl:otherwise>
13787
+ </xsl:choose>
13674
13788
  </xsl:otherwise>
13675
13789
  </xsl:choose>
13676
13790
  </xsl:element>
13677
13791
  </xsl:template>
13678
- <xsl:template match="*[local-name() = 'fmt-stem'][not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])]" mode="update_xml_pres">
13792
+ <xsl:template match="*[local-name() = 'fmt-stem']" mode="update_xml_pres">
13679
13793
  <xsl:element name="stem" namespace="{$namespace_full}">
13680
13794
  <xsl:copy-of select="@*"/>
13681
13795
  <xsl:choose>
13682
13796
  <xsl:when test="*[local-name() = 'semx'] and count(node()) = 1">
13683
- <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
13797
+ <xsl:choose>
13798
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
13799
+ <xsl:copy-of select="*[local-name() = 'semx']/node()"/>
13800
+ </xsl:when>
13801
+ <xsl:otherwise>
13802
+ <xsl:apply-templates select="*[local-name() = 'semx']/node()" mode="update_xml_pres"/>
13803
+ </xsl:otherwise>
13804
+ </xsl:choose>
13684
13805
  </xsl:when>
13685
13806
  <xsl:otherwise>
13686
- <xsl:copy-of select="node()"/>
13807
+ <xsl:choose>
13808
+ <xsl:when test="not(.//*[local-name() = 'passthrough']) and not(.//*[@linebreak])">
13809
+ <xsl:copy-of select="node()"/>
13810
+ </xsl:when>
13811
+ <xsl:otherwise>
13812
+ <xsl:apply-templates select="node()" mode="update_xml_pres"/>
13813
+ </xsl:otherwise>
13814
+ </xsl:choose>
13687
13815
  </xsl:otherwise>
13688
13816
  </xsl:choose>
13689
13817
  </xsl:element>
@@ -13778,6 +13906,9 @@
13778
13906
  <xsl:template match="*[local-name() = 'quote']/*[local-name() = 'author']" mode="update_xml_pres"/>
13779
13907
  <xsl:template match="*[local-name() = 'amend']" mode="update_xml_step1"/>
13780
13908
  <xsl:template match="*[local-name() = 'amend']" mode="update_xml_pres"/>
13909
+ <!-- https://github.com/metanorma/isodoc/issues/687 -->
13910
+ <xsl:template match="*[local-name() = 'source']" mode="update_xml_step1"/>
13911
+ <xsl:template match="*[local-name() = 'source']" mode="update_xml_pres"/>
13781
13912
 
13782
13913
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13783
13914
  <xsl:copy>
@@ -13912,16 +14043,24 @@
13912
14043
  <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_step1">
13913
14044
  <xsl:element name="title" namespace="{$namespace_full}">
13914
14045
  <xsl:copy-of select="@*"/>
14046
+ <xsl:call-template name="addNamedDestinationAttribute"/>
14047
+
13915
14048
  <xsl:apply-templates mode="update_xml_step1"/>
13916
14049
  </xsl:element>
13917
14050
  </xsl:template>
13918
14051
  <xsl:template match="*[local-name() = 'fmt-title']" mode="update_xml_pres">
13919
14052
  <xsl:element name="title" namespace="{$namespace_full}">
13920
14053
  <xsl:copy-of select="@*"/>
14054
+ <xsl:call-template name="addNamedDestinationAttribute"/>
14055
+
13921
14056
  <xsl:apply-templates mode="update_xml_pres"/>
13922
14057
  </xsl:element>
13923
14058
  </xsl:template>
13924
14059
 
14060
+ <xsl:template name="addNamedDestinationAttribute">
14061
+
14062
+ </xsl:template>
14063
+
13925
14064
  <xsl:template match="*[local-name() = 'fmt-name']"/>
13926
14065
  <xsl:template match="*[local-name() = 'fmt-name']" mode="update_xml_step1">
13927
14066
  <xsl:choose>
@@ -13931,6 +14070,8 @@
13931
14070
  <xsl:otherwise>
13932
14071
  <xsl:element name="name" namespace="{$namespace_full}">
13933
14072
  <xsl:copy-of select="@*"/>
14073
+ <xsl:call-template name="addNamedDestinationAttribute"/>
14074
+
13934
14075
  <xsl:apply-templates mode="update_xml_step1"/>
13935
14076
  </xsl:element>
13936
14077
  </xsl:otherwise>
@@ -13944,6 +14085,8 @@
13944
14085
  <xsl:otherwise>
13945
14086
  <xsl:element name="name" namespace="{$namespace_full}">
13946
14087
  <xsl:copy-of select="@*"/>
14088
+ <xsl:call-template name="addNamedDestinationAttribute"/>
14089
+
13947
14090
  <xsl:apply-templates mode="update_xml_pres"/>
13948
14091
  </xsl:element>
13949
14092
  </xsl:otherwise>
@@ -14048,6 +14191,20 @@
14048
14191
  </xsl:element>
14049
14192
  </xsl:template>
14050
14193
 
14194
+ <xsl:template match="*[local-name() = 'fmt-source']"/>
14195
+ <xsl:template match="*[local-name() = 'fmt-source']" mode="update_xml_step1">
14196
+ <xsl:element name="source" namespace="{$namespace_full}">
14197
+ <xsl:copy-of select="@*"/>
14198
+ <xsl:apply-templates mode="update_xml_step1"/>
14199
+ </xsl:element>
14200
+ </xsl:template>
14201
+ <xsl:template match="*[local-name() = 'fmt-source']" mode="update_xml_pres">
14202
+ <xsl:element name="source" namespace="{$namespace_full}">
14203
+ <xsl:copy-of select="@*"/>
14204
+ <xsl:apply-templates mode="update_xml_pres"/>
14205
+ </xsl:element>
14206
+ </xsl:template>
14207
+
14051
14208
  <xsl:template match="*[local-name() = 'span'][ @class = 'fmt-caption-label' or @class = 'fmt-element-name' or @class = 'fmt-caption-delim' or @class = 'fmt-autonum-delim']" mode="update_xml_step1" priority="3">
14052
14209
  <xsl:apply-templates mode="update_xml_step1"/>
14053
14210
  </xsl:template>
@@ -15399,6 +15556,30 @@
15399
15556
  </xsl:attribute>
15400
15557
  </xsl:template>
15401
15558
 
15559
+ <xsl:template name="setIDforNamedDestination">
15560
+ <xsl:if test="@named_dest">
15561
+ <xsl:attribute name="id"><xsl:value-of select="@named_dest"/></xsl:attribute>
15562
+ </xsl:if>
15563
+ </xsl:template>
15564
+
15565
+ <xsl:template name="setIDforNamedDestinationInline">
15566
+ <xsl:if test="@named_dest">
15567
+ <fo:inline><xsl:call-template name="setIDforNamedDestination"/></fo:inline>
15568
+ </xsl:if>
15569
+ </xsl:template>
15570
+
15571
+ <xsl:template name="setNamedDestination">
15572
+ <!-- skip GUID, e.g. _33eac3cb-9663-4291-ae26-1d4b6f4635fc -->
15573
+ <xsl:if test="@id and normalize-space(java:matches(java:java.lang.String.new(@id), '_[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}')) = 'false'">
15574
+ <fox:destination internal-destination="{@id}"/>
15575
+ </xsl:if>
15576
+ <xsl:for-each select=". | *[local-name() = 'title'] | *[local-name() = 'name']">
15577
+ <xsl:if test="@named_dest">
15578
+ <fox:destination internal-destination="{@named_dest}"/>
15579
+ </xsl:if>
15580
+ </xsl:for-each>
15581
+ </xsl:template>
15582
+
15402
15583
  <xsl:template name="add-letter-spacing">
15403
15584
  <xsl:param name="text"/>
15404
15585
  <xsl:param name="letter-spacing" select="'0.15'"/>