metanorma-cc 1.5.4 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6d45f32ac56da049460224a7b9a264fc302db06a9023abdda10b53ab8df4e18
4
- data.tar.gz: ac4e8e88813d02bca6a2fdbec491435cedd0f50de19d4de7e5cf67748341b0b5
3
+ metadata.gz: '01909c88a6295435f534845ce31ebf858ac2d4b50481d55d83d2bc7bb2912eb8'
4
+ data.tar.gz: ccd7bd40e4629e9de5a1a15d14bc86d553244e1a9b1f365bc4e3b1ae5eca91f9
5
5
  SHA512:
6
- metadata.gz: 67cbd5fcc368c00e569451d9842db371be1ad415a4bb74a318edee209bb8fbb982263b3879613cf957f9a13f006f90d638c57ca6e236b11b6c24fe5e026b853a
7
- data.tar.gz: 934db04e842a3a686d2bd30bf671e61f71456adc98605f48ad420e410197b2ee56fbfc575c207aac59ec1f25364990a56332977508a44ee1a8fa116a5e48b178
6
+ metadata.gz: ac51a2123bafb41d8d64f5cc8cc3d35963c89daafde6b7661d8d41bbf730c3a7a571ac03950eb18d3dae019e8ddf3cee967397b0d6499852efcca7381dcec954
7
+ data.tar.gz: 838cfefe10d28a04428101e5d50b107888ee331fcf1b578d362d74a8a0c29c375b978efb12d1b2098fe6fc9da3ab167f0cc524d2e77a305bc372f2f77aea0477
@@ -0,0 +1,62 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
9
+ pull_request:
10
+
11
+ jobs:
12
+ rake:
13
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ continue-on-error: ${{ matrix.experimental }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: [ '2.6', '2.5', '2.4' ]
20
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
21
+ experimental: [ false ]
22
+ include:
23
+ - ruby: '2.7'
24
+ os: 'ubuntu-latest'
25
+ experimental: true
26
+ - ruby: '2.7'
27
+ os: 'windows-latest'
28
+ experimental: true
29
+ - ruby: '2.7'
30
+ os: 'macos-latest'
31
+ experimental: true
32
+ steps:
33
+ - uses: actions/checkout@master
34
+
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+
39
+ - uses: actions/cache@v2
40
+ with:
41
+ path: vendor/bundle
42
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
43
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
44
+
45
+ - run: bundle config set path 'vendor/bundle'
46
+
47
+ - run: bundle install --jobs 4 --retry 3
48
+
49
+ - run: bundle exec rake
50
+
51
+ tests-passed:
52
+ needs: rake
53
+ runs-on: ubuntu-latest
54
+ steps:
55
+ - name: Trigger tests passed event
56
+ uses: Sibz/github-status-action@v1
57
+ with:
58
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
59
+ context: 'tests-passed-successfully'
60
+ description: 'Tests passed successfully'
61
+ state: 'success'
62
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -1,18 +1,14 @@
1
1
  = metanorma-cc: Metanorma processor for CalConnect standards
2
2
 
3
3
  image:https://img.shields.io/gem/v/metanorma-cc.svg["Gem Version", link="https://rubygems.org/gems/metanorma-cc"]
4
- image:https://github.com/metanorma/metanorma-cc/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-cc/actions?workflow=macos"]
5
- image:https://github.com/metanorma/metanorma-cc/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-cc/actions?workflow=ubuntu"]
6
- image:https://github.com/metanorma/metanorma-cc/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-cc/actions?workflow=windows"]
4
+ image:https://github.com/metanorma/metanorma-cc/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-cc/actions?workflow=rake"]
7
5
  image:https://codeclimate.com/github/metanorma/metanorma-cc/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-cc"]
8
6
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-cc.svg["Pull Requests", link="https://github.com/metanorma/metanorma-cc/pulls"]
9
7
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-cc/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-cc/releases"]
10
8
 
11
- _Formerly known as_ `asciidoctor-csd`, `metanorma-csd`.
12
-
13
9
  == Functionality
14
10
 
15
- This gem processes http://asciidoctor.org/[Asciidoctor] documents following
11
+ This gem processes https://www.metanorma.com/[Metanorma documents] following
16
12
  the Metanorma model for generating CalConnect Standards.
17
13
 
18
14
  The gem currently inherits from the https://github.com/metanorma/metanorma-standoc
@@ -59,3 +55,6 @@ See https://www.metanorma.com/author/cc/[Author CalConnect documents with Metano
59
55
  * Example documents are avalable at the https://github.com/metanorma/mn-samples-cc[mn-samples-cc] repository.
60
56
  * Document templates are available at the https://github.com/metanorma/mn-templates-cc[mn-templates-cc] repository.
61
57
 
58
+ == Notes
59
+
60
+ Metanorma-CC was formerly published as `asciidoctor-csd` and `metanorma-csd`.
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -737,6 +738,37 @@
737
738
  </optional>
738
739
  </element>
739
740
  </define>
741
+ <define name="index-xref">
742
+ <element name="index-xref">
743
+ <attribute name="also">
744
+ <data type="boolean"/>
745
+ </attribute>
746
+ <element name="primary">
747
+ <oneOrMore>
748
+ <ref name="PureTextElement"/>
749
+ </oneOrMore>
750
+ </element>
751
+ <optional>
752
+ <element name="secondary">
753
+ <oneOrMore>
754
+ <ref name="PureTextElement"/>
755
+ </oneOrMore>
756
+ </element>
757
+ </optional>
758
+ <optional>
759
+ <element name="tertiary">
760
+ <oneOrMore>
761
+ <ref name="PureTextElement"/>
762
+ </oneOrMore>
763
+ </element>
764
+ </optional>
765
+ <element name="target">
766
+ <oneOrMore>
767
+ <ref name="PureTextElement"/>
768
+ </oneOrMore>
769
+ </element>
770
+ </element>
771
+ </define>
740
772
  <!-- bare ID element, used for referencing arbitrary spans of text -->
741
773
  <define name="bookmark">
742
774
  <element name="bookmark">
@@ -86,7 +86,7 @@
86
86
  </element>
87
87
  </define>
88
88
  <define name="technical-committee">
89
- <element name="technical-committee">
89
+ <element name="committee">
90
90
  <optional>
91
91
  <attribute name="type"/>
92
92
  </optional>
@@ -4,24 +4,33 @@ require "isodoc/cc/word_convert"
4
4
  require "isodoc/cc/presentation_xml_convert"
5
5
  require "metanorma/cc"
6
6
  require "asciidoctor/standoc/converter"
7
- require "fileutils"
8
- require_relative "validate"
7
+ require 'asciidoctor/generic/converter'
9
8
  require_relative "validate_section"
10
- require_relative "front"
11
9
 
12
10
  module Asciidoctor
13
11
  module CC
14
-
15
- # A {Converter} implementation that generates CC output, and a document
16
- # schema encapsulation of the document for validation
17
- class Converter < Standoc::Converter
12
+ class Converter < Asciidoctor::Generic::Converter
18
13
  XML_ROOT_TAG = "csd-standard".freeze
19
14
  XML_NAMESPACE = "https://www.metanorma.org/ns/csd".freeze
20
15
 
21
16
  register_for "cc"
22
17
 
23
- def initialize(backend, opts)
24
- super
18
+ def configuration
19
+ Metanorma::CC.configuration
20
+ end
21
+
22
+ def metadata_committee(node, xml)
23
+ return unless node.attr("technical-committee")
24
+ xml.editorialgroup do |a|
25
+ a.committee node.attr("technical-committee"),
26
+ **attr_code(type: node.attr("technical-committee-type"))
27
+ i = 2
28
+ while node.attr("technical-committee_#{i}") do
29
+ a.committee node.attr("technical-committee_#{i}"),
30
+ **attr_code(type: node.attr("technical-committee-type_#{i}"))
31
+ i += 1
32
+ end
33
+ end
25
34
  end
26
35
 
27
36
  def outputs(node, ret)
@@ -35,28 +44,12 @@ module Asciidoctor
35
44
  nil, false, "#{@filename}.pdf")
