metanorma-ogc 1.3.3 → 1.3.7

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: 9ef5196a6ffd5ac8b0ad6c6d6aaf0b0e8611c960baefa9e04993ff839ea7d614
4
- data.tar.gz: dadb5b1fcdad8fa63f855afc36baeeb5260a44ed6e198acb32519bd2c221758f
3
+ metadata.gz: 390c8c2832913f515a1abb08358f4b5bb91ff39e507cffee4ee0539f481f69cd
4
+ data.tar.gz: dfb5bc1463751a80084b5ea31de579f3021b2b12ff638e56356cfdab49f8544c
5
5
  SHA512:
6
- metadata.gz: 5130f68a47b344522cbf981625250499ea20e504df4642ff31ea191eb118f4c547eec52def376a9fd2931361ee8f721ee43ab190bffc4146685500b526718066
7
- data.tar.gz: 94c2b23fa7509ba59f3d3130b9ab7857990114a8aa56cbb3ad8bf43f092af1c3afe3755e05ce236da440b4073bdafb4ac67eeb021f6e1f9f034107bd6268cf9f
6
+ metadata.gz: c7adb184dd688ab8cb4b7ff196c899468928d4c805791313ac74da37e36a781f02df71af3a22fdea2c484c39fc9dc89aa01040737e07df618e0fce677b298c88
7
+ data.tar.gz: 61c90e5a53d7e09c04593c0a435d4860f55a5823d896b98d9c216c4a38147cd113330e90c83c242b45bca4b8abdb811a884325d484227c7e3ca2bcae6f4a170a
@@ -16,19 +16,9 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.7', '2.6', '2.5', '2.4' ]
19
+ ruby: [ '3.0', '2.7', '2.6', '2.5' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
- include:
23
- - ruby: '3.0'
24
- os: 'ubuntu-latest'
25
- experimental: true
26
- - ruby: '3.0'
27
- os: 'windows-latest'
28
- experimental: true
29
- - ruby: '3.0'
30
- os: 'macos-latest'
31
- experimental: true
32
22
  steps:
33
23
  - uses: actions/checkout@v2
34
24
  with:
@@ -40,3 +30,14 @@ jobs:
40
30
  bundler-cache: true
41
31
 
42
32
  - run: bundle exec rake
33
+
34
+ tests-passed:
35
+ needs: rake
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: peter-evans/repository-dispatch@v1
39
+ with:
40
+ token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
41
+ repository: ${{ github.repository }}
42
+ event-type: tests-passed
43
+ client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
data/.hound.yml CHANGED
@@ -1,3 +1,5 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  ruby:
2
- Enabled: true
4
+ enabled: true
3
5
  config_file: .rubocop.yml
data/.rubocop.yml CHANGED
@@ -1,12 +1,10 @@
1
- # This project follows the Ribose OSS style guide.
2
- # https://github.com/riboseinc/oss-guides
3
- # All project-specific additions and overrides should be specified in this file.
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
4
3
  inherit_from:
5
4
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
6
5
 
7
6
  # local repo-specific modifications
7
+ # ...
8
8
 
9
9
  AllCops:
10
- DisplayCopNames: false
11
- StyleGuideCopsOnly: false
12
- TargetRubyVersion: 2.4
10
+ TargetRubyVersion: 2.5
data/Gemfile CHANGED
@@ -6,6 +6,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}" }
6
6
 
7
7
  gemspec
8
8
 
9
- if File.exist? 'Gemfile.devel'
10
- eval File.read('Gemfile.devel'), nil, 'Gemfile.devel' # rubocop:disable Security/Eval
9
+ if File.exist? "Gemfile.devel"
10
+ eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
11
11
  end
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
- require 'isodoc/gem_tasks'
3
+ require "isodoc/gem_tasks"
4
4
 
5
5
  IsoDoc::GemTasks.install
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- task :default => :spec
8
+ task default: :spec
@@ -2,6 +2,5 @@ require "asciidoctor/ogc/converter"
2
2
 
3
3
  module Asciidoctor
4
4
  module Ogc
5
-
6
5
  end
7
6
  end
@@ -45,6 +45,11 @@
45
45
  <optional>
46
46
  <attribute name="alt"/>
47
47
  </optional>
48
+ <optional>
49
+ <attribute name="updatetype">
50
+ <data type="boolean"/>
51
+ </attribute>
52
+ </optional>
48
53
  <text/>
49
54
  </element>
50
55
  </define>
@@ -199,6 +204,18 @@
199
204
  </zeroOrMore>
200
205
  </element>
201
206
  </define>
207
+ <define name="dt">
208
+ <element name="dt">
209
+ <optional>
210
+ <attribute name="id">
211
+ <data type="ID"/>
212
+ </attribute>
213
+ </optional>
214
+ <zeroOrMore>
215
+ <ref name="TextElement"/>
216
+ </zeroOrMore>
217
+ </element>
218
+ </define>
202
219
  <define name="example">
203
220
  <element name="example">
204
221
  <attribute name="id">
@@ -543,6 +560,9 @@
543
560
  </define>
544
561
  <define name="BibDataExtensionType">
545
562
  <ref name="doctype"/>
563
+ <optional>
564
+ <ref name="docsubtype"/>
565
+ </optional>
546
566
  <optional>
547
567
  <ref name="editorialgroup"/>
548
568
  </optional>
@@ -890,6 +910,14 @@
890
910
  </define>
891
911
  </include>
892
912
  <!-- end overrides -->
913
+ <define name="docsubtype">
914
+ <element name="subdoctype">
915
+ <ref name="DocumentSubtype"/>
916
+ </element>
917
+ </define>
918
+ <define name="DocumentSubtype">
919
+ <text/>
920
+ </define>
893
921
  <define name="colgroup">
894
922
  <element name="colgroup">
895
923
  <oneOrMore>
@@ -939,7 +967,34 @@
939
967
  <define name="concept">
940
968
  <element name="concept">
941
969
  <optional>
942
- <attribute name="term"/>
970
+ <attribute name="ital">
971
+ <data type="boolean"/>
972
+ </attribute>
973
+ </optional>
974
+ <optional>
975
+ <attribute name="ref">
976
+ <data type="boolean"/>
977
+ </attribute>
978
+ </optional>
979
+ <optional>
980
+ <element name="refterm">
981
+ <zeroOrMore>
982
+ <choice>
983
+ <ref name="PureTextElement"/>
984
+ <ref name="stem"/>
985
+ </choice>
986
+ </zeroOrMore>
987
+ </element>
988
+ </optional>
989
+ <optional>
990
+ <element name="renderterm">
991
+ <zeroOrMore>
992
+ <choice>
993
+ <ref name="PureTextElement"/>
994
+ <ref name="stem"/>
995
+ </choice>
996
+ </zeroOrMore>
997
+ </element>
943
998
  </optional>
944
999
  <choice>
945
1000
  <ref name="eref"/>
@@ -965,6 +1020,9 @@
965
1020
  </attribute>
966
1021
  <attribute name="name"/>
967
1022
  <attribute name="action"/>
1023
+ <optional>
1024
+ <attribute name="class"/>
1025
+ </optional>
968
1026
  <zeroOrMore>
969
1027
  <choice>
970
1028
  <ref name="TextElement"/>
