metanorma-iho 0.3.3 → 0.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: 288f5d8afd0281c3ff10cb514820baa3b9915e1f050c946bed0c9eaa22a3c506
4
- data.tar.gz: 665c46bd50d23bed2a4b9ba983890694c7b9da051a7adf4d71f4c8b478ce839d
3
+ metadata.gz: 78ed7a2327fce3d84a0abea428a0a3d64df78ba43260d86763741a7af909fc12
4
+ data.tar.gz: 99d76431ad5f1df63d4b41d75b845313da2bd3798cf09f2fba7144e990d712d3
5
5
  SHA512:
6
- metadata.gz: 0f272b7464a8932dda4d3947eb5b1c471387766e12ec86b33887eb31b0482ea6c077c8c3f6fb110756fe5322774e675b8801c2bec5796790a085fdfba49bb6ad
7
- data.tar.gz: f4b6b13deb6ae462ce7f23b909a3c342b1f278fd895382cf0d38a68710e2d6ba399b15d2338e385759b854c97f04063c2a636bed0d754c2f8e9bd4b819043ee8
6
+ metadata.gz: b2c96de49bd42c36f59dde810db26b023a8c5ca561a047afecd3b923af8620d5488e10f33a0c71322b8a96acffd496daf0f74007154693e76c019a411f96339d
7
+ data.tar.gz: e864952f8073090f3b64a51080f447d2d91d9b357d8d2a33a29c9664a396fe77d1efc7538b69f31d8a2c4e1985febc9f1ef6806b24ec29037c6541d94cc18c53
@@ -4,7 +4,7 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master, main ]
7
+ branches: [ master, main ]
8
8
  tags: [ v* ]
9
9
  pull_request:
10
10
 
@@ -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@master
34
24
 
@@ -49,5 +39,5 @@ jobs:
49
39
  with:
50
40
  token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
51
41
  repository: ${{ github.repository }}
52
- event-type: notify
42
+ event-type: tests-passed
53
43
  client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
data/.hound.yml ADDED
@@ -0,0 +1,5 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ ruby:
4
+ enabled: true
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
@@ -36,6 +36,9 @@
36
36
  <optional>
37
37
  <ref name="doctype"/>
38
38
  </optional>
39
+ <optional>
40
+ <ref name="docsubtype"/>
41
+ </optional>
39
42
  <zeroOrMore>
40
43
  <ref name="editorialgroup"/>
41
44
  </zeroOrMore>
@@ -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>
@@ -15,30 +15,32 @@ module IsoDoc
15
15
  super
16
16
  end
17
17
 
18
- def std_bibitem_entry(list, b, ordinal, biblio)
19
- list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
18
+ def std_bibitem_entry(list, bib, ordinal, biblio)
19
+ list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
20
20
  prefix_bracketed_ref(ref, "[#{ordinal}]")
21
- standard_citation(ref, b)
21
+ standard_citation(ref, bib)
22
22
  end
23
23
  end
24
24
 
25
- def nodes_to_span(n)
25
+ def nodes_to_span(node)
26
26
  noko do |xml|
27
27
  xml.span do |s|
28
- n&.children&.each { |x| parse(x, s) }
28
+ node&.children&.each { |x| parse(x, s) }
29
29
  end
30
30
  end.join("")
31
31
  end
32
32
 
33
33
  def multiplenames_and(names)
34
- return "" if names.length == 0
34
+ return "" if names.empty?
35
35
  return names[0] if names.length == 1
36
36
  return "#{names[0]} and #{names[1]}" if names.length == 2
37
+
37
38
  names[0..-2].join(", ") + " and #{names[-1]}"
38
39
  end
39
40
 
40
- def extract_publisher(b)
41
- c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
41
+ def extract_publisher(bib)
42
+ c = bib
43
+ .xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
42
44
  abbrs = []
43
45
  names = []
44
46
  c&.each do |c1|
@@ -47,63 +49,55 @@ module IsoDoc
47
49
  names << nodes_to_span(n)
48
50
  end
49
51
  return [nil, nil] if names.empty?
50
- return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
52
+
53
+ [multiplenames_and(names), abbrs.map(&:text).join("/")]
51
54
  end
52
55
 
53
- def inline_bibitem_ref_code(b)
54
- id = b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
55
- "or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"))
56
- id ||= b.at(ns("./docidentifier[not(@type = 'metanorma')]"))
56
+ def inline_bibitem_ref_code(bib)
57
+ id = bib.at(ns("./docidentifier[not(@type = 'DOI' or "\
58
+ "@type = 'metanorma' or @type = 'ISSN' or "\
59
+ "@type = 'ISBN' or @type = 'rfc-anchor')]"))
60
+ id ||= bib.at(ns("./docidentifier[not(@type = 'metanorma')]"))
57
61
  return [nil, id, nil] if id
58
- id = Nokogiri::XML::Node.new("docidentifier", b.document)
62
+
63
+ id = Nokogiri::XML::Node.new("docidentifier", bib.document)
59
64
  id << "(NO ID)"
60
65
  [nil, id, nil]
61
66
  end
62
67
 
63
- def extract_edition(b)
64
- b&.at(ns("./edition"))&.text
68
+ def extract_edition(bib)
69
+ bib&.at(ns("./edition"))&.text
65
70
  end
66
71
 
67
- def extract_uri(b)
68
- b.at(ns("./uri"))
72
+ def extract_uri(bib)
73
+ bib.at(ns("./uri"))
69
74
  end
70
75
 
71
76
  def omit_docid_prefix(prefix)
72
77
  return true if prefix == "IHO"
78
+
73
79
  super
74
80
  end
75
81
 
76
82
  def render_identifier(id)
77
- if !id[1].nil? and id[1]["type"] == "IHO"
83
+ if !id[1].nil? && (id[1]["type"] == "IHO")
78
84
  id[1].children = id[1].text.sub(/^IHO /, "")
79
85
  end
80
86
  super
81
87
  end
82
88
 