36
45
  end
37
46
 
38
- def validate(doc)
39
- content_validate(doc)
40
- schema_validate(formattedstr_strip(doc.dup),
41
- File.join(File.dirname(__FILE__), "cc.rng"))
42
- end
43
-
44
- def sections_cleanup(x)
45
- super
46
- x.xpath("//*[@inline-header]").each do |h|
47
- h.delete("inline-header")
48
- end
49
- end
50
-
51
- def style(n, t)
52
- return
53
- end
54
-
55
47
  def html_converter(node)
56
48
  IsoDoc::CC::HtmlConvert.new(html_extract_attributes(node))
57
49
  end
58
50
 
59
51
  def pdf_converter(node)
52
+ return if node.attr("no-pdf")
60
53
  IsoDoc::CC::PdfConvert.new(html_extract_attributes(node))
61
54
  end
62
55
 
@@ -24,6 +24,14 @@
24
24
  <start>
25
25
  <ref name="standard-document"/>
26
26
  </start>
27
+ <define name="doctype">
28
+ <element name="doctype">
29
+ <optional>
30
+ <attribute name="abbreviation"/>
31
+ </optional>
32
+ <ref name="DocumentType"/>
33
+ </element>
34
+ </define>
27
35
  <define name="hyperlink">
28
36
  <element name="link">
29
37
  <attribute name="target">
@@ -42,7 +50,6 @@
42
50
  </define>
43
51
  <define name="xref">
44
52
  <element name="xref">
45
- <!-- attribute target { xsd:IDREF }, -->
46
53
  <attribute name="target">
47
54
  <data type="string">
48
55
  <param name="pattern">\i\c*|\c+#\c+</param>
@@ -142,6 +149,11 @@
142
149
  <data type="boolean"/>
143
150
  </attribute>
144
151
  </optional>
152
+ <optional>
153
+ <attribute name="key">
154
+ <data type="boolean"/>
155
+ </attribute>
156
+ </optional>
145
157
  <oneOrMore>
146
158
  <ref name="dt"/>
147
159
  <ref name="dd"/>
@@ -234,6 +246,9 @@
234
246
  <data type="boolean"/>
235
247
  </attribute>
236
248
  </optional>
249
+ <optional>
250
+ <ref name="colgroup"/>
251
+ </optional>
237
252
  <optional>
238
253
  <ref name="tname"/>
239
254
  </optional>
@@ -752,6 +767,18 @@
752
767
  </define>
753
768
  </include>
754
769
  <!-- end overrides -->
770
+ <define name="colgroup">
771
+ <element name="colgroup">
772
+ <oneOrMore>
773
+ <ref name="col"/>
774
+ </oneOrMore>
775
+ </element>
776
+ </define>
777
+ <define name="col">
778
+ <element name="col">
779
+ <attribute name="width"/>
780
+ </element>
781
+ </define>
755
782
  <define name="TextElement" combine="choice">
756
783
  <ref name="concept"/>
757
784
  </define>
@@ -1165,49 +1192,7 @@
1165
1192
  </define>
1166
1193
  <define name="annex">
1167
1194
  <element name="annex">
1168
- <optional>
1169
- <attribute name="id">
1170
- <data type="ID"/>
1171
- </attribute>
1172
- </optional>
1173
- <optional>
1174
- <attribute name="language"/>
1175
- </optional>
1176
- <optional>
1177
- <attribute name="script"/>
1178
- </optional>
1179
- <optional>
1180
- <attribute name="inline-header">
1181
- <data type="boolean"/>
1182
- </attribute>
1183
- </optional>
1184
- <attribute name="obligation">
1185
- <choice>
1186
- <value>normative</value>
1187
- <value>informative</value>
1188
- </choice>
1189
- </attribute>
1190
- <optional>
1191
- <ref name="section-title"/>
1192
- </optional>
1193
- <group>
1194
- <group>
1195
- <zeroOrMore>
1196
- <ref name="BasicBlock"/>
1197
- </zeroOrMore>
1198
- <zeroOrMore>
1199
- <ref name="note"/>
1200
- </zeroOrMore>
1201
- </group>
1202
- <zeroOrMore>
1203
- <choice>
1204
- <ref name="annex-subsection"/>
1205
- <ref name="terms"/>
1206
- <ref name="definitions"/>
1207
- <ref name="references"/>
1208
- </choice>
1209
- </zeroOrMore>
1210
- </group>
1195
+ <ref name="Annex-Section"/>
1211
1196
  </element>