@@ -1457,26 +1515,26 @@
1457
1515
  <optional>
1458
1516
  <ref name="section-title"/>
1459
1517
  </optional>
1460
- <group>
1518
+ <choice>
1461
1519
  <choice>
1462
1520
  <group>
1463
- <zeroOrMore>
1521
+ <oneOrMore>
1464
1522
  <ref name="BasicBlock"/>
1465
- </zeroOrMore>
1523
+ </oneOrMore>
1466
1524
  <zeroOrMore>
1467
1525
  <ref name="note"/>
1468
1526
  </zeroOrMore>
1469
1527
  </group>
1470
1528
  <ref name="amend"/>
1471
1529
  </choice>
1472
- <zeroOrMore>
1530
+ <oneOrMore>
1473
1531
  <choice>
1474
1532
  <ref name="clause-subsection"/>
1475
1533
  <ref name="terms"/>
1476
1534
  <ref name="definitions"/>
1477
1535
  </choice>
1478
- </zeroOrMore>
1479
- </group>
1536
+ </oneOrMore>
1537
+ </choice>
1480
1538
  </define>
1481
1539
  <define name="Annex-Section">
1482
1540
  <optional>
@@ -79,20 +79,18 @@
79
79
  </zeroOrMore>
80
80
  </element>
81
81
  </define>
82
- <define name="docsubtype">
83
- <element name="docsubtype">
84
- <choice>
85
- <value>conceptual-model</value>
86
- <value>conceptual-model-and-encoding</value>
87
- <value>conceptual-model-and-implementation</value>
88
- <value>encoding</value>
89
- <value>extension</value>
90
- <value>implementation</value>
91
- <value>profile</value>
92
- <value>profile-with-extension</value>
93
- <value>general</value>
94
- </choice>
95
- </element>
82
+ <define name="DocumentSubtype">
83
+ <choice>
84
+ <value>conceptual-model</value>
85
+ <value>conceptual-model-and-encoding</value>
86
+ <value>conceptual-model-and-implementation</value>
87
+ <value>encoding</value>
88
+ <value>extension</value>
89
+ <value>implementation</value>
90
+ <value>profile</value>
91
+ <value>profile-with-extension</value>
92
+ <value>general</value>
93
+ </choice>
96
94
  </define>
97
95
  <define name="submitters">
98
96
  <element name="submitters">
data/lib/isodoc/ogc.rb CHANGED
@@ -7,6 +7,5 @@ require "isodoc/ogc/xref"
7
7
 
8
8
  module IsoDoc
9
9
  module Ogc
10
-
11
10
  end
12
11
  end
@@ -19,7 +19,7 @@ module IsoDoc
19
19
  "user-guide" => "UG",
20
20
  "white-paper" => "WP",
21
21
  "other" => "other",
22
- }
22
+ }.freeze
23
23
 
24
24
  DOCSUBTYPE_ABBR = {
25
25
  "implementation" => "IMP",
@@ -31,7 +31,7 @@ module IsoDoc
31
31
  "profile" => "PF",
32
32
  "profile-with-extension" => "PFE",
33
33
  "general" => "GE",
34
- }
34
+ }.freeze
35
35
 
36
36
  class Metadata < IsoDoc::Metadata
37
37
  def initialize(lang, script, i18n)
@@ -53,16 +53,20 @@ module IsoDoc
53
53
  def author(isoxml, _out)
54
54
  tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
55
55
  set(:tc, tc.text) if tc
56
- authors = isoxml.xpath(ns("//bibdata/contributor[role/@type = 'author']/person"))
56
+ authors = isoxml.xpath(ns("//bibdata/contributor"\
57
+ "[role/@type = 'author']/person"))
57
58
  set(:authors, extract_person_names(authors))
58
- editors = isoxml.xpath(ns("//bibdata/contributor[role/@type = 'editor']/person"))
59
+ editors = isoxml.xpath(ns("//bibdata/contributor"\
60
+ "[role/@type = 'editor']/person"))
59
61
  set(:editors, extract_person_names(editors))
60
62
  agency(isoxml)
61
63
  end
62
64
 
63
65
  def docid(isoxml, _out)
64
- set(:docnumber, isoxml&.at(ns("//bibdata/docidentifier[@type = 'ogc-internal']"))&.text)
65
- set(:externalid, isoxml&.at(ns("//bibdata/docidentifier[@type = 'ogc-external']"))&.text)
66
+ set(:docnumber, isoxml&.at(ns("//bibdata/docidentifier"\
67
+ "[@type = 'ogc-internal']"))&.text)
68
+ set(:externalid, isoxml&.at(ns("//bibdata/docidentifier"\
69
+ "[@type = 'ogc-external']"))&.text)
66
70
  end
67
71
 
68
72
  def unpublished(status)
@@ -78,11 +82,12 @@ module IsoDoc
78
82
 
79
83
  def url(xml, _out)
80
84
  super
81
- a = xml.at(ns("//bibdata/uri[@type = 'previous']")) and set(:previousuri, a.text)
85
+ a = xml.at(ns("//bibdata/uri[@type = 'previous']")) and
86
+ set(:previousuri, a.text)
82
87
  end
83
88
 
84
- def type_capitalise(b)
85
- b.split(/[- ]/).map do |w|
89
+ def type_capitalise(type)
90
+ type.split(/[- ]/).map do |w|
86
91
  %w(SWG).include?(w) ? w : w.capitalize
87
92
  end.join(" ")
88
93
  end
@@ -98,12 +103,12 @@ module IsoDoc
98
103
  end
99
104
  end
100
105
 
101
- def doctype_abbr(b)
102
- IsoDoc::Ogc::DOCTYPE_ABBR[b] || b
106
+ def doctype_abbr(type)
107
+ IsoDoc::Ogc::DOCTYPE_ABBR[type] || type
103
108
  end
104
109
 
105
- def docsubtype_abbr(st, t)
106
- IsoDoc::Ogc::DOCSUBTYPE_ABBR[st] || st
110
+ def docsubtype_abbr(subtype, _type)
111
+ IsoDoc::Ogc::DOCSUBTYPE_ABBR[subtype] || st
107
112
  end
108
113
 
109
114
  def status_print(status)
@@ -7,8 +7,12 @@
7
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
8
  <xsl:param name="basepath"/>
9
9
 
10
- <xsl:variable name="pageWidth" select="'215.9mm'"/>
11
- <xsl:variable name="pageHeight" select="'279.4mm'"/>
10
+ <xsl:variable name="pageWidth" select="215.9"/>
11
+ <xsl:variable name="pageHeight" select="279.4"/>
12
+ <xsl:variable name="marginLeftRight1" select="35"/>
13
+ <xsl:variable name="marginLeftRight2" select="17"/>
14
+ <xsl:variable name="marginTop" select="16.5"/>
15
+ <xsl:variable name="marginBottom" select="22.5"/>
12
16
 
13
17
 
14
18
 
@@ -74,7 +78,7 @@
74
78
  <fo:root font-family="Lato, STIX Two Math, Source Han Sans" font-size="11pt" color="{$color_main}" xml:lang="{$lang}">
75
79
  <fo:layout-master-set>
76
80
  <!-- Cover page -->