83
- def extract_publisher(b)
84
- c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
85
- abbrs = []
86
- names = []
87
- c&.each do |c1|
88
- n = c1.at(ns("./organization/name")) or next
89
- abbrs << (c1.at(ns("./organization/abbreviation")) || n)
90
- names << nodes_to_span(n)
91
- end
92
- return [nil, nil] if names.empty?
93
- return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
94
- end
89
+ def extract_author(bib)
90
+ c = bib.xpath(ns("./contributor[role/@type = 'author']"))
91
+ c = bib.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
92
+ return extract_publisher(bib)[0] if c.empty?
95
93
 
96
- def extract_author(b)
97
- c = b.xpath(ns("./contributor[role/@type = 'author']"))
98
- c = b.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
99
- return extract_publisher(b)[0] if c.empty?
100
94
  c.map do |c1|
101
95
  c1&.at(ns("./organization/name"))&.text || extract_person_name(c1)
102
96
  end.reject { |e| e.nil? || e.empty? }.join(", ")
103
97
  end
104
98
 
105
- def extract_person_name(b)
106
- p = b.at(ns("./person/name")) or return
99
+ def extract_person_name(bib)
100
+ p = bib.at(ns("./person/name")) or return
107
101
  c = p.at(ns("./completename")) and return c.text
108
102
  s = p&.at(ns("./surname"))&.text or return
109
103
  i = p.xpath(ns("./initial")) and
@@ -113,25 +107,25 @@ module IsoDoc
113
107
  front ? "#{s} #{front}" : s
114
108
  end
115
109
 
116
- def is_iho?(b)
117
- extract_publisher(b)[1] == "IHO"
110
+ def iho?(bib)
111
+ extract_publisher(bib)[1] == "IHO"
118
112
  end
119
113
 
120
114
  # [{number}] {docID} edition {edition}: {title}, {author/organization}
121
- def standard_citation(out, b)
122
- if ftitle = b.at(ns("./formattedref"))
115
+ def standard_citation(out, bib)
116
+ if ftitle = bib.at(ns("./formattedref"))
123
117
  ftitle&.children&.each { |n| parse(n, out) }
124
118
  else
125
- id = render_identifier(inline_bibitem_ref_code(b))
119
+ id = render_identifier(inline_bibitem_ref_code(bib))
126
120
  out << id[1] if id[1]
127
- ed = extract_edition(b) if is_iho?(b)
121
+ ed = extract_edition(bib) if iho?(bib)
128
122
  out << " edition #{ed}" if ed
129
123
  out << ": " if id[1] || ed
130
- iso_title(b)&.children&.each { |n| parse(n, out) }
124
+ iso_title(bib)&.children&.each { |n| parse(n, out) }
131
125
  out << ", "
132
- author = extract_author(b)
126
+ author = extract_author(bib)
133
127
  out << author
134
- u = extract_uri(b)
128
+ u = extract_uri(bib)
135
129
  out << " (<a href='#{u.text}'>#{u.text}</a>)" if u
136
130
  end
137
131
  end
@@ -15,8 +15,13 @@
15
15
 
16
16
 
17
17
  <xsl:variable name="debug">false</xsl:variable>
18
- <xsl:variable name="pageWidth" select="'210mm'"/>
19
- <xsl:variable name="pageHeight" select="'297mm'"/>
18
+ <xsl:variable name="pageWidth" select="210"/>
19
+ <xsl:variable name="pageHeight" select="297"/>
20
+ <xsl:variable name="marginLeftRight1" select="25.4"/>
21
+ <xsl:variable name="marginLeftRight2" select="25.4"/>
22
+ <xsl:variable name="marginTop" select="25.4"/>
23
+ <xsl:variable name="marginBottom" select="25.4"/>
24
+
20
25
 
21
26
  <xsl:variable name="title-en" select="/iho:iho-standard/iho:bibdata/iho:title[@language = 'en']"/>
22
27
  <xsl:variable name="docidentifier" select="/iho:iho-standard/iho:bibdata/iho:docidentifier[@type = 'IHO']"/>
@@ -43,44 +48,44 @@
43
48
  <fo:root font-family="Arial, Cambria Math" font-size="12pt" xml:lang="{$lang}">
44
49
  <fo:layout-master-set>
45
50
  <!-- cover page -->
46
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
51
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
47
52
  <fo:region-body margin-top="0mm" margin-bottom="5mm" margin-left="0mm" margin-right="5mm"/>
48
53
  </fo:simple-page-master>
49
54
 
50
- <fo:simple-page-master master-name="first" page-width="{$pageWidth}" page-height="{$pageHeight}">
51
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
52
- <fo:region-before region-name="header" extent="25.4mm"/>
53
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
54
- <fo:region-start region-name="left-region" extent="25.4mm"/>
55
- <fo:region-end region-name="right-region" extent="25.4mm"/>
55
+ <fo:simple-page-master master-name="first" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
56
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
57
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
58
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
59
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
60
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
56
61
  </fo:simple-page-master>
57
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
58
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
59
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
60
- <fo:region-after region-name="footer-odd" extent="25.4mm"/>
61
- <fo:region-start region-name="left-region" extent="25.4mm"/>
62
- <fo:region-end region-name="right-region" extent="25.4mm"/>
62
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
63
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
64
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
65
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
66
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
67
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
63
68
  </fo:simple-page-master>
64
- <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}" page-height="{$pageWidth}">
65
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
66
- <fo:region-before region-name="header-odd" extent="25.4mm"/>
67
- <fo:region-after region-name="footer-odd" extent="25.4mm"/>
68
- <fo:region-start region-name="left-region" extent="25.4mm"/>
69
- <fo:region-end region-name="right-region" extent="25.4mm"/>
69
+ <fo:simple-page-master master-name="odd-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
70
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
71
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
72
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
73
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
74
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
70
75
  </fo:simple-page-master>
71
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
72
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
73
- <fo:region-before region-name="header-even" extent="25.4mm"/>
74
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
75
- <fo:region-start region-name="left-region" extent="25.4mm"/>
76
- <fo:region-end region-name="right-region" extent="25.4mm"/>
76
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
77
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
78
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
79
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
80
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
81
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
77
82
  </fo:simple-page-master>
