metanorma-ogc 1.3.6 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/ogc/boilerplate.xml +6 -6
  3. data/lib/asciidoctor/ogc/converter.rb +91 -36
  4. data/lib/asciidoctor/ogc/front.rb +1 -1
  5. data/lib/asciidoctor/ogc/isodoc.rng +67 -16
  6. data/lib/asciidoctor/ogc/ogc.rng +13 -13
  7. data/lib/asciidoctor/ogc/reqt.rng +15 -4
  8. data/lib/isodoc/ogc/biblio.rb +57 -51
  9. data/lib/isodoc/ogc/i18n-en.yaml +17 -3
  10. data/lib/isodoc/ogc/metadata.rb +1 -1
  11. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +494 -139
  12. data/lib/isodoc/ogc/ogc.best-practice.xsl +494 -139
  13. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +494 -139
  14. data/lib/isodoc/ogc/ogc.community-practice.xsl +494 -139
  15. data/lib/isodoc/ogc/ogc.community-standard.xsl +494 -139
  16. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +494 -139
  17. data/lib/isodoc/ogc/ogc.engineering-report.xsl +494 -139
  18. data/lib/isodoc/ogc/ogc.other.xsl +494 -139
  19. data/lib/isodoc/ogc/ogc.policy.xsl +494 -139
  20. data/lib/isodoc/ogc/ogc.reference-model.xsl +494 -139
  21. data/lib/isodoc/ogc/ogc.release-notes.xsl +494 -139
  22. data/lib/isodoc/ogc/ogc.standard.xsl +494 -139
  23. data/lib/isodoc/ogc/ogc.test-suite.xsl +494 -139
  24. data/lib/isodoc/ogc/ogc.user-guide.xsl +494 -139
  25. data/lib/isodoc/ogc/ogc.white-paper.xsl +451 -100
  26. data/lib/isodoc/ogc/presentation_xml_convert.rb +53 -46
  27. data/lib/isodoc/ogc/reqt.rb +73 -24
  28. data/lib/isodoc/ogc/word_convert.rb +13 -12
  29. data/lib/isodoc/ogc/xref.rb +58 -41
  30. data/lib/metanorma/ogc/processor.rb +2 -1
  31. data/lib/metanorma/ogc/version.rb +1 -1
  32. metadata +2 -2
@@ -64,9 +64,9 @@
64
64
  <optional>
65
65
  <ref name="label"/>
66
66
  </optional>
67
- <optional>
67
+ <zeroOrMore>
68
68
  <ref name="subject"/>
69
- </optional>
69
+ </zeroOrMore>
70
70
  <zeroOrMore>
71
71
  <ref name="reqinherit"/>
72
72
  </zeroOrMore>
@@ -80,6 +80,7 @@
80
80
  <ref name="verification"/>
81
81
  <ref name="import"/>
82
82
  <ref name="description"/>
83
+ <ref name="component"/>
83
84
  </choice>
84
85
  </zeroOrMore>
85
86
  <optional>
@@ -105,12 +106,16 @@
105
106
  </define>
106
107
  <define name="subject">
107
108
  <element name="subject">
108
- <text/>
109
+ <oneOrMore>
110
+ <ref name="TextElement"/>
111
+ </oneOrMore>
109
112
  </element>
110
113
  </define>
111
114
  <define name="reqinherit">
112
115
  <element name="inherit">
113
- <text/>
116
+ <oneOrMore>
117
+ <ref name="TextElement"/>
118
+ </oneOrMore>
114
119
  </element>
115
120
  </define>
116
121
  <define name="measurementtarget">
@@ -138,6 +143,12 @@
138
143
  <ref name="RequirementSubpart"/>
139
144
  </element>
140
145
  </define>
146
+ <define name="component">
147
+ <element name="component">
148
+ <attribute name="class"/>
149
+ <ref name="RequirementSubpart"/>
150
+ </element>
151
+ </define>
141
152
  <define name="reqt_references">
142
153
  <element name="references">
143
154
  <oneOrMore>
@@ -1,31 +1,31 @@
1
1
  module IsoDoc
2
2
  module Ogc
3
3
  module BaseConvert
4
- def std_bibitem_entry(list, b, ordinal, biblio)
5
- list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
4
+ def std_bibitem_entry(list, bib, ordinal, biblio)
5
+ list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
6
6
  prefix_bracketed_ref(ref, "[#{ordinal}]") if biblio
7
- standard_citation(ref, b)
7
+ standard_citation(ref, bib)
8
8
  end
9
9
  end
10
10
 
11
- def nonstd_bibitem(list, b, ordinal, bibliography)
12
- list.p **attr_code(iso_bibitem_entry_attrs(b, bibliography)) do |r|
13
- id = bibitem_ref_code(b)
11
+ def nonstd_bibitem(list, bib, ordinal, bibliography)
12
+ list.p **attr_code(iso_bibitem_entry_attrs(bib, bibliography)) do |r|
13
+ id = bibitem_ref_code(bib)
14
14
  identifier = render_identifier(id)
15
15
  identifier[1] = nil
16
16
  if bibliography
17
17
  ref_entry_code(r, ordinal, identifier, id)
18
18
  end
19
- reference_format(b, r)
19
+ reference_format(bib, r)
20
20
  end
21
21
  end
22
22
 
23
- def reference_format(b, r)
24
- if ftitle = b.at(ns("./formattedref"))
25
- ftitle&.children&.each { |n| parse(n, r) }
23
+ def reference_format(bib, ref)
24
+ if ftitle = bib.at(ns("./formattedref"))
25
+ ftitle&.children&.each { |n| parse(n, ref) }
26
26
  else
27
27
  # eventually will be full LNCS reference
28
- standard_citation(r, b)
28
+ standard_citation(ref, bib)
29
29
  end
30
30
  end
31
31
 
@@ -34,97 +34,101 @@ module IsoDoc
34
34
  end
35
35
 
36
36
  def multiplenames_and(names)
37
- return "" if names.length == 0
37
+ return "" if names.empty?
38
38
  return names[0] if names.length == 1
39
39
  return "#{names[0]} and #{names[1]}" if names.length == 2
40
+
40
41
  names[0..-2].join(", ") + " and #{names[-1]}"
41
42
  end
42
43
 
43
- def nodes_to_span(n)
44
+ def nodes_to_span(node)
44
45
  noko do |xml|
45
46
  xml.span do |s|
46
- n&.children&.each { |x| parse(x, s) }
47
+ node&.children&.each { |x| parse(x, s) }
47
48
  end
48
- end.join("")
49
+ end.join
49
50
  end
50
51
 
51
- def extract_publisher(b)
52
- c = b.xpath(ns("./contributor[role/@type = 'publisher'][organization]"))
52
+ def extract_publisher(bib)
53
53
  abbrs = []
54
54
  names = []
55
- c&.each do |c1|
55
+ bib.xpath(ns("./contributor[role/@type = 'publisher']"\
56
+ "[organization]"))&.each do |c1|
56
57
  n = c1.at(ns("./organization/name")) or next
57
58
  abbrs << (c1.at(ns("./organization/abbreviation")) || n)
58
59
  names << nodes_to_span(n)
59
60
  end
60
61
  return [nil, nil] if names.empty?
61
- return [multiplenames_and(names), (abbrs.map { |x| x.text }).join("/")]
62
+
63
+ [multiplenames_and(names), abbrs.map(&:text).join("/")]
62
64
  end