77
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
81
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
78
82
  <fo:region-body margin-top="16.5mm" margin-bottom="10mm" margin-left="16.5mm" margin-right="14mm"/>
79
83
  <fo:region-before region-name="cover-page-header" extent="16.5mm"/>
80
84
  <fo:region-after extent="10mm"/>
@@ -83,7 +87,7 @@
83
87
  </fo:simple-page-master>
84
88
 
85
89
  <!-- Preface pages -->
86
- <fo:simple-page-master master-name="preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
90
+ <fo:simple-page-master master-name="preface" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
87
91
  <fo:region-body margin-top="16.5mm" margin-bottom="22.5mm" margin-left="16.5mm" margin-right="16.5mm"/>
88
92
  <fo:region-before region-name="header" extent="16.5mm"/>
89
93
  <fo:region-after region-name="footer" extent="22.5mm"/>
@@ -93,12 +97,12 @@
93
97
 
94
98
 
95
99
  <!-- Document pages -->
96
- <fo:simple-page-master master-name="document" page-width="{$pageWidth}" page-height="{$pageHeight}">
97
- <fo:region-body margin-top="16.5mm" margin-bottom="22.5mm" margin-left="35mm" margin-right="17mm"/>
98
- <fo:region-before region-name="header" extent="16.5mm"/>
99
- <fo:region-after region-name="footer" extent="22.5mm"/>
100
+ <fo:simple-page-master master-name="document" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
101
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
102
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
103
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
100
104
  <fo:region-start region-name="left-region" extent="16.5mm"/>
101
- <fo:region-end region-name="right-region" extent="17mm"/>
105
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
102
106
  </fo:simple-page-master>
103
107
 
104
108
  </fo:layout-master-set>
@@ -124,16 +128,16 @@
124
128
  <!-- background image -->
125
129
  <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0">
126
130
  <fo:block>
127
- <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Cover-Background))}" width="{$pageWidth}" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
131
+ <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Cover-Background))}" width="{$pageWidth}mm" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image Front"/>
128
132
  </fo:block>
129
133
  </fo:block-container>
130
134
 
131
135
  <!-- background color -->
132
136
  <fo:block-container absolute-position="fixed" left="0" top="0" font-size="0">
133
137
  <fo:block>
134
- <fo:instream-foreign-object content-height="{$pageHeight}" fox:alt-text="Background color">
135
- <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="215.9mm" height="279.4mm">
136
- <rect width="215.9mm" height="279.4mm" style="fill:rgb(33,55,92);stroke-width:0;fill-opacity:0.85"/>
138
+ <fo:instream-foreign-object content-height="{$pageHeight}mm" fox:alt-text="Background color">
139
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="{$pageWidth}mm" height="{$pageHeight}mm">
140
+ <rect width="{$pageWidth}mm" height="{$pageHeight}mm" style="fill:rgb(33,55,92);stroke-width:0;fill-opacity:0.85"/>
137
141
  </svg>
138
142
  </fo:instream-foreign-object>
139
143
  </fo:block>
@@ -272,10 +276,10 @@
272
276
  </xsl:if>
273
277
 
274
278
  <!-- crossing lines -->
275
- <fo:block-container absolute-position="fixed" width="{$pageWidth}" height="{$pageHeight}" font-size="0">
279
+ <fo:block-container absolute-position="fixed" width="{$pageWidth}mm" height="{$pageHeight}mm" font-size="0">
276
280
  <fo:block>
277
- <fo:instream-foreign-object content-height="{$pageHeight}" content-width="{$pageWidth}" fox:alt-text="Crossing lines">
278
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2159 2794" width="{$pageWidth}" height="{$pageHeight}">
281
+ <fo:instream-foreign-object content-height="{$pageHeight}mm" content-width="{$pageWidth}mm" fox:alt-text="Crossing lines">
282
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2159 2794" width="{$pageWidth}mm" height="{$pageHeight}mm">
279
283
  <line x1="230" y1="0" x2="2159" y2="490" stroke="{$color_lightorange}"/>
280
284
  <line x1="0" y1="395" x2="820" y2="0" stroke="{$color_lightorange}"/>
281
285
  <circle style="fill:{$color_lightorange};" cx="614" cy="100" r="15"/>
@@ -305,10 +309,10 @@
305
309
  <fo:flow flow-name="xsl-region-body">
306
310
 
307
311
  <!-- crossing lines -->
308
- <fo:block-container absolute-position="fixed" width="{$pageWidth}" height="{$pageHeight}" font-size="0">
312
+ <fo:block-container absolute-position="fixed" width="{$pageWidth}mm" height="{$pageHeight}mm" font-size="0">
309
313
  <fo:block>
310
- <fo:instream-foreign-object content-height="{$pageHeight}" content-width="{$pageWidth}" fox:alt-text="Crossing lines">
311
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2159 2794" width="{$pageWidth}" height="{$pageHeight}">
314
+ <fo:instream-foreign-object content-height="{$pageHeight}mm" content-width="{$pageWidth}mm" fox:alt-text="Crossing lines">
315
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2159 2794" width="{$pageWidth}mm" height="{$pageHeight}mm">
312
316
  <line x1="0" y1="545" x2="2084" y2="0" stroke="{$color_lightorange}"/>
313
317
  <line x1="0" y1="1374" x2="355" y2="0" stroke="{$color_lightorange}"/>
314
318
  <circle style="fill:{$color_lightorange};" cx="227" cy="487" r="15"/>
@@ -601,9 +605,9 @@
601
605
  <!-- background color -->
602
606
  <fo:block-container absolute-position="fixed" left="0" top="0" font-size="0">
603
607
  <fo:block>
604
- <fo:instream-foreign-object content-height="{$pageHeight}" fox:alt-text="Background color">
605
- <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="{$pageWidth}" height="{$pageHeight}">
606
- <rect width="215.9mm" height="279.4mm" style="fill:rgb(33,55,92);stroke-width:0;fill-opacity:1"/>
608
+ <fo:instream-foreign-object content-height="{$pageHeight}mm" fox:alt-text="Background color">
609
+ <svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="{$pageWidth}mm" height="{$pageHeight}mm">
610
+ <rect width="{$pageWidth}mm" height="{$pageHeight}mm" style="fill:rgb(33,55,92);stroke-width:0;fill-opacity:1"/>
607
611
  </svg>
608
612
  </fo:instream-foreign-object>
609
613
  </fo:block>
@@ -1355,10 +1359,10 @@
1355
1359
  </xsl:template>
1356
1360
 
1357
1361
  <xsl:template name="insertCrossingLines">
1358
- <fo:block-container absolute-position="fixed" width="{$pageWidth}" height="{$pageHeight}" font-size="0">
1362
+ <fo:block-container absolute-position="fixed" width="{$pageWidth}mm" height="{$pageHeight}mm" font-size="0">
1359
1363
  <fo:block>
1360
- <fo:instream-foreign-object content-height="{$pageHeight}" content-width="{$pageWidth}" fox:alt-text="Crossing lines">
1361
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2159 2794" width="{$pageWidth}" height="{$pageHeight}">
1364
+ <fo:instream-foreign-object content-height="{$pageHeight}mm" content-width="{$pageWidth}mm" fox:alt-text="Crossing lines">
1365
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2159 2794" width="{$pageWidth}mm" height="{$pageHeight}mm">
1362
1366
  <line x1="0" y1="300" x2="2159" y2="675" stroke="{$color_orange}"/>