1212
1197
  </define>
1213
1198
  <define name="terms">
@@ -1,8 +1,9 @@
1
1
  require "nokogiri"
2
+ require "metanorma-generic"
2
3
 
3
4
  module Asciidoctor
4
5
  module CC
5
- class Converter < Standoc::Converter
6
+ class Converter < Asciidoctor::Generic::Converter
6
7
  def section_validate(doc)
7
8
  advisory = doc.root.at("//bibdata/ext[doctype = 'advisory']")
8
9
  symbols_validate(doc.root) unless advisory
@@ -3,18 +3,8 @@ require "isodoc"
3
3
  module IsoDoc
4
4
  module CC
5
5
  module BaseConvert
6
- def cleanup(docxml)
7
- super
8
- term_cleanup(docxml)
9
- end
10
-
11
- def term_cleanup(docxml)
12
- docxml.xpath("//p[@class = 'Terms']").each do |d|
13
- h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
14
- h2.add_child("&nbsp;")
15
- h2.add_child(d.remove)
16
- end
17
- docxml
6
+ def configuration
7
+ Metanorma::CC.configuration
18
8
  end
19
9
  end
20
10
  end
@@ -37,7 +37,7 @@
37
37
 
38
38
  <xsl:template match="/">
39
39
  <xsl:call-template name="namespaceCheck"/>
40
- <fo:root font-family="SourceSansPro, STIX2Math, HanSans" font-size="10.5pt" xml:lang="{$lang}">
40
+ <fo:root font-family="Source Sans Pro, STIX Two Math, Source Han Sans" font-size="10.5pt" xml:lang="{$lang}">
41
41
  <fo:layout-master-set>
42
42
  <!-- Cover page -->
43
43
  <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
@@ -596,7 +596,7 @@
596
596
  <xsl:otherwise> <!-- for ordered lists -->
597
597
  <xsl:choose>
598
598
  <xsl:when test="../@type = 'arabic'">
599
- <xsl:number format="a)"/>
599
+ <xsl:number format="a)" lang="en"/>
600
600
  </xsl:when>
601
601
  <xsl:when test="../@type = 'alphabet'">
602
602
  <xsl:number format="1)"/>
@@ -828,7 +828,12 @@
828
828
 
829
829
 
830
830
  </title-toc>
831
- <title-toc lang="fr">Sommaire</title-toc>
831
+ <title-toc lang="fr">
832
+
833
+ <xsl:text>Sommaire</xsl:text>
834
+
835
+
836
+ </title-toc>
832
837
 
833
838
  <title-toc lang="zh">Contents</title-toc>
834
839
 
@@ -848,13 +853,22 @@
848
853
  <title-part lang="en">
849
854
 
850
855
 
856
+
851
857
  </title-part>
852
858
  <title-part lang="fr">
853
859
 
854
860
 
861
+
855
862
  </title-part>
856
863
  <title-part lang="zh">第 # 部分:</title-part>
857
864
 
865
+ <title-subpart lang="en">
866
+
867
+ </title-subpart>
868
+ <title-subpart lang="fr">
869
+
870
+ </title-subpart>
871
+
858
872
  <title-modified lang="en">modified</title-modified>
859
873
  <title-modified lang="fr">modifiée</title-modified>
860
874
 
@@ -916,10 +930,19 @@
916
930
 
917
931
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
918
932
  <xsl:param name="name"/>
919
- <xsl:variable name="lang">
920
- <xsl:call-template name="getLang"/>
933
+ <xsl:param name="lang"/>
934
+ <xsl:variable name="lang_">
935
+ <xsl:choose>
936
+ <xsl:when test="$lang != ''">
937
+ <xsl:value-of select="$lang"/>
938
+ </xsl:when>
939
+ <xsl:otherwise>
940
+ <xsl:call-template name="getLang"/>
941
+ </xsl:otherwise>
942
+ </xsl:choose>
921
943
  </xsl:variable>
922
- <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
944
+ <xsl:variable name="language" select="normalize-space($lang_)"/>
945
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $language]"/>
923
946
  <xsl:choose>
924
947
  <xsl:when test="normalize-space($title_) != ''">
925
948
  <xsl:value-of select="$title_"/>
@@ -943,7 +966,7 @@
943
966
 
944
967
 
945
968
 
946
- <xsl:attribute name="font-family">SourceCodePro</xsl:attribute>
969
+ <xsl:attribute name="font-family">Source Code Pro</xsl:attribute>
947
970
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
948
971
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
949
972
 
@@ -1069,6 +1092,7 @@
1069
1092
 
1070
1093
 
1071
1094
 
1095
+
1072
1096
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1073
1097
 
1074
1098
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1115,6 +1139,7 @@
1115
1139
 
1116
1140
 
1117
1141
 
1142
+
1118
1143
  </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
1119
1144
 
1120
1145
 
@@ -1190,6 +1215,7 @@
1190
1215
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1191
1216
 
1192
1217
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1218
+
1193
1219
 
1194
1220
 
1195
1221
 
@@ -1236,7 +1262,7 @@
1236
1262
 
1237
1263
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1238
1264
 
1239
- <xsl:attribute name="font-family">SourceCodePro</xsl:attribute>
1265
+ <xsl:attribute name="font-family">Source Code Pro</xsl:attribute>
1240
1266
 
1241
1267
 
1242
1268
 
@@ -1312,6 +1338,10 @@
1312
1338
 
1313
1339
 
1314
1340
 
1341
+ <!-- <xsl:if test="$namespace = 'bipm'">
1342
+ <fo:block>&#xA0;</fo:block>
1343
+ </xsl:if> -->
1344
+
1315
1345
  <!-- $namespace = 'iso' or -->
1316
1346
 
1317
1347
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -1344,11 +1374,14 @@
1344
1374
 
1345
1375
 
1346
1376
  <xsl:variable name="colwidths">