78
- <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}" page-height="{$pageWidth}">
79
- <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="25.4mm" margin-right="25.4mm"/>
80
- <fo:region-before region-name="header-even" extent="25.4mm"/>
81
- <fo:region-after region-name="footer-even" extent="25.4mm"/>
82
- <fo:region-start region-name="left-region" extent="25.4mm"/>
83
- <fo:region-end region-name="right-region" extent="25.4mm"/>
83
+ <fo:simple-page-master master-name="even-landscape" page-width="{$pageHeight}mm" page-height="{$pageWidth}mm">
84
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
85
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
86
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
87
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
88
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
84
89
  </fo:simple-page-master>
85
90
  <!-- Preface pages -->
86
91
  <fo:page-sequence-master master-name="preface">
@@ -1122,6 +1127,7 @@
1122
1127
 
1123
1128
 
1124
1129
 
1130
+
1125
1131
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1126
1132
  <xsl:attribute name="white-space">pre</xsl:attribute>
1127
1133
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -1173,7 +1179,7 @@
1173
1179
 
1174
1180
 
1175
1181
 
1176
-
1182
+
1177
1183
  </xsl:attribute-set><xsl:attribute-set name="example-style">
1178
1184
 
1179
1185
 
@@ -1190,6 +1196,7 @@
1190
1196
 
1191
1197
 
1192
1198
 
1199
+
1193
1200
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
1194
1201
 
1195
1202
 
@@ -1209,9 +1216,7 @@
1209
1216
 
1210
1217
 
1211
1218
 
1212
-
1213
-
1214
-
1219
+
1215
1220
 
1216
1221
 
1217
1222
 
@@ -1241,6 +1246,7 @@
1241
1246
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
1242
1247
 
1243
1248
 
1249
+
1244
1250
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1245
1251
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1246
1252
 
@@ -1261,6 +1267,9 @@
1261
1267
 
1262
1268
 
1263
1269
 
1270
+
1271
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
1272
+
1264
1273
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1265
1274
 
1266
1275
 
@@ -1277,11 +1286,14 @@
1277
1286
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1278
1287
 
1279
1288
 
1289
+
1280
1290
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
1281
1291
 
1282
1292
 
1283
1293
 
1284
1294
 
1295
+
1296
+
1285
1297
  </xsl:attribute-set><xsl:attribute-set name="note-style">
1286
1298
 
1287
1299
 
@@ -1303,6 +1315,7 @@
1303
1315
 
1304
1316
 
1305
1317
 
1318
+
1306
1319
  </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">
1307
1320
 
1308
1321
 
@@ -1349,10 +1362,12 @@
1349
1362
 
1350
1363
 
1351
1364
 
1365
+
1352
1366
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1353
1367
 
1354
1368
 
1355
1369
 
1370
+
1356
1371
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1357
1372
 
1358
1373
 
@@ -1379,6 +1394,7 @@
1379
1394
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1380
1395
 
1381
1396
 
1397
+
1382
1398
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
1383
1399
 
1384
1400
 
@@ -1386,6 +1402,7 @@
1386
1402
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
1387
1403
 
1388
1404
 
1405
+
1389
1406
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1390
1407
 
1391
1408
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
@@ -1413,6 +1430,7 @@
1413
1430
 
1414
1431
 
1415
1432
 
1433
+
1416
1434
 
1417
1435
 
1418
1436
 
@@ -1458,8 +1476,10 @@
1458
1476
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1459
1477
 
1460
1478
 
1479
+
1461
1480
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1462
1481
 
1482
+
1463
1483
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1464
1484
 
1465
1485
 
@@ -1484,6 +1504,8 @@
1484
1504
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1485
1505
 
1486
1506
 
1507
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
1508
+
1487
1509
  </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">
1488
1510
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1489
1511
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1494,14 +1516,15 @@
1494
1516
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1495
1517
 
1496
1518
  <!-- Normative references -->
1497
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
1519
+ <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"/>
1498
1520
  <!-- Terms and definitions -->
1499
1521
  <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"/>
1500
1522
  <!-- Another main sections -->
1501
1523
  <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"/>
1502
1524
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
1503
1525
  <!-- Bibliography -->
1504
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
1526
+ <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"/>
1527
+
1505
1528
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1506
1529
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1507
1530
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -1537,11 +1560,11 @@
1537
1560
  <xsl:variable name="table">
1538
1561
 
1539
1562
  <xsl:variable name="simple-table">
1540
- <xsl:call-template name="getSimpleTable"/>
1563
+ <xsl:call-template name="getSimpleTable"/>
1541
1564
  </xsl:variable>
1542
1565
 
1543
1566
  <!-- <xsl:if test="$namespace = 'bipm'">
1544
- <fo:block>&#xA0;</fo:block>
1567
+ <fo:block>&#xA0;</fo:block>
1545
1568
  </xsl:if> -->
1546
1569
 
1547
1570
  <!-- $namespace = 'iso' or -->
@@ -1650,6 +1673,7 @@
1650
1673
 
1651
1674
 
1652
1675
 
1676
+
1653
1677
  </xsl:variable>
1654
1678
 
1655
1679
 
@@ -1791,6 +1815,9 @@
1791
1815
  <fo:block xsl:use-attribute-sets="table-name-style">
1792
1816
 
1793
1817
 
1818
+
1819
+
1820
+
1794
1821
  <xsl:choose>
1795
1822
  <xsl:when test="$continued = 'true'">
1796
1823
  <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
@@ -1938,6 +1965,7 @@
1938
1965
  <!-- font-weight="bold" -->
1939
1966
  <fo:table-header>
1940
1967
 
1968
+
1941
1969
  <xsl:apply-templates/>
1942
1970
  </fo:table-header>
1943
1971
  </xsl:template><xsl:template name="table-header-title">
@@ -2088,6 +2116,7 @@
2088
2116
 
2089
2117
 
2090
2118
 