63
65
 
64
- def extract_author(b)
65
- c = b.xpath(ns("./contributor[role/@type = 'author']"))
66
- c = b.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
66
+ def extract_author(bib)
67
+ c = bib.xpath(ns("./contributor[role/@type = 'author']"))
68
+ c = bib.xpath(ns("./contributor[role/@type = 'editor']")) if c.empty?
67
69
  return nil if c.empty?
70
+
68
71
  c.map do |c1|
69
72
  c1&.at(ns("./organization/name"))&.text || extract_person_name(c1)
70
73
  end.reject { |e| e.nil? || e.empty? }.join(", ")
71
74
  end
72
75
 
73
- def extract_person_name(b)
74
- p = b.at(ns("./person/name")) or return
76
+ def extract_person_name(bib)
77
+ p = bib.at(ns("./person/name")) or return
75
78
  c = p.at(ns("./completename")) and return c.text
76
79
  s = p&.at(ns("./surname"))&.text or return
77
80
  i = p.xpath(ns("./initial")) and
78
- front = i.map { |e| e.text.gsub(/[^[:upper:]]/, "") }.join("")
81
+ front = i.map { |e| e.text.gsub(/[^[:upper:]]/, "") }.join
79
82
  i.empty? and f = p.xpath(ns("./forename")) and
80
- front = f.map { |e| e.text[0].upcase }.join("")
83
+ front = f.map { |e| e.text[0].upcase }.join
81
84
  front ? "#{s} #{front}" : s
82
85
  end
83
86
 
84
-
85
87
  def date_render(date)
86
88
  return nil if date.nil?
89
+
87
90
  on = date&.at(ns("./on"))&.text
88
91
  from = date&.at(ns("./from"))&.text
89
92
  to = date&.at(ns("./to"))&.text
90
93
  return on if on && !on.empty?
91
94
  return "#{from}&ndash;#{to}" if from && !from.empty?
95
+
92
96
  nil
93
97
  end
94
98
 
95
- def extract_year(b)
96
- d = b.at(ns("./date[@type = 'published']")) ||
97
- b.at(ns("./date[@type = 'issued']")) ||
98
- b.at(ns("./date[@type = 'circulated']")) ||
99
- b.at(ns("./date"))
99
+ def extract_year(bib)
100
+ d = bib.at(ns("./date[@type = 'published']")) ||
101
+ bib.at(ns("./date[@type = 'issued']")) ||
102
+ bib.at(ns("./date[@type = 'circulated']")) ||
103
+ bib.at(ns("./date"))
100
104
  date_render(d)
101
105
  end
102
106
 
103
- def extract_city(b)
104
- b.at(ns("./place"))
107
+ def extract_city(bib)
108
+ bib.at(ns("./place"))
105
109
  end
106
110
 
107
- def extract_uri(b)
108
- b.at(ns("./uri"))
111
+ def extract_uri(bib)
112
+ bib.at(ns("./uri"))
109
113
  end
110
114
 
111
115
  # {author}: {document identifier}, {title}. {publisher}, {city} ({year})
112
- def standard_citation(out, b)
113
- if ftitle = b.at(ns("./formattedref"))
116
+ def standard_citation(out, bib)
117
+ if ftitle = bib.at(ns("./formattedref"))
114
118
  ftitle&.children&.each { |n| parse(n, out) }
115
119
  else
116
- pub, pub_abbrev = extract_publisher(b)
117
- author = extract_author(b)
118
- c = extract_city(b)
119
- y = extract_year(b)
120
- u = extract_uri(b)
120
+ pub, pub_abbrev = extract_publisher(bib)
121
+ author = extract_author(bib)
122
+ c = extract_city(bib)
123
+ y = extract_year(bib)
124
+ u = extract_uri(bib)
121
125
  out << "#{author || pub_abbrev}: " if author || pub_abbrev
122
- id = render_identifier(inline_bibitem_ref_code(b))
126
+ id = render_identifier(inline_bibitem_ref_code(bib))
123
127
  out << id[1] if id[1]
124
- out << " (Draft)" if ogc_draft_ref?(b)
128
+ out << " (Draft)" if ogc_draft_ref?(bib)
125
129
  out << ", "
126
130
  out.i do |i|
127
- iso_title(b)&.children&.each { |n| parse(n, i) }
131
+ iso_title(bib)&.children&.each { |n| parse(n, i) }
128
132
  end
129
133
  out << ". "
130
134
  out << pub if pub
@@ -136,12 +140,14 @@ module IsoDoc
136
140
  end
137
141
  end
138
142
 
139
- def inline_bibitem_ref_code(b)
140
- id = b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
141
- "or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"))
142
- id ||= b.at(ns("./docidentifier[not(@type = 'metanorma')]"))
143
+ def inline_bibitem_ref_code(bib)
144
+ id = bib.at(ns("./docidentifier[not(@type = 'DOI' "\
145
+ "or @type = 'metanorma' or @type = 'ISSN' "\
146
+ "or @type = 'ISBN' or @type = 'rfc-anchor')]"))
147
+ id ||= bib.at(ns("./docidentifier[not(@type = 'metanorma')]"))
143
148
  return [nil, id, nil] if id
144
- id = Nokogiri::XML::Node.new("docidentifier", b.document)
149
+
150
+ id = Nokogiri::XML::Node.new("docidentifier", bib.document)
145
151
  id << "(NO ID)"
146
152
  [nil, id, nil]
147
153
  end
@@ -3,13 +3,27 @@ submitters: Submitters
3
3
  recommendationtest: Recommendation Test
4
4
  requirementtest: Requirement Test
5
5
  permissiontest: Permission Test
6
- recommendationclass: Recommendation Class
7
- requirementclass: Requirement Class
8
- permissionclass: Permission Class
6
+ recommendationclass: Recommendations Class
7
+ requirementclass: Requirements Class
8
+ permissionclass: Permissions Class
9
9
  abstracttest: Abstract Test
10
10
  conformanceclass: Conformance Class
11
11
  example: Example
12
12
  security_empty: No security considerations have been made for this %.