1347
- <xsl:call-template name="calculate-column-widths">
1348
- <xsl:with-param name="cols-count" select="$cols-count"/>
1349
- <xsl:with-param name="table" select="$simple-table"/>
1350
- </xsl:call-template>
1377
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1378
+ <xsl:call-template name="calculate-column-widths">
1379
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1380
+ <xsl:with-param name="table" select="$simple-table"/>
1381
+ </xsl:call-template>
1382
+ </xsl:if>
1351
1383
  </xsl:variable>
1384
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1352
1385
 
1353
1386
  <!-- <xsl:variable name="colwidths2">
1354
1387
  <xsl:call-template name="calculate-column-widths">
@@ -1369,30 +1402,100 @@
1369
1402
 
1370
1403
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1371
1404
 
1405
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1372
1406
 
1373
1407
 
1408
+
1409
+
1410
+
1374
1411
 
1375
1412
 
1376
-
1413
+
1377
1414
 
1378
1415
 
1379
1416
 
1380
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
1381
-
1382
-
1383
-
1417
+
1418
+
1419
+
1420
+
1421
+ <xsl:variable name="table_attributes">
1422
+ <attribute name="table-layout">fixed</attribute>
1423
+ <attribute name="width">100%</attribute>
1424
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1425
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1384
1426
 
1385
1427
 
1386
1428
 
1387
1429
 
1430
+
1431
+
1432
+
1388
1433
 
1434
+
1389
1435
 
1390
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1436
+ </xsl:variable>
1437
+
1438
+
1439
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1391
1440
 
1441
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1442
+ <xsl:attribute name="{@name}">
1443
+ <xsl:value-of select="."/>
1444
+ </xsl:attribute>
1445
+ </xsl:for-each>
1392
1446
 
1447
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1448
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1449
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1450
+ </xsl:if>
1393
1451
 
1452
+ <xsl:choose>
1453
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1454
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1455
+ <fo:table-column column-width="{@width}"/>
1456
+ </xsl:for-each>
1457
+ </xsl:when>
1458
+ <xsl:otherwise>
1459
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1460
+ <xsl:choose>
1461
+ <xsl:when test=". = 1 or . = 0">
1462
+ <fo:table-column column-width="proportional-column-width(2)"/>
1463
+ </xsl:when>
1464
+ <xsl:otherwise>
1465
+ <fo:table-column column-width="proportional-column-width({.})"/>
1466
+ </xsl:otherwise>
1467
+ </xsl:choose>
1468
+ </xsl:for-each>
1469
+ </xsl:otherwise>
1470
+ </xsl:choose>
1394
1471
 
1472
+ <xsl:choose>
1473
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1474
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1475
+ </xsl:when>
1476
+ <xsl:otherwise>
1477
+ <xsl:apply-templates/>
1478
+ </xsl:otherwise>
1479
+ </xsl:choose>
1395
1480
 
1481
+ </fo:table>
1482
+
1483
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1484
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1485
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1486
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1487
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1488
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1489
+ </xsl:call-template>
1490
+ </xsl:for-each>
1491
+
1492
+ <!-- insert footer as table -->
1493
+ <!-- <fo:table>
1494
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1495
+ <xsl:attribute name="{@name}">
1496
+ <xsl:value-of select="."/>
1497
+ </xsl:attribute>
1498
+ </xsl:for-each>
1396
1499
 
1397
1500
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
1398
1501
  <xsl:choose>
@@ -1404,17 +1507,7 @@
1404
1507
  </xsl:otherwise>
1405
1508
  </xsl:choose>
1406
1509
  </xsl:for-each>
1407
-
1408
- <xsl:choose>
1409
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1410
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1411
- </xsl:when>
1412
- <xsl:otherwise>
1413
- <xsl:apply-templates/>
1414
- </xsl:otherwise>
1415
- </xsl:choose>
1416
-
1417
- </fo:table>
1510
+ </fo:table>-->
1418
1511
 
1419
1512
 
1420
1513
 
@@ -1425,6 +1518,7 @@
1425
1518
  <xsl:if test="normalize-space() != ''">
1426
1519
  <fo:block xsl:use-attribute-sets="table-name-style">
1427
1520
 
1521
+
1428
1522
  <xsl:apply-templates/>
1429
1523
  </fo:block>
1430
1524
  </xsl:if>
@@ -1480,6 +1574,13 @@
1480
1574
  <xsl:for-each select="xalan:nodeset($table)//tr">
1481
1575
  <xsl:variable name="td_text">
1482
1576
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1577
+
1578
+ <!-- <xsl:if test="$namespace = 'bipm'">
1579
+ <xsl:for-each select="*[local-name()='td'][$curr-col]//*[local-name()='math']">
1580
+ <word><xsl:value-of select="normalize-space(.)"/></word>
1581
+ </xsl:for-each>
1582
+ </xsl:if> -->
1583
+
1483
1584
  </xsl:variable>
1484
1585
  <xsl:variable name="words">
1485
1586
  <xsl:variable name="string_with_added_zerospaces">
@@ -1539,11 +1640,14 @@
1539
1640
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
1540
1641
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1541
1642
  <xsl:value-of select="@target"/>
1643
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1644
+ <xsl:variable name="math_text" select="normalize-space(.)"/>
1645
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1542
1646
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1543
1647
  <xsl:param name="cols-count"/>
1544
1648
  <!-- font-weight="bold" -->
1545
1649
  <fo:table-header>
1546
-
1650
+
1547
1651
  <xsl:apply-templates/>
1548
1652
  </fo:table-header>
1549
1653
  </xsl:template><xsl:template name="table-header-title">
@@ -1568,6 +1672,13 @@
1568
1672
  </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
1569
1673
  <xsl:apply-templates/>
1570
1674
  </xsl:template><xsl:template name="insertTableFooter">
1675
+ <xsl:param name="cols-count"/>
1676
+ <xsl:if test="../*[local-name()='tfoot']">
1677
+ <fo:table-footer>
1678
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
1679
+ </fo:table-footer>
1680
+ </xsl:if>
1681
+ </xsl:template><xsl:template name="insertTableFooter2">
1571
1682
  <xsl:param name="cols-count"/>
1572
1683
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1573
1684
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
@@ -1589,11 +1700,29 @@
1589
1700
  <!-- fn will be processed inside 'note' processing -->
1590
1701
 
1591
1702
 
1703
+
1704
+
1705
+
1706
+
1592
1707
  <!-- except gb -->