2119
+
2091
2120
  <!-- fn will be processed inside 'note' processing -->
2092
2121
 
2093
2122
 
@@ -2096,6 +2125,10 @@
2096
2125
 
2097
2126
 
2098
2127
 
2128
+
2129
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2130
+
2131
+
2099
2132
  <!-- except gb -->
2100
2133
 
2101
2134
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2121,6 +2154,10 @@
2121
2154
  <!-- fn processing -->
2122
2155
  <xsl:call-template name="fn_display"/>
2123
2156
 
2157
+
2158
+ <!-- for PAS display Notes after footnotes -->
2159
+
2160
+
2124
2161
  </fo:table-cell>
2125
2162
  </fo:table-row>
2126
2163
  </fo:table-body>
@@ -2178,11 +2215,16 @@
2178
2215
  <xsl:if test="$parent-name = 'tfoot'">
2179
2216
 
2180
2217
 
2218
+
2181
2219
  </xsl:if>
2182
2220
 
2183
2221
 
2184
2222
 
2185
2223
 
2224
+
2225
+
2226
+
2227
+
2186
2228
  <!-- <xsl:if test="$namespace = 'bipm'">
2187
2229
  <xsl:attribute name="height">8mm</xsl:attribute>
2188
2230
  </xsl:if> -->
@@ -2212,6 +2254,7 @@
2212
2254
 
2213
2255
 
2214
2256
 
2257
+
2215
2258
  <xsl:if test="$lang = 'ar'">
2216
2259
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2217
2260
  </xsl:if>
@@ -2269,6 +2312,10 @@
2269
2312
 
2270
2313
 
2271
2314
 
2315
+
2316
+
2317
+
2318
+
2272
2319
  <xsl:if test=".//*[local-name() = 'table']">
2273
2320
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2274
2321
  </xsl:if>
@@ -2296,12 +2343,18 @@
2296
2343
 
2297
2344
 
2298
2345
 
2346
+
2299
2347
  <xsl:attribute name="font-size">12pt</xsl:attribute>
2300
2348
 
2301
2349
 
2302
2350
 
2351
+
2352
+ <!-- Table's note name (NOTE, for example) -->
2353
+
2303
2354
  <fo:inline padding-right="2mm">
2304
2355
 
2356
+
2357
+
2305
2358
 
2306
2359
  <xsl:attribute name="font-size">11pt</xsl:attribute>
2307
2360
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
@@ -2312,6 +2365,8 @@
2312
2365
 
2313
2366
  </fo:inline>
2314
2367
 
2368
+
2369
+
2315
2370
  <xsl:apply-templates mode="process"/>
2316
2371
  </fo:block>
2317
2372
 
@@ -2331,6 +2386,8 @@
2331
2386
  <xsl:variable name="reference" select="@reference"/>
2332
2387
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2333
2388
  <fo:block margin-bottom="12pt">
2389
+
2390
+
2334
2391
 
2335
2392
 
2336
2393
 
@@ -2346,9 +2403,11 @@
2346
2403
 
2347
2404
 
2348
2405
 
2406
+
2349
2407
  <xsl:value-of select="@reference"/>
2350
2408
 
2351
2409
 
2410
+
2352
2411
  </fo:inline>
2353
2412
  <fo:inline>
2354
2413
 
@@ -2489,11 +2548,16 @@
2489
2548
 
2490
2549
 
2491
2550
 
2551
+
2552
+
2553
+
2554
+
2492
2555
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2493
2556
 
2494
2557
 
2495
2558
  <xsl:value-of select="@reference"/>
2496
2559
 
2560
+
2497
2561
  </fo:basic-link>
2498
2562
  </fo:inline>
2499
2563
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -2580,6 +2644,7 @@
2580
2644
 
2581
2645
 
2582
2646
 
2647
+
2583
2648
  <xsl:variable name="title-key">
2584
2649
 
2585
2650
 
@@ -2794,6 +2859,7 @@
2794
2859
 
2795
2860
  <fo:table-row>
2796
2861
 
2862
+
2797
2863
  <fo:table-cell>
2798
2864
 
2799
2865
  <fo:block margin-top="6pt">
@@ -2812,6 +2878,7 @@
2812
2878
 
2813
2879
 
2814
2880
 
2881
+
2815
2882
  <xsl:apply-templates/>
2816
2883
  <!-- <xsl:if test="$namespace = 'gb'">
2817
2884
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -2868,6 +2935,8 @@
2868
2935
 
2869
2936
  <xsl:apply-templates/>
2870
2937
  </fo:inline>
2938
+ </xsl:template><xsl:template match="*[local-name()='padding']">
2939
+ <fo:inline padding-right="{@value}"> </fo:inline>
2871
2940
  </xsl:template><xsl:template match="*[local-name()='sup']">
2872
2941
  <fo:inline font-size="80%" vertical-align="super">
2873
2942
  <xsl:apply-templates/>
@@ -3357,9 +3426,27 @@
3357
3426
  <xsl:copy>
3358
3427
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3359
3428
  </xsl:copy>
3360
- <mathml:mspace width="0.5ex"/>
3429
+ <xsl:choose>
3430
+ <!-- if in msub, then don't add space -->
3431
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3432
+ <!-- if next char in digit, don't add space -->
3433
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3434
+ <xsl:otherwise>
3435
+ <mathml:mspace width="0.5ex"/>
3436
+ </xsl:otherwise>
3437
+ </xsl:choose>
3361
3438
  </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">
3362
3439
  <xsl:variable name="target">
3440
+ <xsl:choose>
3441
+ <xsl:when test="@updatetype = 'true'">
3442
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
3443
+ </xsl:when>
3444
+ <xsl:otherwise>
3445
+ <xsl:value-of select="normalize-space(@target)"/>
3446
+ </xsl:otherwise>
3447
+ </xsl:choose>
3448
+ </xsl:variable>
3449
+ <xsl:variable name="target_text">
3363
3450
  <xsl:choose>
3364
3451
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3365
3452
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -3371,20 +3458,22 @@
3371
3458
  </xsl:variable>