13
+ internal_terms_boilerplate: |
14
+ <p>This document uses the terms defined in <link target="https://portal.ogc.org/public_ogc/directives/directives.php">OGC Policy Directive 49</link>, which is based on the ISO/IEC Directives, Part 2, Rules for the structure and drafting of International Standards. In particular, the word “shall” (not “must”) is the verb form used to indicate a requirement to be strictly followed to conform to this standard and OGC documents do not use the equivalent phrases in the ISO/IEC Directives, Part 2.</p>
15
+ <p>This document also uses terms defined in the OGC Standard for Modular specifications (<link target="https://portal.opengeospatial.org/files/?artifact_id=34762">OGC 08-131r3</link>), also known as the 'ModSpec'. The definitions of terms such as standard, specification, requirement, and conformance test are provided in the ModSpec.</p>
16
+ <p>For the purposes of this document, the following additional terms and definitions apply.</p>
17
+ external_terms_boilerplate: |
18
+ <p>This document uses the terms defined in <link target="https://portal.ogc.org/public_ogc/directives/directives.php">OGC Policy Directive 49</link>, which is based on the ISO/IEC Directives, Part 2, Rules for the structure and drafting of International Standards. In particular, the word “shall” (not “must”) is the verb form used to indicate a requirement to be strictly followed to conform to this standard and OGC documents do not use the equivalent phrases in the ISO/IEC Directives, Part 2.</p>
19
+ <p>This document also uses terms defined in the OGC Standard for Modular specifications (<link target="https://portal.opengeospatial.org/files/?artifact_id=34762">OGC 08-131r3</link>), also known as the 'ModSpec'. The definitions of terms such as standard, specification, requirement, and conformance test are provided in the ModSpec.</p>
20
+ <p>For the purposes of this document,
21
+ the terms and definitions given in % additionally apply.</p>
22
+ internal_external_terms_boilerplate: |
23
+ <p>This document uses the terms defined in <link target="https://portal.ogc.org/public_ogc/directives/directives.php">OGC Policy Directive 49</link>, which is based on the ISO/IEC Directives, Part 2, Rules for the structure and drafting of International Standards. In particular, the word “shall” (not “must”) is the verb form used to indicate a requirement to be strictly followed to conform to this standard and OGC documents do not use the equivalent phrases in the ISO/IEC Directives, Part 2.</p>
24
+ <p>This document also uses terms defined in the OGC Standard for Modular specifications (<link target="https://portal.opengeospatial.org/files/?artifact_id=34762">OGC 08-131r3</link>), also known as the 'ModSpec'. The definitions of terms such as standard, specification, requirement, and conformance test are provided in the ModSpec.</p>
25
+ <p>For the purposes of this document, the terms and definitions
26
+ given in % and the following additionally apply.</p>
13
27
  stage_dict:
14
28
  swg-draft: Candidate SWG Draft
15
29
  oab-review: Candidate OAB Review Draft
@@ -96,7 +96,7 @@ module IsoDoc
96
96
  if t = isoxml&.at(ns("//bibdata/ext/doctype"))&.text
97
97
  set(:doctype, type_capitalise(t))
98
98
  set(:doctype_abbr, doctype_abbr(t))
99
- if st = isoxml&.at(ns("//bibdata/ext/docsubtype"))&.text
99
+ if st = isoxml&.at(ns("//bibdata/ext/subdoctype"))&.text
100
100
  set(:docsubtype, type_capitalise(st))
101
101
  set(:docsubtype_abbr, docsubtype_abbr(st, t))
102
102
  end
@@ -174,7 +174,7 @@
174
174
 
175
175
  <fo:block-container absolute-position="fixed" left="16.5mm" top="83mm" height="90mm">
176
176
  <fo:block-container width="155mm">
177
- <fo:block font-size="33pt">
177
+ <fo:block font-size="33pt" role="H1">
178
178
  <xsl:call-template name="addLetterSpacing">
179
179
  <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($doctitle))"/>
180
180
  <xsl:with-param name="letter-spacing" select="1.1"/>
@@ -332,7 +332,7 @@
332
332
  <fo:block-container margin-left="-18mm">
333
333
  <fo:block-container margin-left="0mm">
334
334
  <fo:block margin-bottom="40pt">
335
- <fo:block font-size="33pt" margin-bottom="4pt">
335
+ <fo:block font-size="33pt" margin-bottom="4pt" role="H1">
336
336
  <xsl:call-template name="addLetterSpacing">
337
337
  <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($title-toc))"/>
338
338
  <xsl:with-param name="letter-spacing" select="1.1"/>
@@ -348,70 +348,70 @@
348
348
 
349
349
 
350
350
  <fo:block-container line-height="130%">
351
-
352
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
353
-
354
- <fo:block>
355
- <xsl:if test="@level = 1">
356
- <xsl:attribute name="margin-top">14pt</xsl:attribute>
357
- </xsl:if>
358
- <xsl:if test="@level = 1 or @parent = 'annex'">
359
- <xsl:attribute name="font-size">12pt</xsl:attribute>
360
- </xsl:if>
361
- <xsl:if test="@level = 2 and not(@parent = 'annex')">
362
- <xsl:attribute name="font-size">10pt</xsl:attribute>
363
- </xsl:if>
364
-
365
- <xsl:choose>
366
- <xsl:when test="@level = 1">
367
- <fo:list-block provisional-distance-between-starts="7mm">
368
- <xsl:if test="@type = 'annex'">
369
- <xsl:attribute name="provisional-distance-between-starts">0mm</xsl:attribute>
370
- </xsl:if>
371
- <fo:list-item>
372
- <fo:list-item-label end-indent="label-end()">
373
- <fo:block>
374
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
375
- </fo:block>
376
- </fo:list-item-label>
377
- <fo:list-item-body start-indent="body-start()">
378
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
379
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
380
- <xsl:variable name="sectionTitle">
381
- <xsl:apply-templates select="title"/>
382
- </xsl:variable>
383
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($sectionTitle))"/>
384
- <xsl:text> </xsl:text>
385
- <fo:inline keep-together.within-line="always">
386
- <fo:leader leader-pattern="dots"/>
387
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
388
- </fo:inline>
389
- </fo:basic-link>
390
- </fo:block>
391
- </fo:list-item-body>
392
- </fo:list-item>
393
- </fo:list-block>
394
- </xsl:when>
395
- <xsl:otherwise>
396
- <fo:block text-align-last="justify" margin-left="7mm">
397
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
398
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
399
- <xsl:text> </xsl:text>
400
- <xsl:apply-templates select="title"/>
401
- <xsl:text> </xsl:text>
402
- <fo:inline keep-together.within-line="always">
403
- <fo:leader leader-pattern="dots"/>
404
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
405
- </fo:inline>
406
- </fo:basic-link>
407
- </fo:block>
408
- </xsl:otherwise>
409
- </xsl:choose>
351
+ <fo:block role="TOC">
352
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
410
353
 
411
-
412
- </fo:block>
413
- </xsl:for-each>
414
-
354
+ <fo:block role="TOCI">
355
+ <xsl:if test="@level = 1">
356
+ <xsl:attribute name="margin-top">14pt</xsl:attribute>
357
+ </xsl:if>
358
+ <xsl:if test="@level = 1 or @parent = 'annex'">
359
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
360
+ </xsl:if>
361
+ <xsl:if test="@level = 2 and not(@parent = 'annex')">
362
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
363
+ </xsl:if>
364
+
365
+ <xsl:choose>
366
+ <xsl:when test="@level = 1">
367
+ <fo:list-block provisional-distance-between-starts="7mm">
368
+ <xsl:if test="@type = 'annex'">
369
+ <xsl:attribute name="provisional-distance-between-starts">0mm</xsl:attribute>
370
+ </xsl:if>
371
+ <fo:list-item>
372
+ <fo:list-item-label end-indent="label-end()">
373
+ <fo:block>
374
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
375
+ </fo:block>
376
+ </fo:list-item-label>
377
+ <fo:list-item-body start-indent="body-start()">
378
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
379
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
380
+ <xsl:variable name="sectionTitle">
381
+ <xsl:apply-templates select="title"/>
382
+ </xsl:variable>
383
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($sectionTitle))"/>
384
+ <xsl:text> </xsl:text>
385
+ <fo:inline keep-together.within-line="always">
386
+ <fo:leader leader-pattern="dots"/>
387
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
388
+ </fo:inline>
389
+ </fo:basic-link>
390
+ </fo:block>
391
+ </fo:list-item-body>
392
+ </fo:list-item>
393
+ </fo:list-block>
394
+ </xsl:when>
395
+ <xsl:otherwise>
396
+ <fo:block text-align-last="justify" margin-left="7mm">
397
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
398
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@section))"/>
399
+ <xsl:text> </xsl:text>
400
+ <xsl:apply-templates select="title"/>
401
+ <xsl:text> </xsl:text>
402
+ <fo:inline keep-together.within-line="always">
403
+ <fo:leader leader-pattern="dots"/>
404
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
405
+ </fo:inline>
406
+ </fo:basic-link>
407
+ </fo:block>
408
+ </xsl:otherwise>
409
+ </xsl:choose>
410
+
411
+
412
+ </fo:block>
413
+ </xsl:for-each>
414
+ </fo:block>
415
415
  </fo:block-container>