1593
1708
 
1594
1709
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1595
1710
 
1596
1711
 
1712
+ <!-- show Note under table in preface (ex. abstract) sections -->
1713
+ <!-- empty, because notes show at page side in main sections -->
1714
+ <!-- <xsl:if test="$namespace = 'bipm'">
1715
+ <xsl:choose>
1716
+ <xsl:when test="ancestor::*[local-name()='preface']">
1717
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1718
+ </xsl:when>
1719
+ <xsl:otherwise>
1720
+ <fo:block/>
1721
+ </xsl:otherwise>
1722
+ </xsl:choose>
1723
+ </xsl:if> -->
1724
+
1725
+
1597
1726
  <!-- horizontal row separator -->
1598
1727
 
1599
1728
 
@@ -1607,6 +1736,107 @@
1607
1736
  </fo:table-footer>
1608
1737
 
1609
1738
  </xsl:if>
1739
+ </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1740
+ <xsl:param name="table_attributes"/>
1741
+ <xsl:param name="colwidths"/>
1742
+ <xsl:param name="colgroup"/>
1743
+
1744
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1745
+
1746
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1747
+
1748
+ <xsl:variable name="cols-count">
1749
+ <xsl:choose>
1750
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1751
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
1752
+ </xsl:when>
1753
+ <xsl:otherwise>
1754
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
1755
+ </xsl:otherwise>
1756
+ </xsl:choose>
1757
+ </xsl:variable>
1758
+
1759
+ <fo:table keep-with-previous="always">
1760
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1761
+ <xsl:choose>
1762
+ <xsl:when test="@name = 'border-top'">
1763
+ <xsl:attribute name="{@name}">0pt solid black</xsl:attribute>
1764
+ </xsl:when>
1765
+ <xsl:when test="@name = 'border'">
1766
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
1767
+ <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
1768
+ </xsl:when>
1769
+ <xsl:otherwise>
1770
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
1771
+ </xsl:otherwise>
1772
+ </xsl:choose>
1773
+ </xsl:for-each>
1774
+
1775
+ <xsl:choose>
1776
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1777
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
1778
+ <fo:table-column column-width="{@width}"/>
1779
+ </xsl:for-each>
1780
+ </xsl:when>
1781
+ <xsl:otherwise>
1782
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1783
+ <xsl:choose>
1784
+ <xsl:when test=". = 1 or . = 0">
1785
+ <fo:table-column column-width="proportional-column-width(2)"/>
1786
+ </xsl:when>
1787
+ <xsl:otherwise>
1788
+ <fo:table-column column-width="proportional-column-width({.})"/>
1789
+ </xsl:otherwise>
1790
+ </xsl:choose>
1791
+ </xsl:for-each>
1792
+ </xsl:otherwise>
1793
+ </xsl:choose>
1794
+
1795
+ <fo:table-body>
1796
+ <fo:table-row>
1797
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
1798
+
1799
+
1800
+
1801
+ <!-- fn will be processed inside 'note' processing -->
1802
+
1803
+
1804
+
1805
+
1806
+
1807
+
1808
+
1809
+ <!-- except gb -->
1810
+
1811
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1812
+
1813
+
1814
+ <!-- <xsl:if test="$namespace = 'bipm'">
1815
+ <xsl:choose>
1816
+ <xsl:when test="ancestor::*[local-name()='preface']">
1817
+ show Note under table in preface (ex. abstract) sections
1818
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1819
+ </xsl:when>
1820
+ <xsl:otherwise>
1821
+ empty, because notes show at page side in main sections
1822
+ <fo:block/>
1823
+ </xsl:otherwise>
1824
+ </xsl:choose>
1825
+ </xsl:if> -->
1826
+
1827
+
1828
+ <!-- horizontal row separator -->
1829
+
1830
+
1831
+ <!-- fn processing -->
1832
+ <xsl:call-template name="fn_display"/>
1833
+
1834
+ </fo:table-cell>
1835
+ </fo:table-row>
1836
+ </fo:table-body>
1837
+
1838
+ </fo:table>
1839
+ </xsl:if>
1610
1840
  </xsl:template><xsl:template match="*[local-name()='tbody']">
1611
1841
 
1612
1842
  <xsl:variable name="cols-count">
@@ -1659,8 +1889,12 @@
1659
1889
 
1660
1890
  </xsl:if>
1661
1891
 
1662
-
1663
-
1892
+
1893
+
1894
+
1895
+ <!-- <xsl:if test="$namespace = 'bipm'">
1896
+ <xsl:attribute name="height">8mm</xsl:attribute>
1897
+ </xsl:if> -->
1664
1898
 
1665
1899
  <xsl:apply-templates/>
1666
1900
  </fo:table-row>
@@ -1684,6 +1918,7 @@
1684
1918
 
1685
1919
 
1686
1920
 
1921
+
1687
1922
  <xsl:if test="@colspan">
1688
1923
  <xsl:attribute name="number-columns-spanned">
1689
1924
  <xsl:value-of select="@colspan"/>
@@ -1723,7 +1958,8 @@
1723
1958
 
1724
1959
 
1725
1960
 
1726
-
1961
+
1962
+
1727
1963
 
1728
1964
 
1729
1965
 
@@ -1741,7 +1977,8 @@
1741
1977
  </xsl:attribute>
1742
1978
  </xsl:if>
1743
1979
  <xsl:call-template name="display-align"/>
1744
- <fo:block>
1980
+ <fo:block>
1981
+
1745
1982
  <xsl:apply-templates/>
1746
1983
  </fo:block>
1747
1984
  </fo:table-cell>
@@ -1753,14 +1990,17 @@
1753
1990
 
1754
1991
 
1755
1992
 
1993
+
1994
+
1756
1995
  <fo:inline padding-right="2mm">
1757
1996
 
1758
1997
 
1759
1998
 
1760
-
1999
+
1761
2000
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
1762
2001
 
1763
2002
  </fo:inline>
2003
+
1764
2004
  <xsl:apply-templates mode="process"/>
1765
2005
  </fo:block>
1766
2006
 
@@ -1784,6 +2024,7 @@
1784
2024
 
1785
2025
 
1786
2026
 
2027
+
1787
2028
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
1788
2029
 