3372
3459
  <fo:inline xsl:use-attribute-sets="link-style">
3373
3460
 
3461
+
3462
+
3374
3463
  <xsl:choose>
3375
- <xsl:when test="$target = ''">
3464
+ <xsl:when test="$target_text = ''">
3376
3465
  <xsl:apply-templates/>
3377
3466
  </xsl:when>
3378
3467
  <xsl:otherwise>
3379
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3468
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
3380
3469
  <xsl:choose>
3381
3470
  <xsl:when test="normalize-space(.) = ''">
3382
- <!-- <xsl:value-of select="$target"/> -->
3383
3471
  <xsl:call-template name="add-zero-spaces-link-java">
3384
- <xsl:with-param name="text" select="$target"/>
3472
+ <xsl:with-param name="text" select="$target_text"/>
3385
3473
  </xsl:call-template>
3386
3474
  </xsl:when>
3387
3475
  <xsl:otherwise>
3476
+ <!-- output text from <link>text</link> -->
3388
3477
  <xsl:apply-templates/>
3389
3478
  </xsl:otherwise>
3390
3479
  </xsl:choose>
@@ -3479,6 +3568,7 @@
3479
3568
 
3480
3569
 
3481
3570
 
3571
+
3482
3572
  <fo:block-container margin-left="0mm">
3483
3573
 
3484
3574
 
@@ -3526,6 +3616,7 @@
3526
3616
  </xsl:choose>
3527
3617
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
3528
3618
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
3619
+
3529
3620
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
3530
3621
 
3531
3622
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
@@ -3599,6 +3690,7 @@
3599
3690
  </xsl:call-template>
3600
3691
 
3601
3692
  <fo:block>
3693
+
3602
3694
  <xsl:apply-templates/>
3603
3695
  </fo:block>
3604
3696
  <xsl:call-template name="fn_display_figure"/>
@@ -3721,6 +3813,234 @@
3721
3813
  <xsl:param name="height"/>
3722
3814
  <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; "/>
3723
3815
  <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; "/>