416
416
 
417
417
  <xsl:if test="//ogc:table[@id and ogc:name]">
@@ -430,7 +430,7 @@
430
430
  </fo:block-container>
431
431
  <fo:block-container line-height="130%">
432
432
  <xsl:for-each select="//ogc:table[@id and ogc:name]">
433
- <fo:block text-align-last="justify" margin-top="2pt">
433
+ <fo:block text-align-last="justify" margin-top="2pt" role="TOCI">
434
434
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{ogc:name}">
435
435
  <xsl:apply-templates select="ogc:name" mode="contents"/>
436
436
  <fo:inline keep-together.within-line="always">
@@ -459,7 +459,7 @@
459
459
 
460
460
  <fo:block-container line-height="130%">
461
461
  <xsl:for-each select="//ogc:figure[@id and ogc:name]">
462
- <fo:block text-align-last="justify" margin-top="2pt">
462
+ <fo:block text-align-last="justify" margin-top="2pt" role="TOCI">
463
463
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{ogc:name}">
464
464
  <xsl:apply-templates select="ogc:name" mode="contents"/>
465
465
  <fo:inline keep-together.within-line="always">
@@ -492,7 +492,7 @@
492
492
  <!-- <xsl:for-each select="//ogc:permission[@id and ogc:name] | //ogc:recommendation[@id and ogc:name] | //ogc:requirement[@id and ogc:name]"> -->
493
493
  <xsl:for-each select="//ogc:table[.//ogc:p[@class = 'RecommendationTitle']]">
494
494
  <xsl:variable name="table_id" select="@id"/>