1789
2030
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -1793,12 +2034,15 @@
1793
2034
 
1794
2035
 
1795
2036
 
2037
+
1796
2038
  <xsl:value-of select="@reference"/>
1797
2039
 
2040
+
1798
2041
  </fo:inline>
1799
2042
  <fo:inline>
1800
2043
 
1801
- <xsl:apply-templates/>
2044
+ <!-- <xsl:apply-templates /> -->
2045
+ <xsl:copy-of select="./node()"/>
1802
2046
  </fo:inline>
1803
2047
  </fo:block>
1804
2048
  </xsl:if>
@@ -1835,7 +2079,20 @@
1835
2079
  <xsl:variable name="following_dl_colwidths">
1836
2080
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
1837
2081
  <xsl:variable name="html-table">
1838
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2082
+ <xsl:variable name="doc_ns">
2083
+
2084
+ </xsl:variable>
2085
+ <xsl:variable name="ns">
2086
+ <xsl:choose>
2087
+ <xsl:when test="normalize-space($doc_ns) != ''">
2088
+ <xsl:value-of select="normalize-space($doc_ns)"/>
2089
+ </xsl:when>
2090
+ <xsl:otherwise>
2091
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
2092
+ </xsl:otherwise>
2093
+ </xsl:choose>
2094
+ </xsl:variable>
2095
+ <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
1839
2096
  <xsl:element name="{$ns}:table">
1840
2097
  <xsl:for-each select="*[local-name() = 'dl'][1]">
1841
2098
  <tbody>
@@ -1900,7 +2157,8 @@
1900
2157
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
1901
2158
  </xsl:if>
1902
2159
 
1903
- <xsl:apply-templates/>
2160
+ <!-- <xsl:apply-templates /> -->
2161
+ <xsl:copy-of select="./node()"/>
1904
2162
  </fo:block>
1905
2163
  </fo:table-cell>
1906
2164
  </fo:table-row>
@@ -1919,9 +2177,12 @@
1919
2177
 
1920
2178
 
1921
2179
 
2180
+
1922
2181
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
1923
2182
 
2183
+
1924
2184
  <xsl:value-of select="@reference"/>
2185
+
1925
2186
  </fo:basic-link>
1926
2187
  </fo:inline>
1927
2188
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -1929,7 +2190,11 @@
1929
2190
  <xsl:apply-templates/>
1930
2191
  </fo:inline>
1931
2192
  </xsl:template><xsl:template match="*[local-name()='dl']">
1932
- <fo:block-container margin-left="0mm">
2193
+ <fo:block-container>
2194
+
2195
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2196
+
2197
+
1933
2198
  <xsl:if test="parent::*[local-name() = 'note']">
1934
2199
  <xsl:attribute name="margin-left">
1935
2200
  <xsl:choose>
@@ -1939,8 +2204,11 @@
1939
2204
  </xsl:attribute>
1940
2205
 
1941
2206
  </xsl:if>
1942
- <fo:block-container margin-left="0mm">
1943
-
2207
+ <fo:block-container>
2208
+
2209
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2210
+
2211
+
1944
2212
  <xsl:variable name="parent" select="local-name(..)"/>
1945
2213
 
1946
2214
  <xsl:variable name="key_iso">
@@ -1954,9 +2222,12 @@
1954
2222
  <fo:block margin-bottom="12pt" text-align="left">
1955
2223
 
1956
2224
  <xsl:variable name="title-where">
1957
- <xsl:call-template name="getTitle">
1958
- <xsl:with-param name="name" select="'title-where'"/>
1959
- </xsl:call-template>
2225
+
2226
+
2227
+ <xsl:call-template name="getTitle">
2228
+ <xsl:with-param name="name" select="'title-where'"/>
2229
+ </xsl:call-template>
2230
+
1960
2231
  </xsl:variable>
1961
2232
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
1962
2233
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -1972,9 +2243,12 @@
1972
2243
 
1973
2244
 
1974
2245
  <xsl:variable name="title-where">
1975
- <xsl:call-template name="getTitle">
1976
- <xsl:with-param name="name" select="'title-where'"/>
1977
- </xsl:call-template>
2246
+
2247
+
2248
+ <xsl:call-template name="getTitle">
2249
+ <xsl:with-param name="name" select="'title-where'"/>
2250
+ </xsl:call-template>
2251
+
1978
2252
  </xsl:variable>
1979
2253
  <xsl:value-of select="$title-where"/>
1980
2254
  </fo:block>
@@ -1985,9 +2259,12 @@
1985
2259
 
1986
2260
 
1987
2261
  <xsl:variable name="title-key">
1988
- <xsl:call-template name="getTitle">
1989
- <xsl:with-param name="name" select="'title-key'"/>
1990
- </xsl:call-template>
2262
+
2263
+
2264
+ <xsl:call-template name="getTitle">
2265
+ <xsl:with-param name="name" select="'title-key'"/>
2266
+ </xsl:call-template>
2267
+
1991
2268
  </xsl:variable>
1992
2269
  <xsl:value-of select="$title-key"/>
1993
2270
  </fo:block>
@@ -2019,7 +2296,20 @@
2019
2296
  </xsl:choose>
2020
2297
  <!-- create virtual html table for dl/[dt and dd] -->
2021
2298
  <xsl:variable name="html-table">
2022
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2299
+ <xsl:variable name="doc_ns">
2300
+
2301
+ </xsl:variable>
2302
+ <xsl:variable name="ns">
2303
+ <xsl:choose>
2304
+ <xsl:when test="normalize-space($doc_ns) != ''">
2305
+ <xsl:value-of select="normalize-space($doc_ns)"/>
2306
+ </xsl:when>
2307
+ <xsl:otherwise>
2308
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
2309
+ </xsl:otherwise>
2310
+ </xsl:choose>
2311
+ </xsl:variable>
2312
+ <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2023
2313
  <xsl:element name="{$ns}:table">
2024
2314
  <tbody>
2025
2315
  <xsl:apply-templates mode="dl"/>
@@ -2165,6 +2455,7 @@
2165
2455
 
2166
2456
 
2167
2457
 
2458
+
2168
2459
  <xsl:apply-templates/>
2169
2460
  <!-- <xsl:if test="$namespace = 'gb'">