1363
1367
  <line x1="1215" y1="0" x2="2159" y2="1380" stroke="{$color_orange}"/>
1364
1368
  <line x1="0" y1="1850" x2="2159" y2="2390" stroke="{$color_orange}"/>
@@ -1628,6 +1632,7 @@
1628
1632
 
1629
1633
 
1630
1634
 
1635
+
1631
1636
  <!-- <xsl:attribute name="color">rgb(33, 55, 92)</xsl:attribute> -->
1632
1637
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1633
1638
 
@@ -1719,7 +1724,7 @@
1719
1724
 
1720
1725
 
1721
1726
 
1722
-
1727
+
1723
1728
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1724
1729
 
1725
1730
 
@@ -1735,6 +1740,7 @@
1735
1740
 
1736
1741
 
1737
1742
 
1743
+
1738
1744
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1739
1745
 
1740
1746
 
@@ -1754,9 +1760,7 @@
1754
1760
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1755
1761
 
1756
1762
 
1757
-
1758
-
1759
-
1763
+
1760
1764
 
1761
1765
 
1762
1766
 
@@ -1785,6 +1789,7 @@
1785
1789
 
1786
1790
 
1787
1791
 
1792
+
1788
1793
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1789
1794
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1790
1795
 
@@ -1805,6 +1810,9 @@
1805
1810
 
1806
1811
 
1807
1812
 
1813
+
1814
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1815
+
1808
1816
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1809
1817
 
1810
1818
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -1828,12 +1836,15 @@
1828
1836
 
1829
1837
 
1830
1838
 
1839
+
1831
1840
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1832
1841
 
1833
1842
 
1834
1843
 
1835
1844
 
1836
1845
 
1846
+
1847
+
1837
1848
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1838
1849
 
1839
1850
 
@@ -1853,6 +1864,7 @@
1853
1864
 
1854
1865
 
1855
1866
 
1867
+
1856
1868
  </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">
1857
1869
 
1858
1870
 
@@ -1897,6 +1909,7 @@
1897
1909
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1898
1910
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1899
1911
 
1912
+
1900
1913
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1901
1914
 
1902
1915
 
@@ -1904,6 +1917,7 @@
1904
1917
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
1905
1918
 
1906
1919
 
1920
+
1907
1921
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1908
1922
 
1909
1923
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1933,11 +1947,13 @@
1933
1947
 
1934
1948
 
1935
1949
 
1950
+
1936
1951
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1937
1952
 
1938
1953
 
1939
1954
 
1940
1955
 
1956
+
1941
1957
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1942
1958
 
1943
1959
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -1960,6 +1976,7 @@
1960
1976
 
1961
1977
 
1962
1978
 
1979
+
1963
1980
 
1964
1981
 
1965
1982
 
@@ -2010,8 +2027,10 @@
2010
2027
  <xsl:attribute name="font-size">11pt</xsl:attribute>
2011
2028
 
2012
2029
 
2030
+
2013
2031
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2014
2032
 
2033
+
2015
2034
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
2016
2035
 
2017
2036
  <xsl:attribute name="space-after">6pt</xsl:attribute>
@@ -2036,6 +2055,8 @@
2036
2055
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2037
2056
 
2038
2057
 
2058
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
2059
+
2039
2060
  </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
2040
2061
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2041
2062
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2046,14 +2067,15 @@
2046
2067
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
2047
2068
 
2048
2069
  <!-- Normative references -->
2049
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
2070
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]" mode="contents"/>
2050
2071
  <!-- Terms and definitions -->
2051
2072
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
2052
2073
  <!-- Another main sections -->
2053
2074
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
2054
2075
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
2055
2076
  <!-- Bibliography -->
2056
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
2077
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
2078
+
2057
2079
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
2058
2080
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
2059
2081
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -2084,18 +2106,18 @@
2084
2106
  <xsl:variable name="table-preamble">
2085
2107
 
2086
2108
 
2087
- <fo:block> </fo:block>
2109
+ <fo:block> </fo:block>
2088
2110
 
2089
2111
  </xsl:variable>
2090
2112
 
2091
2113
  <xsl:variable name="table">
2092
2114
 
2093
2115
  <xsl:variable name="simple-table">
2094
- <xsl:call-template name="getSimpleTable"/>
2116
+ <xsl:call-template name="getSimpleTable"/>
2095
2117
  </xsl:variable>
2096
2118
 
2097
2119
  <!-- <xsl:if test="$namespace = 'bipm'">
2098
- <fo:block>&#xA0;</fo:block>
2120
+ <fo:block>&#xA0;</fo:block>
2099
2121
  </xsl:if> -->
2100
2122
 
2101
2123
  <!-- $namespace = 'iso' or -->
@@ -2213,6 +2235,7 @@
2213
2235
 
2214
2236
 
2215
2237
 
2238
+
2216
2239
  </xsl:variable>
2217
2240
 
2218
2241
 
@@ -2351,6 +2374,9 @@
2351
2374
  <fo:block xsl:use-attribute-sets="table-name-style">
2352
2375
 
2353
2376
 
2377
+
2378
+
2379
+
2354
2380
  <xsl:choose>
2355
2381
  <xsl:when test="$continued = 'true'">
2356
2382
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -2498,6 +2524,7 @@
2498
2524
  <!-- font-weight="bold" -->
2499
2525
  <fo:table-header>
2500
2526
 
2527
+
2501
2528
  <xsl:apply-templates/>
2502
2529
  </fo:table-header>
2503
2530
  </xsl:template><xsl:template name="table-header-title">
@@ -2650,6 +2677,7 @@
2650
2677
 
2651
2678
 
2652
2679
 
2680
+
2653
2681
  <!-- fn will be processed inside 'note' processing -->
2654
2682
 
2655
2683
 
@@ -2660,6 +2688,10 @@
2660
2688
 
2661
2689
 
2662
2690
 
2691
+
2692
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2693
+
2694
+
2663
2695
  <!-- except gb -->
2664
2696
 
2665
2697
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2685,6 +2717,10 @@
2685
2717
  <!-- fn processing -->
2686
2718
  <xsl:call-template name="fn_display"/>
2687
2719
 
2720
+
2721
+ <!-- for PAS display Notes after footnotes -->
2722
+
2723
+
2688
2724
  </fo:table-cell>
2689
2725
  </fo:table-row>
2690
2726
  </fo:table-body>
@@ -2742,6 +2778,7 @@
2742
2778
  <xsl:if test="$parent-name = 'tfoot'">
2743
2779
 
2744
2780
 
2781
+
2745
2782
  </xsl:if>
2746
2783
 
2747
2784
 
@@ -2759,6 +2796,10 @@
2759
2796
  </xsl:if>
2760
2797
 
2761
2798
 
2799
+
2800
+
2801
+
2802
+
2762
2803
  <!-- <xsl:if test="$namespace = 'bipm'">
2763
2804
  <xsl:attribute name="height">8mm</xsl:attribute>
2764
2805
  </xsl:if> -->
@@ -2790,6 +2831,7 @@
2790
2831
 
2791
2832
 
2792
2833
 