495
- <fo:block text-align-last="justify" margin-top="6pt">
495
+ <fo:block text-align-last="justify" margin-top="6pt" role="TOCI">
496
496
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{.//ogc:p[@class = 'RecommendationTitle'][1]/text()}">
497
497
  <xsl:apply-templates select=".//ogc:p[@class = 'RecommendationTitle'][ancestor::ogc:table[1][@id= $table_id]]/node()"/>
498
498
  <xsl:text> </xsl:text>
@@ -739,14 +739,20 @@
739
739
  </fo:block>
740
740
  </xsl:template>
741
741
 
742
- <xsl:template match="ogc:license-statement//ogc:title">
743
- <fo:block font-weight="bold" color="{$color_blue}">
742
+ <xsl:template match="ogc:license-statement//ogc:title">
743
+ <xsl:variable name="level">
744
+ <xsl:call-template name="getLevel"/>
745
+ </xsl:variable>
746
+ <fo:block font-weight="bold" color="{$color_blue}" role="H{$level}">
744
747
  <xsl:apply-templates/>
745
748
  </fo:block>
746
749
  </xsl:template>
747
750
 
748
751
  <xsl:template match="ogc:copyright-statement//ogc:title">
749
- <fo:block font-weight="bold" color="{$color_blue}" margin-top="24pt">
752
+ <xsl:variable name="level">
753
+ <xsl:call-template name="getLevel"/>
754
+ </xsl:variable>
755
+ <fo:block font-weight="bold" color="{$color_blue}" margin-top="24pt" role="H{$level}">
750
756
  <xsl:apply-templates/>
751
757
  </fo:block>
752
758
  </xsl:template>
@@ -764,7 +770,10 @@
764
770
  </xsl:template>
765
771
 
766
772
  <xsl:template match="ogc:legal-statement//ogc:title">
767
- <fo:inline font-weight="bold">
773
+ <xsl:variable name="level">
774
+ <xsl:call-template name="getLevel"/>
775
+ </xsl:variable>
776
+ <fo:inline font-weight="bold" role="H{$level}">
768
777
  <xsl:apply-templates/><xsl:text>: </xsl:text>
769
778
  </fo:inline>
770
779
  </xsl:template>
@@ -839,7 +848,7 @@
839
848
  <xsl:when test="$level = 1">
840
849
  <fo:block-container margin-left="-22mm">
841
850
  <fo:block-container margin-left="0mm">
842
- <fo:block margin-bottom="10pt" space-before="36pt" keep-with-next="always">
851
+ <fo:block margin-bottom="10pt" space-before="36pt" keep-with-next="always" role="H{$level}">
843
852
  <fo:table table-layout="fixed" width="100%">
844
853
  <fo:table-column column-width="22mm"/>
845
854
  <fo:table-column column-width="158mm"/>
@@ -883,7 +892,7 @@
883
892
  </fo:block-container>
884
893
  </xsl:when>
885
894
  <xsl:when test="$level = 2">
886
- <fo:block space-before="24pt" margin-bottom="10pt">
895
+ <fo:block space-before="24pt" margin-bottom="10pt" role="H{$level}">
887
896
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
888
897
  <xsl:variable name="title">
889
898
  <xsl:choose>
@@ -905,12 +914,14 @@
905
914
  <xsl:otherwise>
906
915
  <xsl:element name="{$element-name}">
907
916
  <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
908
- <xsl:attribute name="font-weight"><xsl:value-of select="$font-weight"/></xsl:attribute>
909
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
910
- <xsl:attribute name="margin-top">30pt</xsl:attribute>
911
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
912
- <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
917
+ <xsl:attribute name="font-weight"><xsl:value-of select="$font-weight"/></xsl:attribute>
918
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
919
+ <xsl:attribute name="margin-top">30pt</xsl:attribute>
920
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
921
+ <xsl:attribute name="color"><xsl:value-of select="$color_blue"/></xsl:attribute>
922
+ <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
913
923
  <xsl:apply-templates/>
924
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
914
925
  </xsl:element>
915
926
  </xsl:otherwise>
916
927
  </xsl:choose>
@@ -1118,7 +1129,10 @@
1118
1129
  </xsl:template>
1119
1130
 
1120
1131
  <xsl:template match="ogc:term/ogc:name" priority="2">
1121
- <fo:block space-before="36pt" margin-bottom="10pt" keep-with-next="always">
1132
+ <xsl:variable name="levelTerm">
1133
+ <xsl:call-template name="getLevelTermName"/>
1134
+ </xsl:variable>
1135
+ <fo:block space-before="36pt" margin-bottom="10pt" keep-with-next="always" role="H{$levelTerm}">
1122
1136
  <fo:block color="{$color_blue}" keep-with-next="always">
1123
1137
  <fo:inline font-size="18pt" padding-right="1mm"><xsl:apply-templates/></fo:inline>
1124
1138
  <xsl:apply-templates select="../ogc:preferred | ../ogc:deprecated | ../ogc:admitted" mode="term_name"/>
@@ -1263,7 +1277,7 @@
1263
1277
 
1264
1278
  <xsl:template name="insertHeaderFooter">
1265
1279
  <xsl:param name="color" select="$color_blue"/>
1266
- <fo:static-content flow-name="footer">
1280
+ <fo:static-content flow-name="footer" role="artifact">
1267
1281
  <fo:block-container font-size="8pt" height="100%" color="{$color}" padding-top="6mm">
1268
1282
  <fo:table table-layout="fixed" width="100%">
1269
1283
  <fo:table-column column-width="90%"/>
@@ -1423,6 +1437,15 @@
1423
1437
  </fo:inline>
1424
1438
  </xsl:if>
1425
1439
  <xsl:apply-templates select="xalan:nodeset($title)" mode="titlesmall"/>
1440
+
1441
+ <xsl:variable name="variant-title">
1442
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="titlesmall"/>
1443
+ </xsl:variable>
1444
+ <xsl:if test="normalize-space($variant-title) != ''">
1445
+ <fo:inline padding-right="5mm"> </fo:inline>
1446
+ <fo:inline><xsl:copy-of select="$variant-title"/></fo:inline>
1447
+ </xsl:if>
1448
+
1426
1449
  </fo:block>
1427
1450
  <xsl:call-template name="insertOrangeHorizontalLine"/>
1428
1451
  </fo:block>
@@ -1640,6 +1663,7 @@
1640
1663
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1641
1664
  <xsl:attribute name="white-space">pre</xsl:attribute>
1642
1665
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1666
+ <xsl:attribute name="role">Code</xsl:attribute>
1643
1667
 
1644
1668
 
1645
1669
 
@@ -1691,8 +1715,13 @@
1691
1715
 
1692
1716
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1693
1717
 
1694
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1695
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1718
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1719
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1720
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1721
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1722
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1723
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1724
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1696
1725
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1697
1726
 
1698
1727
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -1774,6 +1803,7 @@
1774
1803
 
1775
1804
 
1776
1805
 
1806
+
1777
1807
 
1778
1808
  <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
1779
1809
 
@@ -1790,7 +1820,9 @@
1790
1820
 
1791
1821
 
1792
1822
 
1793
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1823
+ </xsl:attribute-set><xsl:variable name="table-border_">
1824
+
1825
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1794
1826
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1795
1827
 
1796
1828
 
@@ -1918,7 +1950,8 @@
1918
1950
 
1919
1951
 
1920
1952
 
1921
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1953
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1954
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1922
1955
 
1923
1956
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1924
1957
  <xsl:attribute name="margin-left">13mm</xsl:attribute>
@@ -2120,11 +2153,15 @@
2120
2153
  <fo:block>&#xA0;</fo:block>
2121
2154
  </xsl:if> -->
2122
2155
 
2156
+
2157
+ <!-- Display table's name before table as standalone block -->
2123
2158
  <!-- $namespace = 'iso' or -->
2124
2159
 
2125
2160
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2126
2161
 
2127
-
2162
+
2163
+
2164
+
2128
2165
 
2129
2166
  <xsl:call-template name="fn_name_display"/>
2130
2167
 
@@ -2203,6 +2240,12 @@
2203
2240
 
2204
2241
 
2205
2242
 
2243
+
2244
+
2245
+
2246
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
2247
+
2248
+
2206
2249
  <xsl:variable name="table_width">
2207
2250
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2208
2251
 
@@ -2227,6 +2270,7 @@
2227
2270
 
2228
2271
 
2229
2272
 
2273
+
2230
2274
  <attribute name="margin-left">0mm</attribute>
2231
2275
  <attribute name="margin-right">0mm</attribute>
2232
2276
 
@@ -2252,6 +2296,8 @@
2252
2296
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2253
2297
  </xsl:if>
2254
2298
 
2299
+
2300
+
2255
2301
  <xsl:choose>
2256
2302
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2257
2303
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -2536,9 +2582,9 @@
2536
2582
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
2537
2583
  <xsl:with-param name="continued">true</xsl:with-param>
2538
2584
  </xsl:apply-templates>
2539
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
2540
- <xsl:call-template name="fn_name_display"/>
2541
- </xsl:for-each>
2585
+
2586
+
2587
+
2542
2588
 
2543
2589
  </fo:table-cell>
2544
2590
  </fo:table-row>
@@ -2622,7 +2668,11 @@
2622
2668
 
2623
2669
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2624
2670
 
2625
- <xsl:if test="$isNoteOrFnExist = 'true'">
2671
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
2672
+
2673
+ </xsl:variable>
2674
+
2675
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
2626
2676
 
2627
2677
  <xsl:variable name="cols-count">
2628
2678
  <xsl:choose>
@@ -2651,6 +2701,8 @@
2651
2701
  </xsl:choose>
2652
2702
  </xsl:for-each>
2653
2703
 
2704
+
2705
+
2654
2706
  <xsl:choose>
2655
2707
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2656
2708
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2677,6 +2729,7 @@
2677
2729
 
2678
2730
 
2679
2731
 
2732
+
2680
2733
  <!-- fn will be processed inside 'note' processing -->
2681
2734
 
2682
2735
 
@@ -2687,6 +2740,11 @@
2687
2740
 
2688
2741
 
2689
2742
 
2743
+
2744
+
2745
+ <!-- for BSI (not PAS) display Notes before footnotes -->
2746
+
2747
+
2690
2748
  <!-- except gb -->
2691
2749
 
2692
2750
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
@@ -2712,6 +2770,10 @@
2712
2770
  <!-- fn processing -->
2713
2771
  <xsl:call-template name="fn_display"/>
2714
2772
 
2773
+
2774
+ <!-- for PAS display Notes after footnotes -->
2775
+
2776
+
2715
2777
  </fo:table-cell>
2716
2778
  </fo:table-row>
2717
2779
  </fo:table-body>
@@ -2753,6 +2815,19 @@
2753
2815
 
2754
2816
  </fo:table-body>
2755
2817
 
2818
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2819
+ <xsl:choose>
2820
+ <xsl:when test="substring-after(., '—') != ''">
2821
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2822
+ </xsl:when>
2823
+ <xsl:otherwise>
2824
+ <xsl:value-of select="."/>
2825
+ </xsl:otherwise>
2826
+ </xsl:choose>
2827
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2828
+ <xsl:apply-templates mode="presentation_name"/>
2829
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2830
+ <xsl:apply-templates select="."/>
2756
2831
  </xsl:template><xsl:template match="*[local-name()='tr']">
2757
2832
  <xsl:variable name="parent-name" select="local-name(..)"/>
2758
2833
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2765,10 +2840,13 @@
2765
2840
 
2766
2841
 
2767
2842
 
2843
+
2844
+
2768
2845
  </xsl:if>
2769
2846
  <xsl:if test="$parent-name = 'tfoot'">
2770
2847
 
2771
2848
 
2849
+
2772
2850
  </xsl:if>
2773
2851
 
2774
2852
 
@@ -2790,6 +2868,8 @@
2790
2868
 
2791
2869
 
2792
2870
 
2871
+
2872
+
2793
2873
  <!-- <xsl:if test="$namespace = 'bipm'">
2794
2874
  <xsl:attribute name="height">8mm</xsl:attribute>
2795
2875
  </xsl:if> -->
@@ -2913,8 +2993,13 @@
2913
2993
 
2914
2994
 
2915
2995
 
2996
+
2997
+ <!-- Table's note name (NOTE, for example) -->
2998
+
2916
2999
  <fo:inline padding-right="2mm">
2917
3000
 
3001
+
3002
+
2918
3003
 
2919
3004
 
2920
3005
 
@@ -2922,6 +3007,8 @@
2922
3007
 
2923
3008
  </fo:inline>
2924
3009
 
3010
+
3011
+
2925
3012
  <xsl:apply-templates mode="process"/>
2926
3013
  </fo:block>
2927
3014
 
@@ -2929,24 +3016,18 @@
2929
3016
  <xsl:apply-templates/>
2930
3017
  </xsl:template><xsl:template name="fn_display">
2931
3018
  <xsl:variable name="references">
3019
+
2932
3020
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2933
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2934
-
2935
-
2936
- <xsl:attribute name="id">
2937
- <xsl:value-of select="@reference"/>
2938
- <xsl:text>_</xsl:text>
2939
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
2940
- </xsl:attribute>
2941
-
2942
- <xsl:apply-templates/>
2943
- </fn>
3021
+ <xsl:call-template name="create_fn"/>
2944
3022
  </xsl:for-each>
2945
3023
  </xsl:variable>
3024
+
2946
3025
  <xsl:for-each select="xalan:nodeset($references)//fn">
2947
3026
  <xsl:variable name="reference" select="@reference"/>
2948
3027
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2949
3028
  <fo:block margin-bottom="12pt">
3029
+
3030
+
2950
3031
 
2951
3032
 
2952
3033
 
@@ -2966,6 +3047,7 @@
2966
3047
  <xsl:value-of select="@reference"/>
2967
3048
 
2968
3049
 
3050
+
2969
3051
  </fo:inline>
2970
3052
  <fo:inline>
2971
3053
 
@@ -2975,6 +3057,18 @@
2975
3057
  </fo:block>
2976
3058
  </xsl:if>
2977
3059
  </xsl:for-each>
3060
+ </xsl:template><xsl:template name="create_fn">
3061
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
3062
+
3063
+
3064
+ <xsl:attribute name="id">
3065
+ <xsl:value-of select="@reference"/>
3066
+ <xsl:text>_</xsl:text>
3067
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
3068
+ </xsl:attribute>
3069
+
3070
+ <xsl:apply-templates/>
3071
+ </fn>
2978
3072
  </xsl:template><xsl:template name="fn_name_display">
2979
3073
  <!-- <xsl:variable name="references">
2980
3074
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -3122,6 +3216,7 @@
3122
3216
 
3123
3217
  <xsl:value-of select="@reference"/>
3124
3218
 
3219
+
3125
3220
  </fo:basic-link>
3126
3221
  </fo:inline>
3127
3222
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3965,16 +4060,68 @@
3965
4060
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3966
4061
  </xsl:call-template>
3967
4062
 
4063
+
4064
+
3968
4065
  <xsl:variable name="mathml">
3969
4066
  <xsl:apply-templates select="." mode="mathml"/>
3970
4067
  </xsl:variable>
3971
4068
  <fo:instream-foreign-object fox:alt-text="Math">
3972
4069
 
3973
4070
 
4071
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4072
+ <xsl:variable name="comment_text_">
4073
+ <xsl:choose>
4074
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4075
+ <xsl:value-of select="$comment_text_following"/>
4076
+ </xsl:when>
4077
+ <xsl:otherwise>
4078
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4079
+ </xsl:otherwise>
4080
+ </xsl:choose>
4081
+ </xsl:variable>
4082
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4083
+
4084
+ <xsl:if test="normalize-space($comment_text) != ''">
4085
+ <!-- put Mathin Alternate Text -->
4086
+ <xsl:attribute name="fox:alt-text">
4087
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4088
+ </xsl:attribute>
4089
+ </xsl:if>
4090
+
4091
+ <xsl:variable name="mathml_content">
4092
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4093
+ </xsl:variable>
4094
+ <!-- put MathML in Actual Text -->
4095
+ <xsl:attribute name="fox:actual-text">
4096
+ <xsl:value-of select="$mathml_content"/>
4097
+ </xsl:attribute>
4098
+
4099
+
3974
4100
  <!-- <xsl:copy-of select="."/> -->
3975
4101
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3976
4102
  </fo:instream-foreign-object>
3977
4103
  </fo:inline>
4104
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4105
+ <!-- <xsl:text>a+b</xsl:text> -->
4106
+ <xsl:text>&lt;</xsl:text>
4107
+ <xsl:value-of select="local-name()"/>
4108
+ <xsl:if test="local-name() = 'math'">
4109
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
4110
+ </xsl:if>
4111
+ <xsl:for-each select="@*">
4112
+ <xsl:text> </xsl:text>
4113
+ <xsl:value-of select="local-name()"/>
4114
+ <xsl:text>="</xsl:text>
4115
+ <xsl:value-of select="."/>
4116
+ <xsl:text>"</xsl:text>
4117
+ </xsl:for-each>
4118
+ <xsl:text>&gt;</xsl:text>
4119
+ <xsl:apply-templates mode="mathml_actual_text"/>
4120
+ <xsl:text>&lt;/</xsl:text>
4121
+ <xsl:value-of select="local-name()"/>
4122
+ <xsl:text>&gt;</xsl:text>
4123
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
4124
+ <xsl:value-of select="normalize-space()"/>
3978
4125
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3979
4126
  <xsl:copy>
3980
4127
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3984,19 +4131,6 @@
3984
4131
  <!-- replace start and end spaces to non-break space -->
3985
4132
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3986
4133
  </xsl:copy>
3987
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3988
- <xsl:copy>
3989
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3990
- </xsl:copy>
3991
- <xsl:choose>
3992
- <!-- if in msub, then don't add space -->
3993
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3994
- <!-- if next char in digit, don't add space -->
3995
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3996
- <xsl:otherwise>
3997
- <mathml:mspace width="0.5ex"/>
3998
- </xsl:otherwise>
3999
- </xsl:choose>
4000
4134
  </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">
4001
4135
  <xsl:variable name="target">
4002
4136
  <xsl:choose>
@@ -4049,7 +4183,10 @@
4049
4183
  </fo:block>
4050
4184
  <xsl:apply-templates/>
4051
4185
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4052
- <fo:inline><xsl:apply-templates/></fo:inline>
4186
+ <xsl:variable name="level">
4187
+ <xsl:call-template name="getLevel"/>
4188
+ </xsl:variable>
4189
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
4053
4190
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
4054
4191
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
4055
4192
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4084,9 +4221,10 @@
4084
4221
 
4085
4222
  </xsl:variable>
4086
4223
 
4224
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
4087
4225
  <xsl:choose>
4088
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4089
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4226
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
4227
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
4090
4228
  </xsl:choose>
4091
4229
  <xsl:apply-templates/>
4092
4230
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -4134,6 +4272,7 @@
4134
4272
 
4135
4273
 
4136
4274
 
4275
+
4137
4276
  <fo:block-container margin-left="0mm">
4138
4277
 
4139
4278
 
@@ -4237,7 +4376,10 @@
4237
4376
  </fo:block>
4238
4377
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
4239
4378
  <xsl:if test="normalize-space() != ''">
4240
- <fo:inline>
4379
+ <xsl:variable name="level">
4380
+ <xsl:call-template name="getLevelTermName"/>
4381
+ </xsl:variable>
4382
+ <fo:inline role="H{$level}">
4241
4383
  <xsl:apply-templates/>
4242
4384
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
4243
4385
  <xsl:text>.</xsl:text>
@@ -4310,7 +4452,24 @@
4310
4452
  </fo:instream-foreign-object>
4311
4453
  </xsl:when>
4312
4454
  <xsl:otherwise>
4313
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4455
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
4456
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
4457
+
4458
+ <xsl:variable name="img_src">
4459
+ <xsl:choose>
4460
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
4461
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
4462
+ </xsl:choose>
4463
+ </xsl:variable>
4464
+
4465
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
4466
+ <xsl:if test="number($scale) &lt; 100">
4467
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
4468
+ </xsl:if>
4469
+
4470
+ </xsl:if>
4471
+
4472
+ </fo:external-graphic>
4314
4473
  </xsl:otherwise>
4315
4474
  </xsl:choose>
4316
4475
 
@@ -4481,11 +4640,13 @@
4481
4640
  <xsl:attribute name="width">100%</xsl:attribute>
4482
4641
  <xsl:attribute name="content-height">100%</xsl:attribute>
4483
4642
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4643
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4644
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
4484
4645
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4485
4646
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4486
4647
  <!-- effective height / width = 1.48, 1.4 - with title -->
4487
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4488
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4648
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4649
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
4489
4650
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4490
4651
  </xsl:if>
4491
4652
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -4502,6 +4663,23 @@
4502
4663
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4503
4664
  <xsl:value-of select="."/>
4504
4665
  </xsl:attribute>
4666
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4667
+ <xsl:copy>
4668
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4669
+ <xsl:variable name="viewbox">
4670
+ <xsl:call-template name="split">
4671
+ <xsl:with-param name="pText" select="@viewBox"/>
4672
+ <xsl:with-param name="sep" select="' '"/>
4673
+ </xsl:call-template>
4674
+ </xsl:variable>
4675
+ <xsl:attribute name="width">
4676
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4677
+ </xsl:attribute>
4678
+ <xsl:attribute name="height">
4679
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4680
+ </xsl:attribute>
4681
+ <xsl:apply-templates mode="svg_update"/>
4682
+ </xsl:copy>
4505
4683
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4506
4684
  <xsl:variable name="svg_content" select="document(@src)"/>
4507
4685
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4875,6 +5053,7 @@
4875
5053
  </xsl:when>
4876
5054
  <xsl:otherwise>
4877
5055
  <xsl:apply-templates/>
5056
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4878
5057
  </xsl:otherwise>
4879
5058
  </xsl:choose>
4880
5059
  </fo:block>
@@ -5023,14 +5202,6 @@
5023
5202
  <fo:block>
5024
5203
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
5025
5204
  </fo:block>
5026
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
5027
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
5028
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5029
- </fo:block>
5030
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
5031
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
5032
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
5033
- </fo:block>
5034
5205
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
5035
5206
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
5036
5207
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -5047,6 +5218,38 @@
5047
5218
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
5048
5219
  <xsl:apply-templates/>
5049
5220
  </fo:block>
5221
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
5222
+ <fo:block xsl:use-attribute-sets="subject-style">
5223
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5224
+ </fo:block>
5225
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
5226
+ <fo:block xsl:use-attribute-sets="subject-style">
5227
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
5228
+ </fo:block>
5229
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
5230
+ <fo:block xsl:use-attribute-sets="inherit-style">
5231
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
5232
+ </fo:block>
5233
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
5234
+ <fo:block xsl:use-attribute-sets="description-style">
5235
+ <xsl:apply-templates/>
5236
+ </fo:block>
5237
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
5238
+ <fo:block xsl:use-attribute-sets="specification-style">
5239
+ <xsl:apply-templates/>
5240
+ </fo:block>
5241
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
5242
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
5243
+ <xsl:apply-templates/>
5244
+ </fo:block>
5245
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
5246
+ <fo:block xsl:use-attribute-sets="verification-style">
5247
+ <xsl:apply-templates/>
5248
+ </fo:block>
5249
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
5250
+ <fo:block xsl:use-attribute-sets="import-style">
5251
+ <xsl:apply-templates/>
5252
+ </fo:block>
5050
5253
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
5051
5254
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
5052
5255
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -5198,7 +5401,19 @@
5198
5401
  </fo:inline>
5199
5402
  </xsl:if>
5200
5403
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
5201
- <fo:inline><xsl:apply-templates/></fo:inline>
5404
+ <xsl:variable name="element">inline
5405
+
5406
+ </xsl:variable>
5407
+ <xsl:choose>
5408
+ <xsl:when test="contains($element, 'block')">
5409
+ <fo:block xsl:use-attribute-sets="example-p-style">
5410
+ <xsl:apply-templates/>
5411
+ </fo:block>
5412
+ </xsl:when>
5413
+ <xsl:otherwise>
5414
+ <fo:inline><xsl:apply-templates/></fo:inline>
5415
+ </xsl:otherwise>
5416
+ </xsl:choose>
5202
5417
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5203
5418
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5204
5419
 
@@ -5390,9 +5605,10 @@
5390
5605
 
5391
5606
 
5392
5607
  </xsl:if>
5393
-
5608
+
5609
+
5610
+
5394
5611
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5395
-
5396
5612
  <xsl:if test="normalize-space(@citeas) = ''">
5397
5613
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5398
5614
  </xsl:if>
@@ -5401,6 +5617,7 @@
5401
5617
 
5402
5618
 
5403
5619
 
5620
+
5404
5621
  </xsl:if>
5405
5622
 
5406
5623
  <xsl:apply-templates/>
@@ -5779,7 +5996,6 @@
5779
5996
  </xsl:template><xsl:template name="processBibitem">
5780
5997
 
5781
5998
 
5782
- <!-- end BIPM bibitem processing-->
5783
5999
 
5784
6000
 
5785
6001
  <!-- start OGC bibtem processing -->
@@ -6051,6 +6267,9 @@
6051
6267
  <fo:block-container border="1pt solid black" width="50%">
6052
6268
  <fo:block> </fo:block>
6053
6269
  </fo:block-container>
6270
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
6271
+ <fo:inline padding-right="5mm"> </fo:inline>
6272
+ <fo:inline><xsl:apply-templates/></fo:inline>
6054
6273
  </xsl:template><xsl:template name="convertDate">
6055
6274
  <xsl:param name="date"/>
6056
6275
  <xsl:param name="format" select="'short'"/>
@@ -6289,6 +6508,26 @@
6289
6508
  <xsl:value-of select="$level"/>
6290
6509
  </xsl:otherwise>
6291
6510
  </xsl:choose>
6511
+ </xsl:template><xsl:template name="getLevelTermName">
6512
+ <xsl:choose>
6513
+ <xsl:when test="normalize-space(../@depth) != ''">
6514
+ <xsl:value-of select="../@depth"/>
6515
+ </xsl:when>
6516
+ <xsl:otherwise>
6517
+ <xsl:variable name="title_level_">
6518
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
6519
+ <xsl:call-template name="getLevel"/>
6520
+ </xsl:for-each>
6521
+ </xsl:variable>
6522
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
6523
+ <xsl:choose>
6524
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
6525
+ <xsl:otherwise>
6526
+ <xsl:call-template name="getLevel"/>
6527
+ </xsl:otherwise>
6528
+ </xsl:choose>
6529
+ </xsl:otherwise>
6530
+ </xsl:choose>
6292
6531
  </xsl:template><xsl:template name="split">
6293
6532
  <xsl:param name="pText" select="."/>
6294
6533
  <xsl:param name="sep" select="','"/>
@@ -6386,20 +6625,40 @@
6386
6625
  </xsl:call-template>
6387
6626
  </xsl:if>
6388
6627
  </xsl:template><xsl:template name="getLocalizedString">
6389
- <xsl:param name="key"/>
6628
+ <xsl:param name="key"/>
6629
+ <xsl:param name="formatted">false</xsl:param>
6390
6630
 
6391
6631
  <xsl:variable name="curr_lang">
6392
6632
  <xsl:call-template name="getLang"/>
6393
6633
  </xsl:variable>
6394
6634
 
6395
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6635
+ <xsl:variable name="data_value">
6636
+ <xsl:choose>
6637
+ <xsl:when test="$formatted = 'true'">
6638
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6639
+ </xsl:when>
6640
+ <xsl:otherwise>
6641
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6642
+ </xsl:otherwise>
6643
+ </xsl:choose>
6644
+ </xsl:variable>
6396
6645
 
6397
6646
  <xsl:choose>
6398
- <xsl:when test="$data_value != ''">
6399
- <xsl:value-of select="$data_value"/>
6647
+ <xsl:when test="normalize-space($data_value) != ''">
6648
+ <xsl:choose>
6649
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
6650
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
6651
+ </xsl:choose>
6400
6652
  </xsl:when>
6401
6653
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6402
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6654
+ <xsl:choose>
6655
+ <xsl:when test="$formatted = 'true'">
6656
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6657
+ </xsl:when>
6658
+ <xsl:otherwise>
6659
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6660
+ </xsl:otherwise>
6661
+ </xsl:choose>
6403
6662
  </xsl:when>
6404
6663
  <xsl:otherwise>
6405
6664
  <xsl:variable name="key_">
@@ -6410,7 +6669,7 @@
6410
6669
  <xsl:value-of select="$key_"/>
6411
6670
  </xsl:otherwise>
6412
6671
  </xsl:choose>
6413
-
6672
+
6414
6673
  </xsl:template><xsl:template name="setTrackChangesStyles">
6415
6674
  <xsl:param name="isAdded"/>
6416
6675
  <xsl:param name="isDeleted"/>
@@ -6461,4 +6720,100 @@
6461
6720
  <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
6462
6721
  </xsl:choose>
6463
6722
  </xsl:attribute>
6723
+ </xsl:template><xsl:template name="number-to-words">
6724
+ <xsl:param name="number"/>
6725
+ <xsl:param name="first"/>
6726
+ <xsl:if test="$number != ''">
6727
+ <xsl:variable name="words">
6728
+ <words>
6729
+ <word cardinal="1">One-</word>
6730
+ <word ordinal="1">First </word>
6731
+ <word cardinal="2">Two-</word>
6732
+ <word ordinal="2">Second </word>
6733
+ <word cardinal="3">Three-</word>
6734
+ <word ordinal="3">Third </word>
6735
+ <word cardinal="4">Four-</word>
6736
+ <word ordinal="4">Fourth </word>
6737
+ <word cardinal="5">Five-</word>
6738
+ <word ordinal="5">Fifth </word>
6739
+ <word cardinal="6">Six-</word>
6740
+ <word ordinal="6">Sixth </word>
6741
+ <word cardinal="7">Seven-</word>
6742
+ <word ordinal="7">Seventh </word>
6743
+ <word cardinal="8">Eight-</word>
6744
+ <word ordinal="8">Eighth </word>
6745
+ <word cardinal="9">Nine-</word>
6746
+ <word ordinal="9">Ninth </word>
6747
+ <word ordinal="10">Tenth </word>
6748
+ <word ordinal="11">Eleventh </word>
6749
+ <word ordinal="12">Twelfth </word>
6750
+ <word ordinal="13">Thirteenth </word>
6751
+ <word ordinal="14">Fourteenth </word>
6752
+ <word ordinal="15">Fifteenth </word>
6753
+ <word ordinal="16">Sixteenth </word>
6754
+ <word ordinal="17">Seventeenth </word>
6755
+ <word ordinal="18">Eighteenth </word>
6756
+ <word ordinal="19">Nineteenth </word>
6757
+ <word cardinal="20">Twenty-</word>
6758
+ <word ordinal="20">Twentieth </word>
6759
+ <word cardinal="30">Thirty-</word>
6760
+ <word ordinal="30">Thirtieth </word>
6761
+ <word cardinal="40">Forty-</word>
6762
+ <word ordinal="40">Fortieth </word>
6763
+ <word cardinal="50">Fifty-</word>
6764
+ <word ordinal="50">Fiftieth </word>
6765
+ <word cardinal="60">Sixty-</word>
6766
+ <word ordinal="60">Sixtieth </word>
6767
+ <word cardinal="70">Seventy-</word>
6768
+ <word ordinal="70">Seventieth </word>
6769
+ <word cardinal="80">Eighty-</word>
6770
+ <word ordinal="80">Eightieth </word>
6771
+ <word cardinal="90">Ninety-</word>
6772
+ <word ordinal="90">Ninetieth </word>
6773
+ <word cardinal="100">Hundred-</word>
6774
+ <word ordinal="100">Hundredth </word>
6775
+ </words>
6776
+ </xsl:variable>
6777
+
6778
+ <xsl:variable name="ordinal" select="xalan:nodeset($words)//word[@ordinal = $number]/text()"/>
6779
+
6780
+ <xsl:variable name="value">
6781
+ <xsl:choose>
6782
+ <xsl:when test="$ordinal != ''">
6783
+ <xsl:value-of select="$ordinal"/>
6784
+ </xsl:when>
6785
+ <xsl:otherwise>
6786
+ <xsl:choose>
6787
+ <xsl:when test="$number &lt; 100">
6788
+ <xsl:variable name="decade" select="concat(substring($number,1,1), '0')"/>
6789
+ <xsl:variable name="digit" select="substring($number,2)"/>
6790
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $decade]/text()"/>
6791
+ <xsl:value-of select="xalan:nodeset($words)//word[@ordinal = $digit]/text()"/>
6792
+ </xsl:when>
6793
+ <xsl:otherwise>
6794
+ <!-- more 100 -->
6795
+ <xsl:variable name="hundred" select="substring($number,1,1)"/>
6796
+ <xsl:variable name="digits" select="number(substring($number,2))"/>
6797
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = $hundred]/text()"/>
6798
+ <xsl:value-of select="xalan:nodeset($words)//word[@cardinal = '100']/text()"/>
6799
+ <xsl:call-template name="number-to-words">
6800
+ <xsl:with-param name="number" select="$digits"/>
6801
+ </xsl:call-template>
6802
+ </xsl:otherwise>
6803
+ </xsl:choose>
6804
+ </xsl:otherwise>
6805
+ </xsl:choose>
6806
+ </xsl:variable>
6807
+ <xsl:choose>
6808
+ <xsl:when test="$first = 'true'">
6809
+ <xsl:variable name="value_lc" select="java:toLowerCase(java:java.lang.String.new($value))"/>
6810
+ <xsl:call-template name="capitalize">
6811
+ <xsl:with-param name="str" select="$value_lc"/>
6812
+ </xsl:call-template>
6813
+ </xsl:when>
6814
+ <xsl:otherwise>
6815
+ <xsl:value-of select="$value"/>
6816
+ </xsl:otherwise>
6817
+ </xsl:choose>
6818
+ </xsl:if>
6464
6819
  </xsl:template></xsl:stylesheet>