2170
2461
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -2218,6 +2509,7 @@
2218
2509
  </fo:inline>
2219
2510
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
2220
2511
  <fo:inline font-weight="bold">
2512
+
2221
2513
  <xsl:apply-templates/>
2222
2514
  </fo:inline>
2223
2515
  </xsl:template><xsl:template match="*[local-name()='sup']">
@@ -2231,18 +2523,18 @@
2231
2523
  </xsl:template><xsl:template match="*[local-name()='tt']">
2232
2524
  <fo:inline xsl:use-attribute-sets="tt-style">
2233
2525
  <xsl:variable name="_font-size">
2234
-
2235
- 10
2236
-
2526
+
2527
+ 10
2528
+
2529
+
2530
+
2237
2531
 
2238
2532
 
2239
2533
 
2240
2534
 
2241
2535
 
2242
2536
 
2243
-
2244
2537
 
2245
-
2246
2538
 
2247
2539
 
2248
2540
  </xsl:variable>
@@ -2546,7 +2838,18 @@
2546
2838
  <xsl:with-param name="previousRow" select="$newRow"/>
2547
2839
  </xsl:apply-templates>
2548
2840
  </xsl:template><xsl:template name="getLang">
2549
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2841
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
2842
+ <xsl:variable name="language">
2843
+ <xsl:choose>
2844
+ <xsl:when test="$language_current != ''">
2845
+ <xsl:value-of select="$language_current"/>
2846
+ </xsl:when>
2847
+ <xsl:otherwise>
2848
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2849
+ </xsl:otherwise>
2850
+ </xsl:choose>
2851
+ </xsl:variable>
2852
+
2550
2853
  <xsl:choose>
2551
2854
  <xsl:when test="$language = 'English'">en</xsl:when>
2552
2855
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -2580,7 +2883,8 @@
2580
2883
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2581
2884
  <xsl:value-of select="substring($str, 2)"/>
2582
2885
  </xsl:template><xsl:template match="mathml:math">
2583
- <fo:inline font-family="STIX2Math">
2886
+ <fo:inline font-family="STIX Two Math"> <!-- -->
2887
+
2584
2888
  <xsl:variable name="mathml">
2585
2889
  <xsl:apply-templates select="." mode="mathml"/>
2586
2890
  </xsl:variable>
@@ -2610,6 +2914,7 @@
2610
2914
  </xsl:choose>
2611
2915
  </xsl:variable>
2612
2916
  <fo:inline xsl:use-attribute-sets="link-style">
2917
+
2613
2918
  <xsl:choose>
2614
2919
  <xsl:when test="$target = ''">
2615
2920
  <xsl:apply-templates/>
@@ -2663,10 +2968,14 @@
2663
2968
  </fo:inline>
2664
2969
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
2665
2970
  <xsl:variable name="title-modified">
2666
- <xsl:call-template name="getTitle">
2667
- <xsl:with-param name="name" select="'title-modified'"/>
2668
- </xsl:call-template>
2971
+
2972
+
2973
+ <xsl:call-template name="getTitle">
2974
+ <xsl:with-param name="name" select="'title-modified'"/>
2975
+ </xsl:call-template>
2976
+
2669
2977
  </xsl:variable>
2978
+
2670
2979
  <xsl:choose>
2671
2980
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
2672
2981
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -2674,7 +2983,7 @@
2674
2983
  <xsl:apply-templates/>
2675
2984
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
2676
2985
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2677
-
2986
+
2678
2987
  <xsl:apply-templates/>
2679
2988
  </fo:basic-link>
2680
2989
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -2727,6 +3036,8 @@
2727
3036
 
2728
3037
 
2729
3038
 
3039
+
3040
+
2730
3041
  <fo:inline xsl:use-attribute-sets="note-name-style">
2731
3042
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
2732
3043
  </fo:inline>
@@ -2815,7 +3126,8 @@
2815
3126
  </fo:inline>
2816
3127
  </xsl:if>
2817
3128
  </xsl:template><xsl:template match="*[local-name() = 'figure']">
2818
- <fo:block-container id="{@id}">
3129
+ <fo:block-container id="{@id}">
3130
+
2819
3131
  <fo:block>
2820
3132
  <xsl:apply-templates/>
2821
3133
  </fo:block>
@@ -2866,7 +3178,7 @@
2866
3178
  <xsl:apply-templates mode="bookmarks"/>
2867
3179
  </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
2868
3180
  <xsl:apply-templates select="."/>
2869
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3181
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
2870
3182
  <xsl:apply-templates mode="bookmarks"/>
2871
3183
  </xsl:template><xsl:template name="addBookmarks">
2872
3184
  <xsl:param name="contents"/>
@@ -2880,18 +3192,9 @@
2880
3192
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
2881
3193
  <fo:bookmark-title>
2882
3194
  <xsl:variable name="bookmark-title_">
2883
- <xsl:choose>
2884
- <xsl:when test="@lang = 'en'">
2885
-
2886
-
2887
- </xsl:when>
2888
- <xsl:when test="@lang = 'fr'">
2889
-
2890
-
2891
- </xsl:when>
2892
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
2893
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
2894
- </xsl:choose>
3195
+ <xsl:call-template name="getLangVersion">
3196
+ <xsl:with-param name="lang" select="@lang"/>
3197
+ </xsl:call-template>
2895
3198
  </xsl:variable>
2896
3199
  <xsl:choose>
2897
3200
  <xsl:when test="normalize-space($bookmark-title_) != ''">
@@ -2933,6 +3236,20 @@
2933
3236
 
2934
3237
  </fo:bookmark-tree>
2935
3238
  </xsl:if>
3239
+ </xsl:template><xsl:template name="getLangVersion">
3240
+ <xsl:param name="lang"/>
3241
+ <xsl:choose>
3242
+ <xsl:when test="$lang = 'en'">
3243
+
3244
+
3245
+ </xsl:when>
3246
+ <xsl:when test="$lang = 'fr'">
3247
+
3248
+
3249
+ </xsl:when>
3250
+ <xsl:when test="$lang = 'de'">Deutsche</xsl:when>
3251
+ <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3252
+ </xsl:choose>
2936
3253
  </xsl:template><xsl:template match="item" mode="bookmark">
