metanorma-cc 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/macos.yml +39 -0
  3. data/.github/workflows/ubuntu.yml +53 -0
  4. data/.github/workflows/windows.yml +41 -0
  5. data/.gitignore +1 -0
  6. data/.hound.yml +3 -0
  7. data/.rubocop.yml +10 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +11 -0
  10. data/LICENSE +25 -0
  11. data/README.adoc +61 -0
  12. data/Rakefile +6 -0
  13. data/bin/console +14 -0
  14. data/bin/rspec +18 -0
  15. data/bin/setup +8 -0
  16. data/docs/navigation.adoc +8 -0
  17. data/docs/quickstart.adoc +368 -0
  18. data/lib/asciidoctor/cc.rb +5 -0
  19. data/lib/asciidoctor/cc/basicdoc.rng +1059 -0
  20. data/lib/asciidoctor/cc/biblio.rng +1237 -0
  21. data/lib/asciidoctor/cc/boilerplate.xml +46 -0
  22. data/lib/asciidoctor/cc/cc.rng +116 -0
  23. data/lib/asciidoctor/cc/converter.rb +69 -0
  24. data/lib/asciidoctor/cc/front.rb +93 -0
  25. data/lib/asciidoctor/cc/isodoc.rng +1504 -0
  26. data/lib/asciidoctor/cc/reqt.rng +194 -0
  27. data/lib/asciidoctor/cc/validate.rb +29 -0
  28. data/lib/asciidoctor/cc/validate_section.rb +138 -0
  29. data/lib/isodoc/cc/base_convert.rb +42 -0
  30. data/lib/isodoc/cc/csd.standard.xsl +3228 -0
  31. data/lib/isodoc/cc/html/_coverpage.scss +128 -0
  32. data/lib/isodoc/cc/html/cc.scss +763 -0
  33. data/lib/isodoc/cc/html/dots-w@2x.png +0 -0
  34. data/lib/isodoc/cc/html/dots@2x.png +0 -0
  35. data/lib/isodoc/cc/html/header.html +240 -0
  36. data/lib/isodoc/cc/html/html_cc_intro.html +8 -0
  37. data/lib/isodoc/cc/html/html_cc_titlepage.html +93 -0
  38. data/lib/isodoc/cc/html/htmlstyle.scss +409 -0
  39. data/lib/isodoc/cc/html/scripts.html +71 -0
  40. data/lib/isodoc/cc/html/word_cc_intro.html +19 -0
  41. data/lib/isodoc/cc/html/word_cc_titlepage.html +64 -0
  42. data/lib/isodoc/cc/html/wordstyle.scss +1157 -0
  43. data/lib/isodoc/cc/html_convert.rb +51 -0
  44. data/lib/isodoc/cc/metadata.rb +62 -0
  45. data/lib/isodoc/cc/pdf_convert.rb +21 -0
  46. data/lib/isodoc/cc/presentation_xml_convert.rb +10 -0
  47. data/lib/isodoc/cc/word_convert.rb +38 -0
  48. data/lib/metanorma-cc.rb +11 -0
  49. data/lib/metanorma/cc.rb +29 -0
  50. data/lib/metanorma/cc/processor.rb +53 -0
  51. data/lib/metanorma/cc/version.rb +5 -0
  52. data/metanorma-cc.gemspec +43 -0
  53. metadata +253 -0