2834
+
2793
2835
  <xsl:if test="$lang = 'ar'">
2794
2836
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2795
2837
  </xsl:if>
@@ -2840,6 +2882,7 @@
2840
2882
 
2841
2883
 
2842
2884
 
2885
+
2843
2886
  <xsl:attribute name="border">solid 0pt white</xsl:attribute>
2844
2887
 
2845
2888
 
@@ -2847,6 +2890,9 @@
2847
2890
 
2848
2891
 
2849
2892
 
2893
+
2894
+
2895
+
2850
2896
  <xsl:if test=".//*[local-name() = 'table']">
2851
2897
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2852
2898
  </xsl:if>
@@ -2876,8 +2922,14 @@
2876
2922
 
2877
2923
 
2878
2924
 
2925
+
2926
+
2927
+ <!-- Table's note name (NOTE, for example) -->
2928
+
2879
2929
  <fo:inline padding-right="2mm">
2880
2930
 
2931
+
2932
+
2881
2933
 
2882
2934
 
2883
2935
 
@@ -2885,6 +2937,8 @@
2885
2937
 
2886
2938
  </fo:inline>
2887
2939
 
2940
+
2941
+
2888
2942
  <xsl:apply-templates mode="process"/>
2889
2943
  </fo:block>
2890
2944
 
@@ -2910,6 +2964,8 @@
2910
2964
  <xsl:variable name="reference" select="@reference"/>
2911
2965
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2912
2966
  <fo:block margin-bottom="12pt">
2967
+
2968
+
2913
2969
 
2914
2970
 
2915
2971
 
@@ -2925,9 +2981,11 @@
2925
2981
 
2926
2982
 
2927
2983
 
2984
+
2928
2985
  <xsl:value-of select="@reference"/>
2929
2986
 
2930
2987
 
2988
+
2931
2989
  </fo:inline>
2932
2990
  <fo:inline>
2933
2991
 
@@ -3065,11 +3123,15 @@
3065
3123
 
3066
3124
 
3067
3125
 
3126
+
3127
+
3128
+
3068
3129
  <xsl:attribute name="vertical-align">super</xsl:attribute>
3069
3130
 
3070
3131
 
3071
3132
 
3072
3133
 
3134
+
3073
3135
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3074
3136
 
3075
3137
  <xsl:attribute name="internal-destination">
@@ -3080,6 +3142,7 @@
3080
3142
 
3081
3143
  <xsl:value-of select="@reference"/>
3082
3144
 
3145
+
3083
3146
  </fo:basic-link>
3084
3147
  </fo:inline>
3085
3148
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3166,6 +3229,7 @@
3166
3229
 
3167
3230
 
3168
3231
 
3232
+
3169
3233
  <xsl:variable name="title-key">
3170
3234
 
3171
3235
 
@@ -3378,6 +3442,7 @@
3378
3442
 
3379
3443
  <xsl:attribute name="min-height">8.5mm</xsl:attribute>
3380
3444
 
3445
+
3381
3446
  <fo:table-cell>
3382
3447
 
3383
3448
  <fo:block margin-top="6pt">
@@ -3396,6 +3461,7 @@
3396
3461
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3397
3462
 
3398
3463
 
3464
+
3399
3465
  <xsl:apply-templates/>
3400
3466
  <!-- <xsl:if test="$namespace = 'gb'">
3401
3467
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -3452,6 +3518,8 @@
3452
3518
 
3453
3519
  <xsl:apply-templates/>
3454
3520
  </fo:inline>
3521
+ </xsl:template><xsl:template match="*[local-name()='padding']">
3522
+ <fo:inline padding-right="{@value}"> </fo:inline>
3455
3523
  </xsl:template><xsl:template match="*[local-name()='sup']">
3456
3524
  <fo:inline font-size="80%" vertical-align="super">
3457
3525
  <xsl:apply-templates/>
@@ -3941,9 +4009,27 @@
3941
4009
  <xsl:copy>
3942
4010
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3943
4011
  </xsl:copy>
3944
- <mathml:mspace width="0.5ex"/>
4012
+ <xsl:choose>
4013
+ <!-- if in msub, then don't add space -->
4014
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
4015
+ <!-- if next char in digit, don't add space -->
4016
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
4017
+ <xsl:otherwise>
4018
+ <mathml:mspace width="0.5ex"/>
4019
+ </xsl:otherwise>
4020
+ </xsl:choose>
3945
4021
  </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3946
4022
  <xsl:variable name="target">
4023
+ <xsl:choose>
4024
+ <xsl:when test="@updatetype = 'true'">
4025
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
4026
+ </xsl:when>
4027
+ <xsl:otherwise>
4028
+ <xsl:value-of select="normalize-space(@target)"/>
4029
+ </xsl:otherwise>
4030
+ </xsl:choose>
4031
+ </xsl:variable>
4032
+ <xsl:variable name="target_text">
3947
4033
  <xsl:choose>
3948
4034
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3949
4035
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -3955,20 +4041,22 @@
3955
4041
  </xsl:variable>
3956
4042
  <fo:inline xsl:use-attribute-sets="link-style">
3957
4043
 
4044
+
4045
+
3958
4046
  <xsl:choose>
3959
- <xsl:when test="$target = ''">
4047
+ <xsl:when test="$target_text = ''">
3960
4048
  <xsl:apply-templates/>
3961
4049
  </xsl:when>
3962
4050
  <xsl:otherwise>
3963
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4051
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
3964
4052
  <xsl:choose>
3965
4053
  <xsl:when test="normalize-space(.) = ''">
3966
- <!-- <xsl:value-of select="$target"/> -->
3967
4054
  <xsl:call-template name="add-zero-spaces-link-java">
3968
- <xsl:with-param name="text" select="$target"/>
4055
+ <xsl:with-param name="text" select="$target_text"/>
3969
4056
  </xsl:call-template>
3970
4057
  </xsl:when>
3971
4058
  <xsl:otherwise>
4059
+ <!-- output text from <link>text</link> -->
3972
4060
  <xsl:apply-templates/>
3973
4061
  </xsl:otherwise>
3974
4062
  </xsl:choose>
@@ -4067,6 +4155,7 @@
4067
4155
 
4068
4156
 
4069
4157
 
4158
+
4070
4159
  <fo:block-container margin-left="0mm">
4071
4160
 
4072
4161
 
@@ -4110,6 +4199,7 @@
4110
4199
  </xsl:choose>
4111
4200
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
4112
4201
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
4202
+
4113
4203
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4114
4204
 
4115
4205
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -4187,6 +4277,7 @@
4187
4277
  </xsl:call-template>
4188
4278
 
4189
4279
  <fo:block>
4280
+
4190
4281
  <xsl:apply-templates/>
4191
4282
  </fo:block>
4192
4283
  <xsl:call-template name="fn_display_figure"/>
@@ -4309,6 +4400,234 @@
4309
4400
  <xsl:param name="height"/>
4310
4401
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
4311
4402
  <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