2937
3254
  <fo:bookmark internal-destination="{@id}" starting-state="hide">
2938
3255
  <fo:bookmark-title>
@@ -2947,7 +3264,7 @@
2947
3264
  </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
2948
3265
  <xsl:if test="normalize-space() != ''">
2949
3266
  <fo:block xsl:use-attribute-sets="figure-name-style">
2950
-
3267
+
2951
3268
  <xsl:apply-templates/>
2952
3269
  </fo:block>
2953
3270
  </xsl:if>
@@ -3384,9 +3701,14 @@
3384
3701
 
3385
3702
  <fo:inline>
3386
3703
 
3387
- <xsl:call-template name="getTitle">
3388
- <xsl:with-param name="name" select="'title-source'"/>
3389
- </xsl:call-template>
3704
+
3705
+
3706
+
3707
+ <xsl:call-template name="getTitle">
3708
+ <xsl:with-param name="name" select="'title-source'"/>
3709
+ </xsl:call-template>
3710
+
3711
+
3390
3712
  <xsl:text>: </xsl:text>
3391
3713
  </fo:inline>
3392
3714
 
@@ -3539,9 +3861,12 @@
3539
3861
  </fo:block>
3540
3862
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
3541
3863
  <xsl:variable name="title-deprecated">
3542
- <xsl:call-template name="getTitle">
3543
- <xsl:with-param name="name" select="'title-deprecated'"/>
3544
- </xsl:call-template>
3864
+
3865
+
3866
+ <xsl:call-template name="getTitle">
3867
+ <xsl:with-param name="name" select="'title-deprecated'"/>
3868
+ </xsl:call-template>
3869
+
3545
3870
  </xsl:variable>
3546
3871
  <fo:block xsl:use-attribute-sets="deprecates-style">
3547
3872
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -3588,13 +3913,14 @@
3588
3913
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
3589
3914
  <fo:block>
3590
3915
  <xsl:call-template name="setId"/>
3916
+
3591
3917
  <xsl:apply-templates/>
3592
3918
  </fo:block>
3593
3919
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
3594
3920
  <fo:block id="{@id}">
3595
3921
  <xsl:apply-templates/>
3596
3922
  </fo:block>
3597
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
3923
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" priority="3"/><xsl:template match="*[local-name() = 'bibitem'][@hidden='true']" priority="3"/><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
3598
3924
 
3599
3925
  <fo:block id="{@id}">
3600
3926
  <xsl:apply-templates/>
@@ -3623,6 +3949,7 @@
3623
3949
  </xsl:choose>
3624
3950
  </xsl:attribute>
3625
3951
 
3952
+
3626
3953
  <fo:block-container margin-left="0mm">
3627
3954
  <fo:block>
3628
3955
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -3650,7 +3977,8 @@
3650
3977
  <fo:table-column column-width="107mm"/>
3651
3978
  <fo:table-column column-width="15mm"/>
3652
3979
  <fo:table-body>
3653
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
3980
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
3981
+
3654
3982
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
3655
3983
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
3656
3984
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -3668,6 +3996,10 @@
3668
3996
  <fo:block><xsl:apply-templates/></fo:block>
3669
3997
  </fo:table-cell>
3670
3998
  </xsl:template><xsl:template name="processBibitem">
3999
+
4000
+
4001
+ <!-- end BIPM bibitem processing-->
4002
+
3671
4003
 
3672
4004
 
3673
4005
 
@@ -3804,6 +4136,7 @@
3804
4136
  <dc:title>
3805
4137
  <xsl:variable name="title">
3806
4138
 
4139
+
3807
4140
 
3808
4141
  <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
3809
4142
 
@@ -3822,6 +4155,7 @@
3822
4155
  <dc:creator>
3823
4156
 
3824
4157
 
4158
+
3825
4159
  </dc:creator>
3826
4160
  <dc:description>
3827
4161
  <xsl:variable name="abstract">
@@ -3831,6 +4165,7 @@
3831
4165
 
3832
4166
 
3833
4167
 
4168
+
3834
4169
  </xsl:variable>
3835
4170
  <xsl:value-of select="normalize-space($abstract)"/>
3836
4171
  </dc:description>
@@ -3902,13 +4237,22 @@
3902
4237
  </xsl:template><xsl:template name="split">
3903
4238
  <xsl:param name="pText" select="."/>
3904
4239
  <xsl:param name="sep" select="','"/>
4240
+ <xsl:param name="normalize-space" select="'true'"/>
3905
4241
  <xsl:if test="string-length($pText) &gt;0">
3906
4242
  <item>
3907
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4243
+ <xsl:choose>
4244
+ <xsl:when test="$normalize-space = 'true'">
4245
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4246
+ </xsl:when>
4247
+ <xsl:otherwise>
4248
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4249
+ </xsl:otherwise>
4250
+ </xsl:choose>
3908
4251
  </item>
3909
4252
  <xsl:call-template name="split">
3910
4253
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
3911
4254
  <xsl:with-param name="sep" select="$sep"/>
4255
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
3912
4256
  </xsl:call-template>
3913
4257
  </xsl:if>
3914
4258
  </xsl:template><xsl:template name="getDocumentId">
@@ -3974,4 +4318,23 @@
3974
4318
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
3975
4319
  </xsl:call-template>
3976
4320
  </xsl:if>
4321
+ </xsl:template><xsl:template name="repeat">
4322
+ <xsl:param name="char" select="'*'"/>
4323
+ <xsl:param name="count"/>
4324
+ <xsl:if test="$count &gt; 0">
4325
+ <xsl:value-of select="$char"/>
4326
+ <xsl:call-template name="repeat">
4327
+ <xsl:with-param name="char" select="$char"/>
4328
+ <xsl:with-param name="count" select="$count - 1"/>
4329
+ </xsl:call-template>
4330
+ </xsl:if>
4331
+ </xsl:template><xsl:template name="getLocalizedString">
4332
+ <xsl:param name="key"/>
4333
+
4334
+ <xsl:variable name="curr_lang">
4335
+ <xsl:call-template name="getLang"/>
4336
+ </xsl:variable>
4337
+
4338
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4339
+
3977
4340
  </xsl:template></xsl:stylesheet>