3816
+ </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">
3817
+ <xsl:param name="name"/>
3818
+
3819
+ <xsl:variable name="svg_content">
3820
+ <xsl:apply-templates select="." mode="svg_update"/>
3821
+ </xsl:variable>
3822
+
3823
+ <xsl:variable name="alt-text">
3824
+ <xsl:choose>
3825
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
3826
+ <xsl:value-of select="../*[local-name() = 'name']"/>
3827
+ </xsl:when>
3828
+ <xsl:when test="normalize-space($name) != ''">
3829
+ <xsl:value-of select="$name"/>
3830
+ </xsl:when>
3831
+ <xsl:otherwise>Figure</xsl:otherwise>
3832
+ </xsl:choose>
3833
+ </xsl:variable>
3834
+
3835
+ <xsl:choose>
3836
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
3837
+ <fo:block>
3838
+ <xsl:variable name="width" select="@width"/>
3839
+ <xsl:variable name="height" select="@height"/>
3840
+
3841
+ <xsl:variable name="scale_x">
3842
+ <xsl:choose>
3843
+ <xsl:when test="$width &gt; $width_effective_px">
3844
+ <xsl:value-of select="$width_effective_px div $width"/>
3845
+ </xsl:when>
3846
+ <xsl:otherwise>1</xsl:otherwise>
3847
+ </xsl:choose>
3848
+ </xsl:variable>
3849
+
3850
+ <xsl:variable name="scale_y">
3851
+ <xsl:choose>
3852
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
3853
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
3854
+ </xsl:when>
3855
+ <xsl:otherwise>1</xsl:otherwise>
3856
+ </xsl:choose>
3857
+ </xsl:variable>
3858
+
3859
+ <xsl:variable name="scale">
3860
+ <xsl:choose>
3861
+ <xsl:when test="$scale_y != 1">
3862
+ <xsl:value-of select="$scale_x * $scale_y"/>
3863
+ </xsl:when>
3864
+ <xsl:otherwise>
3865
+ <xsl:value-of select="$scale_x"/>
3866
+ </xsl:otherwise>
3867
+ </xsl:choose>
3868
+ </xsl:variable>
3869
+
3870
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
3871
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
3872
+
3873
+ <fo:table table-layout="fixed" width="100%">
3874
+ <fo:table-column column-width="proportional-column-width(1)"/>
3875
+ <fo:table-column column-width="{$width_scale}px"/>
3876
+ <fo:table-column column-width="proportional-column-width(1)"/>
3877
+ <fo:table-body>
3878
+ <fo:table-row>
3879
+ <fo:table-cell column-number="2">
3880
+ <fo:block>
3881
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
3882
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3883
+ <fo:block line-height="0" font-size="0">
3884
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
3885
+ <xsl:call-template name="bookmark"/>
3886
+ </xsl:for-each>
3887
+ </fo:block>
3888
+ </xsl:if>
3889
+ <fo:block text-depth="0" line-height="0" font-size="0">
3890
+
3891
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3892
+ <xsl:attribute name="width">100%</xsl:attribute>
3893
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3894
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3895
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3896
+
3897
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
3898
+ </fo:instream-foreign-object>
3899
+ </fo:block>
3900
+
3901
+ <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">
3902
+ <xsl:with-param name="scale" select="$scale"/>
3903
+ </xsl:apply-templates>
3904
+ </fo:block-container>
3905
+ </fo:block>
3906
+ </fo:table-cell>
3907
+ </fo:table-row>
3908
+ </fo:table-body>
3909
+ </fo:table>
3910
+ </fo:block>
3911
+
3912
+ </xsl:when>
3913
+ <xsl:otherwise>
3914
+ <fo:block xsl:use-attribute-sets="image-style">
3915
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
3916
+ <xsl:attribute name="width">100%</xsl:attribute>
3917
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3918
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3919
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
3920
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
3921
+ <!-- effective height / width = 1.48, 1.4 - with title -->
3922
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
3923
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
3924
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
3925
+ </xsl:if>
3926
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3927
+ <xsl:copy-of select="$svg_content"/>
3928
+ </fo:instream-foreign-object>
3929
+ </fo:block>
3930
+ </xsl:otherwise>
3931
+ </xsl:choose>
3932
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
3933
+ <xsl:copy>
3934
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
3935
+ </xsl:copy>
3936
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
3937
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
3938
+ <xsl:value-of select="."/>
3939
+ </xsl:attribute>
3940
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3941
+ <xsl:variable name="svg_content" select="document(@src)"/>
3942
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3943
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
3944
+ <xsl:call-template name="image_svg">
3945
+ <xsl:with-param name="name" select="$name"/>
3946
+ </xsl:call-template>
3947
+ </xsl:for-each>
3948
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
3949
+ <xsl:copy>
3950
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
3951
+ </xsl:copy>
3952
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
3953
+ <xsl:apply-templates mode="svg_remove_a"/>
3954
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
3955
+ <xsl:param name="scale"/>
3956
+ <xsl:variable name="dest">
3957
+ <xsl:choose>
3958
+ <xsl:when test="starts-with(@href, '#')">
3959
+ <xsl:value-of select="substring-after(@href, '#')"/>
3960
+ </xsl:when>
3961
+ <xsl:otherwise>
3962
+ <xsl:value-of select="@href"/>
3963
+ </xsl:otherwise>
3964
+ </xsl:choose>
3965
+ </xsl:variable>
3966
+ <xsl:for-each select="./*[local-name() = 'rect']">
3967
+ <xsl:call-template name="insertSVGMapLink">
3968
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
3969
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
3970
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
3971
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
3972
+ <xsl:with-param name="dest" select="$dest"/>
3973
+ </xsl:call-template>
3974
+ </xsl:for-each>
3975
+
3976
+ <xsl:for-each select="./*[local-name() = 'polygon']">
3977
+ <xsl:variable name="points">
3978
+ <xsl:call-template name="split">
3979
+ <xsl:with-param name="pText" select="@points"/>
3980
+ </xsl:call-template>
3981
+ </xsl:variable>
3982
+ <xsl:variable name="x_coords">
3983
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
3984
+ <xsl:sort select="." data-type="number"/>
3985
+ <x><xsl:value-of select="."/></x>
3986
+ </xsl:for-each>
3987
+ </xsl:variable>
3988
+ <xsl:variable name="y_coords">
3989
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
3990
+ <xsl:sort select="." data-type="number"/>
3991
+ <y><xsl:value-of select="."/></y>
3992
+ </xsl:for-each>
3993
+ </xsl:variable>
3994
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
3995
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
3996
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
3997
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
3998
+ <xsl:call-template name="insertSVGMapLink">
3999
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
4000
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
4001
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
4002
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
4003
+ <xsl:with-param name="dest" select="$dest"/>
4004
+ </xsl:call-template>
4005
+ </xsl:for-each>
4006
+
4007
+ <xsl:for-each select="./*[local-name() = 'circle']">
4008
+ <xsl:call-template name="insertSVGMapLink">
4009
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
4010
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
4011
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
4012
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
4013
+ <xsl:with-param name="dest" select="$dest"/>
4014
+ </xsl:call-template>
4015
+ </xsl:for-each>
4016
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
4017
+ <xsl:call-template name="insertSVGMapLink">
4018
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
4019
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
4020
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
4021
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
4022
+ <xsl:with-param name="dest" select="$dest"/>
4023
+ </xsl:call-template>
4024
+ </xsl:for-each>
4025
+ </xsl:template><xsl:template name="insertSVGMapLink">
4026
+ <xsl:param name="left"/>
4027
+ <xsl:param name="top"/>
4028
+ <xsl:param name="width"/>
4029
+ <xsl:param name="height"/>
4030
+ <xsl:param name="dest"/>
4031
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
4032
+ <fo:block font-size="1pt">
4033
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
4034
+ <fo:inline-container inline-progression-dimension="100%">
4035
+ <fo:block-container height="{$height - 1}px" width="100%">
4036
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
4037
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
4038
+ </xsl:if> -->
4039
+ <fo:block> </fo:block></fo:block-container>
4040
+ </fo:inline-container>
4041
+ </fo:basic-link>
4042
+ </fo:block>
4043
+ </fo:block-container>
3724
4044
  </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">
3725
4045
  <xsl:apply-templates mode="contents"/>
3726
4046
  <xsl:text> </xsl:text>
@@ -3749,28 +4069,39 @@
3749
4069
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3750
4070
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3751
4071
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4072
+ <xsl:if test="@bundle = 'true'">
4073
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
4074
+ </xsl:if>
3752
4075
  <fo:bookmark-title>
3753
- <xsl:variable name="bookmark-title_">
3754
- <xsl:call-template name="getLangVersion">
3755
- <xsl:with-param name="lang" select="@lang"/>
3756
- <xsl:with-param name="doctype" select="@doctype"/>
3757
- <xsl:with-param name="title" select="@title-part"/>
3758
- </xsl:call-template>
3759
- </xsl:variable>
3760
4076
  <xsl:choose>
3761
- <xsl:when test="normalize-space($bookmark-title_) != ''">
3762
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
3763
- </xsl:when>
3764
- <xsl:otherwise>
4077
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
4078
+ <xsl:variable name="bookmark-title_">
4079
+ <xsl:call-template name="getLangVersion">
4080
+ <xsl:with-param name="lang" select="@lang"/>
4081
+ <xsl:with-param name="doctype" select="@doctype"/>
4082
+ <xsl:with-param name="title" select="@title-part"/>
4083
+ </xsl:call-template>
4084
+ </xsl:variable>
3765
4085
  <xsl:choose>
3766
- <xsl:when test="@lang = 'en'">English</xsl:when>
3767
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
3768
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3769
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4086
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4087
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4088
+ </xsl:when>
4089
+ <xsl:otherwise>
4090
+ <xsl:choose>
4091
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4092
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4093
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4094
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4095
+ </xsl:choose>
4096
+ </xsl:otherwise>
3770
4097
  </xsl:choose>