4403
+ </xsl:template><xsl:variable name="figure_name_height">14</xsl:variable><xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><xsl:variable name="image_dpi" select="96"/><xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/><xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
4404
+ <xsl:param name="name"/>
4405
+
4406
+ <xsl:variable name="svg_content">
4407
+ <xsl:apply-templates select="." mode="svg_update"/>
4408
+ </xsl:variable>
4409
+
4410
+ <xsl:variable name="alt-text">
4411
+ <xsl:choose>
4412
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
4413
+ <xsl:value-of select="../*[local-name() = 'name']"/>
4414
+ </xsl:when>
4415
+ <xsl:when test="normalize-space($name) != ''">
4416
+ <xsl:value-of select="$name"/>
4417
+ </xsl:when>
4418
+ <xsl:otherwise>Figure</xsl:otherwise>
4419
+ </xsl:choose>
4420
+ </xsl:variable>
4421
+
4422
+ <xsl:choose>
4423
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
4424
+ <fo:block>
4425
+ <xsl:variable name="width" select="@width"/>
4426
+ <xsl:variable name="height" select="@height"/>
4427
+
4428
+ <xsl:variable name="scale_x">
4429
+ <xsl:choose>
4430
+ <xsl:when test="$width &gt; $width_effective_px">
4431
+ <xsl:value-of select="$width_effective_px div $width"/>
4432
+ </xsl:when>
4433
+ <xsl:otherwise>1</xsl:otherwise>
4434
+ </xsl:choose>
4435
+ </xsl:variable>
4436
+
4437
+ <xsl:variable name="scale_y">
4438
+ <xsl:choose>
4439
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
4440
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
4441
+ </xsl:when>
4442
+ <xsl:otherwise>1</xsl:otherwise>
4443
+ </xsl:choose>
4444
+ </xsl:variable>
4445
+
4446
+ <xsl:variable name="scale">
4447
+ <xsl:choose>
4448
+ <xsl:when test="$scale_y != 1">
4449
+ <xsl:value-of select="$scale_x * $scale_y"/>
4450
+ </xsl:when>
4451
+ <xsl:otherwise>
4452
+ <xsl:value-of select="$scale_x"/>
4453
+ </xsl:otherwise>
4454
+ </xsl:choose>
4455
+ </xsl:variable>
4456
+
4457
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
4458
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
4459
+
4460
+ <fo:table table-layout="fixed" width="100%">
4461
+ <fo:table-column column-width="proportional-column-width(1)"/>
4462
+ <fo:table-column column-width="{$width_scale}px"/>
4463
+ <fo:table-column column-width="proportional-column-width(1)"/>
4464
+ <fo:table-body>
4465
+ <fo:table-row>
4466
+ <fo:table-cell column-number="2">
4467
+ <fo:block>
4468
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
4469
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
4470
+ <fo:block line-height="0" font-size="0">
4471
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
4472
+ <xsl:call-template name="bookmark"/>
4473
+ </xsl:for-each>
4474
+ </fo:block>
4475
+ </xsl:if>
4476
+ <fo:block text-depth="0" line-height="0" font-size="0">
4477
+
4478
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
4479
+ <xsl:attribute name="width">100%</xsl:attribute>
4480
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4481
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4482
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4483
+
4484
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
4485
+ </fo:instream-foreign-object>
4486
+ </fo:block>
4487
+
4488
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
4489
+ <xsl:with-param name="scale" select="$scale"/>
4490
+ </xsl:apply-templates>
4491
+ </fo:block-container>
4492
+ </fo:block>
4493
+ </fo:table-cell>
4494
+ </fo:table-row>
4495
+ </fo:table-body>
4496
+ </fo:table>
4497
+ </fo:block>
4498
+
4499
+ </xsl:when>
4500
+ <xsl:otherwise>
4501
+ <fo:block xsl:use-attribute-sets="image-style">
4502
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
4503
+ <xsl:attribute name="width">100%</xsl:attribute>
4504
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4505
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4506
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4507
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4508
+ <!-- effective height / width = 1.48, 1.4 - with title -->
4509
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4510
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4511
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4512
+ </xsl:if>
4513
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4514
+ <xsl:copy-of select="$svg_content"/>
4515
+ </fo:instream-foreign-object>
4516
+ </fo:block>
4517
+ </xsl:otherwise>
4518
+ </xsl:choose>
4519
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
4520
+ <xsl:copy>
4521
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
4522
+ </xsl:copy>
4523
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
4524
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4525
+ <xsl:value-of select="."/>
4526
+ </xsl:attribute>
4527
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4528
+ <xsl:variable name="svg_content" select="document(@src)"/>
4529
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4530
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
4531
+ <xsl:call-template name="image_svg">
4532
+ <xsl:with-param name="name" select="$name"/>
4533
+ </xsl:call-template>
4534
+ </xsl:for-each>
4535
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
4536
+ <xsl:copy>
4537
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
4538
+ </xsl:copy>
4539
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
4540
+ <xsl:apply-templates mode="svg_remove_a"/>
4541
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
4542
+ <xsl:param name="scale"/>
4543
+ <xsl:variable name="dest">
4544
+ <xsl:choose>
4545
+ <xsl:when test="starts-with(@href, '#')">
4546
+ <xsl:value-of select="substring-after(@href, '#')"/>
4547
+ </xsl:when>
4548
+ <xsl:otherwise>
4549
+ <xsl:value-of select="@href"/>
4550
+ </xsl:otherwise>
4551
+ </xsl:choose>
4552
+ </xsl:variable>
4553
+ <xsl:for-each select="./*[local-name() = 'rect']">
4554
+ <xsl:call-template name="insertSVGMapLink">
4555
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
4556
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
4557
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
4558
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
4559
+ <xsl:with-param name="dest" select="$dest"/>
4560
+ </xsl:call-template>
4561
+ </xsl:for-each>
4562
+
4563
+ <xsl:for-each select="./*[local-name() = 'polygon']">
4564
+ <xsl:variable name="points">
4565
+ <xsl:call-template name="split">
4566
+ <xsl:with-param name="pText" select="@points"/>
4567
+ </xsl:call-template>
4568
+ </xsl:variable>
4569
+ <xsl:variable name="x_coords">
4570
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
4571
+ <xsl:sort select="." data-type="number"/>
4572
+ <x><xsl:value-of select="."/></x>
4573
+ </xsl:for-each>
4574
+ </xsl:variable>
4575
+ <xsl:variable name="y_coords">
4576
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
4577
+ <xsl:sort select="." data-type="number"/>
4578
+ <y><xsl:value-of select="."/></y>
4579
+ </xsl:for-each>
4580
+ </xsl:variable>
4581
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
4582
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
4583
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
4584
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
4585
+ <xsl:call-template name="insertSVGMapLink">
4586
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
4587
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
4588
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
4589
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
4590
+ <xsl:with-param name="dest" select="$dest"/>
4591
+ </xsl:call-template>
4592
+ </xsl:for-each>
4593
+
4594
+ <xsl:for-each select="./*[local-name() = 'circle']">
4595
+ <xsl:call-template name="insertSVGMapLink">
4596
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
4597
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
4598
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
4599
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
4600
+ <xsl:with-param name="dest" select="$dest"/>
4601
+ </xsl:call-template>
4602
+ </xsl:for-each>
4603
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
4604
+ <xsl:call-template name="insertSVGMapLink">
4605
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
4606
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
4607
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
4608
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
4609
+ <xsl:with-param name="dest" select="$dest"/>
4610
+ </xsl:call-template>
4611
+ </xsl:for-each>
4612
+ </xsl:template><xsl:template name="insertSVGMapLink">
4613
+ <xsl:param name="left"/>
4614
+ <xsl:param name="top"/>
4615
+ <xsl:param name="width"/>
4616
+ <xsl:param name="height"/>
4617
+ <xsl:param name="dest"/>
4618
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
4619
+ <fo:block font-size="1pt">
4620
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
4621
+ <fo:inline-container inline-progression-dimension="100%">
4622
+ <fo:block-container height="{$height - 1}px" width="100%">
4623
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
4624
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
4625
+ </xsl:if> -->
4626
+ <fo:block> </fo:block></fo:block-container>
4627
+ </fo:inline-container>
4628
+ </fo:basic-link>
4629
+ </fo:block>
4630
+ </fo:block-container>
4312
4631
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
4313
4632
  <xsl:apply-templates mode="contents"/>