@@ -0,0 +1,194 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <!--
4
+ Presupposes isodoc.rnc, is included in it
5
+ include "isodoc.rnc" { }
6
+ -->
7
+ <define name="requirement">
8
+ <element name="requirement">
9
+ <ref name="RequirementType"/>
10
+ </element>
11
+ </define>
12
+ <define name="recommendation">
13
+ <element name="recommendation">
14
+ <ref name="RequirementType"/>
15
+ </element>
16
+ </define>
17
+ <define name="permission">
18
+ <element name="permission">
19
+ <ref name="RequirementType"/>
20
+ </element>
21
+ </define>
22
+ <define name="RequirementType">
23
+ <optional>
24
+ <attribute name="obligation">
25
+ <ref name="ObligationType"/>
26
+ </attribute>
27
+ </optional>
28
+ <optional>
29
+ <attribute name="unnumbered">
30
+ <data type="boolean"/>
31
+ </attribute>
32
+ </optional>
33
+ <optional>
34
+ <attribute name="number"/>
35
+ </optional>
36
+ <optional>
37
+ <attribute name="subsequence"/>
38
+ </optional>
39
+ <optional>
40
+ <attribute name="keep-with-next">
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ <optional>
45
+ <attribute name="keep-lines-together">
46
+ <data type="boolean"/>
47
+ </attribute>
48
+ </optional>
49
+ <attribute name="id">
50
+ <data type="ID"/>
51
+ </attribute>
52
+ <optional>
53
+ <attribute name="filename"/>
54
+ </optional>
55
+ <optional>
56
+ <attribute name="model"/>
57
+ </optional>
58
+ <optional>
59
+ <attribute name="type"/>
60
+ </optional>
61
+ <optional>
62
+ <ref name="reqtitle"/>
63
+ </optional>
64
+ <optional>
65
+ <ref name="label"/>
66
+ </optional>
67
+ <optional>
68
+ <ref name="subject"/>
69
+ </optional>
70
+ <zeroOrMore>
71
+ <ref name="reqinherit"/>
72
+ </zeroOrMore>
73
+ <zeroOrMore>
74
+ <ref name="classification"/>
75
+ </zeroOrMore>
76
+ <zeroOrMore>
77
+ <choice>
78
+ <ref name="measurementtarget"/>
79
+ <ref name="specification"/>
80
+ <ref name="verification"/>
81
+ <ref name="import"/>
82
+ <ref name="description"/>
83
+ </choice>
84
+ </zeroOrMore>
85
+ <optional>
86
+ <ref name="reqt_references"/>
87
+ </optional>
88
+ <zeroOrMore>
89
+ <choice>
90
+ <ref name="requirement"/>
91
+ <ref name="recommendation"/>
92
+ <ref name="permission"/>
93
+ </choice>
94
+ </zeroOrMore>
95
+ </define>
96
+ <define name="reqtitle">
97
+ <element name="title">
98
+ <ref name="FormattedString"/>
99
+ </element>
100
+ </define>
101
+ <define name="label">
102
+ <element name="label">
103
+ <text/>
104
+ </element>
105
+ </define>
106
+ <define name="subject">
107
+ <element name="subject">
108
+ <text/>
109
+ </element>
110
+ </define>
111
+ <define name="reqinherit">
112
+ <element name="inherit">
113
+ <text/>
114
+ </element>
115
+ </define>
116
+ <define name="measurementtarget">
117
+ <element name="measurement-target">
118
+ <ref name="RequirementSubpart"/>
119
+ </element>
120
+ </define>
121
+ <define name="specification">
122
+ <element name="specification">
123
+ <ref name="RequirementSubpart"/>
124
+ </element>
125
+ </define>
126
+ <define name="verification">
127
+ <element name="verification">
128
+ <ref name="RequirementSubpart"/>
129
+ </element>
130
+ </define>
131
+ <define name="import">
132
+ <element name="import">
133
+ <ref name="RequirementSubpart"/>
134
+ </element>
135
+ </define>
136
+ <define name="description">
137
+ <element name="description">
138
+ <ref name="RequirementSubpart"/>
139
+ </element>
140
+ </define>
141
+ <define name="reqt_references">
142
+ <element name="references">
143
+ <oneOrMore>
144
+ <ref name="bibitem"/>
145
+ </oneOrMore>
146
+ </element>
147
+ </define>
148
+ <define name="RequirementSubpart">
149
+ <optional>
150
+ <attribute name="type"/>
151
+ </optional>
152
+ <optional>
153
+ <attribute name="exclude">
154
+ <data type="boolean"/>
155
+ </attribute>
156
+ </optional>
157
+ <optional>
158
+ <attribute name="keep-with-next">
159
+ <data type="boolean"/>
160
+ </attribute>
161
+ </optional>
162
+ <optional>
163
+ <attribute name="keep-lines-together">
164
+ <data type="boolean"/>
165
+ </attribute>
166
+ </optional>
167
+ <oneOrMore>
168
+ <ref name="BasicBlock"/>
169
+ </oneOrMore>
170
+ </define>
171
+ <define name="ObligationType">
172
+ <choice>
173
+ <value>requirement</value>
174
+ <value>recommendation</value>
175
+ <value>permission</value>
176
+ </choice>
177
+ </define>
178
+ <define name="classification">
179
+ <element name="classification">
180
+ <ref name="classification_tag"/>
181
+ <ref name="classification_value"/>
182
+ </element>
183
+ </define>
184
+ <define name="classification_tag">
185
+ <element name="tag">
186
+ <text/>
187
+ </element>
188
+ </define>
189
+ <define name="classification_value">
190
+ <element name="value">
191
+ <text/>
192
+ </element>
193
+ </define>
194
+ </grammar>
@@ -0,0 +1,29 @@
1
+ module Asciidoctor
2
+ module CC
3
+ class Converter < Standoc::Converter
4
+ def content_validate(doc)
5
+ super
6
+ bibdata_validate(doc.root)
7
+ end
8
+
9
+ def bibdata_validate(doc)
10
+ doctype_validate(doc)
11
+ stage_validate(doc)
12
+ end
13
+
14
+ def doctype_validate(xmldoc)
15
+ doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
16
+ %w(directive guide specification standard report administrative amendment
17
+ technical-corrigendum advisory).include?(doctype) or
18
+ @log.add("Document Attributes", nil, "#{doctype} is not a recognised document type")
19
+ end
20
+
21
+ def stage_validate(xmldoc)
22
+ stage = xmldoc&.at("//bibdata/status/stage")&.text
23
+ %w(proposal working-draft committee-draft draft-standard final-draft
24
+ published withdrawn).include?(stage) or
25
+ @log.add("Document Attributes", nil, "#{stage} is not a recognised status")
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,138 @@
1
+ require "nokogiri"
2
+
3
+ module Asciidoctor
4
+ module CC
5
+ class Converter < Standoc::Converter
6
+ def section_validate(doc)
7
+ advisory = doc.root.at("//bibdata/ext[doctype = 'advisory']")
8
+ symbols_validate(doc.root) unless advisory
9
+ sections_sequence_validate(doc.root) unless advisory
10
+ super
11
+ end
12
+
13
+ ONE_SYMBOLS_WARNING = "Only one Symbols and Abbreviated "\
14
+ "Terms section in the standard".freeze
15
+
16
+ NON_DL_SYMBOLS_WARNING = "Symbols and Abbreviated Terms can "\
17
+ "only contain a definition list".freeze
18
+
19
+ def symbols_validate(root)
20
+ f = root.xpath("//definitions")
21
+ f.empty? && return
22
+ (f.size == 1) || @log.add("Style", f.first, ONE_SYMBOLS_WARNING)
23
+ f.first.elements.each do |e|
24
+ unless e.name == "dl"
25
+ @log.add("Style", f.first, NON_DL_SYMBOLS_WARNING)
26
+ return
27
+ end
28
+ end
29
+ end
30
+
31
+ def seqcheck(names, msg, accepted)
32
+ n = names.shift
33
+ unless accepted.include? n
34
+ @log.add("Style", nil, msg)
35
+ names = []
36
+ end
37
+ names
38
+ end
39
+
40
+ # spec of permissible section sequence
41
+ # we skip normative references, it goes to end of list
42
+ SEQ =
43
+ [
44
+ {
45
+ msg: "Initial section must be (content) Foreword",
46
+ val: [{ tag: "foreword", title: "Foreword" }],
47
+ },
48
+ {
49
+ msg: "Prefatory material must be followed by (clause) Scope",
50
+ val: [{ tag: "introduction", title: "Introduction" },
51
+ { tag: "clause", title: "Scope" }],
52
+ },
53
+ {
54
+ msg: "Prefatory material must be followed by (clause) Scope",
55
+ val: [{ tag: "clause", title: "Scope" }],
56
+ },
57
+ {
58
+ msg: "Normative References must be followed by "\
59
+ "Terms and Definitions",
60
+ val: [
61
+ { tag: "terms", title: "Terms and definitions" },
62
+ { tag: "clause", title: "Terms and definitions" },
63
+ {
64
+ tag: "terms",
65
+ title: "Terms, definitions, symbols and abbreviated terms",
66
+ },
67
+ {
68
+ tag: "clause",
69
+ title: "Terms, definitions, symbols and abbreviated terms",
70
+ },
71
+ ],
72
+ },
73
+ ].freeze
74
+
75
+ SECTIONS_XPATH =
76
+ "//foreword | //introduction | //sections/terms | .//annex | "\
77
+ "//sections/definitions | //sections/clause | //references[not(parent::clause)] | "\
78
+ "//clause[descendant::references][not(parent::clause)]".freeze
79
+
80
+ def sections_sequence_validate(root)
81
+ f = root.xpath(SECTIONS_XPATH)
82
+ names = f.map { |s| { tag: s.name, title: s&.at("./title")&.text } }
83
+ names = seqcheck(names, SEQ[0][:msg], SEQ[0][:val]) || return
84
+ n = names[0]
85
+ names = seqcheck(names, SEQ[1][:msg], SEQ[1][:val]) || return
86
+ if n == { tag: "introduction", title: "Introduction" }
87
+ names = seqcheck(names, SEQ[2][:msg], SEQ[2][:val]) || return
88
+ end
89
+ names = seqcheck(names, SEQ[3][:msg], SEQ[3][:val]) || return
90
+ n = names.shift
91
+ if n == { tag: "definitions", title: nil }
92
+ n = names.shift || return
93
+ end
94
+ unless n
95
+ @log.add("Style", nil, "Document must contain at least one clause")
96
+ return
97
+ end
98
+ n[:tag] == "clause" ||
99
+ @log.add("Style", nil, "Document must contain clause after "\
100
+ "Terms and Definitions")
101
+ n == { tag: "clause", title: "Scope" } &&
102
+ @log.add("Style", nil, "Scope must occur before Terms and Definitions")
103
+ n = names.shift || return
104
+ while n[:tag] == "clause"
105
+ n[:title] == "Scope" &&
106
+ @log.add("Style", nil, "Scope must occur before Terms and Definitions")
107
+ n = names.shift || return
108
+ end
109
+ unless n[:tag] == "annex" || n[:tag] == "references"
110
+ @log.add("Style", nil, "Only annexes and references can follow clauses")
111
+ end
112
+ while n[:tag] == "annex"
113
+ n = names.shift
114
+ if n.nil?
115
+ @log.add("Style", nil, "Document must include (references) "\
116
+ "Normative References")
117
+ return
118
+ end
119
+ end
120
+ n == { tag: "references", title: "Normative References" } ||
121
+ @log.add("Style", nil, "Document must include (references) "\
122
+ "Normative References")
123
+ n = names.shift
124
+ n == { tag: "references", title: "Bibliography" } ||
125
+ @log.add("Style", nil, "Final section must be (references) Bibliography")
126
+ names.empty? ||
127
+ @log.add("Style", nil, "There are sections after the final Bibliography")
128
+ end
129
+
130
+ def style_warning(node, msg, text = nil)
131
+ return if @novalid
132
+ w = msg
133
+ w += ": #{text}" if text
134
+ @log.add("Style", node, w)
135
+ end
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,42 @@
1
+ require "isodoc"
2
+ require_relative "metadata"
3
+
4
+ module IsoDoc
5
+ module CC
6
+ module BaseConvert
7
+ def metadata_init(lang, script, labels)
8
+ @meta = Metadata.new(lang, script, labels)
9
+ end
10
+
11
+ def annex_name(annex, name, div)
12
+ div.h1 **{ class: "Annex" } do |t|
13
+ t << "#{@xrefs.anchor(annex['id'], :label)} "
14
+ t.br
15
+ t.b do |b|
16
+ name&.children&.each { |c2| parse(c2, b) }
17
+ end
18
+ end
19
+ end
20
+
21
+ def i18n_init(lang, script)
22
+ super
23
+ @annex_lbl = "Appendix"
24
+ @labels["annex"] = "Appendix"
25
+ end
26
+
27
+ def cleanup(docxml)
28
+ super
29
+ term_cleanup(docxml)
30
+ end
31
+
32
+ def term_cleanup(docxml)
33
+ docxml.xpath("//p[@class = 'Terms']").each do |d|
34
+ h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
35
+ h2.add_child("&nbsp;")
36
+ h2.add_child(d.remove)
37
+ end
38
+ docxml
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,3228 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
+
3
+ <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
+
5
+ <xsl:variable name="pageWidth" select="'210mm'"/>
6
+ <xsl:variable name="pageHeight" select="'297mm'"/>
7
+
8
+
9
+
10
+ <xsl:variable name="debug">false</xsl:variable>
11
+
12
+ <xsl:variable name="copyright">
13
+ <xsl:text>© The Calendaring and Scheduling Consortium, Inc. </xsl:text>
14
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
15
+ <xsl:text> – All rights reserved</xsl:text>
16
+ </xsl:variable>
17
+
18
+ <xsl:variable name="header">
19
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:docidentifier[@type = 'csd']"/>
20
+ <xsl:text>:</xsl:text>
21
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
22
+ </xsl:variable>
23
+
24
+ <xsl:variable name="contents">
25
+ <contents>
26
+ <xsl:apply-templates select="/csd:csd-standard/csd:preface/node()" mode="contents"/>
27
+ <!-- <xsl:with-param name="sectionNum" select="'0'"/>
28
+ </xsl:apply-templates> -->
29
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/csd:clause[1]" mode="contents"> <!-- [@id = '_scope'] -->
30
+ <xsl:with-param name="sectionNum" select="'1'"/>
31
+ </xsl:apply-templates>
32
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[1]" mode="contents"> <!-- [@id = '_normative_references'] -->
33
+ <xsl:with-param name="sectionNum" select="'2'"/>
34
+ </xsl:apply-templates>
35
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/*[position() &gt; 1]" mode="contents"> <!-- @id != '_scope' -->
36
+ <xsl:with-param name="sectionNumSkew" select="'1'"/>
37
+ </xsl:apply-templates>
38
+ <xsl:apply-templates select="/csd:csd-standard/csd:annex" mode="contents"/>
39
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[position() &gt; 1]" mode="contents"/> <!-- @id = '_bibliography' -->
40
+
41
+ <xsl:apply-templates select="//csd:figure" mode="contents"/>
42
+
43
+ <xsl:apply-templates select="//csd:table" mode="contents"/>
44
+
45
+ </contents>
46
+ </xsl:variable>
47
+
48
+ <xsl:variable name="lang">
49
+ <xsl:call-template name="getLang"/>
50
+ </xsl:variable>
51
+
52
+ <xsl:template match="/">
53
+ <fo:root font-family="SourceSansPro, STIX2Math, HanSans" font-size="10.5pt" xml:lang="{$lang}">
54
+ <fo:layout-master-set>
55
+ <!-- Cover page -->
56
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
57
+ <fo:region-body margin-top="23.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
58
+ <fo:region-before region-name="cover-page-header" extent="23.5mm"/>
59
+ <fo:region-after extent="10mm"/>
60
+ <fo:region-start extent="19mm"/>
61
+ <fo:region-end extent="19mm"/>
62
+ </fo:simple-page-master>
63
+
64
+ <!-- Document pages -->
65
+ <!-- <fo:simple-page-master master-name="document" page-width="{$pageWidth}" page-height="{$pageHeight}">
66
+ <fo:region-body margin-top="23.5mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
67
+ <fo:region-before extent="23.5mm"/>
68
+ <fo:region-after extent="10mm"/>
69
+ <fo:region-start extent="19mm"/>
70
+ <fo:region-end extent="19mm"/>
71
+ </fo:simple-page-master> -->
72
+
73
+ <!-- Preface odd pages -->
74
+ <fo:simple-page-master master-name="odd-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
75
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
76
+ <fo:region-before region-name="header-odd" extent="17mm"/>
77
+ <fo:region-after region-name="footer-odd" extent="10mm"/>
78
+ <fo:region-start region-name="left-region" extent="19mm"/>
79
+ <fo:region-end region-name="right-region" extent="19mm"/>
80
+ </fo:simple-page-master>
81
+ <!-- Preface even pages -->
82
+ <fo:simple-page-master master-name="even-preface" page-width="{$pageWidth}" page-height="{$pageHeight}">
83
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
84
+ <fo:region-before region-name="header-even" extent="17mm"/>
85
+ <fo:region-after region-name="footer-even" extent="10mm"/>
86
+ <fo:region-start region-name="left-region" extent="19mm"/>
87
+ <fo:region-end region-name="right-region" extent="19mm"/>
88
+ </fo:simple-page-master>
89
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
90
+ <fo:region-body margin-top="17mm" margin-bottom="10mm" margin-left="19mm" margin-right="19mm"/>
91
+ <fo:region-before region-name="header" extent="17mm"/>
92
+ <fo:region-after region-name="footer" extent="10mm"/>
93
+ <fo:region-start region-name="left" extent="19mm"/>
94
+ <fo:region-end region-name="right" extent="19mm"/>
95
+ </fo:simple-page-master>
96
+ <fo:page-sequence-master master-name="preface">
97
+ <fo:repeatable-page-master-alternatives>
98
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
99
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even-preface"/>
100
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd-preface"/>
101
+ </fo:repeatable-page-master-alternatives>
102
+ </fo:page-sequence-master>
103
+
104
+ <!-- Document odd pages -->
105
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
106
+ <fo:region-body margin-top="20.2mm" margin-bottom="20.3mm" margin-left="19mm" margin-right="19mm"/>
107
+ <fo:region-before region-name="header-odd" extent="20.2mm"/>
108
+ <fo:region-after region-name="footer-odd" extent="20.3mm"/>
109
+ <fo:region-start region-name="left-region" extent="19mm"/>
110
+ <fo:region-end region-name="right-region" extent="19mm"/>
111
+ </fo:simple-page-master>
112
+ <!-- Preface even pages -->
113
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
114
+ <fo:region-body margin-top="20.2mm" margin-bottom="20.3mm" margin-left="19mm" margin-right="19mm"/>
115
+ <fo:region-before region-name="header-even" extent="20.2mm"/>
116
+ <fo:region-after region-name="footer-even" extent="20.3mm"/>
117
+ <fo:region-start region-name="left-region" extent="19mm"/>
118
+ <fo:region-end region-name="right-region" extent="19mm"/>
119
+ </fo:simple-page-master>
120
+ <fo:page-sequence-master master-name="document">
121
+ <fo:repeatable-page-master-alternatives>
122
+ <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
123
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
124
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/>
125
+ </fo:repeatable-page-master-alternatives>
126
+ </fo:page-sequence-master>
127
+
128
+ </fo:layout-master-set>
129
+
130
+ <xsl:call-template name="addPDFUAmeta"/>
131
+
132
+
133
+ <!-- Cover Page -->
134
+ <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
135
+ <fo:static-content flow-name="xsl-footnote-separator">
136
+ <fo:block>
137
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
138
+ </fo:block>
139
+ </fo:static-content>
140
+ <fo:static-content flow-name="cover-page-header" font-size="10pt">
141
+ <fo:block-container height="23.5mm" display-align="before">
142
+ <fo:block padding-top="12.5mm">
143
+ <xsl:value-of select="$copyright"/>
144
+ </fo:block>
145
+ </fo:block-container>
146
+ </fo:static-content>
147
+
148
+ <fo:flow flow-name="xsl-region-body">
149
+
150
+ <fo:block text-align="right">
151
+ <!-- CC/FDS 18011:2018 -->
152
+ <fo:block font-size="14pt" font-weight="bold" margin-bottom="10pt">
153
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:docidentifier[@type = 'csd']"/><xsl:text> </xsl:text>
154
+ </fo:block>
155
+ <fo:block margin-bottom="12pt">
156
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:owner/csd:organization/csd:name"/>
157
+ <xsl:text> TC </xsl:text>
158
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:ext/csd:editorialgroup/csd:technical-committee"/>
159
+ <xsl:text> </xsl:text>
160
+ </fo:block>
161
+ </fo:block>
162
+ <fo:block font-size="24pt" font-weight="bold" text-align="center">
163
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/>
164
+ <xsl:value-of select="$linebreak"/>
165
+ </fo:block>
166
+ <fo:block> </fo:block>
167
+ <fo:block margin-bottom="12pt"> </fo:block>
168
+ <fo:block-container font-size="16pt" text-align="center" border="0.5pt solid black" margin-bottom="12pt" margin-left="-1mm" margin-right="-1mm">
169
+ <fo:block-container margin-left="0mm" margin-right="0mm">
170
+ <fo:block padding-top="1mm">
171
+ <xsl:call-template name="capitalizeWords">
172
+ <!-- ex: final-draft -->
173
+ <xsl:with-param name="str" select="/csd:csd-standard/csd:bibdata/csd:status/csd:stage"/>
174
+ </xsl:call-template>
175
+ <xsl:text> </xsl:text>
176
+ <xsl:call-template name="capitalizeWords">
177
+ <!-- ex: standard -->
178
+ <xsl:with-param name="str" select="/csd:csd-standard/csd:bibdata/csd:ext/csd:doctype"/>
179
+ </xsl:call-template>
180
+ </fo:block>
181
+ </fo:block-container>
182
+ </fo:block-container>
183
+ <fo:block margin-bottom="10pt"> </fo:block>
184
+ <fo:block-container font-size="10pt" border="0.5pt solid black" margin-bottom="12pt" margin-left="-1mm" margin-right="-1mm">
185
+ <fo:block-container margin-left="0mm" margin-right="0mm">
186
+ <fo:block text-align="center" font-weight="bold" padding-top="1mm" margin-bottom="6pt">Warning for drafts</fo:block>
187
+ <fo:block margin-left="2mm" margin-right="2mm">
188
+ <fo:block margin-bottom="6pt">This document is not a CalConnect Standard. It is distributed for review and comment, and is subject to change without notice and may not be referred to as a Standard. Recipients of this draft are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</fo:block>
189
+ <fo:block margin-bottom="10pt">Recipients of this draft are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</fo:block>
190
+ </fo:block>
191
+ </fo:block-container>
192
+ </fo:block-container>
193
+ <fo:block text-align="center">
194
+ <xsl:text>The Calendaring and Scheduling Consortium, Inc.  </xsl:text>
195
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
196
+ </fo:block>
197
+ </fo:flow>
198
+ </fo:page-sequence>
199
+ <!-- End Cover Page -->
200
+
201
+
202
+ <!-- Copyright, Content, Foreword, etc. pages -->
203
+ <fo:page-sequence master-reference="preface" initial-page-number="2" format="i" force-page-count="end-on-even">
204
+ <fo:static-content flow-name="xsl-footnote-separator">
205
+ <fo:block>
206
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
207
+ </fo:block>
208
+ </fo:static-content>
209
+ <xsl:call-template name="insertHeaderFooter"/>
210
+ <fo:flow flow-name="xsl-region-body">
211
+
212
+ <xsl:if test="$debug = 'true'">
213
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
214
+ DEBUG
215
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
216
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
217
+ </xsl:if>
218
+
219
+ <fo:block margin-bottom="15pt"> </fo:block>
220
+ <fo:block margin-bottom="14pt">
221
+ <xsl:text>© </xsl:text>
222
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:copyright/csd:from"/>
223
+ <xsl:text> </xsl:text>
224
+ <fo:inline>
225
+ <xsl:apply-templates select="/csd:csd-standard/csd:boilerplate/csd:feedback-statement/csd:clause/csd:p[@id = 'boilerplate-name']"/>
226
+ </fo:inline>
227
+ </fo:block>
228
+ <fo:block margin-bottom="12pt">
229
+ <xsl:apply-templates select="/csd:csd-standard/csd:boilerplate/csd:legal-statement"/>
230
+ </fo:block>
231
+ <fo:block margin-bottom="12pt">
232
+ <xsl:apply-templates select="/csd:csd-standard/csd:boilerplate/csd:feedback-statement/csd:clause/csd:p[@id = 'boilerplate-name']"/>
233
+ </fo:block>
234
+ <fo:block>
235
+ <xsl:apply-templates select="/csd:csd-standard/csd:boilerplate/csd:feedback-statement/csd:clause/csd:p[@id = 'boilerplate-address']"/>
236
+ </fo:block>
237
+
238
+ <fo:block break-after="page"/>
239
+
240
+ <fo:block-container font-weight="bold" line-height="115%">
241
+ <xsl:variable name="title-toc">
242
+ <xsl:call-template name="getTitle">
243
+ <xsl:with-param name="name" select="'title-toc'"/>
244
+ </xsl:call-template>
245
+ </xsl:variable>
246
+ <fo:block font-size="14pt" margin-bottom="15.5pt"><xsl:value-of select="$title-toc"/></fo:block>
247
+
248
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true' and @level &lt;= 2][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
249
+
250
+ <fo:block>
251
+ <xsl:if test="@level = 1">
252
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
253
+ </xsl:if>
254
+ <fo:list-block>
255
+ <xsl:attribute name="provisional-distance-between-starts">
256
+ <xsl:choose>
257
+ <!-- skip 0 section without subsections -->
258
+ <xsl:when test="@section != '' and not(@display-section = 'false')">8mm</xsl:when>
259
+ <xsl:otherwise>0mm</xsl:otherwise>
260
+ </xsl:choose>
261
+ </xsl:attribute>
262
+ <fo:list-item>
263
+ <fo:list-item-label end-indent="label-end()">
264
+ <fo:block>
265
+ <xsl:if test="@section and not(@display-section = 'false')"> <!-- output below -->
266
+ <xsl:value-of select="@section"/><xsl:text>.</xsl:text>
267
+ </xsl:if>
268
+ </fo:block>
269
+ </fo:list-item-label>
270
+ <fo:list-item-body start-indent="body-start()">
271
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
272
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
273
+ <xsl:if test="@section and @display-section = 'false'">
274
+ <xsl:value-of select="@section"/><xsl:text> </xsl:text>
275
+ </xsl:if>
276
+ <xsl:if test="@addon != ''">
277
+ <xsl:text>(</xsl:text><xsl:value-of select="@addon"/><xsl:text>)</xsl:text>
278
+ </xsl:if>
279
+ <xsl:text> </xsl:text><xsl:value-of select="text()"/>
280
+ <fo:inline keep-together.within-line="always">
281
+ <fo:leader leader-pattern="dots"/>
282
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
283
+ </fo:inline>
284
+ </fo:basic-link>
285
+ </fo:block>
286
+ </fo:list-item-body>
287
+ </fo:list-item>
288
+ </fo:list-block>
289
+ </fo:block>
290
+ </xsl:for-each>
291
+ </fo:block-container>
292
+
293
+ <!-- Foreword, Introduction -->
294
+ <xsl:apply-templates select="/csd:csd-standard/csd:preface/node()"/>
295
+
296
+ </fo:flow>
297
+ </fo:page-sequence>
298
+
299
+
300
+ <!-- Document Pages -->
301
+ <fo:page-sequence master-reference="document" initial-page-number="1" format="1" force-page-count="no-force">
302
+ <fo:static-content flow-name="xsl-footnote-separator">
303
+ <fo:block>
304
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
305
+ </fo:block>
306
+ </fo:static-content>
307
+ <xsl:call-template name="insertHeaderFooter"/>
308
+ <fo:flow flow-name="xsl-region-body">
309
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="17pt">
310
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/>
311
+ </fo:block>
312
+ <fo:block>
313
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/csd:clause[1]"> <!-- Scope -->
314
+ <xsl:with-param name="sectionNum" select="'1'"/>
315
+ </xsl:apply-templates>
316
+ <!-- Normative references -->
317
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[1]">
318
+ <xsl:with-param name="sectionNum" select="'2'"/>
319
+ </xsl:apply-templates>
320
+
321
+ <!-- Other Sections -->
322
+ <xsl:apply-templates select="/csd:csd-standard/csd:sections/*[position() &gt; 1]">
323
+ <xsl:with-param name="sectionNumSkew" select="'1'"/>
324
+ </xsl:apply-templates>
325
+
326
+ <xsl:apply-templates select="/csd:csd-standard/csd:annex"/>
327
+ <xsl:apply-templates select="/csd:csd-standard/csd:bibliography/csd:references[position() &gt; 1]"/>
328
+
329
+ </fo:block>
330
+ </fo:flow>
331
+ </fo:page-sequence>
332
+
333
+ <!-- End Document Pages -->
334
+
335
+ </fo:root>
336
+ </xsl:template>
337
+
338
+ <!-- for pass the paremeter 'sectionNum' over templates, like 'tunnel' parameter in XSLT 2.0 -->
339
+ <xsl:template match="node()">
340
+ <xsl:param name="sectionNum"/>
341
+ <xsl:param name="sectionNumSkew"/>
342
+ <xsl:apply-templates>
343
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
344
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
345
+ </xsl:apply-templates>
346
+ </xsl:template>
347
+
348
+ <!-- ============================= -->
349
+ <!-- CONTENTS -->
350
+ <!-- ============================= -->
351
+ <xsl:template match="node()" mode="contents">
352
+ <xsl:param name="sectionNum"/>
353
+ <xsl:param name="sectionNumSkew"/>
354
+ <xsl:apply-templates mode="contents">
355
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
356
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
357
+ </xsl:apply-templates>
358
+ </xsl:template>
359
+
360
+
361
+ <!-- calculate main section number (1,2,3) and pass it deep into templates -->
362
+ <!-- it's necessary, because there is itu:bibliography/itu:references from other section, but numbering should be sequental -->
363
+ <xsl:template match="csd:csd-standard/csd:sections/*" mode="contents">
364
+ <xsl:param name="sectionNum"/>
365
+ <xsl:param name="sectionNumSkew" select="0"/>
366
+ <xsl:variable name="sectionNum_">
367
+ <xsl:choose>
368
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
369
+ <xsl:when test="$sectionNumSkew != 0">
370
+ <xsl:variable name="number"><xsl:number count="*"/></xsl:variable> <!-- csd:sections/csd:clause | csd:sections/csd:terms -->
371
+ <xsl:value-of select="$number + $sectionNumSkew"/>
372
+ </xsl:when>
373
+ <xsl:otherwise>
374
+ <xsl:number count="*"/>
375
+ </xsl:otherwise>
376
+ </xsl:choose>
377
+ </xsl:variable>
378
+ <xsl:apply-templates mode="contents">
379
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
380
+ </xsl:apply-templates>
381
+ </xsl:template>
382
+
383
+ <!-- Any node with title element - clause, definition, annex,... -->
384
+ <xsl:template match="csd:title | csd:preferred" mode="contents">
385
+ <xsl:param name="sectionNum"/>
386
+ <!-- sectionNum=<xsl:value-of select="$sectionNum"/> -->
387
+ <xsl:variable name="id">
388
+ <xsl:call-template name="getId"/>
389
+ </xsl:variable>
390
+
391
+ <xsl:variable name="level">
392
+ <xsl:call-template name="getLevel"/>
393
+ </xsl:variable>
394
+
395
+ <xsl:variable name="section">
396
+ <xsl:call-template name="getSection">
397
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
398
+ </xsl:call-template>
399
+ </xsl:variable>
400
+
401
+ <xsl:variable name="display">
402
+ <xsl:choose>
403
+ <xsl:when test="ancestor::csd:bibitem">false</xsl:when>
404
+ <xsl:when test="ancestor::csd:term">false</xsl:when>
405
+ <xsl:when test="ancestor::csd:annex and $level &gt;= 2">false</xsl:when>
406
+ <xsl:when test="$level &lt;= 3">true</xsl:when>
407
+ <xsl:otherwise>false</xsl:otherwise>
408
+ </xsl:choose>
409
+ </xsl:variable>
410
+
411
+ <xsl:variable name="display-section">
412
+ <xsl:choose>
413
+ <xsl:when test="ancestor::csd:annex">false</xsl:when>
414
+ <xsl:otherwise>true</xsl:otherwise>
415
+ </xsl:choose>
416
+ </xsl:variable>
417
+
418
+ <xsl:variable name="type">
419
+ <xsl:value-of select="local-name(..)"/>
420
+ </xsl:variable>
421
+
422
+ <xsl:variable name="root">
423
+ <xsl:choose>
424
+ <xsl:when test="ancestor::csd:annex">annex</xsl:when>
425
+ <xsl:when test="ancestor::csd:clause">clause</xsl:when>
426
+ </xsl:choose>
427
+ </xsl:variable>
428
+
429
+ <item id="{$id}" level="{$level}" section="{$section}" display-section="{$display-section}" display="{$display}" type="{$type}" root="{$root}">
430
+ <xsl:attribute name="addon">
431
+ <xsl:if test="local-name(..) = 'annex'"><xsl:value-of select="../@obligation"/></xsl:if>
432
+ </xsl:attribute>
433
+ <xsl:value-of select="."/>
434
+ </item>
435
+
436
+ <xsl:apply-templates mode="contents">
437
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
438
+ </xsl:apply-templates>
439
+
440
+ </xsl:template>
441
+
442
+
443
+ <xsl:template match="csd:figure" mode="contents">
444
+ <item level="" id="{@id}" display="false">
445
+ <xsl:attribute name="section">
446
+ <xsl:variable name="title-figure">
447
+ <xsl:call-template name="getTitle">
448
+ <xsl:with-param name="name" select="'title-figure'"/>
449
+ </xsl:call-template>
450
+ </xsl:variable>
451
+ <xsl:value-of select="$title-figure"/><xsl:number format="A.1-1" level="multiple" count="csd:annex | csd:figure"/>
452
+ </xsl:attribute>
453
+ </item>
454
+ </xsl:template>
455
+
456
+
457
+ <xsl:template match="csd:table" mode="contents">
458
+ <xsl:param name="sectionNum"/>
459
+ <xsl:variable name="annex-id" select="ancestor::csd:annex/@id"/>
460
+ <item level="" id="{@id}" display="false" type="table">
461
+ <xsl:attribute name="section">
462
+ <xsl:variable name="title-table">
463
+ <xsl:call-template name="getTitle">
464
+ <xsl:with-param name="name" select="'title-table'"/>
465
+ </xsl:call-template>
466
+ </xsl:variable>
467
+ <xsl:value-of select="$title-table"/>
468
+ <xsl:choose>
469
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
470
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
471
+ </xsl:when>
472
+ <xsl:when test="ancestor::*[local-name()='annex']">
473
+ <xsl:number format="A-" count="csd:annex"/>
474
+ <xsl:number format="1" level="any" count="csd:table[ancestor::csd:annex[@id = $annex-id]]"/>
475
+ </xsl:when>
476
+ <xsl:otherwise>
477
+ <!-- <xsl:number format="1"/> -->
478
+ <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table']"/>
479
+ </xsl:otherwise>
480
+ </xsl:choose>
481
+ </xsl:attribute>
482
+ <xsl:value-of select="csd:name/text()"/>
483
+ </item>
484
+ </xsl:template>
485
+
486
+
487
+
488
+ <xsl:template match="csd:formula" mode="contents">
489
+ <item level="" id="{@id}" display="false">
490
+ <xsl:attribute name="section">
491
+ <xsl:variable name="title-formula">
492
+ <xsl:call-template name="getTitle">
493
+ <xsl:with-param name="name" select="'title-formula'"/>
494
+ </xsl:call-template>
495
+ </xsl:variable>
496
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="csd:annex | csd:formula"/>
497
+ </xsl:attribute>
498
+ </item>
499
+ </xsl:template>
500
+ <!-- ============================= -->
501
+ <!-- ============================= -->
502
+
503
+
504
+ <xsl:template match="csd:license-statement//csd:title">
505
+ <fo:block text-align="center" font-weight="bold">
506
+ <xsl:apply-templates/>
507
+ </fo:block>
508
+ </xsl:template>
509
+
510
+ <xsl:template match="csd:license-statement//csd:p">
511
+ <fo:block margin-left="1.5mm" margin-right="1.5mm">
512
+ <xsl:if test="following-sibling::csd:p">
513
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
514
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
515
+ </xsl:if>
516
+ <xsl:apply-templates/>
517
+ </fo:block>
518
+ </xsl:template>
519
+
520
+ <!-- <fo:block margin-bottom="12pt">© ISO 2019, Published in Switzerland.</fo:block>
521
+ <fo:block font-size="10pt" margin-bottom="12pt">All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below or ISO’s member body in the country of the requester.</fo:block>
522
+ <fo:block font-size="10pt" text-indent="7.1mm">
523
+ <fo:block>ISO copyright office</fo:block>
524
+ <fo:block>Ch. de Blandonnet 8 • CP 401</fo:block>
525
+ <fo:block>CH-1214 Vernier, Geneva, Switzerland</fo:block>
526
+ <fo:block>Tel. + 41 22 749 01 11</fo:block>
527
+ <fo:block>Fax + 41 22 749 09 47</fo:block>
528
+ <fo:block>copyright@iso.org</fo:block>
529
+ <fo:block>www.iso.org</fo:block>
530
+ </fo:block> -->
531
+
532
+ <xsl:template match="csd:copyright-statement//csd:p">
533
+ <fo:block>
534
+ <xsl:if test="preceding-sibling::csd:p">
535
+ <!-- <xsl:attribute name="font-size">10pt</xsl:attribute> -->
536
+ </xsl:if>
537
+ <xsl:if test="following-sibling::csd:p">
538
+ <!-- <xsl:attribute name="margin-bottom">12pt</xsl:attribute> -->
539
+ <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
540
+ </xsl:if>
541
+ <xsl:if test="not(following-sibling::csd:p)">
542
+ <!-- <xsl:attribute name="margin-left">7.1mm</xsl:attribute> -->
543
+ <xsl:attribute name="margin-left">4mm</xsl:attribute>
544
+ </xsl:if>
545
+ <xsl:apply-templates/>
546
+ </fo:block>
547
+ </xsl:template>
548
+
549
+ <!-- Foreword, Introduction -->
550
+ <xsl:template match="csd:csd-standard/csd:preface/*">
551
+ <fo:block break-after="page"/>
552
+ <!-- <fo:block> -->
553
+ <xsl:apply-templates/>
554
+ <!-- </fo:block> -->
555
+ </xsl:template>
556
+
557
+
558
+
559
+ <!-- clause, terms, clause, ...-->
560
+ <xsl:template match="csd:csd-standard/csd:sections/*">
561
+ <xsl:param name="sectionNum"/>
562
+ <xsl:param name="sectionNumSkew" select="0"/>
563
+ <fo:block>
564
+ <xsl:variable name="pos"><xsl:number count="csd:sections/csd:clause | csd:sections/csd:terms"/></xsl:variable>
565
+ <xsl:if test="$pos &gt;= 2">
566
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
567
+ </xsl:if>
568
+ <!-- pos=<xsl:value-of select="$pos" /> -->
569
+ <xsl:variable name="sectionNum_">
570
+ <xsl:choose>
571
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
572
+ <xsl:when test="$sectionNumSkew != 0">
573
+ <xsl:variable name="number"><xsl:number count="csd:sections/csd:clause | csd:sections/csd:terms"/></xsl:variable>
574
+ <xsl:value-of select="$number + $sectionNumSkew"/>
575
+ </xsl:when>
576
+ </xsl:choose>
577
+ </xsl:variable>
578
+ <xsl:if test="not(csd:title)">
579
+ <fo:block margin-top="3pt" margin-bottom="12pt">
580
+ <xsl:value-of select="$sectionNum_"/><xsl:number format=".1 " level="multiple" count="csd:clause"/>
581
+ </fo:block>
582
+ </xsl:if>
583
+ <xsl:apply-templates>
584
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
585
+ </xsl:apply-templates>
586
+ </fo:block>
587
+ </xsl:template>
588
+
589
+
590
+
591
+ <xsl:template match="csd:clause//csd:clause[not(csd:title)]">
592
+ <xsl:param name="sectionNum"/>
593
+ <xsl:variable name="section">
594
+ <xsl:call-template name="getSection">
595
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
596
+ </xsl:call-template>
597
+ </xsl:variable>
598
+
599
+ <fo:block margin-top="3pt"><!-- margin-bottom="6pt" -->
600
+ <fo:inline font-weight="bold" padding-right="3mm">
601
+ <xsl:value-of select="$section"/><!-- <xsl:number format=".1 " level="multiple" count="csd:clause/csd:clause" /> -->
602
+ </fo:inline>
603
+ <xsl:apply-templates>
604
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
605
+ <xsl:with-param name="inline" select="'true'"/>
606
+ </xsl:apply-templates>
607
+ </fo:block>
608
+ </xsl:template>
609
+
610
+
611
+ <xsl:template match="csd:title">
612
+ <xsl:param name="sectionNum"/>
613
+
614
+ <xsl:variable name="parent-name" select="local-name(..)"/>
615
+ <xsl:variable name="references_num_current">
616
+ <xsl:number level="any" count="csd:references"/>
617
+ </xsl:variable>
618
+
619
+ <xsl:variable name="id">
620
+ <xsl:call-template name="getId"/>
621
+ </xsl:variable>
622
+
623
+ <xsl:variable name="level">
624
+ <xsl:call-template name="getLevel"/>
625
+ </xsl:variable>
626
+
627
+ <xsl:variable name="section">
628
+ <xsl:call-template name="getSection">
629
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
630
+ </xsl:call-template>
631
+ </xsl:variable>
632
+
633
+ <xsl:variable name="font-size">
634
+ <xsl:choose>
635
+ <xsl:when test="ancestor::csd:preface">13pt</xsl:when>
636
+ <xsl:when test="$level = 1">13pt</xsl:when>
637
+ <xsl:when test="$level = 2">12pt</xsl:when>
638
+ <xsl:when test="$level &gt;= 3">11pt</xsl:when>
639
+ <xsl:otherwise>16pt</xsl:otherwise>
640
+ </xsl:choose>
641
+ </xsl:variable>
642
+
643
+ <xsl:variable name="element-name">
644
+ <xsl:choose>
645
+ <xsl:when test="../@inline-header = 'true'">fo:inline</xsl:when>
646
+ <xsl:otherwise>fo:block</xsl:otherwise>
647
+ </xsl:choose>
648
+ </xsl:variable>
649
+
650
+ <xsl:variable name="color" select="'rgb(14, 26, 133)'"/>
651
+
652
+ <xsl:element name="{$element-name}">
653
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
654
+ <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
655
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
656
+ <!-- <xsl:attribute name="margin-top">
657
+ <xsl:choose>
658
+ <xsl:when test="$level = 2 and ancestor::annex">18pt</xsl:when>
659
+ <xsl:when test="$level = '' or $level = 1">6pt</xsl:when>
660
+ <xsl:otherwise>12pt</xsl:otherwise>
661
+ </xsl:choose>
662
+ </xsl:attribute> -->
663
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
664
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
665
+ <xsl:attribute name="color"><xsl:value-of select="$color"/></xsl:attribute>
666
+ <xsl:if test="ancestor::csd:sections">
667
+ <xsl:attribute name="margin-top">13.5pt</xsl:attribute>
668
+ </xsl:if>
669
+ <!-- DEBUG level=<xsl:value-of select="$level"/>x -->
670
+ <!-- section=<xsl:value-of select="$sectionNum"/> -->
671
+ <!-- <xsl:if test="$sectionNum"> -->
672
+ <xsl:if test="$section != ''">
673
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
674
+ <xsl:choose>
675
+ <xsl:when test="$level &gt;= 3">
676
+ <fo:inline padding-right="2mm"> </fo:inline>
677
+ </xsl:when>
678
+ <xsl:when test="$level = 1">
679
+ <fo:inline padding-right="2mm"> </fo:inline>
680
+ </xsl:when>
681
+ <xsl:otherwise>
682
+ <fo:inline padding-right="1mm"> </fo:inline>
683
+ </xsl:otherwise>
684
+ </xsl:choose>
685
+ </xsl:if>
686
+ <xsl:apply-templates/>
687
+ </xsl:element>
688
+ </xsl:template>
689
+
690
+
691
+ <xsl:template match="csd:p">
692
+ <xsl:param name="inline" select="'false'"/>
693
+ <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
694
+ <xsl:variable name="element-name">
695
+ <xsl:choose>
696
+ <xsl:when test="$inline = 'true'">fo:inline</xsl:when>
697
+ <xsl:when test="../@inline-header = 'true' and $previous-element = 'title'">fo:inline</xsl:when> <!-- first paragraph after inline title -->
698
+ <xsl:when test="local-name(..) = 'admonition'">fo:inline</xsl:when>
699
+ <xsl:when test="@id = 'boilerplate-name'">fo:inline</xsl:when>
700
+ <xsl:otherwise>fo:block</xsl:otherwise>
701
+ </xsl:choose>
702
+ </xsl:variable>
703
+ <xsl:element name="{$element-name}">
704
+ <xsl:attribute name="text-align">
705
+ <xsl:choose>
706
+ <!-- <xsl:when test="ancestor::csd:preface">justify</xsl:when> -->
707
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
708
+ <xsl:otherwise>left</xsl:otherwise><!-- justify -->
709
+ </xsl:choose>
710
+ </xsl:attribute>
711
+ <xsl:attribute name="margin-bottom">
712
+ <xsl:choose>
713
+ <xsl:when test="ancestor::csd:li">0pt</xsl:when>
714
+ <xsl:otherwise>12pt</xsl:otherwise>
715
+ </xsl:choose>
716
+ </xsl:attribute>
717
+ <xsl:attribute name="line-height">115%</xsl:attribute>
718
+ <xsl:apply-templates/>
719
+ </xsl:element>
720
+ <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
721
+ <fo:block margin-bottom="12pt">
722
+ <xsl:if test="ancestor::csd:annex">
723
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
724
+ </xsl:if>
725
+ <xsl:value-of select="$linebreak"/>
726
+ </fo:block>
727
+ </xsl:if>
728
+ <xsl:if test="$inline = 'true'">
729
+ <fo:block> </fo:block>
730
+ </xsl:if>
731
+ </xsl:template>
732
+
733
+ <!--
734
+ <fn reference="1">
735
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
736
+ </fn>
737
+ -->
738
+ <xsl:template match="csd:p/csd:fn">
739
+ <fo:footnote>
740
+ <xsl:variable name="number">
741
+ <xsl:number level="any" count="csd:p/csd:fn"/>
742
+ </xsl:variable>
743
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super">
744
+ <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
745
+ <!-- <xsl:value-of select="@reference"/> -->
746
+ <xsl:value-of select="$number + count(//csd:bibitem/csd:note)"/><!-- <xsl:text>)</xsl:text> -->
747
+ </fo:basic-link>
748
+ </fo:inline>
749
+ <fo:footnote-body>
750
+ <fo:block font-size="10pt" margin-bottom="12pt">
751
+ <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"> <!-- baseline-shift="30%" padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
752
+ <xsl:value-of select="$number + count(//csd:bibitem/csd:note)"/><!-- <xsl:text>)</xsl:text> -->
753
+ </fo:inline>
754
+ <xsl:for-each select="csd:p">
755
+ <xsl:apply-templates/>
756
+ </xsl:for-each>
757
+ </fo:block>
758
+ </fo:footnote-body>
759
+ </fo:footnote>
760
+ </xsl:template>
761
+
762
+ <xsl:template match="csd:p/csd:fn/csd:p">
763
+ <xsl:apply-templates/>
764
+ </xsl:template>
765
+
766
+ <xsl:template match="csd:review">
767
+ <!-- comment 2019-11-29 -->
768
+ <!-- <fo:block font-weight="bold">Review:</fo:block>
769
+ <xsl:apply-templates /> -->
770
+ </xsl:template>
771
+
772
+ <xsl:template match="text()">
773
+ <xsl:value-of select="."/>
774
+ </xsl:template>
775
+
776
+
777
+
778
+ <xsl:template match="csd:image">
779
+ <fo:block-container text-align="center">
780
+ <fo:block>
781
+ <fo:external-graphic src="{@src}" fox:alt-text="Image {@alt}"/>
782
+ </fo:block>
783
+ <xsl:variable name="title-figure">
784
+ <xsl:call-template name="getTitle">
785
+ <xsl:with-param name="name" select="'title-figure'"/>
786
+ </xsl:call-template>
787
+ </xsl:variable>
788
+ <fo:block font-weight="bold" margin-top="12pt" margin-bottom="12pt"><xsl:value-of select="$title-figure"/><xsl:number format="1" level="any"/></fo:block>
789
+ </fo:block-container>
790
+
791
+ </xsl:template>
792
+
793
+ <xsl:template match="csd:figure">
794
+ <fo:block-container id="{@id}">
795
+ <fo:block>
796
+ <xsl:apply-templates/>
797
+ </fo:block>
798
+ <xsl:call-template name="fn_display_figure"/>
799
+ <xsl:for-each select="csd:note//csd:p">
800
+ <xsl:call-template name="note"/>
801
+ </xsl:for-each>
802
+ <fo:block font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-previous="always">
803
+ <xsl:variable name="title-figure">
804
+ <xsl:call-template name="getTitle">
805
+ <xsl:with-param name="name" select="'title-figure'"/>
806
+ </xsl:call-template>
807
+ </xsl:variable>
808
+ <xsl:choose>
809
+ <xsl:when test="ancestor::csd:annex">
810
+ <xsl:choose>
811
+ <xsl:when test="local-name(..) = 'figure'">
812
+ <xsl:number format="a) "/>
813
+ </xsl:when>
814
+ <xsl:otherwise>
815
+ <xsl:value-of select="$title-figure"/><xsl:number format="A.1-1" level="multiple" count="csd:annex | csd:figure"/>
816
+ </xsl:otherwise>
817
+ </xsl:choose>
818
+
819
+ </xsl:when>
820
+ <xsl:otherwise>
821
+ <xsl:value-of select="$title-figure"/><xsl:number format="1" level="any"/>
822
+ </xsl:otherwise>
823
+ </xsl:choose>
824
+ <xsl:if test="csd:name">
825
+ <xsl:if test="not(local-name(..) = 'figure')">
826
+ <xsl:text> — </xsl:text>
827
+ </xsl:if>
828
+ <xsl:value-of select="csd:name"/>
829
+ </xsl:if>
830
+ </fo:block>
831
+ </fo:block-container>
832
+ </xsl:template>
833
+
834
+ <xsl:template match="csd:figure/csd:name"/>
835
+ <xsl:template match="csd:figure/csd:fn"/>
836
+ <xsl:template match="csd:figure/csd:note"/>
837
+
838
+
839
+ <xsl:template match="csd:figure/csd:image">
840
+ <fo:block text-align="center">
841
+ <fo:external-graphic src="{@src}" content-width="100%" content-height="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/> <!-- content-width="75%" -->
842
+ </fo:block>
843
+ </xsl:template>
844
+
845
+
846
+ <xsl:template match="csd:bibitem">
847
+ <fo:block id="{@id}" margin-bottom="6pt"> <!-- 12 pt -->
848
+ <xsl:if test=".//csd:fn">
849
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
850
+ </xsl:if>
851
+ <!-- csd:docidentifier -->
852
+ <xsl:if test="csd:docidentifier">
853
+ <xsl:choose>
854
+ <xsl:when test="csd:docidentifier/@type = 'metanorma'"/>
855
+ <xsl:otherwise>
856
+ <xsl:value-of select="csd:docidentifier"/>
857
+ </xsl:otherwise>
858
+ </xsl:choose>
859
+ </xsl:if>
860
+ <xsl:apply-templates select="csd:note"/>
861
+ <xsl:if test="csd:docidentifier">, </xsl:if>
862
+ <fo:inline font-style="italic">
863
+ <xsl:choose>
864
+ <xsl:when test="csd:title[@type = 'main' and @language = 'en']">
865
+ <xsl:value-of select="csd:title[@type = 'main' and @language = 'en']"/>
866
+ </xsl:when>
867
+ <xsl:otherwise>
868
+ <xsl:value-of select="csd:title"/>
869
+ </xsl:otherwise>
870
+ </xsl:choose>
871
+ </fo:inline>
872
+ </fo:block>
873
+ </xsl:template>
874
+
875
+
876
+ <xsl:template match="csd:bibitem/csd:note">
877
+ <fo:footnote>
878
+ <xsl:variable name="number">
879
+ <xsl:choose>
880
+ <xsl:when test="ancestor::csd:references[preceding-sibling::csd:references]">
881
+ <xsl:number level="any" count="csd:references[preceding-sibling::csd:references]//csd:bibitem/csd:note"/>
882
+ </xsl:when>
883
+ <xsl:otherwise>
884
+ <xsl:number level="any" count="csd:bibitem/csd:note"/>
885
+ </xsl:otherwise>
886
+ </xsl:choose>
887
+ </xsl:variable>
888
+ <fo:inline font-size="65%" keep-with-previous.within-line="always" vertical-align="super"> <!-- 60% baseline-shift="35%" -->
889
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
890
+ <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
891
+ </fo:basic-link>
892
+ </fo:inline>
893
+ <fo:footnote-body>
894
+ <fo:block font-size="10pt" margin-bottom="12pt" start-indent="0pt">
895
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"><!-- baseline-shift="30%" padding-right="9mm" alignment-baseline="hanging" -->
896
+ <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
897
+ </fo:inline>
898
+ <xsl:apply-templates/>
899
+ </fo:block>
900
+ </fo:footnote-body>
901
+ </fo:footnote>
902
+ </xsl:template>
903
+
904
+
905
+
906
+ <xsl:template match="csd:ul | csd:ol">
907
+ <fo:list-block provisional-distance-between-starts="6.5mm" margin-bottom="12pt">
908
+ <xsl:if test="ancestor::csd:ol">
909
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
910
+ </xsl:if>
911
+ <xsl:apply-templates/>
912
+ </fo:list-block>
913
+ </xsl:template>
914
+
915
+ <xsl:template match="csd:li">
916
+ <fo:list-item>
917
+ <fo:list-item-label end-indent="label-end()">
918
+ <fo:block>
919
+ <xsl:choose>
920
+ <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
921
+ <xsl:otherwise> <!-- for ordered lists -->
922
+ <xsl:choose>
923
+ <xsl:when test="../@type = 'arabic'">
924
+ <xsl:number format="a)"/>
925
+ </xsl:when>
926
+ <xsl:when test="../@type = 'alphabet'">
927
+ <xsl:number format="1)"/>
928
+ </xsl:when>
929
+ <xsl:otherwise>
930
+ <xsl:number format="1."/>
931
+ </xsl:otherwise>
932
+ </xsl:choose>
933
+ </xsl:otherwise>
934
+ </xsl:choose>
935
+ </fo:block>
936
+ </fo:list-item-label>
937
+ <fo:list-item-body start-indent="body-start()">
938
+ <xsl:apply-templates/>
939
+ </fo:list-item-body>
940
+ </fo:list-item>
941
+ </xsl:template>
942
+
943
+
944
+ <xsl:template match="csd:term">
945
+ <xsl:param name="sectionNum"/>
946
+ <fo:block id="{@id}">
947
+ <xsl:apply-templates>
948
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
949
+ </xsl:apply-templates>
950
+ </fo:block>
951
+ </xsl:template>
952
+
953
+ <xsl:template match="csd:preferred">
954
+ <xsl:param name="sectionNum"/>
955
+ <xsl:variable name="section">
956
+ <xsl:call-template name="getSection">
957
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
958
+ </xsl:call-template>
959
+ </xsl:variable>
960
+ <xsl:variable name="level">
961
+ <xsl:call-template name="getLevel"/>
962
+ </xsl:variable>
963
+ <xsl:variable name="font-size">
964
+ <xsl:choose>
965
+ <xsl:when test="$level &gt;= 3">11pt</xsl:when>
966
+ <xsl:otherwise>12pt</xsl:otherwise>
967
+ </xsl:choose>
968
+ </xsl:variable>
969
+ <fo:block font-size="{$font-size}" line-height="1.1">
970
+ <fo:block font-weight="bold" keep-with-next="always">
971
+ <fo:inline>
972
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
973
+ <!-- <xsl:value-of select="$sectionNum"/>.<xsl:number count="csd:term"/> -->
974
+ </fo:inline>
975
+ </fo:block>
976
+ <fo:block font-weight="bold" keep-with-next="always">
977
+ <xsl:apply-templates/>
978
+ </fo:block>
979
+ </fo:block>
980
+ </xsl:template>
981
+
982
+ <xsl:template match="csd:admitted">
983
+ <fo:block>
984
+ <xsl:apply-templates/>
985
+ </fo:block>
986
+ </xsl:template>
987
+
988
+ <xsl:template match="csd:deprecates">
989
+ <xsl:variable name="title-deprecated">
990
+ <xsl:call-template name="getTitle">
991
+ <xsl:with-param name="name" select="'title-deprecated'"/>
992
+ </xsl:call-template>
993
+ </xsl:variable>
994
+ <fo:block><xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/></fo:block>
995
+ </xsl:template>
996
+
997
+ <xsl:template match="csd:definition[preceding-sibling::csd:domain]">
998
+ <xsl:apply-templates/>
999
+ </xsl:template>
1000
+ <xsl:template match="csd:definition[preceding-sibling::csd:domain]/csd:p">
1001
+ <fo:inline> <xsl:apply-templates/></fo:inline>
1002
+ <fo:block> </fo:block>
1003
+ </xsl:template>
1004
+
1005
+ <xsl:template match="csd:definition">
1006
+ <fo:block margin-bottom="6pt">
1007
+ <xsl:apply-templates/>
1008
+ </fo:block>
1009
+ </xsl:template>
1010
+
1011
+ <xsl:template match="csd:termsource">
1012
+ <fo:block margin-bottom="8pt" keep-with-previous="always">
1013
+ <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1014
+ <fo:basic-link internal-destination="{csd:origin/@bibitemid}" fox:alt-text="{csd:origin/@citeas}">
1015
+ <xsl:text>[</xsl:text>
1016
+ <xsl:variable name="title-source">
1017
+ <xsl:call-template name="getTitle">
1018
+ <xsl:with-param name="name" select="'title-source'"/>
1019
+ </xsl:call-template>
1020
+ </xsl:variable>
1021
+ <xsl:value-of select="$title-source"/>
1022
+ <xsl:text>: </xsl:text>
1023
+ <xsl:value-of select="csd:origin/@citeas"/>
1024
+
1025
+ <xsl:apply-templates select="csd:origin/csd:localityStack"/>
1026
+
1027
+ </fo:basic-link>
1028
+ <xsl:apply-templates select="csd:modification"/>
1029
+ <xsl:text>]</xsl:text>
1030
+ </fo:block>
1031
+ </xsl:template>
1032
+
1033
+ <xsl:template match="csd:modification/csd:p">
1034
+ <fo:inline><xsl:apply-templates/></fo:inline>
1035
+ </xsl:template>
1036
+
1037
+ <xsl:template match="csd:termnote">
1038
+ <fo:block font-size="10pt" margin-bottom="12pt">
1039
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
1040
+ <xsl:variable name="title-note-to-entry">
1041
+ <xsl:call-template name="getTitle">
1042
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
1043
+ </xsl:call-template>
1044
+ </xsl:variable>
1045
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
1046
+ <xsl:apply-templates/>
1047
+ </fo:block>
1048
+ </xsl:template>
1049
+
1050
+ <xsl:template match="csd:termnote/csd:p">
1051
+ <fo:inline><xsl:apply-templates/></fo:inline>
1052
+ </xsl:template>
1053
+
1054
+ <xsl:template match="csd:domain">
1055
+ <fo:inline>&lt;<xsl:apply-templates/>&gt;</fo:inline>
1056
+ </xsl:template>
1057
+
1058
+
1059
+ <xsl:template match="csd:termexample">
1060
+ <fo:block font-size="10pt" margin-bottom="12pt">
1061
+ <xsl:variable name="title-example">
1062
+ <xsl:call-template name="getTitle">
1063
+ <xsl:with-param name="name" select="'title-example'"/>
1064
+ </xsl:call-template>
1065
+ </xsl:variable>
1066
+ <fo:inline padding-right="10mm"><xsl:value-of select="normalize-space($title-example)"/></fo:inline>
1067
+ <xsl:apply-templates/>
1068
+ </fo:block>
1069
+ </xsl:template>
1070
+
1071
+ <xsl:template match="csd:termexample/csd:p">
1072
+ <fo:inline><xsl:apply-templates/></fo:inline>
1073
+ </xsl:template>
1074
+
1075
+
1076
+ <xsl:template match="csd:annex">
1077
+ <fo:block break-after="page"/>
1078
+ <xsl:apply-templates/>
1079
+ </xsl:template>
1080
+
1081
+
1082
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']"> -->
1083
+ <xsl:template match="csd:references[position() &gt; 1]">
1084
+ <fo:block break-after="page"/>
1085
+ <xsl:apply-templates/>
1086
+ </xsl:template>
1087
+
1088
+
1089
+ <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
1090
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem"> -->
1091
+ <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem">
1092
+ <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
1093
+ <fo:list-item>
1094
+ <fo:list-item-label end-indent="label-end()">
1095
+ <fo:block>
1096
+ <fo:inline id="{@id}">
1097
+ <xsl:number format="[1]"/>
1098
+ </fo:inline>
1099
+ </fo:block>
1100
+ </fo:list-item-label>
1101
+ <fo:list-item-body start-indent="body-start()">
1102
+ <fo:block>
1103
+ <xsl:if test="csd:docidentifier">
1104
+ <xsl:choose>
1105
+ <xsl:when test="csd:docidentifier/@type = 'metanorma'"/>
1106
+ <xsl:otherwise><fo:inline><xsl:value-of select="csd:docidentifier"/><xsl:apply-templates select="csd:note"/>, </fo:inline></xsl:otherwise>
1107
+ </xsl:choose>
1108
+
1109
+ </xsl:if>
1110
+ <xsl:choose>
1111
+ <xsl:when test="csd:title[@type = 'main' and @language = 'en']">
1112
+ <xsl:apply-templates select="csd:title[@type = 'main' and @language = 'en']"/>
1113
+ </xsl:when>
1114
+ <xsl:otherwise>
1115
+ <xsl:apply-templates select="csd:title"/>
1116
+ </xsl:otherwise>
1117
+ </xsl:choose>
1118
+ <xsl:apply-templates select="csd:formattedref"/>
1119
+ </fo:block>
1120
+ </fo:list-item-body>
1121
+ </fo:list-item>
1122
+ </fo:list-block>
1123
+ </xsl:template>
1124
+
1125
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem" mode="contents"/> -->
1126
+ <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem" mode="contents"/>
1127
+
1128
+ <!-- <xsl:template match="csd:references[@id = '_bibliography']/csd:bibitem/csd:title"> -->
1129
+ <xsl:template match="csd:references[position() &gt; 1]/csd:bibitem/csd:title">
1130
+ <fo:inline font-style="italic">
1131
+ <xsl:apply-templates/>
1132
+ </fo:inline>
1133
+ </xsl:template>
1134
+
1135
+ <xsl:template match="csd:quote">
1136
+ <fo:block margin-top="12pt" margin-left="12mm" margin-right="12mm">
1137
+ <xsl:apply-templates select=".//csd:p"/>
1138
+ </fo:block>
1139
+ <fo:block text-align="right">
1140
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
1141
+ <xsl:text>— </xsl:text><xsl:value-of select="csd:author"/>
1142
+ <xsl:if test="csd:source">
1143
+ <xsl:text>, </xsl:text>
1144
+ <xsl:apply-templates select="csd:source"/>
1145
+ </xsl:if>
1146
+ </fo:block>
1147
+ </xsl:template>
1148
+
1149
+ <xsl:template match="csd:source">
1150
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1151
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1152
+ <xsl:apply-templates select="csd:localityStack"/>
1153
+ </fo:basic-link>
1154
+ </xsl:template>
1155
+
1156
+
1157
+ <xsl:template match="csd:xref">
1158
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">
1159
+ <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
1160
+ <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))">
1161
+ <xsl:attribute name="color">blue</xsl:attribute>
1162
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1163
+ </xsl:if>
1164
+ <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1165
+ <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id = current()/@target]/@root"/>
1166
+ <xsl:variable name="title-clause">
1167
+ <xsl:call-template name="getTitle">
1168
+ <xsl:with-param name="name" select="'title-clause'"/>
1169
+ </xsl:call-template>
1170
+ </xsl:variable>
1171
+
1172
+ <xsl:choose>
1173
+ <xsl:when test="$type = 'clause' and $root != 'annex'"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1174
+ <xsl:when test="$type = 'term' and $root = 'clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1175
+ <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1176
+ </xsl:choose>
1177
+ <xsl:value-of select="$section"/>
1178
+ </fo:basic-link>
1179
+ </xsl:template>
1180
+
1181
+ <xsl:template match="csd:sourcecode" priority="2">
1182
+ <xsl:call-template name="sourcecode"/>
1183
+ <fo:block font-size="11pt" font-weight="bold" text-align="center" margin-bottom="12pt">
1184
+ <xsl:variable name="title-figure">
1185
+ <xsl:call-template name="getTitle">
1186
+ <xsl:with-param name="name" select="'title-figure'"/>
1187
+ </xsl:call-template>
1188
+ </xsl:variable>
1189
+ <xsl:value-of select="$title-figure"/>
1190
+ <xsl:number format="1" level="any"/>
1191
+ </fo:block>
1192
+ </xsl:template>
1193
+
1194
+ <xsl:template match="csd:tt" priority="2">
1195
+ <fo:inline font-family="SourceCodePro" font-size="10pt">
1196
+ <xsl:apply-templates/>
1197
+ </fo:inline>
1198
+ </xsl:template>
1199
+
1200
+ <xsl:template match="csd:example">
1201
+ <fo:block font-size="10pt" margin-bottom="12pt" font-weight="bold" keep-with-next="always">
1202
+ <xsl:variable name="title-example">
1203
+ <xsl:call-template name="getTitle">
1204
+ <xsl:with-param name="name" select="'title-example'"/>
1205
+ </xsl:call-template>
1206
+ </xsl:variable>
1207
+ <xsl:value-of select="normalize-space($title-example)"/>
1208
+ <xsl:if test="following-sibling::csd:example or preceding-sibling::csd:example">
1209
+ <xsl:number format=" 1"/>
1210
+ </xsl:if>
1211
+ </fo:block>
1212
+ <fo:block font-size="10pt" margin-left="12.5mm">
1213
+ <xsl:apply-templates/>
1214
+ </fo:block>
1215
+ </xsl:template>
1216
+
1217
+ <xsl:template match="csd:example/csd:p">
1218
+ <fo:block margin-bottom="14pt">
1219
+ <xsl:apply-templates/>
1220
+ </fo:block>
1221
+ </xsl:template>
1222
+
1223
+ <xsl:template match="csd:note/csd:p" name="note">
1224
+ <fo:block font-size="10pt" margin-bottom="12pt">
1225
+ <xsl:variable name="title-note">
1226
+ <xsl:call-template name="getTitle">
1227
+ <xsl:with-param name="name" select="'title-note'"/>
1228
+ </xsl:call-template>
1229
+ </xsl:variable>
1230
+ <fo:inline padding-right="6mm"><xsl:value-of select="$title-note"/><xsl:number count="csd:note"/></fo:inline>
1231
+ <xsl:apply-templates/>
1232
+ </fo:block>
1233
+ </xsl:template>
1234
+
1235
+ <!-- <eref type="inline" bibitemid="ISO20483" citeas="ISO 20483:2013"><locality type="annex"><referenceFrom>C</referenceFrom></locality></eref> -->
1236
+ <xsl:template match="csd:eref">
1237
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}" color="blue" text-decoration="underline"> <!-- font-size="9pt" color="blue" vertical-align="super" -->
1238
+ <xsl:if test="@type = 'footnote'">
1239
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1240
+ <xsl:attribute name="font-size">80%</xsl:attribute>
1241
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1242
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1243
+ </xsl:if>
1244
+ <xsl:if test="@type = 'inline'">
1245
+ <xsl:attribute name="color">blue</xsl:attribute>
1246
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1247
+ </xsl:if>
1248
+ <!-- <xsl:if test="@type = 'inline'">
1249
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1250
+ </xsl:if> -->
1251
+ <xsl:choose>
1252
+ <xsl:when test="@citeas">
1253
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1254
+ </xsl:when>
1255
+ <xsl:when test="@bibitemid">
1256
+ <xsl:value-of select="//csd:bibitem[@id = current()/@bibitemid]/csd:docidentifier"/>
1257
+ </xsl:when>
1258
+ <xsl:otherwise/>
1259
+ </xsl:choose>
1260
+ <xsl:apply-templates select="csd:localityStack"/>
1261
+ </fo:basic-link>
1262
+ </xsl:template>
1263
+
1264
+ <xsl:template match="csd:locality">
1265
+ <xsl:variable name="title-clause">
1266
+ <xsl:call-template name="getTitle">
1267
+ <xsl:with-param name="name" select="'title-clause'"/>
1268
+ </xsl:call-template>
1269
+ </xsl:variable>
1270
+ <xsl:variable name="title-annex">
1271
+ <xsl:call-template name="getTitle">
1272
+ <xsl:with-param name="name" select="'title-annex'"/>
1273
+ </xsl:call-template>
1274
+ </xsl:variable>
1275
+ <xsl:choose>
1276
+ <xsl:when test="@type ='clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1277
+ <xsl:when test="@type ='annex'"><xsl:value-of select="$title-annex"/></xsl:when>
1278
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
1279
+ </xsl:choose>
1280
+ <xsl:text> </xsl:text><xsl:value-of select="csd:referenceFrom"/>
1281
+ </xsl:template>
1282
+
1283
+ <xsl:template match="csd:admonition">
1284
+ <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
1285
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/>
1286
+ <xsl:text> — </xsl:text>
1287
+ <xsl:apply-templates/>
1288
+ </fo:block>
1289
+ </xsl:template>
1290
+
1291
+ <xsl:template match="csd:formula">
1292
+ <fo:block id="{@id}">
1293
+ <xsl:apply-templates/>
1294
+ </fo:block>
1295
+ </xsl:template>
1296
+
1297
+ <xsl:template match="csd:formula/csd:dt/csd:stem">
1298
+ <fo:inline>
1299
+ <xsl:apply-templates/>
1300
+ </fo:inline>
1301
+ </xsl:template>
1302
+
1303
+ <xsl:template match="csd:formula/csd:stem">
1304
+ <fo:block margin-top="6pt" margin-bottom="12pt">
1305
+ <fo:table table-layout="fixed" width="100%">
1306
+ <fo:table-column column-width="95%"/>
1307
+ <fo:table-column column-width="5%"/>
1308
+ <fo:table-body>
1309
+ <fo:table-row>
1310
+ <fo:table-cell display-align="center">
1311
+ <fo:block text-align="left" margin-left="5mm">
1312
+ <xsl:apply-templates/>
1313
+ </fo:block>
1314
+ </fo:table-cell>
1315
+ <fo:table-cell display-align="center">
1316
+ <fo:block text-align="right">
1317
+ <xsl:choose>
1318
+ <xsl:when test="ancestor::csd:annex">
1319
+ <xsl:number format="(A.1)" level="multiple" count="csd:annex | csd:formula"/>
1320
+ </xsl:when>
1321
+ <xsl:otherwise> <!-- not(ancestor::csd:annex) -->
1322
+ <!-- <xsl:text>(</xsl:text><xsl:number level="any" count="csd:formula"/><xsl:text>)</xsl:text> -->
1323
+ </xsl:otherwise>
1324
+ </xsl:choose>
1325
+ </fo:block>
1326
+ </fo:table-cell>
1327
+ </fo:table-row>
1328
+ </fo:table-body>
1329
+ </fo:table>
1330
+ <fo:inline keep-together.within-line="always">
1331
+ </fo:inline>
1332
+ </fo:block>
1333
+ </xsl:template>
1334
+
1335
+
1336
+ <xsl:template match="csd:br" priority="2">
1337
+ <!-- <fo:block>&#xA0;</fo:block> -->
1338
+ <xsl:value-of select="$linebreak"/>
1339
+ </xsl:template>
1340
+
1341
+ <xsl:template name="insertHeaderFooter">
1342
+ <fo:static-content flow-name="header-even">
1343
+ <fo:block-container height="17mm" display-align="before">
1344
+ <fo:block padding-top="12.5mm">
1345
+ <xsl:value-of select="$header"/>
1346
+ </fo:block>
1347
+ </fo:block-container>
1348
+ </fo:static-content>
1349
+ <fo:static-content flow-name="footer-even">
1350
+ <fo:block-container font-size="10pt" height="100%" display-align="after">
1351
+ <fo:table table-layout="fixed" width="100%">
1352
+ <fo:table-column column-width="10%"/>
1353
+ <fo:table-column column-width="90%"/>
1354
+ <fo:table-body>
1355
+ <fo:table-row>
1356
+ <fo:table-cell>
1357
+ <fo:block padding-bottom="5mm"><fo:page-number/></fo:block>
1358
+ </fo:table-cell>
1359
+ <fo:table-cell padding-right="2mm">
1360
+ <fo:block padding-bottom="5mm" text-align="right"><xsl:value-of select="$copyright"/></fo:block>
1361
+ </fo:table-cell>
1362
+ </fo:table-row>
1363
+ </fo:table-body>
1364
+ </fo:table>
1365
+ </fo:block-container>
1366
+ </fo:static-content>
1367
+ <fo:static-content flow-name="header-odd">
1368
+ <fo:block-container height="17mm" display-align="before">
1369
+ <fo:block text-align="right" padding-top="12.5mm">
1370
+ <xsl:value-of select="$header"/>
1371
+ </fo:block>
1372
+ </fo:block-container>
1373
+ </fo:static-content>
1374
+ <fo:static-content flow-name="footer-odd">
1375
+ <fo:block-container font-size="10pt" height="100%" display-align="after">
1376
+ <fo:table table-layout="fixed" width="100%">
1377
+ <fo:table-column column-width="90%"/>
1378
+ <fo:table-column column-width="10%"/>
1379
+ <fo:table-body>
1380
+ <fo:table-row>
1381
+ <fo:table-cell>
1382
+ <fo:block padding-bottom="5mm"><xsl:value-of select="$copyright"/></fo:block>
1383
+ </fo:table-cell>
1384
+ <fo:table-cell padding-right="2mm">
1385
+ <fo:block padding-bottom="5mm" text-align="right"><fo:page-number/></fo:block>
1386
+ </fo:table-cell>
1387
+ </fo:table-row>
1388
+ </fo:table-body>
1389
+ </fo:table>
1390
+ </fo:block-container>
1391
+ </fo:static-content>
1392
+ </xsl:template>
1393
+
1394
+
1395
+
1396
+ <xsl:template name="getSection">
1397
+ <xsl:param name="sectionNum"/>
1398
+ <xsl:variable name="level">
1399
+ <xsl:call-template name="getLevel"/>
1400
+ </xsl:variable>
1401
+ <xsl:variable name="section">
1402
+ <xsl:choose>
1403
+ <xsl:when test="ancestor::csd:bibliography">
1404
+ <xsl:value-of select="$sectionNum"/>
1405
+ </xsl:when>
1406
+ <xsl:when test="ancestor::csd:sections">
1407
+ <!-- 1, 2, 3, 4, ... from main section (not annex, bibliography, ...) -->
1408
+ <xsl:choose>
1409
+ <xsl:when test="$level = 1">
1410
+ <xsl:value-of select="$sectionNum"/>
1411
+ </xsl:when>
1412
+ <xsl:when test="$level &gt;= 2">
1413
+ <xsl:variable name="num">
1414
+ <xsl:call-template name="getSubSection"/>
1415
+ </xsl:variable>
1416
+ <xsl:value-of select="concat($sectionNum, $num)"/>
1417
+ </xsl:when>
1418
+ <xsl:otherwise>
1419
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
1420
+ </xsl:otherwise>
1421
+ </xsl:choose>
1422
+ <!-- <xsl:text>.</xsl:text> -->
1423
+ </xsl:when>
1424
+ <!-- <xsl:when test="ancestor::csd:annex[@obligation = 'informative']">
1425
+ <xsl:choose>
1426
+ <xsl:when test="$level = 1">
1427
+ <xsl:text>Annex </xsl:text>
1428
+ <xsl:number format="I" level="any" count="csd:annex[@obligation = 'informative']"/>
1429
+ </xsl:when>
1430
+ <xsl:otherwise>
1431
+ <xsl:number format="I.1" level="multiple" count="csd:annex[@obligation = 'informative'] | csd:clause"/>
1432
+ </xsl:otherwise>
1433
+ </xsl:choose>
1434
+ </xsl:when> -->
1435
+ <xsl:when test="ancestor::csd:annex">
1436
+ <xsl:choose>
1437
+ <xsl:when test="$level = 1">
1438
+ <xsl:variable name="title-annex">
1439
+ <xsl:call-template name="getTitle">
1440
+ <xsl:with-param name="name" select="'title-annex'"/>
1441
+ </xsl:call-template>
1442
+ </xsl:variable>
1443
+ <xsl:value-of select="$title-annex"/>
1444
+ <xsl:choose>
1445
+ <xsl:when test="count(//csd:annex) = 1">
1446
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:ext/csd:structuredidentifier/csd:annexid"/>
1447
+ </xsl:when>
1448
+ <xsl:otherwise>
1449
+ <xsl:number format="A." level="any" count="csd:annex"/>
1450
+ </xsl:otherwise>
1451
+ </xsl:choose>
1452
+ </xsl:when>
1453
+ <xsl:otherwise>
1454
+ <xsl:choose>
1455
+ <xsl:when test="count(//csd:annex) = 1">
1456
+ <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:ext/csd:structuredidentifier/csd:annexid"/><xsl:number format=".1" level="multiple" count="csd:clause"/>
1457
+ </xsl:when>
1458
+ <xsl:otherwise>
1459
+ <xsl:number format="A.1." level="multiple" count="csd:annex | csd:clause"/>
1460
+ </xsl:otherwise>
1461
+ </xsl:choose>
1462
+ </xsl:otherwise>
1463
+ </xsl:choose>
1464
+ </xsl:when>
1465
+ <xsl:when test="ancestor::csd:preface"> <!-- if preface and there is clause(s) -->
1466
+ <xsl:choose>
1467
+ <xsl:when test="$level = 1 and ..//csd:clause">0</xsl:when>
1468
+ <xsl:when test="$level &gt;= 2">
1469
+ <xsl:variable name="num">
1470
+ <xsl:number format=".1." level="multiple" count="csd:clause"/>
1471
+ </xsl:variable>
1472
+ <xsl:value-of select="concat('0', $num)"/>
1473
+ </xsl:when>
1474
+ <xsl:otherwise>
1475
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
1476
+ </xsl:otherwise>
1477
+ </xsl:choose>
1478
+ </xsl:when>
1479
+ <xsl:otherwise>
1480
+ </xsl:otherwise>
1481
+ </xsl:choose>
1482
+ </xsl:variable>
1483
+ <xsl:value-of select="$section"/>
1484
+ </xsl:template>
1485
+
1486
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
1487
+
1488
+ <title-table lang="en">Table </title-table>
1489
+ <title-table lang="fr">Tableau </title-table>
1490
+
1491
+ <title-table lang="zh">Table </title-table>
1492
+
1493
+
1494
+
1495
+ <title-note lang="en">NOTE </title-note>
1496
+ <title-note lang="fr">NOTE </title-note>
1497
+
1498
+ <title-note lang="zh">NOTE </title-note>
1499
+
1500
+
1501
+
1502
+ <title-figure lang="en">Figure </title-figure>
1503
+ <title-figure lang="fr">Figure </title-figure>
1504
+
1505
+ <title-figure lang="zh">Figure </title-figure>
1506
+
1507
+
1508
+
1509
+ <title-example lang="en">EXAMPLE </title-example>
1510
+ <title-example lang="fr">EXEMPLE </title-example>
1511
+
1512
+ <title-example lang="zh">EXAMPLE </title-example>
1513
+
1514
+
1515
+
1516
+ <title-example-xref lang="en">Example </title-example-xref>
1517
+ <title-example-xref lang="fr">Exemple </title-example-xref>
1518
+
1519
+ <title-section lang="en">Section </title-section>
1520
+ <title-section lang="fr">Section </title-section>
1521
+
1522
+ <title-inequality lang="en">Inequality </title-inequality>
1523
+ <title-inequality lang="fr">Inequality </title-inequality>
1524
+
1525
+ <title-equation lang="en">Equation </title-equation>
1526
+ <title-equation lang="fr">Equation </title-equation>
1527
+
1528
+ <title-annex lang="en">Annex </title-annex>
1529
+ <title-annex lang="fr">Annexe </title-annex>
1530
+
1531
+ <title-annex lang="zh">Annex </title-annex>
1532
+
1533
+
1534
+
1535
+ <title-appendix lang="en">Appendix </title-appendix>
1536
+ <title-appendix lang="fr">Appendix </title-appendix>
1537
+
1538
+ <title-clause lang="en">Clause </title-clause>
1539
+ <title-clause lang="fr">Article </title-clause>
1540
+
1541
+ <title-clause lang="zh">Clause </title-clause>
1542
+
1543
+
1544
+
1545
+ <title-edition lang="en">
1546
+
1547
+ <xsl:text>Edition </xsl:text>
1548
+
1549
+
1550
+ </title-edition>
1551
+
1552
+ <title-formula lang="en">Formula </title-formula>
1553
+ <title-formula lang="fr">Formula </title-formula>
1554
+
1555
+ <title-toc lang="en">
1556
+
1557
+ <xsl:text>Contents</xsl:text>
1558
+
1559
+
1560
+
1561
+ </title-toc>
1562
+ <title-toc lang="fr">Sommaire</title-toc>
1563
+
1564
+ <title-toc lang="zh">Contents</title-toc>
1565
+
1566
+
1567
+
1568
+ <title-page lang="en">Page</title-page>
1569
+ <title-page lang="fr">Page</title-page>
1570
+
1571
+ <title-key lang="en">Key</title-key>
1572
+ <title-key lang="fr">Légende</title-key>
1573
+
1574
+ <title-where lang="en">where</title-where>
1575
+ <title-where lang="fr">où</title-where>
1576
+
1577
+ <title-descriptors lang="en">Descriptors</title-descriptors>
1578
+
1579
+ <title-part lang="en">
1580
+
1581
+
1582
+ </title-part>
1583
+ <title-part lang="fr">
1584
+
1585
+
1586
+ </title-part>
1587
+ <title-part lang="zh">第 # 部分:</title-part>
1588
+
1589
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
1590
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
1591
+
1592
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
1593
+
1594
+
1595
+
1596
+ <title-modified lang="en">modified</title-modified>
1597
+ <title-modified lang="fr">modifiée</title-modified>
1598
+
1599
+ <title-modified lang="zh">modified</title-modified>
1600
+
1601
+
1602
+
1603
+ <title-source lang="en">SOURCE</title-source>
1604
+
1605
+ <title-keywords lang="en">Keywords</title-keywords>
1606
+
1607
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
1608
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
1609
+
1610
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
1611
+
1612
+ <title-list-tables lang="en">List of Tables</title-list-tables>
1613
+
1614
+ <title-list-figures lang="en">List of Figures</title-list-figures>
1615
+
1616
+ <title-recommendation lang="en">Recommendation </title-recommendation>
1617
+
1618
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
1619
+
1620
+ <title-abstract lang="en">Abstract</title-abstract>
1621
+
1622
+ <title-summary lang="en">Summary</title-summary>
1623
+
1624
+ <title-in lang="en">in </title-in>
1625
+
1626
+ <title-box lang="en">Box </title-box>
1627
+
1628
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
1629
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
1630
+
1631
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
1632
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
1633
+
1634
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
1635
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
1636
+
1637
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
1638
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
1639
+
1640
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
1641
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
1642
+
1643
+ <title-caution lang="en">CAUTION</title-caution>
1644
+ <title-caution lang="zh">注意</title-caution>
1645
+
1646
+ <title-warning lang="en">WARNING</title-warning>
1647
+ <title-warning lang="zh">警告</title-warning>
1648
+
1649
+ <title-amendment lang="en">AMENDMENT</title-amendment>
1650
+ </xsl:variable><xsl:template name="getTitle">
1651
+ <xsl:param name="name"/>
1652
+ <xsl:variable name="lang">
1653
+ <xsl:call-template name="getLang"/>
1654
+ </xsl:variable>
1655
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
1656
+ <xsl:choose>
1657
+ <xsl:when test="normalize-space($title_) != ''">
1658
+ <xsl:value-of select="$title_"/>
1659
+ </xsl:when>
1660
+ <xsl:otherwise>
1661
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1662
+ </xsl:otherwise>
1663
+ </xsl:choose>
1664
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
1665
+
1666
+ <xsl:attribute name="color">blue</xsl:attribute>
1667
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1668
+
1669
+
1670
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1671
+
1672
+
1673
+
1674
+ <xsl:attribute name="font-family">SourceCodePro</xsl:attribute>
1675
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1676
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1677
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1678
+
1679
+
1680
+
1681
+
1682
+
1683
+
1684
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
1685
+
1686
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
1687
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1688
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
1689
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1690
+
1691
+
1692
+
1693
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
1694
+
1695
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1696
+ <xsl:attribute name="margin-top">8pt</xsl:attribute>
1697
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1698
+
1699
+
1700
+
1701
+ </xsl:attribute-set><xsl:template match="text()">
1702
+ <xsl:value-of select="."/>
1703
+ </xsl:template><xsl:template match="*[local-name()='br']">
1704
+ <xsl:value-of select="$linebreak"/>
1705
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1706
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
1707
+ <xsl:call-template name="add-zero-spaces-java"/>
1708
+ </xsl:template><xsl:template match="*[local-name()='table']">
1709
+
1710
+ <xsl:variable name="simple-table">
1711
+ <!-- <xsl:copy> -->
1712
+ <xsl:call-template name="getSimpleTable"/>
1713
+ <!-- </xsl:copy> -->
1714
+ </xsl:variable>
1715
+
1716
+ <!-- DEBUG -->
1717
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
1718
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
1719
+
1720
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
1721
+
1722
+ <!-- <xsl:if test="$namespace = 'iso'">
1723
+ <fo:block space-before="6pt">&#xA0;</fo:block>
1724
+ </xsl:if> -->
1725
+
1726
+ <xsl:choose>
1727
+ <xsl:when test="@unnumbered = 'true'"/>
1728
+ <xsl:otherwise>
1729
+
1730
+
1731
+
1732
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
1733
+
1734
+
1735
+
1736
+
1737
+
1738
+
1739
+
1740
+
1741
+ <xsl:variable name="title-table">
1742
+ <xsl:call-template name="getTitle">
1743
+ <xsl:with-param name="name" select="'title-table'"/>
1744
+ </xsl:call-template>
1745
+ </xsl:variable>
1746
+ <xsl:value-of select="$title-table"/>
1747
+
1748
+ <xsl:call-template name="getTableNumber"/>
1749
+
1750
+
1751
+ <xsl:if test="*[local-name()='name']">
1752
+
1753
+
1754
+
1755
+ <xsl:text> — </xsl:text>
1756
+
1757
+ <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
1758
+ </xsl:if>
1759
+ </fo:block>
1760
+
1761
+
1762
+ <xsl:call-template name="fn_name_display"/>
1763
+
1764
+ </xsl:otherwise>
1765
+ </xsl:choose>
1766
+
1767
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1768
+
1769
+ <!-- <xsl:variable name="cols-count">
1770
+ <xsl:choose>
1771
+ <xsl:when test="*[local-name()='thead']">
1772
+ <xsl:call-template name="calculate-columns-numbers">
1773
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1774
+ </xsl:call-template>
1775
+ </xsl:when>
1776
+ <xsl:otherwise>
1777
+ <xsl:call-template name="calculate-columns-numbers">
1778
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1779
+ </xsl:call-template>
1780
+ </xsl:otherwise>
1781
+ </xsl:choose>
1782
+ </xsl:variable> -->
1783
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1784
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1785
+
1786
+
1787
+
1788
+ <xsl:variable name="colwidths">
1789
+ <xsl:call-template name="calculate-column-widths">
1790
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1791
+ <xsl:with-param name="table" select="$simple-table"/>
1792
+ </xsl:call-template>
1793
+ </xsl:variable>
1794
+
1795
+ <!-- <xsl:variable name="colwidths2">
1796
+ <xsl:call-template name="calculate-column-widths">
1797
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1798
+ </xsl:call-template>
1799
+ </xsl:variable> -->
1800
+
1801
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1802
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1803
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1804
+
1805
+ <xsl:variable name="margin-left">
1806
+ <xsl:choose>
1807
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1808
+ <xsl:otherwise>0</xsl:otherwise>
1809
+ </xsl:choose>
1810
+ </xsl:variable>
1811
+
1812
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1813
+
1814
+
1815
+
1816
+
1817
+
1818
+
1819
+
1820
+
1821
+ <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
1822
+
1823
+
1824
+
1825
+
1826
+
1827
+
1828
+
1829
+
1830
+
1831
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1832
+
1833
+
1834
+
1835
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1836
+ <xsl:choose>
1837
+ <xsl:when test=". = 1 or . = 0">
1838
+ <fo:table-column column-width="proportional-column-width(2)"/>
1839
+ </xsl:when>
1840
+ <xsl:otherwise>
1841
+ <fo:table-column column-width="proportional-column-width({.})"/>
1842
+ </xsl:otherwise>
1843
+ </xsl:choose>
1844
+ </xsl:for-each>
1845
+
1846
+ <xsl:choose>
1847
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1848
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1849
+ </xsl:when>
1850
+ <xsl:otherwise>
1851
+ <xsl:apply-templates/>
1852
+ </xsl:otherwise>
1853
+ </xsl:choose>
1854
+
1855
+ </fo:table>
1856
+
1857
+
1858
+
1859
+ </fo:block-container>
1860
+ </xsl:template><xsl:template name="getTableNumber">
1861
+ <xsl:choose>
1862
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
1863
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
1864
+ </xsl:when>
1865
+ <xsl:when test="ancestor::*[local-name()='annex']">
1866
+
1867
+
1868
+
1869
+
1870
+
1871
+
1872
+
1873
+
1874
+ <xsl:number format="A-1" level="multiple" count="*[local-name()='annex'] | *[local-name()='table'][not(@unnumbered) or @unnumbered != 'true'] "/>
1875
+
1876
+ </xsl:when>
1877
+ <xsl:otherwise>
1878
+
1879
+
1880
+ <xsl:number format="A." count="*[local-name()='annex']"/>
1881
+ <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
1882
+
1883
+ </xsl:otherwise>
1884
+ </xsl:choose>
1885
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
1886
+ <xsl:apply-templates/>
1887
+ </xsl:template><xsl:template name="calculate-columns-numbers">
1888
+ <xsl:param name="table-row"/>
1889
+ <xsl:variable name="columns-count" select="count($table-row/*)"/>
1890
+ <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
1891
+ <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
1892
+ <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
1893
+ </xsl:template><xsl:template name="calculate-column-widths">
1894
+ <xsl:param name="table"/>
1895
+ <xsl:param name="cols-count"/>
1896
+ <xsl:param name="curr-col" select="1"/>
1897
+ <xsl:param name="width" select="0"/>
1898
+
1899
+ <xsl:if test="$curr-col &lt;= $cols-count">
1900
+ <xsl:variable name="widths">
1901
+ <xsl:choose>
1902
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
1903
+ <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
1904
+ <xsl:variable name="words">
1905
+ <xsl:call-template name="tokenize">
1906
+ <xsl:with-param name="text" select="translate(*[local-name()='th'][$curr-col],'- —:', ' ')"/>
1907
+ </xsl:call-template>
1908
+ </xsl:variable>
1909
+ <xsl:variable name="max_length">
1910
+ <xsl:call-template name="max_length">
1911
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
1912
+ </xsl:call-template>
1913
+ </xsl:variable>
1914
+ <width>
1915
+ <xsl:value-of select="$max_length"/>
1916
+ </width>
1917
+ </xsl:for-each>
1918
+ <xsl:for-each select="*[local-name()='tbody']//*[local-name()='tr']">
1919
+ <xsl:variable name="words">
1920
+ <xsl:call-template name="tokenize">
1921
+ <xsl:with-param name="text" select="translate(*[local-name()='td'][$curr-col],'- —:', ' ')"/>
1922
+ </xsl:call-template>
1923
+ </xsl:variable>
1924
+ <xsl:variable name="max_length">
1925
+ <xsl:call-template name="max_length">
1926
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
1927
+ </xsl:call-template>
1928
+ </xsl:variable>
1929
+ <width>
1930
+ <xsl:value-of select="$max_length"/>
1931
+ </width>
1932
+
1933
+ </xsl:for-each>
1934
+ </xsl:when>
1935
+ <xsl:otherwise>
1936
+ <xsl:for-each select="xalan:nodeset($table)//tr">
1937
+ <xsl:variable name="td_text">
1938
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1939
+ </xsl:variable>
1940
+ <xsl:variable name="words">
1941
+ <xsl:variable name="string_with_added_zerospaces">
1942
+ <xsl:call-template name="add-zero-spaces-java">
1943
+ <xsl:with-param name="text" select="$td_text"/>
1944
+ </xsl:call-template>
1945
+ </xsl:variable>
1946
+ <xsl:call-template name="tokenize">
1947
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
1948
+ <!-- 2009 thinspace -->
1949
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
1950
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
1951
+ </xsl:call-template>
1952
+ </xsl:variable>
1953
+ <xsl:variable name="max_length">
1954
+ <xsl:call-template name="max_length">
1955
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
1956
+ </xsl:call-template>
1957
+ </xsl:variable>
1958
+ <width>
1959
+ <xsl:variable name="divider">
1960
+ <xsl:choose>
1961
+ <xsl:when test="td[$curr-col]/@divide">
1962
+ <xsl:value-of select="td[$curr-col]/@divide"/>
1963
+ </xsl:when>
1964
+ <xsl:otherwise>1</xsl:otherwise>
1965
+ </xsl:choose>
1966
+ </xsl:variable>
1967
+ <xsl:value-of select="$max_length div $divider"/>
1968
+ </width>
1969
+
1970
+ </xsl:for-each>
1971
+
1972
+ </xsl:otherwise>
1973
+ </xsl:choose>
1974
+ </xsl:variable>
1975
+
1976
+
1977
+ <column>
1978
+ <xsl:for-each select="xalan:nodeset($widths)//width">
1979
+ <xsl:sort select="." data-type="number" order="descending"/>
1980
+ <xsl:if test="position()=1">
1981
+ <xsl:value-of select="."/>
1982
+ </xsl:if>
1983
+ </xsl:for-each>
1984
+ </column>
1985
+ <xsl:call-template name="calculate-column-widths">
1986
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1987
+ <xsl:with-param name="curr-col" select="$curr-col +1"/>
1988
+ <xsl:with-param name="table" select="$table"/>
1989
+ </xsl:call-template>
1990
+ </xsl:if>
1991
+ </xsl:template><xsl:template match="text()" mode="td_text">
1992
+ <xsl:variable name="zero-space">​</xsl:variable>
1993
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
1994
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
1995
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
1996
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1997
+ <xsl:value-of select="@target"/>
1998
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1999
+ <xsl:param name="cols-count"/>
2000
+ <!-- font-weight="bold" -->
2001
+ <fo:table-header>
2002
+
2003
+ <xsl:apply-templates/>
2004
+ </fo:table-header>
2005
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
2006
+ <fo:table-body>
2007
+ <xsl:apply-templates/>
2008
+ </fo:table-body>
2009
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2010
+ <xsl:apply-templates/>
2011
+ </xsl:template><xsl:template name="insertTableFooter">
2012
+ <xsl:param name="cols-count"/>
2013
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2014
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2015
+
2016
+ <fo:table-footer>
2017
+
2018
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
2019
+
2020
+ <!-- if there are note(s) or fn(s) then create footer row -->
2021
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2022
+
2023
+
2024
+
2025
+ <fo:table-row>
2026
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
2027
+
2028
+
2029
+
2030
+ <!-- fn will be processed inside 'note' processing -->
2031
+
2032
+
2033
+ <!-- except gb -->
2034
+
2035
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
2036
+
2037
+
2038
+ <!-- horizontal row separator -->
2039
+
2040
+
2041
+ <!-- fn processing -->
2042
+ <xsl:call-template name="fn_display"/>
2043
+
2044
+ </fo:table-cell>
2045
+ </fo:table-row>
2046
+
2047
+ </xsl:if>
2048
+ </fo:table-footer>
2049
+
2050
+ </xsl:if>
2051
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2052
+
2053
+ <xsl:variable name="cols-count">
2054
+ <xsl:choose>
2055
+ <xsl:when test="../*[local-name()='thead']">
2056
+ <xsl:call-template name="calculate-columns-numbers">
2057
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2058
+ </xsl:call-template>
2059
+ </xsl:when>
2060
+ <xsl:otherwise>
2061
+ <xsl:call-template name="calculate-columns-numbers">
2062
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2063
+ </xsl:call-template>
2064
+ </xsl:otherwise>
2065
+ </xsl:choose>
2066
+ </xsl:variable>
2067
+
2068
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
2069
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2070
+ </xsl:apply-templates>
2071
+
2072
+ <xsl:call-template name="insertTableFooter">
2073
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2074
+ </xsl:call-template>
2075
+
2076
+ <fo:table-body>
2077
+ <xsl:apply-templates/>
2078
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
2079
+
2080
+ </fo:table-body>
2081
+
2082
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2083
+ <xsl:variable name="parent-name" select="local-name(..)"/>
2084
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2085
+ <fo:table-row min-height="4mm">
2086
+ <xsl:if test="$parent-name = 'thead'">
2087
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2088
+
2089
+
2090
+
2091
+
2092
+
2093
+ </xsl:if>
2094
+ <xsl:if test="$parent-name = 'tfoot'">
2095
+
2096
+
2097
+ </xsl:if>
2098
+
2099
+
2100
+ <xsl:apply-templates/>
2101
+ </fo:table-row>
2102
+ </xsl:template><xsl:template match="*[local-name()='th']">
2103
+ <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2104
+
2105
+
2106
+
2107
+
2108
+
2109
+
2110
+
2111
+ <xsl:if test="@colspan">
2112
+ <xsl:attribute name="number-columns-spanned">
2113
+ <xsl:value-of select="@colspan"/>
2114
+ </xsl:attribute>
2115
+ </xsl:if>
2116
+ <xsl:if test="@rowspan">
2117
+ <xsl:attribute name="number-rows-spanned">
2118
+ <xsl:value-of select="@rowspan"/>
2119
+ </xsl:attribute>
2120
+ </xsl:if>
2121
+ <fo:block>
2122
+ <xsl:apply-templates/>
2123
+ </fo:block>
2124
+ </fo:table-cell>
2125
+ </xsl:template><xsl:template match="*[local-name()='td']">
2126
+ <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2127
+
2128
+
2129
+
2130
+
2131
+
2132
+
2133
+
2134
+
2135
+
2136
+ <xsl:if test="@colspan">
2137
+ <xsl:attribute name="number-columns-spanned">
2138
+ <xsl:value-of select="@colspan"/>
2139
+ </xsl:attribute>
2140
+ </xsl:if>
2141
+ <xsl:if test="@rowspan">
2142
+ <xsl:attribute name="number-rows-spanned">
2143
+ <xsl:value-of select="@rowspan"/>
2144
+ </xsl:attribute>
2145
+ </xsl:if>
2146
+ <fo:block>
2147
+
2148
+ <xsl:apply-templates/>
2149
+ </fo:block>
2150
+ <!-- <xsl:choose>
2151
+ <xsl:when test="count(*) = 1 and *[local-name() = 'p']">
2152
+ <xsl:apply-templates />
2153
+ </xsl:when>
2154
+ <xsl:otherwise>
2155
+ <fo:block>
2156
+ <xsl:apply-templates />
2157
+ </fo:block>
2158
+ </xsl:otherwise>
2159
+ </xsl:choose> -->
2160
+
2161
+
2162
+ </fo:table-cell>
2163
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
2164
+
2165
+
2166
+ <fo:block font-size="10pt" margin-bottom="12pt">
2167
+
2168
+
2169
+
2170
+
2171
+ <fo:inline padding-right="2mm">
2172
+
2173
+
2174
+ <xsl:variable name="title-note">
2175
+ <xsl:call-template name="getTitle">
2176
+ <xsl:with-param name="name" select="'title-note'"/>
2177
+ </xsl:call-template>
2178
+ </xsl:variable>
2179
+ <xsl:value-of select="$title-note"/>
2180
+
2181
+
2182
+
2183
+ <xsl:number format="1 "/>
2184
+
2185
+ </fo:inline>
2186
+ <xsl:apply-templates mode="process"/>
2187
+ </fo:block>
2188
+
2189
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2190
+ <xsl:apply-templates/>
2191
+ </xsl:template><xsl:template name="fn_display">
2192
+ <xsl:variable name="references">
2193
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2194
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2195
+
2196
+
2197
+ <xsl:apply-templates/>
2198
+ </fn>
2199
+ </xsl:for-each>
2200
+ </xsl:variable>
2201
+ <xsl:for-each select="xalan:nodeset($references)//fn">
2202
+ <xsl:variable name="reference" select="@reference"/>
2203
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2204
+ <fo:block margin-bottom="12pt">
2205
+
2206
+
2207
+
2208
+
2209
+ <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2210
+
2211
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2212
+
2213
+
2214
+
2215
+
2216
+
2217
+
2218
+ <xsl:value-of select="@reference"/>
2219
+
2220
+ </fo:inline>
2221
+ <fo:inline>
2222
+
2223
+ <xsl:apply-templates/>
2224
+ </fo:inline>
2225
+ </fo:block>
2226
+ </xsl:if>
2227
+ </xsl:for-each>
2228
+ </xsl:template><xsl:template name="fn_name_display">
2229
+ <!-- <xsl:variable name="references">
2230
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2231
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2232
+ <xsl:apply-templates />
2233
+ </fn>
2234
+ </xsl:for-each>
2235
+ </xsl:variable>
2236
+ $references=<xsl:copy-of select="$references"/> -->
2237
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2238
+ <xsl:variable name="reference" select="@reference"/>
2239
+ <fo:block id="{@reference}_{ancestor::*[@id][1]/@id}"><xsl:value-of select="@reference"/></fo:block>
2240
+ <fo:block margin-bottom="12pt">
2241
+ <xsl:apply-templates/>
2242
+ </fo:block>
2243
+ </xsl:for-each>
2244
+ </xsl:template><xsl:template name="fn_display_figure">
2245
+ <xsl:variable name="key_iso">
2246
+ <!-- and (not(@class) or @class !='pseudocode') -->
2247
+ </xsl:variable>
2248
+ <xsl:variable name="references">
2249
+ <xsl:for-each select=".//*[local-name()='fn']">
2250
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2251
+ <xsl:apply-templates/>
2252
+ </fn>
2253
+ </xsl:for-each>
2254
+ </xsl:variable>
2255
+
2256
+ <!-- current hierarchy is 'figure' element -->
2257
+ <xsl:variable name="following_dl_colwidths">
2258
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
2259
+ <xsl:variable name="html-table">
2260
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2261
+ <xsl:element name="{$ns}:table">
2262
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2263
+ <tbody>
2264
+ <xsl:apply-templates mode="dl"/>
2265
+ </tbody>
2266
+ </xsl:for-each>
2267
+ </xsl:element>
2268
+ </xsl:variable>
2269
+
2270
+ <xsl:call-template name="calculate-column-widths">
2271
+ <xsl:with-param name="cols-count" select="2"/>
2272
+ <xsl:with-param name="table" select="$html-table"/>
2273
+ </xsl:call-template>
2274
+
2275
+ </xsl:if>
2276
+ </xsl:variable>
2277
+
2278
+
2279
+ <xsl:variable name="maxlength_dt">
2280
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2281
+ <xsl:call-template name="getMaxLength_dt"/>
2282
+ </xsl:for-each>
2283
+ </xsl:variable>
2284
+
2285
+ <xsl:if test="xalan:nodeset($references)//fn">
2286
+ <fo:block>
2287
+ <fo:table width="95%" table-layout="fixed">
2288
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2289
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2290
+
2291
+ </xsl:if>
2292
+ <xsl:choose>
2293
+ <!-- if there 'dl', then set same columns width -->
2294
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
2295
+ <xsl:call-template name="setColumnWidth_dl">
2296
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
2297
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2298
+ </xsl:call-template>
2299
+ </xsl:when>
2300
+ <xsl:otherwise>
2301
+ <fo:table-column column-width="15%"/>
2302
+ <fo:table-column column-width="85%"/>
2303
+ </xsl:otherwise>
2304
+ </xsl:choose>
2305
+ <fo:table-body>
2306
+ <xsl:for-each select="xalan:nodeset($references)//fn">
2307
+ <xsl:variable name="reference" select="@reference"/>
2308
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2309
+ <fo:table-row>
2310
+ <fo:table-cell>
2311
+ <fo:block>
2312
+ <fo:inline font-size="80%" padding-right="5mm" vertical-align="super" id="{@id}">
2313
+
2314
+ <xsl:value-of select="@reference"/>
2315
+ </fo:inline>
2316
+ </fo:block>
2317
+ </fo:table-cell>
2318
+ <fo:table-cell>
2319
+ <fo:block text-align="justify" margin-bottom="12pt">
2320
+
2321
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2322
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
2323
+ </xsl:if>
2324
+
2325
+ <xsl:apply-templates/>
2326
+ </fo:block>
2327
+ </fo:table-cell>
2328
+ </fo:table-row>
2329
+ </xsl:if>
2330
+ </xsl:for-each>
2331
+ </fo:table-body>
2332
+ </fo:table>
2333
+ </fo:block>
2334
+ </xsl:if>
2335
+
2336
+ </xsl:template><xsl:template match="*[local-name()='fn']">
2337
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2338
+ <fo:inline font-size="80%" keep-with-previous.within-line="always">
2339
+
2340
+
2341
+
2342
+
2343
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2344
+
2345
+ <xsl:value-of select="@reference"/>
2346
+ </fo:basic-link>
2347
+ </fo:inline>
2348
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2349
+ <fo:inline>
2350
+ <xsl:apply-templates/>
2351
+ </fo:inline>
2352
+ </xsl:template><xsl:template match="*[local-name()='dl']">
2353
+ <xsl:variable name="parent" select="local-name(..)"/>
2354
+
2355
+ <xsl:variable name="key_iso">
2356
+ <!-- and (not(../@class) or ../@class !='pseudocode') -->
2357
+ </xsl:variable>
2358
+
2359
+ <xsl:choose>
2360
+ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2361
+
2362
+
2363
+ <fo:block margin-bottom="12pt" text-align="left">
2364
+
2365
+ <xsl:variable name="title-where">
2366
+ <xsl:call-template name="getTitle">
2367
+ <xsl:with-param name="name" select="'title-where'"/>
2368
+ </xsl:call-template>
2369
+ </xsl:variable>
2370
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2371
+ <xsl:apply-templates select="*[local-name()='dt']/*"/>
2372
+ <xsl:text/>
2373
+ <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2374
+ </fo:block>
2375
+
2376
+ </xsl:when>
2377
+ <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2378
+ <fo:block margin-bottom="12pt" text-align="left">
2379
+
2380
+
2381
+
2382
+
2383
+ <xsl:variable name="title-where">
2384
+ <xsl:call-template name="getTitle">
2385
+ <xsl:with-param name="name" select="'title-where'"/>
2386
+ </xsl:call-template>
2387
+ </xsl:variable>
2388
+ <xsl:value-of select="$title-where"/>
2389
+ </fo:block>
2390
+ </xsl:when>
2391
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2392
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
2393
+
2394
+
2395
+
2396
+ <xsl:variable name="title-key">
2397
+ <xsl:call-template name="getTitle">
2398
+ <xsl:with-param name="name" select="'title-key'"/>
2399
+ </xsl:call-template>
2400
+ </xsl:variable>
2401
+ <xsl:value-of select="$title-key"/>
2402
+ </fo:block>
2403
+ </xsl:when>
2404
+ </xsl:choose>
2405
+
2406
+ <!-- a few components -->
2407
+ <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2408
+ <fo:block>
2409
+
2410
+
2411
+
2412
+
2413
+ <fo:block>
2414
+
2415
+
2416
+
2417
+
2418
+ <fo:table width="95%" table-layout="fixed">
2419
+
2420
+ <xsl:choose>
2421
+ <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2422
+ <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2423
+ </xsl:when>
2424
+ <xsl:when test="normalize-space($key_iso) = 'true'">
2425
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2426
+
2427
+ </xsl:when>
2428
+ </xsl:choose>
2429
+ <!-- create virtual html table for dl/[dt and dd] -->
2430
+ <xsl:variable name="html-table">
2431
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2432
+ <xsl:element name="{$ns}:table">
2433
+ <tbody>
2434
+ <xsl:apply-templates mode="dl"/>
2435
+ </tbody>
2436
+ </xsl:element>
2437
+ </xsl:variable>
2438
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
2439
+ <xsl:variable name="colwidths">
2440
+ <xsl:call-template name="calculate-column-widths">
2441
+ <xsl:with-param name="cols-count" select="2"/>
2442
+ <xsl:with-param name="table" select="$html-table"/>
2443
+ </xsl:call-template>
2444
+ </xsl:variable>
2445
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2446
+ <xsl:variable name="maxlength_dt">
2447
+ <xsl:call-template name="getMaxLength_dt"/>
2448
+ </xsl:variable>
2449
+ <xsl:call-template name="setColumnWidth_dl">
2450
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2451
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2452
+ </xsl:call-template>
2453
+ <fo:table-body>
2454
+ <xsl:apply-templates>
2455
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2456
+ </xsl:apply-templates>
2457
+ </fo:table-body>
2458
+ </fo:table>
2459
+ </fo:block>
2460
+ </fo:block>
2461
+ </xsl:if>
2462
+ </xsl:template><xsl:template name="setColumnWidth_dl">
2463
+ <xsl:param name="colwidths"/>
2464
+ <xsl:param name="maxlength_dt"/>
2465
+ <xsl:choose>
2466
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
2467
+ <fo:table-column column-width="50%"/>
2468
+ <fo:table-column column-width="50%"/>
2469
+ </xsl:when>
2470
+ <xsl:otherwise>
2471
+ <xsl:choose>
2472
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2473
+ <fo:table-column column-width="5%"/>
2474
+ <fo:table-column column-width="95%"/>
2475
+ </xsl:when>
2476
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2477
+ <fo:table-column column-width="10%"/>
2478
+ <fo:table-column column-width="90%"/>
2479
+ </xsl:when>
2480
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2481
+ <fo:table-column column-width="60%"/>
2482
+ <fo:table-column column-width="40%"/>
2483
+ </xsl:when> -->
2484
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
2485
+ <fo:table-column column-width="50%"/>
2486
+ <fo:table-column column-width="50%"/>
2487
+ </xsl:when>
2488
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
2489
+ <fo:table-column column-width="40%"/>
2490
+ <fo:table-column column-width="60%"/>
2491
+ </xsl:when>
2492
+ <xsl:otherwise>
2493
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2494
+ <xsl:choose>
2495
+ <xsl:when test=". = 1 or . = 0">
2496
+ <fo:table-column column-width="proportional-column-width(2)"/>
2497
+ </xsl:when>
2498
+ <xsl:otherwise>
2499
+ <fo:table-column column-width="proportional-column-width({.})"/>
2500
+ </xsl:otherwise>
2501
+ </xsl:choose>
2502
+ </xsl:for-each>
2503
+ </xsl:otherwise>
2504
+ </xsl:choose>
2505
+ <!-- <fo:table-column column-width="15%"/>
2506
+ <fo:table-column column-width="85%"/> -->
2507
+ </xsl:otherwise>
2508
+ </xsl:choose>
2509
+ </xsl:template><xsl:template name="getMaxLength_dt">
2510
+ <xsl:for-each select="*[local-name()='dt']">
2511
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2512
+ <xsl:if test="position() = 1">
2513
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2514
+ </xsl:if>
2515
+ </xsl:for-each>
2516
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
2517
+ <xsl:param name="key_iso"/>
2518
+
2519
+ <!-- <tr>
2520
+ <td>NOTE</td>
2521
+ <td>
2522
+ <xsl:apply-templates />
2523
+ </td>
2524
+ </tr>
2525
+ -->
2526
+ <fo:table-row>
2527
+ <fo:table-cell>
2528
+ <fo:block margin-top="6pt">
2529
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2530
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2531
+ </xsl:if>
2532
+ <xsl:variable name="title-note">
2533
+ <xsl:call-template name="getTitle">
2534
+ <xsl:with-param name="name" select="'title-note'"/>
2535
+ </xsl:call-template>
2536
+ </xsl:variable>
2537
+ <xsl:value-of select="$title-note"/>
2538
+ </fo:block>
2539
+ </fo:table-cell>
2540
+ <fo:table-cell>
2541
+ <fo:block>
2542
+ <xsl:apply-templates/>
2543
+ </fo:block>
2544
+ </fo:table-cell>
2545
+ </fo:table-row>
2546
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
2547
+ <tr>
2548
+ <td>
2549
+ <xsl:apply-templates/>
2550
+ </td>
2551
+ <td>
2552
+
2553
+
2554
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2555
+
2556
+ </td>
2557
+ </tr>
2558
+
2559
+ </xsl:template><xsl:template match="*[local-name()='dt']">
2560
+ <xsl:param name="key_iso"/>
2561
+
2562
+ <fo:table-row>
2563
+ <fo:table-cell>
2564
+
2565
+ <fo:block margin-top="6pt">
2566
+
2567
+
2568
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2569
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2570
+
2571
+ </xsl:if>
2572
+
2573
+
2574
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
2575
+
2576
+
2577
+
2578
+
2579
+ <xsl:apply-templates/>
2580
+ <!-- <xsl:if test="$namespace = 'gb'">
2581
+ <xsl:if test="ancestor::*[local-name()='formula']">
2582
+ <xsl:text>—</xsl:text>
2583
+ </xsl:if>
2584
+ </xsl:if> -->
2585
+ </fo:block>
2586
+ </fo:table-cell>
2587
+ <fo:table-cell>
2588
+ <fo:block>
2589
+
2590
+
2591
+
2592
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2593
+
2594
+ </fo:block>
2595
+ </fo:table-cell>
2596
+ </fo:table-row>
2597
+
2598
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2599
+ <xsl:apply-templates/>
2600
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
2601
+ <xsl:apply-templates/>
2602
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2603
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
2604
+ </xsl:template><xsl:template match="*[local-name()='em']">
2605
+ <fo:inline font-style="italic">
2606
+ <xsl:apply-templates/>
2607
+ </fo:inline>
2608
+ </xsl:template><xsl:template match="*[local-name()='strong']">
2609
+ <fo:inline font-weight="bold">
2610
+ <xsl:apply-templates/>
2611
+ </fo:inline>
2612
+ </xsl:template><xsl:template match="*[local-name()='sup']">
2613
+ <fo:inline font-size="80%" vertical-align="super">
2614
+ <xsl:apply-templates/>
2615
+ </fo:inline>
2616
+ </xsl:template><xsl:template match="*[local-name()='sub']">
2617
+ <fo:inline font-size="80%" vertical-align="sub">
2618
+ <xsl:apply-templates/>
2619
+ </fo:inline>
2620
+ </xsl:template><xsl:template match="*[local-name()='tt']">
2621
+ <fo:inline font-family="Courier" font-size="10pt">
2622
+ <xsl:apply-templates/>
2623
+ </fo:inline>
2624
+ </xsl:template><xsl:template match="*[local-name()='del']">
2625
+ <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2626
+ <xsl:apply-templates/>
2627
+ </fo:inline>
2628
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2629
+ <xsl:variable name="text" select="normalize-space(.)"/>
2630
+ <fo:inline font-size="75%">
2631
+ <xsl:if test="string-length($text) &gt; 0">
2632
+ <xsl:call-template name="recursiveSmallCaps">
2633
+ <xsl:with-param name="text" select="$text"/>
2634
+ </xsl:call-template>
2635
+ </xsl:if>
2636
+ </fo:inline>
2637
+ </xsl:template><xsl:template name="recursiveSmallCaps">
2638
+ <xsl:param name="text"/>
2639
+ <xsl:variable name="char" select="substring($text,1,1)"/>
2640
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
2641
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
2642
+ <xsl:choose>
2643
+ <xsl:when test="$char=$upperCase">
2644
+ <fo:inline font-size="{100 div 0.75}%">
2645
+ <xsl:value-of select="$upperCase"/>
2646
+ </fo:inline>
2647
+ </xsl:when>
2648
+ <xsl:otherwise>
2649
+ <xsl:value-of select="$upperCase"/>
2650
+ </xsl:otherwise>
2651
+ </xsl:choose>
2652
+ <xsl:if test="string-length($text) &gt; 1">
2653
+ <xsl:call-template name="recursiveSmallCaps">
2654
+ <xsl:with-param name="text" select="substring($text,2)"/>
2655
+ </xsl:call-template>
2656
+ </xsl:if>
2657
+ </xsl:template><xsl:template name="tokenize">
2658
+ <xsl:param name="text"/>
2659
+ <xsl:param name="separator" select="' '"/>
2660
+ <xsl:choose>
2661
+ <xsl:when test="not(contains($text, $separator))">
2662
+ <word>
2663
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
2664
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
2665
+ <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
2666
+ <xsl:variable name="len_str">
2667
+ <xsl:choose>
2668
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
2669
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
2670
+ </xsl:when>
2671
+ <xsl:otherwise>
2672
+ <xsl:value-of select="$len_str_tmp"/>
2673
+ </xsl:otherwise>
2674
+ </xsl:choose>
2675
+ </xsl:variable>
2676
+
2677
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
2678
+ <xsl:message>
2679
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
2680
+ len_str=<xsl:value-of select="$len_str"/>
2681
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
2682
+ </xsl:message>
2683
+ </xsl:if> -->
2684
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
2685
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
2686
+ <xsl:choose>
2687
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
2688
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
2689
+ </xsl:when>
2690
+ <xsl:otherwise>
2691
+ <xsl:value-of select="$len_str"/>
2692
+ </xsl:otherwise>
2693
+ </xsl:choose>
2694
+ </word>
2695
+ </xsl:when>
2696
+ <xsl:otherwise>
2697
+ <word>
2698
+ <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
2699
+ </word>
2700
+ <xsl:call-template name="tokenize">
2701
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
2702
+ </xsl:call-template>
2703
+ </xsl:otherwise>
2704
+ </xsl:choose>
2705
+ </xsl:template><xsl:template name="max_length">
2706
+ <xsl:param name="words"/>
2707
+ <xsl:for-each select="$words//word">
2708
+ <xsl:sort select="." data-type="number" order="descending"/>
2709
+ <xsl:if test="position()=1">
2710
+ <xsl:value-of select="."/>
2711
+ </xsl:if>
2712
+ </xsl:for-each>
2713
+ </xsl:template><xsl:template name="add-zero-spaces-java">
2714
+ <xsl:param name="text" select="."/>
2715
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2716
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2717
+ </xsl:template><xsl:template name="add-zero-spaces">
2718
+ <xsl:param name="text" select="."/>
2719
+ <xsl:variable name="zero-space-after-chars">-</xsl:variable>
2720
+ <xsl:variable name="zero-space-after-dot">.</xsl:variable>
2721
+ <xsl:variable name="zero-space-after-colon">:</xsl:variable>
2722
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
2723
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
2724
+ <xsl:variable name="zero-space">​</xsl:variable>
2725
+ <xsl:choose>
2726
+ <xsl:when test="contains($text, $zero-space-after-chars)">
2727
+ <xsl:value-of select="substring-before($text, $zero-space-after-chars)"/>
2728
+ <xsl:value-of select="$zero-space-after-chars"/>
2729
+ <xsl:value-of select="$zero-space"/>
2730
+ <xsl:call-template name="add-zero-spaces">
2731
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-chars)"/>
2732
+ </xsl:call-template>
2733
+ </xsl:when>
2734
+ <xsl:when test="contains($text, $zero-space-after-dot)">
2735
+ <xsl:value-of select="substring-before($text, $zero-space-after-dot)"/>
2736
+ <xsl:value-of select="$zero-space-after-dot"/>
2737
+ <xsl:value-of select="$zero-space"/>
2738
+ <xsl:call-template name="add-zero-spaces">
2739
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-dot)"/>
2740
+ </xsl:call-template>
2741
+ </xsl:when>
2742
+ <xsl:when test="contains($text, $zero-space-after-colon)">
2743
+ <xsl:value-of select="substring-before($text, $zero-space-after-colon)"/>
2744
+ <xsl:value-of select="$zero-space-after-colon"/>
2745
+ <xsl:value-of select="$zero-space"/>
2746
+ <xsl:call-template name="add-zero-spaces">
2747
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-colon)"/>
2748
+ </xsl:call-template>
2749
+ </xsl:when>
2750
+ <xsl:when test="contains($text, $zero-space-after-equal)">
2751
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
2752
+ <xsl:value-of select="$zero-space-after-equal"/>
2753
+ <xsl:value-of select="$zero-space"/>
2754
+ <xsl:call-template name="add-zero-spaces">
2755
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
2756
+ </xsl:call-template>
2757
+ </xsl:when>
2758
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
2759
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
2760
+ <xsl:value-of select="$zero-space-after-underscore"/>
2761
+ <xsl:value-of select="$zero-space"/>
2762
+ <xsl:call-template name="add-zero-spaces">
2763
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
2764
+ </xsl:call-template>
2765
+ </xsl:when>
2766
+ <xsl:otherwise>
2767
+ <xsl:value-of select="$text"/>
2768
+ </xsl:otherwise>
2769
+ </xsl:choose>
2770
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
2771
+ <xsl:param name="text" select="."/>
2772
+ <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
2773
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
2774
+ <xsl:variable name="zero-space">​</xsl:variable>
2775
+ <xsl:choose>
2776
+ <xsl:when test="contains($text, $zero-space-after-equals)">
2777
+ <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
2778
+ <xsl:value-of select="$zero-space-after-equals"/>
2779
+ <xsl:value-of select="$zero-space"/>
2780
+ <xsl:call-template name="add-zero-spaces-equal">
2781
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
2782
+ </xsl:call-template>
2783
+ </xsl:when>
2784
+ <xsl:when test="contains($text, $zero-space-after-equal)">
2785
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
2786
+ <xsl:value-of select="$zero-space-after-equal"/>
2787
+ <xsl:value-of select="$zero-space"/>
2788
+ <xsl:call-template name="add-zero-spaces-equal">
2789
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
2790
+ </xsl:call-template>
2791
+ </xsl:when>
2792
+ <xsl:otherwise>
2793
+ <xsl:value-of select="$text"/>
2794
+ </xsl:otherwise>
2795
+ </xsl:choose>
2796
+ </xsl:template><xsl:template name="getSimpleTable">
2797
+ <xsl:variable name="simple-table">
2798
+
2799
+ <!-- Step 1. colspan processing -->
2800
+ <xsl:variable name="simple-table-colspan">
2801
+ <tbody>
2802
+ <xsl:apply-templates mode="simple-table-colspan"/>
2803
+ </tbody>
2804
+ </xsl:variable>
2805
+
2806
+ <!-- Step 2. rowspan processing -->
2807
+ <xsl:variable name="simple-table-rowspan">
2808
+ <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
2809
+ </xsl:variable>
2810
+
2811
+ <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
2812
+
2813
+ <!-- <xsl:choose>
2814
+ <xsl:when test="current()//*[local-name()='th'][@colspan] or current()//*[local-name()='td'][@colspan] ">
2815
+
2816
+ </xsl:when>
2817
+ <xsl:otherwise>
2818
+ <xsl:copy-of select="current()"/>
2819
+ </xsl:otherwise>
2820
+ </xsl:choose> -->
2821
+ </xsl:variable>
2822
+ <xsl:copy-of select="$simple-table"/>
2823
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
2824
+ <xsl:apply-templates mode="simple-table-colspan"/>
2825
+ </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
2826
+ <xsl:choose>
2827
+ <xsl:when test="@colspan">
2828
+ <xsl:variable name="td">
2829
+ <xsl:element name="td">
2830
+ <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
2831
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
2832
+ <xsl:apply-templates mode="simple-table-colspan"/>
2833
+ </xsl:element>
2834
+ </xsl:variable>
2835
+ <xsl:call-template name="repeatNode">
2836
+ <xsl:with-param name="count" select="@colspan"/>
2837
+ <xsl:with-param name="node" select="$td"/>
2838
+ </xsl:call-template>
2839
+ </xsl:when>
2840
+ <xsl:otherwise>
2841
+ <xsl:element name="td">
2842
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
2843
+ <xsl:apply-templates mode="simple-table-colspan"/>
2844
+ </xsl:element>
2845
+ </xsl:otherwise>
2846
+ </xsl:choose>
2847
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
2848
+ <xsl:element name="tr">
2849
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
2850
+ <xsl:apply-templates mode="simple-table-colspan"/>
2851
+ </xsl:element>
2852
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
2853
+ <xsl:copy>
2854
+ <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
2855
+ </xsl:copy>
2856
+ </xsl:template><xsl:template name="repeatNode">
2857
+ <xsl:param name="count"/>
2858
+ <xsl:param name="node"/>
2859
+
2860
+ <xsl:if test="$count &gt; 0">
2861
+ <xsl:call-template name="repeatNode">
2862
+ <xsl:with-param name="count" select="$count - 1"/>
2863
+ <xsl:with-param name="node" select="$node"/>
2864
+ </xsl:call-template>
2865
+ <xsl:copy-of select="$node"/>
2866
+ </xsl:if>
2867
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
2868
+ <xsl:copy>
2869
+ <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
2870
+ </xsl:copy>
2871
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
2872
+ <xsl:copy>
2873
+ <xsl:copy-of select="tr[1]"/>
2874
+ <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
2875
+ <xsl:with-param name="previousRow" select="tr[1]"/>
2876
+ </xsl:apply-templates>
2877
+ </xsl:copy>
2878
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
2879
+ <xsl:param name="previousRow"/>
2880
+ <xsl:variable name="currentRow" select="."/>
2881
+
2882
+ <xsl:variable name="normalizedTDs">
2883
+ <xsl:for-each select="xalan:nodeset($previousRow)//td">
2884
+ <xsl:choose>
2885
+ <xsl:when test="@rowspan &gt; 1">
2886
+ <xsl:copy>
2887
+ <xsl:attribute name="rowspan">
2888
+ <xsl:value-of select="@rowspan - 1"/>
2889
+ </xsl:attribute>
2890
+ <xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
2891
+ <xsl:copy-of select="node()"/>
2892
+ </xsl:copy>
2893
+ </xsl:when>
2894
+ <xsl:otherwise>
2895
+ <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
2896
+ </xsl:otherwise>
2897
+ </xsl:choose>
2898
+ </xsl:for-each>
2899
+ </xsl:variable>
2900
+
2901
+ <xsl:variable name="newRow">
2902
+ <xsl:copy>
2903
+ <xsl:copy-of select="$currentRow/@*"/>
2904
+ <xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
2905
+ </xsl:copy>
2906
+ </xsl:variable>
2907
+ <xsl:copy-of select="$newRow"/>
2908
+
2909
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
2910
+ <xsl:with-param name="previousRow" select="$newRow"/>
2911
+ </xsl:apply-templates>
2912
+ </xsl:template><xsl:template name="getLang">
2913
+ <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2914
+ <xsl:choose>
2915
+ <xsl:when test="$language = 'English'">en</xsl:when>
2916
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
2917
+ </xsl:choose>
2918
+ </xsl:template><xsl:template name="capitalizeWords">
2919
+ <xsl:param name="str"/>
2920
+ <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
2921
+ <xsl:choose>
2922
+ <xsl:when test="contains($str2, ' ')">
2923
+ <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
2924
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
2925
+ <xsl:value-of select="substring($substr, 2)"/> -->
2926
+ <xsl:call-template name="capitalize">
2927
+ <xsl:with-param name="str" select="$substr"/>
2928
+ </xsl:call-template>
2929
+ <xsl:text> </xsl:text>
2930
+ <xsl:call-template name="capitalizeWords">
2931
+ <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
2932
+ </xsl:call-template>
2933
+ </xsl:when>
2934
+ <xsl:otherwise>
2935
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
2936
+ <xsl:value-of select="substring($str2, 2)"/> -->
2937
+ <xsl:call-template name="capitalize">
2938
+ <xsl:with-param name="str" select="$str2"/>
2939
+ </xsl:call-template>
2940
+ </xsl:otherwise>
2941
+ </xsl:choose>
2942
+ </xsl:template><xsl:template name="capitalize">
2943
+ <xsl:param name="str"/>
2944
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2945
+ <xsl:value-of select="substring($str, 2)"/>
2946
+ </xsl:template><xsl:template match="mathml:math">
2947
+ <fo:inline font-family="STIX2Math">
2948
+ <fo:instream-foreign-object fox:alt-text="Math">
2949
+ <xsl:copy-of select="."/>
2950
+ </fo:instream-foreign-object>
2951
+ </fo:inline>
2952
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
2953
+ <xsl:for-each select="*[local-name()='locality']">
2954
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
2955
+ <xsl:apply-templates select="."/>
2956
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
2957
+ </xsl:for-each>
2958
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
2959
+ <xsl:variable name="target">
2960
+ <xsl:choose>
2961
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
2962
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
2963
+ </xsl:when>
2964
+ <xsl:otherwise>
2965
+ <xsl:value-of select="normalize-space(@target)"/>
2966
+ </xsl:otherwise>
2967
+ </xsl:choose>
2968
+ </xsl:variable>
2969
+ <fo:inline xsl:use-attribute-sets="link-style">
2970
+ <xsl:choose>
2971
+ <xsl:when test="$target = ''">
2972
+ <xsl:apply-templates/>
2973
+ </xsl:when>
2974
+ <xsl:otherwise>
2975
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
2976
+ <xsl:choose>
2977
+ <xsl:when test="normalize-space(.) = ''">
2978
+ <xsl:value-of select="$target"/>
2979
+ </xsl:when>
2980
+ <xsl:otherwise>
2981
+ <xsl:apply-templates/>
2982
+ </xsl:otherwise>
2983
+ </xsl:choose>
2984
+ </fo:basic-link>
2985
+ </xsl:otherwise>
2986
+ </xsl:choose>
2987
+ </fo:inline>
2988
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
2989
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
2990
+ <!-- <xsl:choose>
2991
+ <xsl:when test="@lang = 'en'"></xsl:when>
2992
+ <xsl:otherwise> -->
2993
+ <xsl:attribute name="white-space">pre</xsl:attribute>
2994
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
2995
+ <!-- </xsl:otherwise>
2996
+ </xsl:choose> -->
2997
+ <xsl:apply-templates/>
2998
+ </fo:block>
2999
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
3000
+ <fo:inline id="{@id}"/>
3001
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
3002
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3003
+ <xsl:variable name="title-appendix">
3004
+ <xsl:call-template name="getTitle">
3005
+ <xsl:with-param name="name" select="'title-appendix'"/>
3006
+ </xsl:call-template>
3007
+ </xsl:variable>
3008
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3009
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3010
+ </fo:block>
3011
+ <xsl:apply-templates/>
3012
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3013
+ <fo:inline><xsl:apply-templates/></fo:inline>
3014
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3015
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
3016
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
3017
+ <xsl:variable name="title-example">
3018
+ <xsl:call-template name="getTitle">
3019
+ <xsl:with-param name="name" select="'title-example'"/>
3020
+ </xsl:call-template>
3021
+ </xsl:variable>
3022
+ <xsl:value-of select="$title-example"/>
3023
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3024
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
3025
+ </xsl:if>
3026
+ <xsl:if test="*[local-name()='name']">
3027
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
3028
+ </xsl:if>
3029
+ </fo:block>
3030
+ <xsl:apply-templates/>
3031
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
3032
+ <fo:inline><xsl:apply-templates/></fo:inline>
3033
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
3034
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3035
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
3036
+ <xsl:variable name="annotation-id" select="@id"/>
3037
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
3038
+ <fo:block id="{$annotation-id}" white-space="nowrap">
3039
+ <fo:inline>
3040
+ <xsl:apply-templates>
3041
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
3042
+ </xsl:apply-templates>
3043
+ </fo:inline>
3044
+ </fo:block>
3045
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3046
+ <xsl:param name="callout"/>
3047
+ <fo:inline id="{@id}">
3048
+ <!-- for first p in annotation, put <x> -->
3049
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3050
+ <xsl:apply-templates/>
3051
+ </fo:inline>
3052
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
3053
+ <xsl:variable name="title-modified">
3054
+ <xsl:call-template name="getTitle">
3055
+ <xsl:with-param name="name" select="'title-modified'"/>
3056
+ </xsl:call-template>
3057
+ </xsl:variable>
3058
+ <xsl:choose>
3059
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3060
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3061
+ </xsl:choose>
3062
+ <xsl:apply-templates/>
3063
+ </xsl:template><xsl:template name="convertDate">
3064
+ <xsl:param name="date"/>
3065
+ <xsl:param name="format" select="'short'"/>
3066
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
3067
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
3068
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
3069
+ <xsl:variable name="monthStr">
3070
+ <xsl:choose>
3071
+ <xsl:when test="$month = '01'">January</xsl:when>
3072
+ <xsl:when test="$month = '02'">February</xsl:when>
3073
+ <xsl:when test="$month = '03'">March</xsl:when>
3074
+ <xsl:when test="$month = '04'">April</xsl:when>
3075
+ <xsl:when test="$month = '05'">May</xsl:when>
3076
+ <xsl:when test="$month = '06'">June</xsl:when>
3077
+ <xsl:when test="$month = '07'">July</xsl:when>
3078
+ <xsl:when test="$month = '08'">August</xsl:when>
3079
+ <xsl:when test="$month = '09'">September</xsl:when>
3080
+ <xsl:when test="$month = '10'">October</xsl:when>
3081
+ <xsl:when test="$month = '11'">November</xsl:when>
3082
+ <xsl:when test="$month = '12'">December</xsl:when>
3083
+ </xsl:choose>
3084
+ </xsl:variable>
3085
+ <xsl:variable name="result">
3086
+ <xsl:choose>
3087
+ <xsl:when test="$format = 'short' or $day = ''">
3088
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
3089
+ </xsl:when>
3090
+ <xsl:otherwise>
3091
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
3092
+ </xsl:otherwise>
3093
+ </xsl:choose>
3094
+ </xsl:variable>
3095
+ <xsl:value-of select="$result"/>
3096
+ </xsl:template><xsl:template name="insertKeywords">
3097
+ <xsl:param name="sorting" select="'true'"/>
3098
+ <xsl:param name="charAtEnd" select="'.'"/>
3099
+ <xsl:param name="charDelim" select="', '"/>
3100
+ <xsl:choose>
3101
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
3102
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3103
+ <xsl:sort data-type="text" order="ascending"/>
3104
+ <xsl:call-template name="insertKeyword">
3105
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3106
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3107
+ </xsl:call-template>
3108
+ </xsl:for-each>
3109
+ </xsl:when>
3110
+ <xsl:otherwise>
3111
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3112
+ <xsl:call-template name="insertKeyword">
3113
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3114
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3115
+ </xsl:call-template>
3116
+ </xsl:for-each>
3117
+ </xsl:otherwise>
3118
+ </xsl:choose>
3119
+ </xsl:template><xsl:template name="insertKeyword">
3120
+ <xsl:param name="charAtEnd"/>
3121
+ <xsl:param name="charDelim"/>
3122
+ <xsl:apply-templates/>
3123
+ <xsl:choose>
3124
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3125
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3126
+ </xsl:choose>
3127
+ </xsl:template><xsl:template name="addPDFUAmeta">
3128
+ <fo:declarations>
3129
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
3130
+ <pdf:dictionary type="normal" key="ViewerPreferences">
3131
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
3132
+ </pdf:dictionary>
3133
+ </pdf:catalog>
3134
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
3135
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
3136
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
3137
+ <!-- Dublin Core properties go here -->
3138
+ <dc:title>
3139
+ <xsl:variable name="title">
3140
+
3141
+
3142
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
3143
+
3144
+
3145
+
3146
+ </xsl:variable>
3147
+ <xsl:choose>
3148
+ <xsl:when test="normalize-space($title) != ''">
3149
+ <xsl:value-of select="$title"/>
3150
+ </xsl:when>
3151
+ <xsl:otherwise>
3152
+ <xsl:text> </xsl:text>
3153
+ </xsl:otherwise>
3154
+ </xsl:choose>
3155
+ </dc:title>
3156
+ <dc:creator>
3157
+
3158
+
3159
+ </dc:creator>
3160
+ <dc:description>
3161
+ <xsl:variable name="abstract">
3162
+
3163
+ <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
3164
+
3165
+
3166
+
3167
+
3168
+ </xsl:variable>
3169
+ <xsl:value-of select="normalize-space($abstract)"/>
3170
+ </dc:description>
3171
+ <pdf:Keywords>
3172
+ <xsl:call-template name="insertKeywords"/>
3173
+ </pdf:Keywords>
3174
+ </rdf:Description>
3175
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
3176
+ <!-- XMP properties go here -->
3177
+ <xmp:CreatorTool/>
3178
+ </rdf:Description>
3179
+ </rdf:RDF>
3180
+ </x:xmpmeta>
3181
+ </fo:declarations>
3182
+ </xsl:template><xsl:template name="getId">
3183
+ <xsl:choose>
3184
+ <xsl:when test="../@id">
3185
+ <xsl:value-of select="../@id"/>
3186
+ </xsl:when>
3187
+ <xsl:otherwise>
3188
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
3189
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
3190
+ </xsl:otherwise>
3191
+ </xsl:choose>
3192
+ </xsl:template><xsl:template name="getLevel">
3193
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
3194
+ <xsl:variable name="level">
3195
+ <xsl:choose>
3196
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
3197
+ <xsl:value-of select="$level_total - 2"/>
3198
+ </xsl:when>
3199
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
3200
+ <xsl:value-of select="$level_total - 2"/>
3201
+ </xsl:when>
3202
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
3203
+ <xsl:value-of select="$level_total - 2"/>
3204
+ </xsl:when>
3205
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
3206
+ <xsl:otherwise>
3207
+ <xsl:value-of select="$level_total - 1"/>
3208
+ </xsl:otherwise>
3209
+ </xsl:choose>
3210
+ </xsl:variable>
3211
+ <xsl:value-of select="$level"/>
3212
+ </xsl:template><xsl:template name="getSubSection">
3213
+ <xsl:number format=".1" level="multiple" count="*[local-name() = 'clause']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'terms'] | *[local-name() = 'terms']/*[local-name() = 'term'] | *[local-name() = 'clause']/*[local-name() = 'term'] | *[local-name() = 'terms']/*[local-name() = 'clause'] | *[local-name() = 'terms']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'clause'] | *[local-name() = 'clause']/*[local-name() = 'definitions'] | *[local-name() = 'definitions']/*[local-name() = 'definitions'] | *[local-name() = 'clause']/*[local-name() = 'references']"/>
3214
+ </xsl:template><xsl:template name="split">
3215
+ <xsl:param name="pText" select="."/>
3216
+ <xsl:param name="sep" select="','"/>
3217
+ <xsl:if test="string-length($pText) &gt;0">
3218
+ <item>
3219
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
3220
+ </item>
3221
+ <xsl:call-template name="split">
3222
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
3223
+ <xsl:with-param name="sep" select="$sep"/>
3224
+ </xsl:call-template>
3225
+ </xsl:if>
3226
+ </xsl:template><xsl:template name="getDocumentId">
3227
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3228
+ </xsl:template></xsl:stylesheet>