4098
+ </xsl:when>
4099
+ <xsl:otherwise>
4100
+ <xsl:value-of select="@title-part"/>
3771
4101
  </xsl:otherwise>
3772
4102
  </xsl:choose>
3773
4103
  </fo:bookmark-title>
4104
+
3774
4105
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3775
4106
 
3776
4107
  <xsl:call-template name="insertFigureBookmarks">
@@ -3869,20 +4200,28 @@
3869
4200
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
3870
4201
  </xsl:choose>
3871
4202
  </xsl:template><xsl:template match="item" mode="bookmark">
3872
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
3873
- <fo:bookmark-title>
3874
- <xsl:if test="@section != ''">
3875
- <xsl:value-of select="@section"/>
3876
- <xsl:text> </xsl:text>
3877
- </xsl:if>
3878
- <xsl:value-of select="normalize-space(title)"/>
3879
- </fo:bookmark-title>
3880
- <xsl:apply-templates mode="bookmark"/>
3881
- </fo:bookmark>
4203
+ <xsl:choose>
4204
+ <xsl:when test="@id != ''">
4205
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4206
+ <fo:bookmark-title>
4207
+ <xsl:if test="@section != ''">
4208
+ <xsl:value-of select="@section"/>
4209
+ <xsl:text> </xsl:text>
4210
+ </xsl:if>
4211
+ <xsl:value-of select="normalize-space(title)"/>
4212
+ </fo:bookmark-title>
4213
+ <xsl:apply-templates mode="bookmark"/>
4214
+ </fo:bookmark>
4215
+ </xsl:when>
4216
+ <xsl:otherwise>
4217
+ <xsl:apply-templates mode="bookmark"/>
4218
+ </xsl:otherwise>
4219
+ </xsl:choose>
3882
4220
  </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">
3883
4221
  <xsl:if test="normalize-space() != ''">
3884
4222
  <fo:block xsl:use-attribute-sets="figure-name-style">
3885
4223
 
4224
+
3886
4225
  <xsl:apply-templates/>
3887
4226
  </fo:block>
3888
4227
  </xsl:if>
@@ -3962,6 +4301,8 @@
3962
4301
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3963
4302
 
3964
4303
  <fo:block-container margin-left="0mm">
4304
+ <xsl:copy-of select="@id"/>
4305
+
3965
4306
  <xsl:if test="parent::*[local-name() = 'note']">
3966
4307
  <xsl:attribute name="margin-left">
3967
4308
  <xsl:choose>
@@ -3972,7 +4313,9 @@
3972
4313
 
3973
4314
  </xsl:if>
3974
4315
  <fo:block-container margin-left="0mm">
3975
-
4316
+
4317
+
4318
+
3976
4319
  <fo:block xsl:use-attribute-sets="sourcecode-style">
3977
4320
  <xsl:variable name="_font-size">
3978
4321
 
@@ -4001,10 +4344,14 @@
4001
4344
  </xsl:choose>
4002
4345
  </xsl:attribute>
4003
4346
  </xsl:if>
4004
- <xsl:apply-templates/>
4005
- </fo:block>
4347
+
4348
+ <xsl:apply-templates/>
4349
+ </fo:block>
4350
+
4351
+
4006
4352
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4007
4353
 
4354
+
4008
4355
  </fo:block-container>
4009
4356
  </fo:block-container>
4010
4357
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -4239,6 +4586,7 @@
4239
4586
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4240
4587
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4241
4588
 
4589
+
4242
4590
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4243
4591
 
4244
4592
  <xsl:variable name="element">
@@ -4348,12 +4696,15 @@
4348
4696
 
4349
4697
 
4350
4698
 
4699
+
4700
+
4701
+
4351
4702
  <xsl:call-template name="getTitle">
4352
4703
  <xsl:with-param name="name" select="'title-source'"/>
4353
4704
  </xsl:call-template>
4705
+ <xsl:text>: </xsl:text>
4354
4706
 
4355
4707
 
4356
- <xsl:text>: </xsl:text>
4357
4708
  </fo:inline>
4358
4709
 
4359
4710
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -4424,7 +4775,9 @@
4424
4775
 
4425
4776
 
4426
4777
  </xsl:if>
4427
-
4778
+
4779
+
4780
+
4428
4781
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4429
4782
  <xsl:if test="normalize-space(@citeas) = ''">
4430
4783
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
@@ -4436,6 +4789,7 @@
4436
4789
 
4437
4790
 
4438
4791
 
4792
+
4439
4793
  </xsl:if>
4440
4794
 
4441
4795
  <xsl:apply-templates/>
@@ -4480,6 +4834,7 @@
4480
4834
 
4481
4835
 
4482
4836
 
4837
+
4483
4838
  </xsl:variable>
4484
4839
 
4485
4840
  <xsl:variable name="padding-right">
@@ -4576,6 +4931,7 @@
4576
4931
  <xsl:call-template name="setId"/>
4577
4932
 
4578
4933
 
4934
+
4579
4935
  <xsl:apply-templates/>
4580
4936
  </fo:block>
4581
4937
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -4921,17 +5277,17 @@
4921
5277
  <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')]"/>
4922
5278
  <xsl:choose>
4923
5279
  <xsl:when test="normalize-space($_doc_ident) != ''">
4924
- <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"/>
5280
+ <!-- <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"/>
4925
5281
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
4926
5282
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4927
- </xsl:if>
5283
+ </xsl:if> -->
4928
5284
  <xsl:value-of select="$_doc_ident"/>
4929
5285
  </xsl:when>
4930
5286
  <xsl:otherwise>
4931
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
5287
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
4932
5288
  <xsl:if test="$type != ''">
4933
5289
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
4934
- </xsl:if>
5290
+ </xsl:if> -->
4935
5291
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
4936
5292
  </xsl:otherwise>
4937
5293
  </xsl:choose>
@@ -5244,6 +5600,9 @@
5244
5600
  <xsl:when test="parent::*[local-name() = 'preface']">