4314
4633
  <xsl:text> </xsl:text>
@@ -4337,28 +4656,39 @@
4337
4656
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
4338
4657
  <xsl:for-each select="xalan:nodeset($contents)/doc">
4339
4658
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4659
+ <xsl:if test="@bundle = 'true'">
4660
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4661
+ </xsl:if>
4340
4662
  <fo:bookmark-title>
4341
- <xsl:variable name="bookmark-title_">
4342
- <xsl:call-template name="getLangVersion">
4343
- <xsl:with-param name="lang" select="@lang"/>
4344
- <xsl:with-param name="doctype" select="@doctype"/>
4345
- <xsl:with-param name="title" select="@title-part"/>
4346
- </xsl:call-template>
4347
- </xsl:variable>
4348
4663
  <xsl:choose>
4349
- <xsl:when test="normalize-space($bookmark-title_) != ''">
4350
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
4351
- </xsl:when>
4352
- <xsl:otherwise>
4664
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4665
+ <xsl:variable name="bookmark-title_">
4666
+ <xsl:call-template name="getLangVersion">
4667
+ <xsl:with-param name="lang" select="@lang"/>
4668
+ <xsl:with-param name="doctype" select="@doctype"/>
4669
+ <xsl:with-param name="title" select="@title-part"/>
4670
+ </xsl:call-template>
4671
+ </xsl:variable>
4353
4672
  <xsl:choose>
4354
- <xsl:when test="@lang = 'en'">English</xsl:when>
4355
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
4356
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4357
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4673
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4674
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4675
+ </xsl:when>
4676
+ <xsl:otherwise>
4677
+ <xsl:choose>
4678
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4679
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4680
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4681
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4682
+ </xsl:choose>
4683
+ </xsl:otherwise>
4358
4684
  </xsl:choose>
4685
+ </xsl:when>
4686
+ <xsl:otherwise>
4687
+ <xsl:value-of select="@title-part"/>
4359
4688
  </xsl:otherwise>
4360
4689
  </xsl:choose>
4361
4690
  </fo:bookmark-title>
4691
+
4362
4692
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4363
4693
 
4364
4694
  <xsl:call-template name="insertFigureBookmarks">
@@ -4500,20 +4830,28 @@
4500
4830
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
4501
4831
  </xsl:choose>
4502
4832
  </xsl:template><xsl:template match="item" mode="bookmark">
4503
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
4504
- <fo:bookmark-title>
4505
- <xsl:if test="@section != ''">
4506
- <xsl:value-of select="@section"/>
4507
- <xsl:text> </xsl:text>
4508
- </xsl:if>
4509
- <xsl:value-of select="normalize-space(title)"/>
4510
- </fo:bookmark-title>
4511
- <xsl:apply-templates mode="bookmark"/>
4512
- </fo:bookmark>
4833
+ <xsl:choose>
4834
+ <xsl:when test="@id != ''">
4835
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4836
+ <fo:bookmark-title>
4837
+ <xsl:if test="@section != ''">
4838
+ <xsl:value-of select="@section"/>
4839
+ <xsl:text> </xsl:text>
4840
+ </xsl:if>
4841
+ <xsl:value-of select="normalize-space(title)"/>
4842
+ </fo:bookmark-title>
4843
+ <xsl:apply-templates mode="bookmark"/>
4844
+ </fo:bookmark>
4845
+ </xsl:when>
4846
+ <xsl:otherwise>
4847
+ <xsl:apply-templates mode="bookmark"/>
4848
+ </xsl:otherwise>
4849
+ </xsl:choose>
4513
4850
  </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">
4514
4851
  <xsl:if test="normalize-space() != ''">
4515
4852
  <fo:block xsl:use-attribute-sets="figure-name-style">
4516
4853
 
4854
+
4517
4855
  <xsl:apply-templates/>
4518
4856
  </fo:block>
4519
4857
  </xsl:if>
@@ -4593,6 +4931,8 @@
4593
4931
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4594
4932
 
4595
4933
  <fo:block-container margin-left="0mm">
4934
+ <xsl:copy-of select="@id"/>
4935
+
4596
4936
  <xsl:if test="parent::*[local-name() = 'note']">
4597
4937
  <xsl:attribute name="margin-left">
4598
4938
  <xsl:choose>
@@ -4603,7 +4943,9 @@
4603
4943
 
4604
4944
  </xsl:if>
4605
4945
  <fo:block-container margin-left="0mm">
4606
-
4946
+
4947
+
4948
+
4607
4949
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4608
4950
  <xsl:variable name="_font-size">
4609
4951
 
@@ -4632,10 +4974,14 @@
4632
4974
  </xsl:choose>
4633
4975
  </xsl:attribute>
4634
4976
  </xsl:if>
4635
- <xsl:apply-templates/>
4636
- </fo:block>
4977
+
4978
+ <xsl:apply-templates/>
4979
+ </fo:block>
4980
+
4981
+
4637
4982
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4638
4983
 
4984
+
4639
4985
  </fo:block-container>
4640
4986
  </fo:block-container>
4641
4987
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4878,6 +5224,7 @@
4878
5224
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4879
5225
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4880
5226
 
5227
+
4881
5228
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4882
5229
 
4883
5230
  <xsl:variable name="element">
@@ -4986,12 +5333,15 @@
4986
5333
 
4987
5334
 
4988
5335
 
5336
+
5337
+
5338
+
4989
5339
  <xsl:call-template name="getTitle">
4990
5340
  <xsl:with-param name="name" select="'title-source'"/>
4991
5341
  </xsl:call-template>
5342
+ <xsl:text>: </xsl:text>
4992
5343
 
4993
5344
 
4994
- <xsl:text>: </xsl:text>
4995
5345
  </fo:inline>
4996
5346
 
4997
5347
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -5062,7 +5412,9 @@
5062
5412
 
5063
5413
 
5064
5414
  </xsl:if>
5065
-
5415
+
5416
+
5417
+
5066
5418
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5067
5419
  <xsl:if test="normalize-space(@citeas) = ''">
5068
5420
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -5072,6 +5424,7 @@
5072
5424
 
5073
5425
 
5074
5426
 
5427
+
5075
5428
  </xsl:if>
5076
5429
 
5077
5430
  <xsl:apply-templates/>
@@ -5104,6 +5457,7 @@
5104
5457
 
5105
5458
 
5106
5459
 
5460
+
5107
5461
  <xsl:choose>
5108
5462
  <xsl:when test="$depth = 2">2</xsl:when>
5109
5463
  <xsl:otherwise>1</xsl:otherwise>
@@ -5216,6 +5570,7 @@
5216
5570
  <xsl:call-template name="setId"/>
5217
5571
 
5218
5572
 
5573
+
5219
5574
  <xsl:apply-templates/>
5220
5575
  </fo:block>
5221
5576
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -5604,17 +5959,17 @@
5604
5959
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
5605
5960
  <xsl:choose>
5606
5961
  <xsl:when test="normalize-space($_doc_ident) != ''">
5607
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
5962
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
5608
5963
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
5609
5964
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5610
- </xsl:if>
5965
+ </xsl:if> -->
5611
5966
  <xsl:value-of select="$_doc_ident"/>
5612
5967
  </xsl:when>
5613
5968
  <xsl:otherwise>
5614
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5969
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5615
5970
  <xsl:if test="$type != ''">
5616
5971
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
5617
- </xsl:if>
5972
+ </xsl:if> -->
5618
5973
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
5619
5974
  </xsl:otherwise>
5620
5975
  </xsl:choose>
@@ -5927,6 +6282,9 @@
5927
6282
  <xsl:when test="parent::*[local-name() = 'preface']">
5928
6283
  <xsl:value-of select="$level_total - 1"/>
5929
6284
  </xsl:when>
6285
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
6286
+ <xsl:value-of select="$level_total - 1"/>
6287
+ </xsl:when>
5930
6288
  <xsl:when test="ancestor::*[local-name() = 'preface']">
5931
6289
  <xsl:value-of select="$level_total - 2"/>
5932
6290
  </xsl:when>
@@ -6067,7 +6425,14 @@
6067
6425
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6068
6426
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6069
6427
  </xsl:when>
6070
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6428
+ <xsl:otherwise>
6429
+ <xsl:variable name="key_">
6430
+ <xsl:call-template name="capitalize">
6431
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
6432
+ </xsl:call-template>
6433
+ </xsl:variable>
6434
+ <xsl:value-of select="$key_"/>
6435
+ </xsl:otherwise>
6071
6436
  </xsl:choose>
6072
6437
 
6073
6438
  </xsl:template><xsl:template name="setTrackChangesStyles">
@@ -6110,4 +6475,110 @@
6110
6475
  <xsl:value-of select="$align"/>
6111
6476
  </xsl:when>
6112
6477
  </xsl:choose>
6478
+ </xsl:template><xsl:template name="setTextAlignment">
6479
+ <xsl:param name="default">left</xsl:param>
6480
+ <xsl:attribute name="text-align">
6481
+ <xsl:choose>
6482
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
6483
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
6484
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
6485
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
6486
+ </xsl:choose>
6487
+ </xsl:attribute>
6488
+ </xsl:template><xsl:template name="number-to-words">
6489
+ <xsl:param name="number"/>
6490
+ <xsl:param name="first"/>
6491
+ <xsl:if test="$number != ''">
6492
+ <xsl:variable name="words">
6493
+ <words>
6494
+ <word cardinal="1">One-</word>
6495
+ <word ordinal="1">First </word>
6496
+ <word cardinal="2">Two-</word>
6497
+ <word ordinal="2">Second </word>
6498
+ <word cardinal="3">Three-</word>
6499
+ <word ordinal="3">Third </word>
6500
+ <word cardinal="4">Four-</word>
6501
+ <word ordinal="4">Fourth </word>
6502
+ <word cardinal="5">Five-</word>
6503
+ <word ordinal="5">Fifth </word>
6504
+ <word cardinal="6">Six-</word>
6505
+ <word ordinal="6">Sixth </word>
6506
+ <word cardinal="7">Seven-</word>
6507
+ <word ordinal="7">Seventh </word>
6508
+ <word cardinal="8">Eight-</word>
6509
+ <word ordinal="8">Eighth </word>
6510
+ <word cardinal="9">Nine-</word>
6511
+ <word ordinal="9">Ninth </word>
6512
+ <word ordinal="10">Tenth </word>
6513
+ <word ordinal="11">Eleventh </word>
6514
+ <word ordinal="12">Twelfth </word>
6515
+ <word ordinal="13">Thirteenth </word>
6516
+ <word ordinal="14">Fourteenth </word>
6517
+ <word ordinal="15">Fifteenth </word>
6518
+ <word ordinal="16">Sixteenth </word>
6519
+ <word ordinal="17">Seventeenth </word>
6520
+ <word ordinal="18">Eighteenth </word>
6521
+ <word ordinal="19">Nineteenth </word>
6522
+ <word cardinal="20">Twenty-</word>
6523
+ <word ordinal="20">Twentieth </word>
6524
+ <word cardinal="30">Thirty-</word>
6525
+ <word ordinal="30">Thirtieth </word>
6526
+ <word cardinal="40">Forty-</word>
6527
+ <word ordinal="40">Fortieth </word>
6528
+ <word cardinal="50">Fifty-</word>
6529
+ <word ordinal="50">Fiftieth </word>
6530
+ <word cardinal="60">Sixty-</word>
6531
+ <word ordinal="60">Sixtieth </word>
6532
+ <word cardinal="70">Seventy-</word>
6533
+ <word ordinal="70">Seventieth </word>
6534
+ <word cardinal="80">Eighty-</word>
6535
+ <word ordinal="80">Eightieth </word>
6536
+ <word cardinal="90">Ninety-</word>
6537
+ <word ordinal="90">Ninetieth </word>
6538
+ <word cardinal="100">Hundred-</word>
6539
+ <word ordinal="100">Hundredth </word>
6540
+ </words>
6541
+ </xsl:variable>
6542
+
6543
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
6544
+
6545
+ <xsl:variable name="value">
6546
+ <xsl:choose>
6547
+ <xsl:when test="$ordinal != ''">
6548
+ <xsl:value-of select="$ordinal"/>
6549
+ </xsl:when>
6550
+ <xsl:otherwise>
6551
+ <xsl:choose>
6552
+ <xsl:when test="$number &lt; 100">
6553
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
6554
+ <xsl:variable name="digit" select="substring($number,2)"/>
6555
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
6556
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
6557
+ </xsl:when>
6558
+ <xsl:otherwise>
6559
+ <!-- more 100 -->
6560
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
6561
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
6562
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
6563
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
6564
+ <xsl:call-template name="number-to-words">
6565
+ <xsl:with-param name="number" select="$digits"/>
6566
+ </xsl:call-template>
6567
+ </xsl:otherwise>
6568
+ </xsl:choose>
6569
+ </xsl:otherwise>
6570
+ </xsl:choose>
6571
+ </xsl:variable>
6572
+ <xsl:choose>
6573
+ <xsl:when test="$first = 'true'">
6574
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
6575
+ <xsl:call-template name="capitalize">
6576
+ <xsl:with-param name="str" select="$value_lc"/>
6577
+ </xsl:call-template>
6578
+ </xsl:when>
6579
+ <xsl:otherwise>
6580
+ <xsl:value-of select="$value"/>
6581
+ </xsl:otherwise>
6582
+ </xsl:choose>
6583
+ </xsl:if>
6113
6584
  </xsl:template></xsl:stylesheet>