5245
5601
  <xsl:value-of select="$level_total - 1"/>
5246
5602
  </xsl:when>
5603
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
5604
+ <xsl:value-of select="$level_total - 1"/>
5605
+ </xsl:when>
5247
5606
  <xsl:when test="ancestor::*[local-name() = 'preface']">
5248
5607
  <xsl:value-of select="$level_total - 2"/>
5249
5608
  </xsl:when>
@@ -5384,7 +5743,14 @@
5384
5743
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5385
5744
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5386
5745
  </xsl:when>
5387
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5746
+ <xsl:otherwise>
5747
+ <xsl:variable name="key_">
5748
+ <xsl:call-template name="capitalize">
5749
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
5750
+ </xsl:call-template>
5751
+ </xsl:variable>
5752
+ <xsl:value-of select="$key_"/>
5753
+ </xsl:otherwise>
5388
5754
  </xsl:choose>
5389
5755
 
5390
5756
  </xsl:template><xsl:template name="setTrackChangesStyles">
@@ -5427,4 +5793,110 @@
5427
5793
  <xsl:value-of select="$align"/>
5428
5794
  </xsl:when>
5429
5795
  </xsl:choose>
5796
+ </xsl:template><xsl:template name="setTextAlignment">
5797
+ <xsl:param name="default">left</xsl:param>
5798
+ <xsl:attribute name="text-align">
5799
+ <xsl:choose>
5800
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
5801
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
5802
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
5803
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
5804
+ </xsl:choose>
5805
+ </xsl:attribute>
5806
+ </xsl:template><xsl:template name="number-to-words">
5807
+ <xsl:param name="number"/>
5808
+ <xsl:param name="first"/>
5809
+ <xsl:if test="$number != ''">
5810
+ <xsl:variable name="words">
5811
+ <words>
5812
+ <word cardinal="1">One-</word>
5813
+ <word ordinal="1">First </word>
5814
+ <word cardinal="2">Two-</word>
5815
+ <word ordinal="2">Second </word>
5816
+ <word cardinal="3">Three-</word>
5817
+ <word ordinal="3">Third </word>
5818
+ <word cardinal="4">Four-</word>
5819
+ <word ordinal="4">Fourth </word>
5820
+ <word cardinal="5">Five-</word>
5821
+ <word ordinal="5">Fifth </word>
5822
+ <word cardinal="6">Six-</word>
5823
+ <word ordinal="6">Sixth </word>
5824
+ <word cardinal="7">Seven-</word>
5825
+ <word ordinal="7">Seventh </word>
5826
+ <word cardinal="8">Eight-</word>
5827
+ <word ordinal="8">Eighth </word>
5828
+ <word cardinal="9">Nine-</word>
5829
+ <word ordinal="9">Ninth </word>
5830
+ <word ordinal="10">Tenth </word>
5831
+ <word ordinal="11">Eleventh </word>
5832
+ <word ordinal="12">Twelfth </word>
5833
+ <word ordinal="13">Thirteenth </word>
5834
+ <word ordinal="14">Fourteenth </word>
5835
+ <word ordinal="15">Fifteenth </word>
5836
+ <word ordinal="16">Sixteenth </word>
5837
+ <word ordinal="17">Seventeenth </word>
5838
+ <word ordinal="18">Eighteenth </word>
5839
+ <word ordinal="19">Nineteenth </word>
5840
+ <word cardinal="20">Twenty-</word>
5841
+ <word ordinal="20">Twentieth </word>
5842
+ <word cardinal="30">Thirty-</word>
5843
+ <word ordinal="30">Thirtieth </word>
5844
+ <word cardinal="40">Forty-</word>
5845
+ <word ordinal="40">Fortieth </word>
5846
+ <word cardinal="50">Fifty-</word>
5847
+ <word ordinal="50">Fiftieth </word>
5848
+ <word cardinal="60">Sixty-</word>
5849
+ <word ordinal="60">Sixtieth </word>
5850
+ <word cardinal="70">Seventy-</word>
5851
+ <word ordinal="70">Seventieth </word>
5852
+ <word cardinal="80">Eighty-</word>
5853
+ <word ordinal="80">Eightieth </word>
5854
+ <word cardinal="90">Ninety-</word>
5855
+ <word ordinal="90">Ninetieth </word>
5856
+ <word cardinal="100">Hundred-</word>
5857
+ <word ordinal="100">Hundredth </word>
5858
+ </words>
5859
+ </xsl:variable>
5860
+
5861
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
5862
+
5863
+ <xsl:variable name="value">
5864
+ <xsl:choose>
5865
+ <xsl:when test="$ordinal != ''">
5866
+ <xsl:value-of select="$ordinal"/>
5867
+ </xsl:when>
5868
+ <xsl:otherwise>
5869
+ <xsl:choose>
5870
+ <xsl:when test="$number &lt; 100">
5871
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
5872
+ <xsl:variable name="digit" select="substring($number,2)"/>
5873
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
5874
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
5875
+ </xsl:when>
5876
+ <xsl:otherwise>
5877
+ <!-- more 100 -->
5878
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
5879
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
5880
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
5881
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
5882
+ <xsl:call-template name="number-to-words">
5883
+ <xsl:with-param name="number" select="$digits"/>
5884
+ </xsl:call-template>
5885
+ </xsl:otherwise>
5886
+ </xsl:choose>
5887
+ </xsl:otherwise>
5888
+ </xsl:choose>
5889
+ </xsl:variable>
5890
+ <xsl:choose>
5891
+ <xsl:when test="$first = 'true'">
5892
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
5893
+ <xsl:call-template name="capitalize">
5894
+ <xsl:with-param name="str" select="$value_lc"/>
5895
+ </xsl:call-template>
5896
+ </xsl:when>
5897
+ <xsl:otherwise>
5898
+ <xsl:value-of select="$value"/>
5899
+ </xsl:otherwise>
5900
+ </xsl:choose>
5901
+ </xsl:if>
5430
5902
  </xsl:template></xsl:stylesheet>