metanorma-gb 1.3.23 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -91,6 +91,12 @@
91
91
  </define>
92
92
  <define name="sections">
93
93
  <element name="sections">
94
+ <zeroOrMore>
95
+ <choice>
96
+ <ref name="note"/>
97
+ <ref name="admonition"/>
98
+ </choice>
99
+ </zeroOrMore>
94
100
  <ref name="clause"/>
95
101
  <optional>
96
102
  <choice>
@@ -263,6 +269,8 @@
263
269
  <value>publicly-available-specification</value>
264
270
  <value>international-workshop-agreement</value>
265
271
  <value>guide</value>
272
+ <value>amendment</value>
273
+ <value>technical-corrigendum</value>
266
274
  </choice>
267
275
  </define>
268
276
  <define name="structuredidentifier">
@@ -354,6 +362,9 @@
354
362
  <data type="boolean"/>
355
363
  </attribute>
356
364
  </optional>
365
+ <optional>
366
+ <attribute name="number"/>
367
+ </optional>
357
368
  <optional>
358
369
  <attribute name="subsequence"/>
359
370
  </optional>
@@ -510,7 +521,7 @@
510
521
  </attribute>
511
522
  </optional>
512
523
  <oneOrMore>
513
- <ref name="paragraph-with-footnote"/>
524
+ <ref name="BasicBlock"/>
514
525
  </oneOrMore>
515
526
  </element>
516
527
  </define>
@@ -30,9 +30,22 @@
30
30
  <data type="boolean"/>
31
31
  </attribute>
32
32
  </optional>
33
+ <optional>
34
+ <attribute name="number"/>
35
+ </optional>
33
36
  <optional>
34
37
  <attribute name="subsequence"/>
35
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>
36
49
  <attribute name="id">
37
50
  <data type="ID"/>
38
51
  </attribute>
@@ -141,6 +154,16 @@
141
154
  <data type="boolean"/>
142
155
  </attribute>
143
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>
144
167
  <oneOrMore>
145
168
  <ref name="BasicBlock"/>
146
169
  </oneOrMore>
@@ -1,6 +1,6 @@
1
- require_relative "gbconvert"
1
+ require_relative "common"
2
2
  require "gb_agencies"
3
- require_relative "gbcleanup"
3
+ require_relative "cleanup"
4
4
  require_relative "metadata"
5
5
  require "fileutils"
6
6
 
@@ -12,7 +12,8 @@ module IsoDoc
12
12
  h = options[:headerfont] || "Arial"
13
13
  m = options[:monospacefont] || "Courier"
14
14
  t = options[:titlefont] || "Arial"
15
- "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n$titlefont: #{t};\n"
15
+ "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"\
16
+ "$titlefont: #{t};\n"
16
17
  end
17
18
 
18
19
  def metadata_init(lang, script, labels)
@@ -45,7 +46,8 @@ module IsoDoc
45
46
  YAML.load_file(File.join(File.dirname(__FILE__),
46
47
  "i18n-zh-Hans.yaml"))
47
48
  else
48
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-zh-Hans.yaml"))
49
+ YAML.load_file(File.join(File.dirname(__FILE__),
50
+ "i18n-zh-Hans.yaml"))
49
51
  end
50
52
  @labels = @labels.merge(y)
51
53
  end
@@ -55,16 +57,18 @@ module IsoDoc
55
57
  end
56
58
 
57
59
  def formula_parse(node, out)
58
- out.div **attr_code(id: node["id"], class: "formula") do |div|
60
+ out.div **formula_attrs(node) do |div1|
61
+ div1.div **attr_code(class: "formula") do |div|
59
62
  insert_tab(div, 1)
60
- parse(node.at(ns("./stem")), out)
61
- lbl = anchor(node['id'], :label, false)
63
+ parse(node.at(ns("./stem")), div)
64
+ lbl = @xrefs.anchor(node['id'], :label, false)
62
65
  unless lbl.nil?
63
66
  insert_tab(div, 1)
64
67
  div << "(#{lbl})"
65
68
  end
66
69
  end
67
- formula_where(node.at(ns("./dl")), out)
70
+ formula_where(node.at(ns("./dl")), div1)
71
+ end
68
72
  end
69
73
 
70
74
  def formula_where(dl, out)
@@ -100,12 +104,16 @@ module IsoDoc
100
104
  end
101
105
 
102
106
  def note_parse(node, out)
107
+ note_parse_table(node, out, note_label(node) + ":")
108
+ end
109
+
110
+ def note_parse_table(node, out, label)
103
111
  @note = true
104
- out.table **attr_code(id: node["id"], class: "Note") do |t|
112
+ out.table **note_attrs(node) do |t|
105
113
  t.tr do |tr|
106
114
  @libdir = File.dirname(__FILE__)
107
115
  tr.td **EXAMPLE_TBL_ATTR do |td|
108
- td << l10n(note_label(node) + ":")
116
+ td << l10n(label)
109
117
  end
110
118
  tr.td **{ style: "vertical-align:top;", class: "Note" } do |td|
111
119
  node.children.each { |n| parse(n, td) }
@@ -116,18 +124,7 @@ module IsoDoc
116
124
  end
117
125
 
118
126
  def termnote_parse(node, out)
119
- @note = true
120
- out.table **attr_code(id: node["id"], class: "Note") do |t|
121
- t.tr do |tr|
122
- tr.td **EXAMPLE_TBL_ATTR do |td|
123
- td << l10n("#{anchor(node['id'], :label)}:")
124
- end
125
- tr.td **{ style: "vertical-align:top;", class: "Note" } do |td|
126
- node.children.each { |n| parse(n, td) }
127
- end
128
- end
129
- end
130
- @note = false
127
+ note_parse_table(node, out, "#{@xrefs.anchor(node['id'], :label)}:")
131
128
  end
132
129
 
133
130
  def middle(isoxml, out)
@@ -168,15 +165,17 @@ module IsoDoc
168
165
  def termref_render(x)
169
166
  x.sub!(%r{\s*\[MODIFICATION\]\s*$}m, l10n(", #{@modified_lbl}"))
170
167
  parts = x.split(%r{(\s*\[MODIFICATION\]|,)}m)
171
- parts[1] = l10n(", #{@source_lbl}") if parts.size > 1 && parts[1] == "," &&
172
- !/^\s*#{@modified_lbl}/.match(parts[2])
168
+ parts[1] = l10n(", #{@source_lbl}") if parts.size > 1 &&
169
+ parts[1] == "," && !/^\s*#{@modified_lbl}/.match(parts[2])
173
170
  parts.map do |p|
174
- /\s*\[MODIFICATION\]/.match(p) ? l10n(", #{@modified_lbl} &mdash; ") : p
171
+ /\s*\[MODIFICATION\]/.match(p) ?
172
+ l10n(", #{@modified_lbl} &mdash; ") : p
175
173
  end.join.sub(/\A\s*/m, l10n("[")).sub(/\s*\z/m, l10n("]"))
176
174
  end
177
175
 
178
176
  def termref_resolve(docxml)
179
- docxml.split(%r{(\[TERMREF\]|\[/TERMREF\])}).each_slice(4).
177
+ docxml.gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, l10n("; ")).
178
+ split(%r{(\[TERMREF\]|\[/TERMREF\])}).each_slice(4).
180
179
  map do |a|
181
180
  a.size < 3 ? a[0] : a[0] + termref_render(a[2])
182
181
  end.join
@@ -212,7 +211,7 @@ module IsoDoc
212
211
  end
213
212
 
214
213
  def example_span_label(node, div, name)
215
- n = get_anchors[node["id"]]
214
+ n = @xrefs.get[node["id"]]
216
215
  div.span **{ class: "example_label" } do |p|
217
216
  lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @example_lbl :
218
217
  l10n("#{@example_lbl} #{n[:label]}")
@@ -251,11 +250,8 @@ module IsoDoc
251
250
 
252
251
  def example_parse(node, out)
253
252
  out.div **{ id: node["id"], class: "example" } do |div|
254
- if node_begins_with_para(node)
255
- example_p_parse(node, div)
256
- else
257
- example_parse1(node, div)
258
- end
253
+ node_begins_with_para(node) ?
254
+ example_p_parse(node, div) : example_parse1(node, div)
259
255
  end
260
256
  end
261
257
 
@@ -1,5 +1,5 @@
1
1
  require "isodoc"
2
- require_relative "./gbcleanup.rb"
2
+ require_relative "./cleanup.rb"
3
3
  require_relative "./metadata.rb"
4
4
  require "fileutils"
5
5
 
@@ -0,0 +1,3621 @@
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:gb="https://www.metanorma.org/ns/gb" 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 method="xml" encoding="UTF-8" indent="no"/>
4
+
5
+ <xsl:param name="svg_images"/>
6
+ <xsl:variable name="images" select="document($svg_images)"/>
7
+
8
+
9
+
10
+ <xsl:key name="kfn" match="gb:p/gb:fn" use="@reference"/>
11
+
12
+
13
+
14
+ <xsl:variable name="debug">false</xsl:variable>
15
+ <xsl:variable name="pageWidth" select="'210mm'"/>
16
+ <xsl:variable name="pageHeight" select="'297mm'"/>
17
+
18
+ <xsl:variable name="part" select="normalize-space(/gb:gb-standard/gb:bibdata/gb:ext/gb:structuredidentifier/gb:project-number/@part)"/>
19
+
20
+ <xsl:variable name="standard-name">
21
+ <xsl:call-template name="capitalize">
22
+ <xsl:with-param name="str" select="/gb:gb-standard/gb:bibdata/gb:ext/gb:gbtype/gb:gbscope"/>
23
+ </xsl:call-template>
24
+ <xsl:text> standard (</xsl:text>
25
+ <xsl:call-template name="capitalize">
26
+ <xsl:with-param name="str" select="/gb:gb-standard/gb:bibdata/gb:ext/gb:gbtype/gb:gbmandate"/>
27
+ </xsl:call-template>
28
+ <xsl:text>)</xsl:text>
29
+ </xsl:variable>
30
+
31
+ <xsl:variable name="language" select="/gb:gb-standard/gb:bibdata/gb:language"/>
32
+
33
+
34
+ <!-- Example:
35
+ <item level="1" id="Foreword" display="true">Foreword</item>
36
+ <item id="term-script" display="false">3.2</item>
37
+ -->
38
+ <xsl:variable name="contents">
39
+ <contents>
40
+ <xsl:apply-templates select="/gb:gb-standard/gb:preface/node()" mode="contents"/>
41
+
42
+ <xsl:apply-templates select="/gb:gb-standard/gb:sections/gb:clause[1]" mode="contents"> <!-- [@id = '_scope'] -->
43
+ <xsl:with-param name="sectionNum" select="'1'"/>
44
+ </xsl:apply-templates>
45
+ <xsl:apply-templates select="/gb:gb-standard/gb:bibliography/gb:references[1]" mode="contents"> <!-- [@id = '_normative_references'] -->
46
+ <xsl:with-param name="sectionNum" select="'2'"/>
47
+ </xsl:apply-templates>
48
+ <xsl:apply-templates select="/gb:gb-standard/gb:sections/*[position() &gt; 1]" mode="contents"> <!-- @id != '_scope' -->
49
+ <xsl:with-param name="sectionNumSkew" select="'1'"/>
50
+ </xsl:apply-templates>
51
+ <xsl:apply-templates select="/gb:gb-standard/gb:annex" mode="contents"/>
52
+ <xsl:apply-templates select="/gb:gb-standard/gb:bibliography/gb:references[position() &gt; 1]" mode="contents"/> <!-- @id = '_bibliography' -->
53
+
54
+ <xsl:apply-templates select="//gb:figure" mode="contents"/>
55
+
56
+ <xsl:apply-templates select="//gb:table" mode="contents"/>
57
+ </contents>
58
+ </xsl:variable>
59
+
60
+ <xsl:variable name="lang">
61
+ <xsl:call-template name="getLang"/>
62
+ </xsl:variable>
63
+
64
+ <xsl:template match="/">
65
+ <xsl:message>INFO: Document namespace: '<xsl:value-of select="namespace-uri(/*)"/>'</xsl:message>
66
+ <fo:root font-family="SimSun" font-size="10.5pt" xml:lang="{$lang}"> <!-- -->
67
+ <fo:layout-master-set>
68
+
69
+ <!-- cover page -->
70
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
71
+ <fo:region-body margin-top="10mm" margin-bottom="24mm" margin-left="25mm" margin-right="23mm"/>
72
+ <fo:region-before region-name="cover-header" extent="10mm"/>
73
+ <fo:region-after region-name="cover-footer" extent="24mm"/>
74
+ <fo:region-start region-name="cover-left-region" extent="25mm"/>
75
+ <fo:region-end region-name="cover-right-region" extent="23mm"/>
76
+ </fo:simple-page-master>
77
+
78
+ <!-- contents pages -->
79
+ <!-- odd pages -->
80
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
81
+ <fo:region-body margin-top="35mm" margin-bottom="20mm" margin-left="25mm" margin-right="20mm"/>
82
+ <fo:region-before region-name="header" extent="35mm"/>
83
+ <fo:region-after region-name="footer-odd" extent="20mm"/>
84
+ <fo:region-start region-name="left-region" extent="25mm"/>
85
+ <fo:region-end region-name="right-region" extent="20mm"/>
86
+ </fo:simple-page-master>
87
+ <!-- even pages -->
88
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
89
+ <fo:region-body margin-top="35mm" margin-bottom="25mm" margin-left="20mm" margin-right="25mm"/>
90
+ <fo:region-before region-name="header" extent="35mm"/>
91
+ <fo:region-after region-name="footer-even" extent="20mm"/>
92
+ <fo:region-start region-name="left-region" extent="20mm"/>
93
+ <fo:region-end region-name="right-region" extent="25mm"/>
94
+ </fo:simple-page-master>
95
+ <fo:page-sequence-master master-name="preface">
96
+ <fo:repeatable-page-master-alternatives>
97
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
98
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/>
99
+ </fo:repeatable-page-master-alternatives>
100
+ </fo:page-sequence-master>
101
+ <fo:page-sequence-master master-name="document">
102
+ <fo:repeatable-page-master-alternatives>
103
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="even"/>
104
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="odd"/>
105
+ </fo:repeatable-page-master-alternatives>
106
+ </fo:page-sequence-master>
107
+
108
+ <fo:simple-page-master master-name="last-odd" page-width="215.9mm" page-height="279.4mm">
109
+ <fo:region-body margin-top="20mm" margin-bottom="20mm" margin-left="30mm" margin-right="15mm"/>
110
+ <fo:region-before region-name="header" extent="20mm"/>
111
+ <fo:region-after region-name="footer-odd" extent="20mm"/>
112
+ <fo:region-start region-name="left-region" extent="30mm"/>
113
+ <fo:region-end region-name="right-region" extent="15mm"/>
114
+ </fo:simple-page-master>
115
+ <fo:simple-page-master master-name="last-even" page-width="215.9mm" page-height="279.4mm">
116
+ <fo:region-body margin-top="20mm" margin-bottom="20mm" margin-left="15mm" margin-right="30mm"/>
117
+ <fo:region-before region-name="header" extent="20mm"/>
118
+ <fo:region-after region-name="footer-odd" extent="20mm"/>
119
+ <fo:region-start region-name="left-region" extent="15mm"/>
120
+ <fo:region-end region-name="right-region" extent="30mm"/>
121
+ </fo:simple-page-master>
122
+ <fo:page-sequence-master master-name="last">
123
+ <fo:repeatable-page-master-alternatives>
124
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="last-even"/>
125
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="last-odd"/>
126
+ </fo:repeatable-page-master-alternatives>
127
+ </fo:page-sequence-master>
128
+ </fo:layout-master-set>
129
+
130
+ <xsl:call-template name="addPDFUAmeta"/>
131
+
132
+ <fo:page-sequence master-reference="cover" force-page-count="no-force">
133
+ <fo:flow flow-name="xsl-region-body">
134
+ <fo:block-container>
135
+ <xsl:variable name="ccs" select="normalize-space(/gb:gb-standard/gb:bibdata/gb:ext/gb:ccs)"/>
136
+ <fo:block font-weight="bold" line-height="130%">
137
+ <xsl:if test="$ccs != ''">
138
+ <xsl:text>ICS</xsl:text>
139
+ </xsl:if>
140
+ <xsl:text> </xsl:text>
141
+ <xsl:value-of select="$linebreak"/>
142
+ <xsl:value-of select="substring($ccs, 1, 1)"/>
143
+ <xsl:text> </xsl:text>
144
+ <fo:inline font-family="SimHei" font-weight="normal"><xsl:value-of select="substring($ccs, 2)"/></fo:inline>
145
+ <xsl:text> </xsl:text>
146
+ </fo:block>
147
+ </fo:block-container>
148
+ <!-- GB Logo -->
149
+ <fo:block-container position="absolute" top="3mm" left="119mm"> <!-- top="8mm" -->
150
+ <fo:block>
151
+ <xsl:variable name="gbprefix" select="normalize-space(java:toLowerCase(java:java.lang.String.new(/gb:gb-standard/gb:bibdata/gb:ext/gb:gbtype/gb:gbprefix)))"/>
152
+ <xsl:choose>
153
+ <xsl:when test="$gbprefix = 'db' or $gbprefix = '81'">
154
+ <fo:instream-foreign-object fox:alt-text="Logo">
155
+ <svg xmlns="http://www.w3.org/2000/svg" id="图层_1" data-name="图层 1" viewBox="0 0 133.2 66.6"><title>gb-standard-db</title><path d="M56.5,0H0V66.6H56.5A8.5,8.5,0,0,0,65,58.1V8.5A8.5,8.5,0,0,0,56.5,0ZM42.4,56.3a2.9,2.9,0,0,1-2.9,2.9H22.8V7.5H39.5a2.8,2.8,0,0,1,2.9,2.8Z"/><path d="M133.2,24.7V8.5A8.5,8.5,0,0,0,124.7,0H68.2V66.6h56.5a8.5,8.5,0,0,0,8.5-8.5V41.3a8.6,8.6,0,0,0-6.9-8.3A8.6,8.6,0,0,0,133.2,24.7ZM110.6,56.3a2.9,2.9,0,0,1-2.9,2.9H91.1v-22h16.6a2.9,2.9,0,0,1,2.9,2.8Zm0-29.6a2.9,2.9,0,0,1-2.9,2.9H91.1V7.5h16.6a2.8,2.8,0,0,1,2.9,2.8Z"/></svg>
156
+ </fo:instream-foreign-object>
157
+ </xsl:when>
158
+ <xsl:when test="$gbprefix = 'gb'">
159
+ <fo:instream-foreign-object fox:alt-text="Logo">
160
+ <svg xmlns="http://www.w3.org/2000/svg" width="29.9mm" id="图层_1" data-name="图层 1" viewBox="0 0 232.1 117"><defs><style>.cls-1{fill:#fff;}.cls-1,.cls-2,.cls-3{stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.32px;}.cls-3{fill:none;}</style></defs><title>gb-standard-gb</title><path class="cls-1" d="M201.6,36.5c0,5.6-4.3,8.4-8.8,8.4H147.9L136,58.5h55.2c14,0,22.7-9.1,23.7-19.8.7-6.5-.9-14.1-6-19l-9.6,11A7.6,7.6,0,0,1,201.6,36.5Z"/><path class="cls-1" d="M133.6,102.7V14.6h61c6.4,0,11,2,14.3,5.1L218.1,9C212.5,4.1,204.4.7,192.8.7H120.1V116.3l13.6-13.6Z"/><path class="cls-1" d="M216.6,81.1c0-11.9-7.1-16-7.1-16a82,82,0,0,1-9.5,9.5,6.1,6.1,0,0,1,2.3,5c0,3.3-.7,8.9-12.3,8.9H147.9l-14.2,14.2h50.8C203.9,102.7,216.6,95.7,216.6,81.1Z"/><path class="cls-2" d="M223.1,56.7s8.3-11.6,7-23.5c-.8-7.1-3.8-17.2-12-24.2l-9.2,10.7c5.1,4.9,6.7,12.5,6,19-1,10.7-9.7,19.8-23.7,19.8H136l11.9-13.6V28.6h44.9a9.4,9.4,0,0,1,6.5,2.1l9.6-11c-3.3-3.1-7.9-5.1-14.3-5.1h-61v88.1h.1l14.2-14.2V72.8h44.9c3.5,0,5.8.7,7.2,1.8a82,82,0,0,0,9.5-9.5s7.1,4.1,7.1,16c0,14.6-12.7,21.6-32.1,21.6H133.7l-13.6,13.6h72.7c20.6,0,35-13.6,37.4-25.5S232.1,67,223.1,56.7Z"/><line class="cls-3" x1="133.6" y1="14.6" x2="120.1" y2="0.7"/><polygon class="cls-2" points="70.9 59.6 57.8 74.7 85.1 74.7 98.8 59.6 70.9 59.6"/><path class="cls-2" d="M52,15.9c-8.8,0-35,9.3-36,38-.6,16,4.3,28.2,11.3,36.3l10.8-9.8c-5.2-4.8-9.2-12.2-9.2-23.1,0-21.4,21-27.3,28.9-27.3H113L98.8,15.9Z"/><path class="cls-1" d="M49.8,101.6h49v-42L85.1,74.7V88.5H57.8a31,31,0,0,1-19.7-8.1L27.3,90.2C33.8,97.6,42.2,101.6,49.8,101.6Z"/><polygon class="cls-1" points="57.8 45.4 57.8 74.7 70.9 59.6 98.8 59.6 113 45.4 85.1 45.4 57.8 45.4"/><path class="cls-2" d="M98.8,101.6h-49c-7.6,0-16-4-22.5-11.4L17,99.5c9.3,10.1,22.7,16.8,40.8,16.8H113V45.4L98.8,59.6Z"/><path class="cls-1" d="M16,53.9c1-28.7,27.2-38,36-38H98.8L113,30V.7H57.8C34.2.7.7,22,.7,52.9.7,69.8,5.8,87.2,17,99.5l10.3-9.3C20.3,82.1,15.4,69.9,16,53.9Z"/><line class="cls-3" x1="57.8" y1="45.4" x2="70.9" y2="59.6"/><line class="cls-3" x1="85.1" y1="88.5" x2="98.8" y2="101.6"/><line class="cls-3" x1="98.8" y1="15.9" x2="113" y2="0.7"/></svg>
161
+ </fo:instream-foreign-object>
162
+ </xsl:when>
163
+ <xsl:when test="$gbprefix = 'gjb'">
164
+ <fo:instream-foreign-object fox:alt-text="Logo">
165
+ <svg xmlns="http://www.w3.org/2000/svg" id="图层_1" data-name="图层 1" viewBox="0 0 232.2 88.4"><defs><style>.cls-1{fill:#fff;}.cls-1,.cls-2,.cls-3{stroke:#000;stroke-linecap:round;stroke-linejoin:round;}.cls-3{fill:none;}</style></defs><title>gb-standard-gjb</title><path class="cls-1" d="M209.1,27.6c0,4.2-3.3,6.4-6.7,6.4H168.5l-9,10.2h41.7c10.6,0,17.2-6.9,18-14.9.5-4.9-.7-10.7-4.6-14.4l-7.2,8.3A5.9,5.9,0,0,1,209.1,27.6Z"/><path class="cls-1" d="M157.7,77.6V11h46.1a15.4,15.4,0,0,1,10.8,3.9l7-8.1C217.3,3.1,211.2.5,202.4.5H147.5V87.9l10.3-10.3Z"/><path class="cls-1" d="M220.4,61.3c0-9-5.3-12.1-5.3-12.1a70.7,70.7,0,0,1-7.2,7.2,4.5,4.5,0,0,1,1.7,3.7c0,2.5-.5,6.8-9.3,6.8H168.5L157.8,77.6h38.4C210.9,77.6,220.4,72.3,220.4,61.3Z"/><path class="cls-2" d="M225.4,42.9s6.2-8.8,5.2-17.8c-.6-5.4-2.8-13-9-18.3l-7,8.1c3.9,3.7,5.1,9.5,4.6,14.4-.8,8-7.4,14.9-18,14.9H159.5l9-10.2V21.6h33.9a7.5,7.5,0,0,1,5,1.6l7.2-8.3A15.4,15.4,0,0,0,203.8,11H157.7V77.6h.1l10.7-10.7V55h33.9a9.1,9.1,0,0,1,5.5,1.4,70.7,70.7,0,0,0,7.2-7.2s5.3,3.1,5.3,12.1c0,11-9.5,16.3-24.2,16.3H157.8L147.5,87.9h54.9c15.6,0,26.5-10.3,28.3-19.3S232.1,50.6,225.4,42.9Z"/><line class="cls-3" x1="157.7" y1="11" x2="147.5" y2="0.5"/><path class="cls-2" d="M121.4,87.9c10.3,0,20.3-12.1,20.3-24.5V.5h-21V57.6c0,3.9,0,9.3-7.3,9.3H87.7v21h33.7Z"/><path class="cls-1" d="M120.7,57.6c0,3.9,0,9.3-7.3,9.3H87.7v21L98.8,77.4h19.3c8.3,0,13.3-6,13.3-19V11L141.7.5h-21Z"/><line class="cls-3" x1="131.4" y1="11" x2="120.7" y2="0.5"/><line class="cls-3" x1="98.8" y1="77.4" x2="87.7" y2="66.9"/><polygon class="cls-2" points="51.4 45.1 41.5 56.5 62.2 56.5 72.5 45.1 51.4 45.1"/><path class="cls-2" d="M39.3,12c-6.6,0-26.5,7-27.2,28.7-.4,12.1,3.2,21.4,8.5,27.4l8.2-7.3c-3.9-3.7-7-9.3-7-17.5,0-16.2,15.9-20.6,21.9-20.6H83.3L72.6,12Z"/><path class="cls-1" d="M37.6,76.7h35V45.1L62.2,56.5V66.9H43.7a23.8,23.8,0,0,1-14.9-6.1l-8.2,7.3C25.6,73.8,31.9,76.7,37.6,76.7Z"/><polygon class="cls-1" points="41.5 34.3 41.5 56.5 51.4 45.1 72.5 45.1 83.3 34.3 62.2 34.3 41.5 34.3"/><path class="cls-2" d="M72.6,76.7h-35c-5.7,0-12-2.9-17-8.6l-7.7,7.1c7,7.7,17.1,12.7,30.8,12.7H83.3V34.3L72.6,45.1Z"/><path class="cls-1" d="M12.1,40.7C12.8,19,32.7,12,39.3,12H72.6L83.3,22.7V.5H43.7C25.9.5.5,16.6.5,40c0,12.8,3.9,25.9,12.4,35.2l7.7-7.1C15.3,62.1,11.7,52.8,12.1,40.7Z"/><line class="cls-3" x1="41.5" y1="34.3" x2="51.4" y2="45.1"/><line class="cls-3" x1="62.2" y1="66.9" x2="72.6" y2="76.7"/><line class="cls-3" x1="72.6" y1="12" x2="83.3" y2="0.5"/></svg>
166
+ </fo:instream-foreign-object>
167
+ </xsl:when>
168
+ <xsl:when test="$gbprefix = 'gm'">
169
+ <fo:instream-foreign-object fox:alt-text="Logo">
170
+ <svg xmlns="http://www.w3.org/2000/svg" id="图层_1" data-name="图层 1" viewBox="0 0 187.2 95.1"><title>gb-standard-gm</title><polygon points="160 0 141.8 32.9 123.6 0 96.3 0 96.3 11.3 96.3 95.1 123.6 95.1 123.6 60.7 125 63.3 141.8 93.6 158.5 63.3 160 60.7 160 95.1 187.2 95.1 187.2 11.3 187.2 0 160 0"/><path d="M81.3,0H9.9A10,10,0,0,0,0,9.9V85.2a9.9,9.9,0,0,0,9.9,9.9h43a9.9,9.9,0,0,0,6.8-2.7v2.7H91.2V43.2H48.8v9.5H59.7V78.9A5.7,5.7,0,0,1,54,84.5H37.2a5.7,5.7,0,0,1-5.7-5.6V16.3a5.8,5.8,0,0,1,5.7-5.7H54a5.8,5.8,0,0,1,5.7,5.7V31.2H91.2V9.9A10,10,0,0,0,81.3,0Z"/></svg>
171
+ </fo:instream-foreign-object>
172
+ </xsl:when>
173
+ <xsl:when test="$gbprefix = 'jjf'">
174
+ <fo:instream-foreign-object fox:alt-text="Logo">
175
+ <svg xmlns="http://www.w3.org/2000/svg" id="图层_1" data-name="图层 1" viewBox="0 0 226.8 89.6"><defs><style>.cls-1,.cls-2,.cls-3{stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2px;}.cls-2{fill:#fff;}.cls-3{fill:none;}</style></defs><title>gb-standard-jjf</title><polygon class="cls-1" points="84.3 12.3 75.1 23.9 144.4 23.9 144.4 0.6 133.7 12.3 84.3 12.3"/><polygon class="cls-2" points="75.1 23.9 84.3 12.3 133.7 12.3 144.4 0.6 75.1 0.6 75.1 23.9"/><path class="cls-2" d="M92,73.6c2.6,2.2,6.2,3.4,11.3,3.4,13.4,0,19.1-7.3,19.1-22.2V13.5L110.7,23.7V62s-1,4.6-5.5,4.6a7.5,7.5,0,0,1-3.9-1h0Z" transform="translate(0)"/><path class="cls-1" d="M86.8,57c0,7.1,1.2,13,5.2,16.6l9.3-8h0c-1.9-1.1-2.8-3.3-2.8-6.2V44L86.8,51.7Z" transform="translate(0)"/><path class="cls-1" d="M110.7,12.3V23.7l11.7-10.2V54.8c0,14.9-5.7,22.2-19.1,22.2-5.1,0-8.7-1.2-11.3-3.4l-7.9,6.8c5,4.5,12,7.4,20.8,7.4,19,0,29.1-14.2,29.1-25.8V12.3Z" transform="translate(0)"/><path class="cls-2" d="M86.8,57V51.7L98.5,44H75.1V59.4a28.7,28.7,0,0,0,9,21L92,73.6C88,70,86.8,64.1,86.8,57Z" transform="translate(0)"/><polyline class="cls-3" points="88.4 53.6 86.8 51.7 75.1 44"/><line class="cls-3" x1="84.3" y1="12.3" x2="75.1" y2="0.6"/><polygon class="cls-1" points="9.8 12.3 0.6 23.9 69.9 23.9 69.9 0.6 59.1 12.3 9.8 12.3"/><polygon class="cls-2" points="0.6 23.9 9.8 12.3 59.1 12.3 69.9 0.6 0.6 0.6 0.6 23.9"/><path class="cls-2" d="M17.5,73.6C20,75.8,23.7,77,28.8,77c13.4,0,19-7.3,19-22.2V13.5L36.2,23.7V62s-1.1,4.6-5.5,4.6a8.2,8.2,0,0,1-4-1h0Z" transform="translate(0)"/><path class="cls-1" d="M12.3,57c0,7.1,1.2,13,5.2,16.6l9.2-8h0c-1.8-1.1-2.8-3.3-2.8-6.2V44L12.3,51.7Z" transform="translate(0)"/><path class="cls-1" d="M36.2,12.3V23.7L47.8,13.5V54.8c0,14.9-5.6,22.2-19,22.2-5.1,0-8.8-1.2-11.3-3.4L9.6,80.4c5,4.5,12,7.4,20.7,7.4,19,0,29.2-14.2,29.2-25.8V12.3Z" transform="translate(0)"/><path class="cls-2" d="M12.3,57V51.7L23.9,44H.6V59.4a28.4,28.4,0,0,0,9,21l7.9-6.8C13.5,70,12.3,64.1,12.3,57Z" transform="translate(0)"/><polyline class="cls-3" points="13.9 53.6 12.3 51.7 0.6 44"/><line class="cls-3" x1="9.8" y1="12.3" x2="0.6" y2="0.6"/><polygon class="cls-1" points="226.2 0.6 173.4 0.6 152.4 0.6 149.1 0.6 149.1 89 173.4 89 173.4 24.9 226.2 24.9 226.2 0.6"/><rect class="cls-1" x="161.3" y="36.6" width="64.9" height="24.33"/><polygon class="cls-2" points="162.1 48.8 216.1 48.8 226.2 36.6 173.4 36.6 162.1 48.8"/><polygon class="cls-2" points="152.4 0.6 149.1 0.6 149.1 89 161.3 79.1 161.3 12.3 216.8 12.3 226.2 0.6 173.4 0.6 152.4 0.6"/><line class="cls-3" x1="161.3" y1="12.3" x2="149.1" y2="0.6"/></svg>
176
+ </fo:instream-foreign-object>
177
+ </xsl:when>
178
+ <xsl:when test="$gbprefix = 'zb'">
179
+ <fo:instream-foreign-object fox:alt-text="Logo">
180
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="图层_1" x="0px" y="0px" viewBox="0 0 157.1 81.9" style="enable-background:new 0 0 157.1 81.9;" xml:space="preserve">
181
+ <g>
182
+ <rect x="80.8" width="32.2" height="81.9"/>
183
+ <polygon points="74.9,46.2 42.7,81.9 74.9,81.9 "/>
184
+ <polygon points="33.6,0 0,0 0,37.8 "/>
185
+ <path d="M157.1,61.1c0-8.6-6-17.5-15.4-21c7.7-1.1,14.6-10.4,14.6-21.2c0-10.8-9.5-19-27.7-19h-11.7v81.1 c5.3,0.4,11.4,0.8,17.7,0.8C153,81.9,157.1,69.8,157.1,61.1z"/>
186
+ <polygon points="75.6,0 40.6,0 0,81.9 35,81.9 "/>
187
+ </g>
188
+ </svg>
189
+ </fo:instream-foreign-object>
190
+ </xsl:when>
191
+ <xsl:when test="$gbprefix = 'ls' or $gbprefix = 'abc'">
192
+ <xsl:attribute name="text-align">right</xsl:attribute>
193
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
194
+ <fo:inline font-size="36pt"><xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:ext/gb:gbtype/gb:gbprefix"/></fo:inline>
195
+ </xsl:when>
196
+ <!-- <xsl:when test="$gbprefix = 'gb'">
197
+ <fo:external-graphic src="{concat('data:image/gif;base64,', normalize-space($Image-GB-Logo))}" width="29.9mm" content-height="14.8mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image GB Logo"/>
198
+ </xsl:when> -->
199
+ <xsl:otherwise> </xsl:otherwise>
200
+ </xsl:choose>
201
+ </fo:block>
202
+ </fo:block-container>
203
+ <!-- National standard (Recommended) -->
204
+ <fo:block-container position="absolute" left="0mm" top="28mm" width="170mm" text-align="center">
205
+ <fo:block font-weight="bold" font-size="12pt"> <!-- font-stretch="wider" not supported by FOP-->
206
+ <xsl:call-template name="addLetterSpacing">
207
+ <xsl:with-param name="text" select="$standard-name"/>
208
+ <xsl:with-param name="letter-spacing" select="0.7"/>
209
+ </xsl:call-template>
210
+ </fo:block>
211
+ </fo:block-container>
212
+ <fo:block-container position="absolute" left="0mm" top="43mm" height="46.4mm" width="165mm" text-align="right">
213
+ <fo:block>
214
+ <!-- GB/T/303 80021.1 -->
215
+ <fo:block font-family="SimHei" font-size="14pt">
216
+ <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:docidentifier[@type = 'gb']"/>
217
+ </fo:block>
218
+ <!-- Partly Supercedes GB/T 88021-2016 -->
219
+ <fo:block margin-top="2.85pt">
220
+ <xsl:variable name="title-partly-supercedes">
221
+ <xsl:call-template name="getTitle">
222
+ <xsl:with-param name="name" select="'title-partly-supercedes'"/>
223
+ </xsl:call-template>
224
+ </xsl:variable>
225
+ <xsl:value-of select="$title-partly-supercedes"/>
226
+ <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:relation[@type='obsoletes']/gb:bibitem/gb:docidentifier"/>
227
+ </fo:block>
228
+ </fo:block>
229
+ </fo:block-container>
230
+ <fo:block-container position="absolute" left="0mm" top="66mm" height="2mm" width="170mm" border-top="1pt solid black">
231
+ <fo:block> </fo:block>
232
+ </fo:block-container>
233
+ <fo:block-container position="absolute" left="-2.5mm" top="106mm" height="124mm" width="165mm" text-align="center">
234
+ <!-- Cereals and pulses—Specifications and test methods—Part 1: Rice -->
235
+ <fo:block font-size="26pt" line-height="130%">
236
+ <xsl:attribute name="font-family">
237
+ <xsl:choose>
238
+ <xsl:when test="$lang = 'zh'">SimSun</xsl:when>
239
+ <xsl:otherwise>Cambria</xsl:otherwise>
240
+ </xsl:choose>
241
+ </xsl:attribute>
242
+ <xsl:call-template name="insertTitle">
243
+ <xsl:with-param name="lang" select="$language"/>
244
+ </xsl:call-template>
245
+ </fo:block>
246
+ <fo:block font-size="14pt" margin-top="28.35pt" margin-bottom="28.35pt">
247
+ <xsl:variable name="secondlang">
248
+ <xsl:choose>
249
+ <xsl:when test="$language = 'en'">zh</xsl:when>
250
+ <xsl:when test="$language = 'zh'">en</xsl:when>
251
+ </xsl:choose>
252
+ </xsl:variable>
253
+ <xsl:if test="$secondlang = 'en'">
254
+ <xsl:attribute name="font-family">SimHei</xsl:attribute>
255
+ </xsl:if>
256
+ <xsl:call-template name="insertTitle">
257
+ <xsl:with-param name="lang" select="$secondlang"/>
258
+ </xsl:call-template>
259
+ </fo:block>
260
+ <!-- (ISO 17301-1:2016, IDT) -->
261
+ <fo:block font-size="14pt" margin-top="30pt">
262
+ <xsl:text> </xsl:text>
263
+ <xsl:if test="/gb:gb-standard/gb:bibdata/gb:relation[@type='adoptedFrom']/gb:bibitem/gb:docidentifier">
264
+ <xsl:text>(</xsl:text>
265
+ <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:relation[@type='adoptedFrom']/gb:bibitem/gb:docidentifier"/>
266
+ <xsl:text>, </xsl:text>
267
+ <xsl:text> IDT</xsl:text>
268
+ <xsl:text>)</xsl:text>
269
+ </xsl:if>
270
+ <xsl:text> </xsl:text>
271
+ </fo:block>
272
+ <!-- (CD) -->
273
+ <fo:block font-size="12pt" margin-top="30pt">
274
+ <xsl:text>(</xsl:text>
275
+ <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:status/gb:stage/@abbreviation"/>
276
+ <xsl:text>)</xsl:text>
277
+ </fo:block>
278
+ <fo:block text-align="justify">
279
+ <!-- When submitting feedback, please attach any relevant patents that you are aware of, together with supporting documents. -->
280
+ <xsl:apply-templates select="/gb:gb-standard/gb:boilerplate/gb:legal-statement"/>
281
+ </fo:block>
282
+ <fo:block margin-top="9.05pt">
283
+ <xsl:text>(</xsl:text>
284
+ <xsl:variable name="title-completion-date">
285
+ <xsl:call-template name="getTitle">
286
+ <xsl:with-param name="name" select="'title-completion-date'"/>
287
+ </xsl:call-template>
288
+ </xsl:variable>
289
+ <xsl:value-of select="$title-completion-date"/>
290
+ <xsl:text>: </xsl:text>
291
+ <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:version/gb:revision-date"/>
292
+ <xsl:text>)</xsl:text>
293
+ </fo:block>
294
+ </fo:block-container>
295
+ <fo:block-container position="absolute" left="0mm" top="239mm" width="170mm" border-bottom="1pt solid black">
296
+ <fo:block font-family="SimHei" font-size="14pt" text-align-last="justify" margin-bottom="2.5mm">
297
+ <xsl:variable name="title-issuance-date">
298
+ <xsl:call-template name="getTitle">
299
+ <xsl:with-param name="name" select="'title-issuance-date'"/>
300
+ </xsl:call-template>
301
+ </xsl:variable>
302
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-issuance-date),'#',/gb:gb-standard/gb:bibdata/gb:date[@type='issued']/gb:on)"/>
303
+
304
+ <fo:inline keep-together.within-line="always">
305
+ <fo:leader leader-pattern="space"/>
306
+ </fo:inline>
307
+
308
+ <xsl:variable name="title-implementation-date">
309
+ <xsl:call-template name="getTitle">
310
+ <xsl:with-param name="name" select="'title-implementation-date'"/>
311
+ </xsl:call-template>
312
+ </xsl:variable>
313
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-implementation-date),'#',/gb:gb-standard/gb:bibdata/gb:date[@type='implemented']/gb:on)"/>
314
+
315
+ </fo:block>
316
+ </fo:block-container>
317
+ <fo:block break-after="page"/>
318
+ <fo:block> </fo:block>
319
+ </fo:flow>
320
+ </fo:page-sequence>
321
+
322
+
323
+
324
+ <fo:page-sequence master-reference="preface" format="I" initial-page-number="1" force-page-count="no-force">
325
+ <xsl:call-template name="insertHeaderFooter"/>
326
+ <fo:flow flow-name="xsl-region-body">
327
+ <fo:block-container>
328
+
329
+ <fo:block font-family="SimHei" font-size="16pt" margin-top="6pt" margin-bottom="32pt" text-align="center">
330
+ <xsl:variable name="title-toc">
331
+ <xsl:call-template name="getTitle">
332
+ <xsl:with-param name="name" select="'title-toc'"/>
333
+ </xsl:call-template>
334
+ </xsl:variable>
335
+ <xsl:value-of select="$title-toc"/>
336
+ </fo:block>
337
+
338
+ <xsl:if test="$debug = 'true'">
339
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
340
+ DEBUG
341
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
342
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
343
+ </xsl:if>
344
+
345
+ <fo:block line-height="220%">
346
+ <xsl:variable name="margin-left">12</xsl:variable>
347
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'][not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
348
+ <fo:block text-align-last="justify">
349
+ <xsl:if test="@level =2">
350
+ <xsl:attribute name="margin-left">3.7mm</xsl:attribute>
351
+ </xsl:if>
352
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
353
+ <xsl:if test="normalize-space(@section) != '' and not(@display-section = 'false')">
354
+ <fo:inline>
355
+ <xsl:if test="@type = 'annex' and @level = 1">
356
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
357
+ </xsl:if>
358
+ <xsl:value-of select="@section"/>
359
+ </fo:inline>
360
+ <xsl:if test="not(@type = 'annex' and @level = 1)">
361
+ <xsl:text>. </xsl:text>
362
+ </xsl:if>
363
+ <xsl:if test="@type = 'annex' and @level = 1">
364
+ <xsl:text> </xsl:text>
365
+ </xsl:if>
366
+ </xsl:if>
367
+ <xsl:if test="@addon != ''">
368
+ <fo:inline font-weight="normal">(<xsl:value-of select="@addon"/>)</fo:inline>
369
+ <xsl:text> </xsl:text>
370
+ </xsl:if>
371
+ <xsl:value-of select="text()"/>
372
+ <xsl:text> </xsl:text>
373
+ <fo:inline keep-together.within-line="always">
374
+ <fo:leader font-weight="normal" leader-pattern="dots"/>
375
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
376
+ </fo:inline>
377
+ </fo:basic-link>
378
+
379
+ </fo:block>
380
+
381
+ </xsl:for-each>
382
+ </fo:block>
383
+ </fo:block-container>
384
+
385
+ <!-- Foreword, Introduction -->
386
+ <fo:block line-height="150%">
387
+ <xsl:apply-templates select="/gb:gb-standard/gb:preface/node()"/>
388
+ </fo:block>
389
+
390
+ </fo:flow>
391
+ </fo:page-sequence>
392
+
393
+ <fo:page-sequence master-reference="document" format="1" initial-page-number="1" force-page-count="no-force">
394
+ <fo:static-content flow-name="xsl-footnote-separator">
395
+ <fo:block margin-left="7.4mm">
396
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
397
+ </fo:block>
398
+ </fo:static-content>
399
+ <xsl:call-template name="insertHeaderFooter"/>
400
+ <fo:flow flow-name="xsl-region-body">
401
+ <fo:block line-height="150%">
402
+
403
+ <!-- Cereals and pulses—Specifications and test methods—Part 1: Rice -->
404
+ <fo:block font-family="SimHei" font-size="16pt" text-align="center" line-height="130%" margin-bottom="18pt">
405
+ <xsl:call-template name="insertTitle">
406
+ <xsl:with-param name="lang" select="$language"/>
407
+ </xsl:call-template>
408
+ </fo:block>
409
+
410
+ <xsl:apply-templates select="/gb:gb-standard/gb:sections/gb:clause[1]"> <!-- Scope -->
411
+ <xsl:with-param name="sectionNum" select="'1'"/>
412
+ </xsl:apply-templates>
413
+
414
+ <!-- Normative references -->
415
+ <xsl:apply-templates select="/gb:gb-standard/gb:bibliography/gb:references[1]">
416
+ <xsl:with-param name="sectionNum" select="'2'"/>
417
+ </xsl:apply-templates>
418
+
419
+ <!-- Main sections -->
420
+ <xsl:apply-templates select="/gb:gb-standard/gb:sections/*[position() &gt; 1]">
421
+ <xsl:with-param name="sectionNumSkew" select="'1'"/>
422
+ </xsl:apply-templates>
423
+
424
+ <!-- Annex(s) -->
425
+ <xsl:apply-templates select="/gb:gb-standard/gb:annex"/>
426
+
427
+ <!-- Bibliography -->
428
+ <xsl:apply-templates select="/gb:gb-standard/gb:bibliography/gb:references[position() &gt; 1]"/>
429
+
430
+ </fo:block>
431
+ </fo:flow>
432
+ </fo:page-sequence>
433
+
434
+ <fo:page-sequence master-reference="last" force-page-count="no-force">
435
+ <fo:flow flow-name="xsl-region-body">
436
+ <fo:block-container font-size="12pt">
437
+ <fo:block margin-top="14pt" margin-bottom="14pt">
438
+ <xsl:value-of select="$standard-name"/>
439
+ </fo:block>
440
+ <fo:block margin-top="14pt" margin-bottom="14pt">
441
+ <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:title[@language = 'zh' and @type = 'title-main']"/>
442
+ </fo:block>
443
+ <fo:block margin-top="14pt" margin-bottom="14pt">
444
+ <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:docidentifier[@type = 'gb']"/>
445
+ </fo:block>
446
+ </fo:block-container>
447
+ </fo:flow>
448
+ </fo:page-sequence>
449
+
450
+ </fo:root>
451
+ </xsl:template>
452
+
453
+ <xsl:template name="insertTitle">
454
+ <xsl:param name="lang" select="'en'"/>
455
+ <xsl:variable name="delimeter">
456
+ <xsl:choose>
457
+ <xsl:when test="$lang = 'zh'"> </xsl:when>
458
+ <xsl:otherwise>—</xsl:otherwise>
459
+ </xsl:choose>
460
+ </xsl:variable>
461
+
462
+ <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:title[@language = $lang and @type='title-intro']"/>
463
+ <xsl:variable name="title-main" select="/gb:gb-standard/gb:bibdata/gb:title[@language = $lang and @type = 'title-main']"/>
464
+ <xsl:if test="normalize-space($title-main) != ''">
465
+ <xsl:value-of select="$delimeter"/>
466
+ <xsl:value-of select="$title-main"/>
467
+ </xsl:if>
468
+ <xsl:variable name="title-part" select="/gb:gb-standard/gb:bibdata/gb:title[@language = $lang and @type = 'title-part']"/>
469
+ <xsl:if test="normalize-space($title-part) != ''">
470
+ <xsl:value-of select="$delimeter"/>
471
+ <xsl:if test="$part != ''">
472
+ <xsl:choose>
473
+ <xsl:when test="$lang = 'zh'">
474
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='zh']),'#',$part)"/>
475
+ </xsl:when>
476
+ <xsl:otherwise>
477
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
478
+ </xsl:otherwise>
479
+ </xsl:choose>
480
+ </xsl:if>
481
+ <xsl:value-of select="$title-part"/>
482
+ </xsl:if>
483
+ </xsl:template>
484
+
485
+ <!-- for pass the paremeter 'sectionNum' over templates, like 'tunnel' parameter in XSLT 2.0 -->
486
+ <xsl:template match="node()">
487
+ <xsl:param name="sectionNum"/>
488
+ <xsl:param name="sectionNumSkew"/>
489
+ <xsl:apply-templates>
490
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
491
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
492
+ </xsl:apply-templates>
493
+ </xsl:template>
494
+
495
+ <!-- ============================= -->
496
+ <!-- CONTENTS -->
497
+ <!-- ============================= -->
498
+ <xsl:template match="node()" mode="contents">
499
+ <xsl:param name="sectionNum"/>
500
+ <xsl:param name="sectionNumSkew"/>
501
+ <xsl:apply-templates mode="contents">
502
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
503
+ <xsl:with-param name="sectionNumSkew" select="$sectionNumSkew"/>
504
+ </xsl:apply-templates>
505
+ </xsl:template>
506
+
507
+
508
+ <!-- calculate main section number (1,2,3) and pass it deep into templates -->
509
+ <!-- it's necessary, because there is itu:bibliography/itu:references from other section, but numbering should be sequental -->
510
+ <xsl:template match="gb:gb-standard/gb:sections/*" mode="contents">
511
+ <xsl:param name="sectionNum"/>
512
+ <xsl:param name="sectionNumSkew" select="0"/>
513
+ <xsl:variable name="sectionNum_">
514
+ <xsl:choose>
515
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
516
+ <xsl:when test="$sectionNumSkew != 0">
517
+ <xsl:variable name="number"><xsl:number count="*"/></xsl:variable> <!-- gb:sections/gb:clause | gb:sections/gb:terms -->
518
+ <xsl:value-of select="$number + $sectionNumSkew"/>
519
+ </xsl:when>
520
+ <xsl:otherwise>
521
+ <xsl:number count="*"/>
522
+ </xsl:otherwise>
523
+ </xsl:choose>
524
+ </xsl:variable>
525
+ <xsl:apply-templates mode="contents">
526
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
527
+ </xsl:apply-templates>
528
+ </xsl:template>
529
+
530
+ <!-- Any node with title element - clause, definition, annex,... -->
531
+ <xsl:template match="gb:title | gb:preferred" mode="contents">
532
+ <xsl:param name="sectionNum"/>
533
+ <!-- sectionNum=<xsl:value-of select="$sectionNum"/> -->
534
+ <xsl:variable name="id">
535
+ <xsl:call-template name="getId"/>
536
+ </xsl:variable>
537
+
538
+ <xsl:variable name="level">
539
+ <xsl:call-template name="getLevel"/>
540
+ </xsl:variable>
541
+
542
+ <xsl:variable name="section">
543
+ <xsl:call-template name="getSection">
544
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
545
+ </xsl:call-template>
546
+ </xsl:variable>
547
+
548
+ <xsl:variable name="display">
549
+ <xsl:choose>
550
+ <xsl:when test="ancestor::gb:bibitem">false</xsl:when>
551
+ <xsl:when test="ancestor::gb:term">false</xsl:when>
552
+ <xsl:when test="ancestor::gb:annex and $level &gt;= 3">false</xsl:when>
553
+ <xsl:when test="$level &lt;= 3">true</xsl:when>
554
+ <xsl:otherwise>false</xsl:otherwise>
555
+ </xsl:choose>
556
+ </xsl:variable>
557
+
558
+ <xsl:variable name="display-section">true</xsl:variable>
559
+
560
+ <xsl:variable name="type">
561
+ <xsl:value-of select="local-name(..)"/>
562
+ </xsl:variable>
563
+
564
+ <xsl:variable name="root">
565
+ <xsl:choose>
566
+ <xsl:when test="ancestor::gb:annex">annex</xsl:when>
567
+ </xsl:choose>
568
+ </xsl:variable>
569
+
570
+ <item id="{$id}" level="{$level}" section="{$section}" display-section="{$display-section}" display="{$display}" type="{$type}" root="{$root}">
571
+ <xsl:attribute name="addon">
572
+ <xsl:if test="local-name(..) = 'annex'">
573
+ <xsl:variable name="obligation" select="../@obligation"/>
574
+ <xsl:variable name="title-obligation-normative">
575
+ <xsl:call-template name="getTitle">
576
+ <xsl:with-param name="name" select="'title-obligation-normative'"/>
577
+ </xsl:call-template>
578
+ </xsl:variable>
579
+ <xsl:choose>
580
+ <xsl:when test="$obligation = 'normative'"><xsl:value-of select="$title-obligation-normative"/></xsl:when>
581
+ <xsl:otherwise><xsl:value-of select="$obligation"/></xsl:otherwise>
582
+ </xsl:choose>
583
+ </xsl:if>
584
+ </xsl:attribute>
585
+ <xsl:value-of select="."/>
586
+ </item>
587
+
588
+ <xsl:apply-templates mode="contents">
589
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
590
+ </xsl:apply-templates>
591
+
592
+ </xsl:template>
593
+
594
+
595
+ <xsl:template match="gb:figure" mode="contents">
596
+ <item level="" id="{@id}" display="false">
597
+ <xsl:attribute name="section">
598
+ <xsl:call-template name="getFigureNumber"/>
599
+ </xsl:attribute>
600
+ </item>
601
+ </xsl:template>
602
+
603
+ <xsl:template match="gb:table" mode="contents">
604
+ <xsl:param name="sectionNum"/>
605
+ <xsl:variable name="annex-id" select="ancestor::gb:annex/@id"/>
606
+ <item level="" id="{@id}" display="false" type="table">
607
+ <xsl:attribute name="section">
608
+ <xsl:variable name="title-table">
609
+ <xsl:call-template name="getTitle">
610
+ <xsl:with-param name="name" select="'title-table'"/>
611
+ </xsl:call-template>
612
+ </xsl:variable>
613
+ <xsl:value-of select="$title-table"/>
614
+ <xsl:choose>
615
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
616
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
617
+ </xsl:when>
618
+ <xsl:when test="ancestor::*[local-name()='annex']">
619
+ <xsl:number format="A-" count="gb:annex"/>
620
+ <xsl:number format="1" level="any" count="gb:table[ancestor::gb:annex[@id = $annex-id]]"/>
621
+ </xsl:when>
622
+ <xsl:otherwise>
623
+ <!-- <xsl:number format="1"/> -->
624
+ <xsl:number format="1" level="any" count="*[local-name()='sections']//*[local-name()='table']"/>
625
+ </xsl:otherwise>
626
+ </xsl:choose>
627
+ </xsl:attribute>
628
+ <xsl:value-of select="gb:name/text()"/>
629
+ </item>
630
+ </xsl:template>
631
+
632
+ <xsl:template match="gb:formula" mode="contents">
633
+ <item level="" id="{@id}" display="false">
634
+ <xsl:attribute name="section">
635
+ <xsl:variable name="title-formula">
636
+ <xsl:call-template name="getTitle">
637
+ <xsl:with-param name="name" select="'title-formula'"/>
638
+ </xsl:call-template>
639
+ </xsl:variable>
640
+ <xsl:value-of select="$title-formula"/><xsl:number format="(A.1)" level="multiple" count="gb:annex | gb:formula"/>
641
+ </xsl:attribute>
642
+ </item>
643
+ </xsl:template>
644
+
645
+ <xsl:template match="gb:li" mode="contents">
646
+ <xsl:param name="sectionNum"/>
647
+ <item level="" id="{@id}" display="false" type="li">
648
+ <xsl:attribute name="section">
649
+ <xsl:call-template name="getListItemFormat"/>
650
+ </xsl:attribute>
651
+ <xsl:attribute name="parent_section">
652
+ <xsl:for-each select="ancestor::*[not(local-name() = 'p' or local-name() = 'ol')][1]">
653
+ <xsl:call-template name="getSection">
654
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
655
+ </xsl:call-template>
656
+ </xsl:for-each>
657
+ </xsl:attribute>
658
+ </item>
659
+ <xsl:apply-templates mode="contents">
660
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
661
+ </xsl:apply-templates>
662
+ </xsl:template>
663
+
664
+ <xsl:template name="getListItemFormat">
665
+ <xsl:choose>
666
+ <xsl:when test="local-name(..) = 'ul'">—</xsl:when> <!-- dash -->
667
+ <xsl:otherwise> <!-- for ordered lists -->
668
+ <xsl:choose>
669
+ <xsl:when test="../@type = 'arabic'">
670
+ <xsl:number format="a)"/>
671
+ </xsl:when>
672
+ <xsl:when test="../@type = 'alphabet'">
673
+ <xsl:number format="a)"/>
674
+ </xsl:when>
675
+ <xsl:otherwise>
676
+ <xsl:number format="1."/>
677
+ </xsl:otherwise>
678
+ </xsl:choose>
679
+ </xsl:otherwise>
680
+ </xsl:choose>
681
+ </xsl:template>
682
+
683
+ <!-- ============================= -->
684
+ <!-- ============================= -->
685
+
686
+
687
+ <xsl:template match="gb:license-statement//gb:title">
688
+ <fo:block text-align="center" font-weight="bold">
689
+ <xsl:apply-templates/>
690
+ </fo:block>
691
+ </xsl:template>
692
+
693
+ <xsl:template match="gb:license-statement//gb:p">
694
+ <fo:block margin-left="1.5mm" margin-right="1.5mm">
695
+ <xsl:if test="following-sibling::gb:p">
696
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
697
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
698
+ </xsl:if>
699
+ <xsl:apply-templates/>
700
+ </fo:block>
701
+ </xsl:template>
702
+
703
+ <!-- <fo:block margin-bottom="12pt">© ISO 2019, Published in Switzerland.</fo:block>
704
+ <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>
705
+ <fo:block font-size="10pt" text-indent="7.1mm">
706
+ <fo:block>ISO copyright office</fo:block>
707
+ <fo:block>Ch. de Blandonnet 8 • CP 401</fo:block>
708
+ <fo:block>CH-1214 Vernier, Geneva, Switzerland</fo:block>
709
+ <fo:block>Tel. + 41 22 749 01 11</fo:block>
710
+ <fo:block>Fax + 41 22 749 09 47</fo:block>
711
+ <fo:block>copyright@iso.org</fo:block>
712
+ <fo:block>www.iso.org</fo:block>
713
+ </fo:block> -->
714
+
715
+ <xsl:template match="gb:copyright-statement//gb:p">
716
+ <fo:block>
717
+ <xsl:if test="preceding-sibling::gb:p">
718
+ <!-- <xsl:attribute name="font-size">10pt</xsl:attribute> -->
719
+ </xsl:if>
720
+ <xsl:if test="following-sibling::gb:p">
721
+ <!-- <xsl:attribute name="margin-bottom">12pt</xsl:attribute> -->
722
+ <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
723
+ </xsl:if>
724
+ <xsl:if test="contains(@id, 'address')"> <!-- not(following-sibling::gb:p) -->
725
+ <!-- <xsl:attribute name="margin-left">7.1mm</xsl:attribute> -->
726
+ <xsl:attribute name="margin-left">4mm</xsl:attribute>
727
+ </xsl:if>
728
+ <xsl:apply-templates/>
729
+ </fo:block>
730
+ </xsl:template>
731
+
732
+ <!-- Foreword, Introduction -->
733
+ <xsl:template match="gb:gb-standard/gb:preface/*">
734
+ <fo:block break-after="page"/>
735
+ <xsl:apply-templates/>
736
+ </xsl:template>
737
+
738
+
739
+ <!-- clause, terms, clause, ...-->
740
+ <xsl:template match="gb:gb-standard/gb:sections/*">
741
+ <xsl:param name="sectionNum"/>
742
+ <xsl:param name="sectionNumSkew" select="0"/>
743
+ <fo:block>
744
+ <xsl:variable name="pos"><xsl:number count="gb:sections/gb:clause | gb:sections/gb:terms"/></xsl:variable>
745
+ <xsl:if test="$pos &gt;= 2">
746
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
747
+ </xsl:if>
748
+ <!-- pos=<xsl:value-of select="$pos" /> -->
749
+ <xsl:variable name="sectionNum_">
750
+ <xsl:choose>
751
+ <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
752
+ <xsl:when test="$sectionNumSkew != 0">
753
+ <xsl:variable name="number"><xsl:number count="gb:sections/gb:clause | gb:sections/gb:terms"/></xsl:variable>
754
+ <xsl:value-of select="$number + $sectionNumSkew"/>
755
+ </xsl:when>
756
+ </xsl:choose>
757
+ </xsl:variable>
758
+ <xsl:if test="not(gb:title)">
759
+ <fo:block margin-top="3pt" margin-bottom="12pt">
760
+ <xsl:value-of select="$sectionNum_"/><xsl:number format=".1 " level="multiple" count="gb:clause"/>
761
+ </fo:block>
762
+ </xsl:if>
763
+ <xsl:apply-templates>
764
+ <xsl:with-param name="sectionNum" select="$sectionNum_"/>
765
+ </xsl:apply-templates>
766
+ </fo:block>
767
+ </xsl:template>
768
+
769
+
770
+ <xsl:template match="gb:clause//gb:clause[not(gb:title)]">
771
+ <xsl:param name="sectionNum"/>
772
+ <xsl:variable name="section">
773
+ <xsl:call-template name="getSection">
774
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
775
+ </xsl:call-template>
776
+ </xsl:variable>
777
+ <fo:block margin-top="6pt" margin-bottom="6pt" keep-with-next="always">
778
+ <fo:inline font-family="SimHei">
779
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
780
+ </fo:inline>
781
+ </fo:block>
782
+ <xsl:apply-templates>
783
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
784
+ </xsl:apply-templates>
785
+ </xsl:template>
786
+
787
+
788
+ <xsl:template match="gb:title">
789
+ <xsl:param name="sectionNum"/>
790
+
791
+ <xsl:variable name="parent-name" select="local-name(..)"/>
792
+ <xsl:variable name="references_num_current">
793
+ <xsl:number level="any" count="gb:references"/>
794
+ </xsl:variable>
795
+
796
+ <xsl:variable name="id">
797
+ <xsl:call-template name="getId"/>
798
+ </xsl:variable>
799
+
800
+ <xsl:variable name="level">
801
+ <xsl:call-template name="getLevel"/>
802
+ </xsl:variable>
803
+
804
+ <xsl:variable name="section">
805
+ <xsl:call-template name="getSection">
806
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
807
+ </xsl:call-template>
808
+ </xsl:variable>
809
+
810
+ <xsl:variable name="font-family">
811
+ <xsl:choose>
812
+ <xsl:when test="ancestor::gb:annex and $level &gt;= 3">SimSun</xsl:when>
813
+ <xsl:otherwise>SimHei</xsl:otherwise>
814
+ </xsl:choose>
815
+ </xsl:variable>
816
+
817
+ <xsl:variable name="font-size">
818
+ <xsl:choose>
819
+ <xsl:when test="ancestor::gb:preface">16pt</xsl:when>
820
+ <xsl:otherwise>10.5pt</xsl:otherwise>
821
+ </xsl:choose>
822
+ </xsl:variable>
823
+
824
+ <xsl:variable name="element-name">
825
+ <xsl:choose>
826
+ <xsl:when test="../@inline-header = 'true'">fo:inline</xsl:when>
827
+ <xsl:otherwise>fo:block</xsl:otherwise>
828
+ </xsl:choose>
829
+ </xsl:variable>
830
+
831
+ <xsl:choose>
832
+ <xsl:when test="$parent-name = 'annex'">
833
+ <fo:block id="{$id}" font-family="{$font-family}" font-size="{$font-size}" text-align="center" margin-bottom="12pt" keep-with-next="always">
834
+ <xsl:value-of select="$section"/>
835
+ <xsl:if test=" ../@obligation">
836
+ <xsl:value-of select="$linebreak"/>
837
+ <fo:inline font-weight="normal">
838
+ <xsl:text>(</xsl:text>
839
+ <xsl:variable name="obligation" select="../@obligation"/>
840
+ <xsl:variable name="title-obligation-normative">
841
+ <xsl:call-template name="getTitle">
842
+ <xsl:with-param name="name" select="'title-obligation-normative'"/>
843
+ </xsl:call-template>
844
+ </xsl:variable>
845
+ <xsl:choose>
846
+ <xsl:when test="$obligation = 'normative'"><xsl:value-of select="$title-obligation-normative"/></xsl:when>
847
+ <xsl:otherwise><xsl:value-of select="$obligation"/></xsl:otherwise>
848
+ </xsl:choose>
849
+ <xsl:text>)</xsl:text>
850
+ </fo:inline>
851
+ </xsl:if>
852
+ <fo:block margin-top="14pt" margin-bottom="24pt"><xsl:apply-templates/></fo:block>
853
+ </fo:block>
854
+ </xsl:when>
855
+ <xsl:when test="$parent-name = 'references' and $references_num_current != 1"> <!-- Bibliography -->
856
+ <fo:block id="{$id}" font-family="{$font-family}" text-align="center" margin-top="6pt" margin-bottom="16pt" keep-with-next="always">
857
+ <xsl:apply-templates/>
858
+ </fo:block>
859
+ </xsl:when>
860
+
861
+ <xsl:otherwise>
862
+ <xsl:element name="{$element-name}">
863
+ <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
864
+ <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
865
+ <xsl:attribute name="font-family"><xsl:value-of select="$font-family"/></xsl:attribute>
866
+ <xsl:attribute name="margin-top">
867
+ <xsl:choose>
868
+ <xsl:when test="ancestor::gb:preface">8pt</xsl:when>
869
+ <xsl:when test="$level = 2 and ancestor::gb:annex">10pt</xsl:when>
870
+ <xsl:when test="$level = 1">16pt</xsl:when>
871
+ <xsl:when test="$level = ''">6pt</xsl:when>
872
+ <xsl:otherwise>12pt</xsl:otherwise>
873
+ </xsl:choose>
874
+ </xsl:attribute>
875
+ <xsl:attribute name="margin-bottom">
876
+ <xsl:choose>
877
+ <xsl:when test="ancestor::gb:preface">24pt</xsl:when>
878
+ <xsl:when test="$level = 1">16pt</xsl:when>
879
+ <xsl:otherwise>8pt</xsl:otherwise>
880
+ </xsl:choose>
881
+ </xsl:attribute>
882
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
883
+ <xsl:if test="ancestor::gb:preface">
884
+ <xsl:attribute name="text-align">center</xsl:attribute>
885
+ <xsl:attribute name="font-family">SimHei</xsl:attribute>
886
+ </xsl:if>
887
+ <xsl:if test="$element-name = 'fo:inline'">
888
+ <xsl:attribute name="padding-left">7.4mm</xsl:attribute>
889
+ </xsl:if>
890
+
891
+ <xsl:value-of select="$section"/>
892
+ <xsl:if test="$section != ''">. </xsl:if>
893
+
894
+ <xsl:apply-templates/>
895
+ </xsl:element>
896
+
897
+ <xsl:if test="$element-name = 'fo:inline' and not(following-sibling::gb:p)">
898
+ <!-- <fo:block> -->
899
+ <xsl:value-of select="$linebreak"/>
900
+ <!-- </fo:block> -->
901
+ </xsl:if>
902
+ </xsl:otherwise>
903
+ </xsl:choose>
904
+ </xsl:template>
905
+
906
+
907
+
908
+ <xsl:template match="gb:p">
909
+ <xsl:param name="inline" select="'false'"/>
910
+ <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
911
+ <xsl:variable name="element-name">
912
+ <xsl:choose>
913
+ <xsl:when test="$inline = 'true'">fo:inline</xsl:when>
914
+ <xsl:when test="../@inline-header = 'true' and $previous-element = 'title'">fo:inline</xsl:when> <!-- first paragraph after inline title -->
915
+ <!-- <xsl:when test="local-name(..) = 'admonition'">fo:inline</xsl:when> -->
916
+ <xsl:otherwise>fo:block</xsl:otherwise>
917
+ </xsl:choose>
918
+ </xsl:variable>
919
+ <xsl:element name="{$element-name}">
920
+ <xsl:attribute name="text-align">
921
+ <xsl:choose>
922
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
923
+ <xsl:when test="ancestor::gb:td/@align"><xsl:value-of select="ancestor::gb:td/@align"/></xsl:when>
924
+ <xsl:when test="ancestor::gb:th/@align"><xsl:value-of select="ancestor::gb:th/@align"/></xsl:when>
925
+ <xsl:otherwise>justify</xsl:otherwise><!-- left -->
926
+ </xsl:choose>
927
+ </xsl:attribute>
928
+ <xsl:attribute name="text-indent">
929
+ <xsl:choose>
930
+ <xsl:when test="parent::gb:li">0mm</xsl:when>
931
+ <xsl:when test="parent::gb:dd">0mm</xsl:when>
932
+ <xsl:otherwise>7.4mm</xsl:otherwise>
933
+ </xsl:choose>
934
+ </xsl:attribute>
935
+ <xsl:if test="parent::gb:dd and ancestor::*[local-name()='formula']">
936
+ <xsl:text>— </xsl:text>
937
+ </xsl:if>
938
+ <xsl:apply-templates/>
939
+ </xsl:element>
940
+ <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
941
+ <xsl:choose>
942
+ <xsl:when test="ancestor::gb:annex">
943
+ <xsl:value-of select="$linebreak"/>
944
+ </xsl:when>
945
+ <xsl:otherwise>
946
+ <fo:block margin-bottom="12pt">
947
+ <xsl:value-of select="$linebreak"/>
948
+ </fo:block>
949
+ </xsl:otherwise>
950
+ </xsl:choose>
951
+ </xsl:if>
952
+ <xsl:if test="$inline = 'true'">
953
+ <fo:block> </fo:block>
954
+ </xsl:if>
955
+ </xsl:template>
956
+
957
+ <xsl:template match="gb:li//gb:p//text()">
958
+ <xsl:choose>
959
+ <xsl:when test="contains(., '&#9;')">
960
+ <fo:inline white-space="pre"><xsl:value-of select="."/></fo:inline>
961
+ </xsl:when>
962
+ <xsl:otherwise>
963
+ <xsl:value-of select="."/>
964
+ </xsl:otherwise>
965
+ </xsl:choose>
966
+
967
+ </xsl:template>
968
+
969
+ <!--
970
+ <fn reference="1">
971
+ <p id="_8e5cf917-f75a-4a49-b0aa-1714cb6cf954">Formerly denoted as 15 % (m/m).</p>
972
+ </fn>
973
+ -->
974
+
975
+ <xsl:variable name="p_fn">
976
+ <xsl:for-each select="//gb:p/gb:fn[generate-id(.)=generate-id(key('kfn',@reference)[1])]">
977
+ <!-- copy unique fn -->
978
+ <fn gen_id="{generate-id(.)}">
979
+ <xsl:copy-of select="@*"/>
980
+ <xsl:copy-of select="node()"/>
981
+ </fn>
982
+ </xsl:for-each>
983
+ </xsl:variable>
984
+
985
+ <xsl:template match="gb:p/gb:fn" priority="2">
986
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
987
+ <xsl:variable name="reference" select="@reference"/>
988
+ <xsl:variable name="number">
989
+ <xsl:value-of select="count(xalan:nodeset($p_fn)//fn[@reference = $reference]/preceding-sibling::fn) + 1"/>
990
+ </xsl:variable>
991
+ <xsl:choose>
992
+ <xsl:when test="xalan:nodeset($p_fn)//fn[@gen_id = $gen_id]">
993
+ <fo:footnote>
994
+ <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
995
+ <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
996
+ <!-- <xsl:value-of select="@reference"/> -->
997
+ <xsl:value-of select="$number + count(//gb:bibitem[ancestor::gb:references[@id='_normative_references' or not(preceding-sibling::gb:references)]]/gb:note)"/>
998
+ </fo:basic-link>
999
+ </fo:inline>
1000
+ <fo:footnote-body>
1001
+ <fo:block font-size="9pt" margin-bottom="12pt">
1002
+ <fo:inline font-size="50%" id="footnote_{@reference}_{$number}" keep-with-next.within-line="always" vertical-align="super">
1003
+ <xsl:value-of select="$number + count(//gb:bibitem[ancestor::gb:references[@id='_normative_references' or not(preceding-sibling::gb:references)]]/gb:note)"/>
1004
+ </fo:inline>
1005
+ <xsl:for-each select="gb:p">
1006
+ <xsl:apply-templates/>
1007
+ </xsl:for-each>
1008
+ </fo:block>
1009
+ </fo:footnote-body>
1010
+ </fo:footnote>
1011
+ </xsl:when>
1012
+ <xsl:otherwise>
1013
+ <fo:inline font-size="50%" keep-with-previous.within-line="always" vertical-align="super">
1014
+ <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1015
+ <xsl:value-of select="$number + count(//gb:bibitem/gb:note)"/>
1016
+ </fo:basic-link>
1017
+ </fo:inline>
1018
+ </xsl:otherwise>
1019
+ </xsl:choose>
1020
+ </xsl:template>
1021
+
1022
+ <xsl:template match="gb:p/gb:fn/gb:p">
1023
+ <xsl:apply-templates/>
1024
+ </xsl:template>
1025
+
1026
+ <xsl:template match="gb:review">
1027
+ <!-- comment 2019-11-29 -->
1028
+ <!-- <fo:block font-weight="bold">Review:</fo:block>
1029
+ <xsl:apply-templates /> -->
1030
+ </xsl:template>
1031
+
1032
+ <xsl:template match="text()">
1033
+ <xsl:value-of select="."/>
1034
+ </xsl:template>
1035
+
1036
+ <xsl:template match="gb:image">
1037
+ <fo:block-container text-align="center">
1038
+ <fo:block>
1039
+ <fo:external-graphic src="{@src}" fox:alt-text="Image {@alt}"/>
1040
+ </fo:block>
1041
+ <fo:block font-family="SimHei" margin-top="12pt" margin-bottom="12pt">
1042
+ <xsl:variable name="title-figure">
1043
+ <xsl:call-template name="getTitle">
1044
+ <xsl:with-param name="name" select="'title-figure'"/>
1045
+ </xsl:call-template>
1046
+ </xsl:variable>
1047
+ <xsl:value-of select="$title-figure"/>
1048
+ <xsl:call-template name="getFigureNumber"/>
1049
+ </fo:block>
1050
+ </fo:block-container>
1051
+ </xsl:template>
1052
+
1053
+ <xsl:template match="gb:figure">
1054
+ <fo:block-container id="{@id}">
1055
+ <fo:block>
1056
+ <xsl:apply-templates/>
1057
+ </fo:block>
1058
+ <xsl:call-template name="fn_display_figure"/>
1059
+ <xsl:for-each select="gb:note//gb:p">
1060
+ <xsl:call-template name="note"/>
1061
+ </xsl:for-each>
1062
+ <fo:block font-family="SimHei" text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-previous="always">
1063
+ <xsl:call-template name="getFigureNumber"/>
1064
+ <xsl:if test="gb:name">
1065
+ <!-- <xsl:if test="not(local-name(..) = 'figure')"> -->
1066
+ <xsl:text> — </xsl:text>
1067
+ <!-- </xsl:if> -->
1068
+ <xsl:value-of select="gb:name"/>
1069
+ </xsl:if>
1070
+ </fo:block>
1071
+ </fo:block-container>
1072
+ </xsl:template>
1073
+
1074
+ <xsl:template name="getFigureNumber">
1075
+ <xsl:variable name="title-figure">
1076
+ <xsl:call-template name="getTitle">
1077
+ <xsl:with-param name="name" select="'title-figure'"/>
1078
+ </xsl:call-template>
1079
+ </xsl:variable>
1080
+ <xsl:choose>
1081
+ <xsl:when test="ancestor::gb:annex">
1082
+ <xsl:value-of select="$title-figure"/><xsl:number format="A.1-1" level="multiple" count="gb:annex | gb:figure"/>
1083
+ </xsl:when>
1084
+ <xsl:otherwise>
1085
+ <xsl:value-of select="$title-figure"/><xsl:number format="1" level="any"/>
1086
+ </xsl:otherwise>
1087
+ </xsl:choose>
1088
+ </xsl:template>
1089
+
1090
+ <xsl:template match="gb:figure/gb:name"/>
1091
+ <xsl:template match="gb:figure/gb:fn" priority="2"/>
1092
+ <xsl:template match="gb:figure/gb:note"/>
1093
+
1094
+
1095
+ <xsl:template match="gb:figure/gb:image">
1096
+ <fo:block text-align="center">
1097
+ <xsl:variable name="src">
1098
+ <xsl:choose>
1099
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
1100
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
1101
+ </xsl:when>
1102
+ <xsl:otherwise>
1103
+ <xsl:value-of select="@src"/>
1104
+ </xsl:otherwise>
1105
+ </xsl:choose>
1106
+ </xsl:variable>
1107
+ <fo:external-graphic src="{$src}" width="100%" content-height="100%" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image {@alt}"/> <!-- src="{@src}" -->
1108
+ </fo:block>
1109
+ </xsl:template>
1110
+
1111
+
1112
+ <xsl:template match="gb:bibitem">
1113
+ <fo:block id="{@id}" font-size="11pt" margin-bottom="12pt" text-indent="-11.7mm" margin-left="11.7mm"> <!-- 12 pt -->
1114
+ <!-- gb:docidentifier -->
1115
+ <xsl:if test="gb:docidentifier">
1116
+ <xsl:choose>
1117
+ <xsl:when test="gb:docidentifier/@type = 'metanorma'"/>
1118
+ <xsl:otherwise><fo:inline><xsl:value-of select="gb:docidentifier"/></fo:inline></xsl:otherwise>
1119
+ </xsl:choose>
1120
+ </xsl:if>
1121
+ <xsl:apply-templates select="gb:note"/>
1122
+ <xsl:if test="gb:docidentifier">, </xsl:if>
1123
+ <fo:inline font-style="italic">
1124
+ <xsl:choose>
1125
+ <xsl:when test="gb:title[@type = 'main' and @language = 'en']">
1126
+ <xsl:value-of select="gb:title[@type = 'main' and @language = 'en']"/>
1127
+ </xsl:when>
1128
+ <xsl:otherwise>
1129
+ <xsl:value-of select="gb:title"/>
1130
+ </xsl:otherwise>
1131
+ </xsl:choose>
1132
+ </fo:inline>
1133
+ </fo:block>
1134
+ </xsl:template>
1135
+
1136
+
1137
+ <xsl:template match="gb:bibitem/gb:note">
1138
+ <fo:footnote>
1139
+ <xsl:variable name="number">
1140
+ <xsl:number level="any" count="gb:bibitem/gb:note"/>
1141
+ </xsl:variable>
1142
+ <fo:inline font-size="50%" keep-with-previous.within-line="always" baseline-shift="30%">
1143
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
1144
+ <xsl:value-of select="$number"/>
1145
+ </fo:basic-link>
1146
+ </fo:inline>
1147
+ <fo:footnote-body>
1148
+ <fo:block font-size="9pt" margin-bottom="4pt" start-indent="0pt" text-indent="7.4mm">
1149
+ <fo:inline font-size="50%" id="{generate-id()}" keep-with-next.within-line="always" baseline-shift="30%"><!-- alignment-baseline="hanging" font-size="60%" -->
1150
+ <xsl:value-of select="$number"/>
1151
+ </fo:inline>
1152
+ <xsl:apply-templates/>
1153
+ </fo:block>
1154
+ </fo:footnote-body>
1155
+ </fo:footnote>
1156
+ </xsl:template>
1157
+
1158
+
1159
+
1160
+ <xsl:template match="gb:ul | gb:ol">
1161
+ <fo:list-block margin-bottom="12pt" margin-left="7.4mm" provisional-distance-between-starts="4mm"> <!-- margin-bottom="8pt" -->
1162
+ <xsl:if test="local-name() = 'ol'">
1163
+ <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute>
1164
+ </xsl:if>
1165
+ <xsl:apply-templates/>
1166
+ </fo:list-block>
1167
+ <xsl:for-each select="./gb:note//gb:p">
1168
+ <xsl:call-template name="note"/>
1169
+ </xsl:for-each>
1170
+ </xsl:template>
1171
+
1172
+ <xsl:template match="gb:ul//gb:note | gb:ol//gb:note"/>
1173
+
1174
+ <xsl:template match="gb:li">
1175
+ <fo:list-item id="{@id}">
1176
+ <fo:list-item-label end-indent="label-end()">
1177
+ <fo:block>
1178
+ <xsl:call-template name="getListItemFormat"/>
1179
+ </fo:block>
1180
+ </fo:list-item-label>
1181
+ <fo:list-item-body start-indent="body-start()">
1182
+ <xsl:apply-templates/>
1183
+ <xsl:apply-templates select=".//gb:note" mode="process"/>
1184
+ </fo:list-item-body>
1185
+ </fo:list-item>
1186
+ </xsl:template>
1187
+
1188
+
1189
+ <xsl:template match="gb:term">
1190
+ <xsl:param name="sectionNum"/>
1191
+ <fo:block id="{@id}" font-family="SimHei" font-size="11pt" keep-with-next="always" margin-top="10pt" margin-bottom="8pt" line-height="1.1">
1192
+ <fo:inline>
1193
+ <xsl:variable name="section">
1194
+ <xsl:for-each select="*[1]">
1195
+ <xsl:call-template name="getSection">
1196
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1197
+ </xsl:call-template>
1198
+ </xsl:for-each>
1199
+ </xsl:variable>
1200
+ <xsl:value-of select="$section"/><xsl:text>.</xsl:text>
1201
+ </fo:inline>
1202
+ </fo:block>
1203
+ <fo:block>
1204
+ <xsl:apply-templates>
1205
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
1206
+ </xsl:apply-templates>
1207
+ </fo:block>
1208
+ </xsl:template>
1209
+
1210
+ <xsl:template match="gb:preferred">
1211
+ <xsl:param name="sectionNum"/>
1212
+
1213
+ <fo:inline font-family="SimHei" font-size="11pt">
1214
+ <xsl:if test="not(preceding-sibling::*[1][local-name() = 'preferred'])">
1215
+ <xsl:attribute name="padding-left">7.4mm</xsl:attribute>
1216
+ </xsl:if>
1217
+ <xsl:apply-templates/><xsl:text> </xsl:text>
1218
+ </fo:inline>
1219
+
1220
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'preferred'])">
1221
+ <xsl:value-of select="$linebreak"/>
1222
+ </xsl:if>
1223
+
1224
+ </xsl:template>
1225
+
1226
+ <xsl:template match="gb:admitted">
1227
+ <xsl:param name="sectionNum"/>
1228
+
1229
+ <fo:inline font-size="11pt">
1230
+ <xsl:if test="not(preceding-sibling::*[1][local-name() = 'admitted'])">
1231
+ <xsl:attribute name="padding-left">7.4mm</xsl:attribute>
1232
+ </xsl:if>
1233
+ <xsl:apply-templates/><xsl:text> </xsl:text>
1234
+ </fo:inline>
1235
+
1236
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'admitted'])">
1237
+ <xsl:value-of select="$linebreak"/>
1238
+ </xsl:if>
1239
+
1240
+ </xsl:template>
1241
+
1242
+ <xsl:template match="gb:deprecates">
1243
+ <xsl:param name="sectionNum"/>
1244
+ <fo:inline font-size="11pt">
1245
+ <xsl:if test="not(preceding-sibling::*[1][local-name() = 'deprecates'])">
1246
+ <xsl:attribute name="padding-left">7.4mm</xsl:attribute>
1247
+ <xsl:variable name="title-deprecated">
1248
+ <xsl:call-template name="getTitle">
1249
+ <xsl:with-param name="name" select="'title-deprecated'"/>
1250
+ </xsl:call-template>
1251
+ </xsl:variable>
1252
+ <fo:inline><xsl:value-of select="$title-deprecated"/>: </fo:inline>
1253
+ </xsl:if>
1254
+ <xsl:apply-templates/>
1255
+ </fo:inline>
1256
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'deprecates'])">
1257
+ <xsl:value-of select="$linebreak"/>
1258
+ </xsl:if>
1259
+
1260
+ </xsl:template>
1261
+
1262
+ <xsl:template match="gb:definition[preceding-sibling::gb:domain]">
1263
+ <xsl:apply-templates/>
1264
+ </xsl:template>
1265
+ <xsl:template match="gb:definition[preceding-sibling::gb:domain]/gb:p">
1266
+ <fo:inline> <xsl:apply-templates/></fo:inline>
1267
+ <fo:block> </fo:block>
1268
+ </xsl:template>
1269
+
1270
+ <xsl:template match="gb:definition">
1271
+ <fo:block>
1272
+ <xsl:apply-templates/>
1273
+ </fo:block>
1274
+ </xsl:template>
1275
+
1276
+ <xsl:template match="gb:termsource">
1277
+ <fo:block text-indent="7.4mm">
1278
+ <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
1279
+ <fo:basic-link internal-destination="{gb:origin/@bibitemid}" fox:alt-text="{gb:origin/@citeas}">
1280
+ <xsl:text>[</xsl:text> <!-- SOURCE: -->
1281
+ <xsl:value-of select="gb:origin/@citeas"/>
1282
+
1283
+ <xsl:apply-templates select="gb:origin/gb:localityStack"/>
1284
+
1285
+ </fo:basic-link>
1286
+ <xsl:apply-templates select="gb:modification"/>
1287
+ <xsl:text>]</xsl:text>
1288
+ </fo:block>
1289
+ </xsl:template>
1290
+
1291
+
1292
+ <xsl:template match="gb:modification/gb:p">
1293
+ <xsl:apply-templates/>
1294
+ </xsl:template>
1295
+ <xsl:template match="gb:modification/text()">
1296
+ <xsl:apply-templates/>
1297
+ </xsl:template>
1298
+
1299
+ <xsl:template match="gb:termnote">
1300
+ <fo:block-container font-size="9pt" margin-left="7.4mm" margin-top="4pt" line-height="125%">
1301
+ <fo:block-container margin-left="0mm">
1302
+ <fo:table table-layout="fixed" width="100%">
1303
+ <fo:table-column column-width="27mm"/>
1304
+ <fo:table-column column-width="138mm"/>
1305
+ <fo:table-body>
1306
+ <fo:table-row>
1307
+ <fo:table-cell>
1308
+ <fo:block font-family="SimHei">
1309
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
1310
+ <xsl:variable name="title-note-to-entry">
1311
+ <xsl:call-template name="getTitle">
1312
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
1313
+ </xsl:call-template>
1314
+ </xsl:variable>
1315
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
1316
+ </fo:block>
1317
+ </fo:table-cell>
1318
+ <fo:table-cell>
1319
+ <fo:block>
1320
+ <xsl:apply-templates/>
1321
+ </fo:block>
1322
+ </fo:table-cell>
1323
+ </fo:table-row>
1324
+ </fo:table-body>
1325
+ </fo:table>
1326
+ </fo:block-container>
1327
+ </fo:block-container>
1328
+ </xsl:template>
1329
+
1330
+ <xsl:template match="gb:termnote/gb:p">
1331
+ <fo:inline><xsl:apply-templates/></fo:inline>
1332
+ </xsl:template>
1333
+
1334
+ <xsl:template match="gb:domain">
1335
+ <fo:inline padding-left="7.4mm">&lt;<xsl:apply-templates/>&gt; </fo:inline>
1336
+ </xsl:template>
1337
+
1338
+
1339
+ <xsl:template match="gb:termexample">
1340
+ <fo:block font-size="9pt" margin-top="14pt" margin-bottom="14pt" text-align="justify">
1341
+ <fo:inline padding-right="1mm" font-family="SimHei">
1342
+ <xsl:variable name="title-example">
1343
+ <xsl:call-template name="getTitle">
1344
+ <xsl:with-param name="name" select="'title-example'"/>
1345
+ </xsl:call-template>
1346
+ </xsl:variable>
1347
+ <xsl:value-of select="$title-example"/>
1348
+ <xsl:if test="count(ancestor::gb:term[1]//gb:termexample) &gt; 1">
1349
+ <xsl:number/>
1350
+ </xsl:if>
1351
+ <xsl:text>:</xsl:text>
1352
+ </fo:inline>
1353
+ <xsl:apply-templates/>
1354
+ </fo:block>
1355
+ </xsl:template>
1356
+
1357
+ <xsl:template match="gb:termexample/gb:p">
1358
+ <fo:inline><xsl:apply-templates/></fo:inline>
1359
+ </xsl:template>
1360
+
1361
+
1362
+ <xsl:template match="gb:annex">
1363
+ <fo:block break-after="page"/>
1364
+ <xsl:apply-templates/>
1365
+ </xsl:template>
1366
+
1367
+
1368
+ <!-- <xsl:template match="gb:references[@id = '_bibliography']"> -->
1369
+ <xsl:template match="gb:references[position() &gt; 1]">
1370
+ <fo:block break-after="page"/>
1371
+ <xsl:apply-templates/>
1372
+ <fo:block-container text-align="center">
1373
+ <fo:block-container margin-left="63mm" width="42mm" border-bottom="2pt solid black">
1374
+ <fo:block> </fo:block>
1375
+ </fo:block-container>
1376
+ </fo:block-container>
1377
+ </xsl:template>
1378
+
1379
+
1380
+ <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
1381
+ <!-- <xsl:template match="gb:references[@id = '_bibliography']/gb:bibitem"> -->
1382
+ <xsl:template match="gb:references[position() &gt; 1]/gb:bibitem">
1383
+ <fo:list-block font-size="11pt" margin-bottom="12pt" provisional-distance-between-starts="12mm">
1384
+ <fo:list-item>
1385
+ <fo:list-item-label end-indent="label-end()">
1386
+ <fo:block>
1387
+ <fo:inline id="{@id}">
1388
+ <xsl:number format="[1]"/>
1389
+ </fo:inline>
1390
+ </fo:block>
1391
+ </fo:list-item-label>
1392
+ <fo:list-item-body start-indent="body-start()">
1393
+ <fo:block text-align="justify">
1394
+ <xsl:variable name="docidentifier">
1395
+ <xsl:if test="gb:docidentifier">
1396
+ <xsl:choose>
1397
+ <xsl:when test="gb:docidentifier/@type = 'metanorma'"/>
1398
+ <xsl:otherwise><xsl:value-of select="gb:docidentifier"/></xsl:otherwise>
1399
+ </xsl:choose>
1400
+ </xsl:if>
1401
+ </xsl:variable>
1402
+ <fo:inline><xsl:value-of select="$docidentifier"/></fo:inline>
1403
+ <xsl:apply-templates select="gb:note"/>
1404
+ <xsl:if test="normalize-space($docidentifier) != ''">, </xsl:if>
1405
+ <xsl:choose>
1406
+ <xsl:when test="gb:title[@type = 'main' and @language = 'en']">
1407
+ <xsl:apply-templates select="gb:title[@type = 'main' and @language = 'en']"/>
1408
+ </xsl:when>
1409
+ <xsl:otherwise>
1410
+ <xsl:apply-templates select="gb:title"/>
1411
+ </xsl:otherwise>
1412
+ </xsl:choose>
1413
+ <xsl:apply-templates select="gb:formattedref"/>
1414
+ </fo:block>
1415
+ </fo:list-item-body>
1416
+ </fo:list-item>
1417
+ </fo:list-block>
1418
+ </xsl:template>
1419
+
1420
+ <!-- <xsl:template match="gb:references[@id = '_bibliography']/gb:bibitem" mode="contents"/> -->
1421
+ <xsl:template match="gb:references[position() &gt; 1]/gb:bibitem" mode="contents"/>
1422
+
1423
+ <!-- <xsl:template match="gb:references[@id = '_bibliography']/gb:bibitem/gb:title"> -->
1424
+ <xsl:template match="gb:references[position() &gt; 1]/gb:bibitem/gb:title">
1425
+ <fo:inline font-style="italic">
1426
+ <xsl:apply-templates/>
1427
+ </fo:inline>
1428
+ </xsl:template>
1429
+
1430
+ <xsl:template match="gb:quote">
1431
+ <fo:block margin-top="12pt" margin-left="12mm" margin-right="12mm">
1432
+ <xsl:apply-templates select=".//gb:p"/>
1433
+ </fo:block>
1434
+ <fo:block text-align="right">
1435
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
1436
+ <xsl:text>— </xsl:text><xsl:value-of select="gb:author"/>
1437
+ <xsl:if test="gb:source">
1438
+ <xsl:text>, </xsl:text>
1439
+ <xsl:apply-templates select="gb:source"/>
1440
+ </xsl:if>
1441
+ </fo:block>
1442
+ </xsl:template>
1443
+
1444
+ <xsl:template match="gb:source">
1445
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1446
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1447
+ <xsl:apply-templates select="gb:localityStack"/>
1448
+ </fo:basic-link>
1449
+ </xsl:template>
1450
+
1451
+
1452
+ <xsl:template match="mathml:math" priority="2">
1453
+ <fo:inline font-family="Cambria Math">
1454
+ <fo:instream-foreign-object fox:alt-text="Math">
1455
+ <xsl:copy-of select="."/>
1456
+ </fo:instream-foreign-object>
1457
+ </fo:inline>
1458
+ </xsl:template>
1459
+
1460
+ <xsl:template match="gb:xref">
1461
+ <xsl:param name="sectionNum"/>
1462
+
1463
+ <xsl:variable name="target" select="normalize-space(@target)"/>
1464
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
1465
+ <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = $target]/@section"/>
1466
+ <!-- <xsl:if test="not(starts-with($section, 'Figure') or starts-with($section, 'Table'))"> -->
1467
+ <!-- <xsl:attribute name="color">blue</xsl:attribute>
1468
+ <xsl:attribute name="text-decoration">underline</xsl:attribute> -->
1469
+ <!-- </xsl:if> -->
1470
+ <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = $target]/@type"/>
1471
+ <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id =$target]/@root"/>
1472
+ <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =$target]/@level"/>
1473
+
1474
+ <xsl:variable name="title-clause">
1475
+ <xsl:call-template name="getTitle">
1476
+ <xsl:with-param name="name" select="'title-clause'"/>
1477
+ </xsl:call-template>
1478
+ </xsl:variable>
1479
+ <xsl:variable name="title-annex">
1480
+ <xsl:call-template name="getTitle">
1481
+ <xsl:with-param name="name" select="'title-annex'"/>
1482
+ </xsl:call-template>
1483
+ </xsl:variable>
1484
+
1485
+ <xsl:choose>
1486
+ <xsl:when test="$type = 'clause' and $root != 'annex' and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1487
+ <xsl:when test="$type = 'clause' and $root = 'annex'"><xsl:value-of select="$title-annex"/></xsl:when>
1488
+ <xsl:when test="$type = 'li'">
1489
+ <xsl:attribute name="color">black</xsl:attribute>
1490
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
1491
+ <xsl:variable name="parent_section" select="xalan:nodeset($contents)//item[@id =$target]/@parent_section"/>
1492
+ <xsl:variable name="currentSection">
1493
+ <xsl:call-template name="getSection"/>
1494
+ </xsl:variable>
1495
+ <xsl:if test="not(contains($parent_section, $currentSection))">
1496
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{$target}">
1497
+ <xsl:attribute name="color">blue</xsl:attribute>
1498
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1499
+ <xsl:value-of select="$parent_section"/><xsl:text> </xsl:text>
1500
+ </fo:basic-link>
1501
+ </xsl:if>
1502
+ </xsl:when>
1503
+ <xsl:when test="normalize-space($section) = ''">
1504
+ <xsl:text>[</xsl:text><xsl:value-of select="$target"/><xsl:text>]</xsl:text>
1505
+ </xsl:when>
1506
+ <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
1507
+ </xsl:choose>
1508
+ <xsl:value-of select="$section"/>
1509
+ </fo:basic-link>
1510
+ </xsl:template>
1511
+
1512
+ <xsl:template match="gb:example/gb:p">
1513
+ <fo:block font-size="10pt" margin-top="8pt" margin-bottom="8pt">
1514
+ <!-- <xsl:if test="ancestor::gb:li">
1515
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
1516
+ </xsl:if> -->
1517
+ <xsl:variable name="claims_id" select="ancestor::gb:clause[1]/@id"/>
1518
+ <fo:inline padding-right="5mm">
1519
+ <xsl:variable name="title-example">
1520
+ <xsl:call-template name="getTitle">
1521
+ <xsl:with-param name="name" select="'title-example'"/>
1522
+ </xsl:call-template>
1523
+ </xsl:variable>
1524
+ <xsl:value-of select="$title-example"/>
1525
+ <xsl:if test="count(ancestor::gb:clause[1]//gb:example) &gt; 1">
1526
+ <xsl:number count="gb:example[ancestor::gb:clause[@id = $claims_id]]" level="any"/>
1527
+ </xsl:if>
1528
+ </fo:inline>
1529
+ <xsl:apply-templates/>
1530
+ </fo:block>
1531
+ </xsl:template>
1532
+
1533
+ <xsl:template match="gb:note/gb:p" name="note">
1534
+ <xsl:variable name="claims_id" select="ancestor::gb:clause[1]/@id"/>
1535
+ <fo:block-container font-size="9pt" margin-left="7.4mm" margin-top="4pt" line-height="125%">
1536
+ <fo:block-container margin-left="0mm">
1537
+ <fo:table table-layout="fixed" width="100%">
1538
+ <fo:table-column column-width="10mm"/>
1539
+ <fo:table-column column-width="155mm"/>
1540
+ <fo:table-body>
1541
+ <fo:table-row>
1542
+ <fo:table-cell>
1543
+ <fo:block font-family="SimHei">
1544
+ <xsl:variable name="title-note">
1545
+ <xsl:call-template name="getTitle">
1546
+ <xsl:with-param name="name" select="'title-note'"/>
1547
+ </xsl:call-template>
1548
+ </xsl:variable>
1549
+ <xsl:value-of select="normalize-space($title-note)"/>
1550
+ <xsl:if test="count(ancestor::gb:clause[1]//gb:note) &gt; 1">
1551
+ <xsl:text> </xsl:text><xsl:number count="gb:note[ancestor::gb:clause[@id = $claims_id]]" level="any"/>
1552
+ </xsl:if>
1553
+ <xsl:text>:</xsl:text>
1554
+ </fo:block>
1555
+ </fo:table-cell>
1556
+ <fo:table-cell>
1557
+ <fo:block text-align="justify">
1558
+ <xsl:apply-templates/>
1559
+ </fo:block>
1560
+ </fo:table-cell>
1561
+ </fo:table-row>
1562
+ </fo:table-body>
1563
+ </fo:table>
1564
+ </fo:block-container>
1565
+ </fo:block-container>
1566
+ </xsl:template>
1567
+
1568
+ <!-- <eref type="inline" bibitemid="IEC60050-113" citeas="IEC 60050-113:2011"><localityStack><locality type="clause"><referenceFrom>113-01-12</referenceFrom></locality></localityStack></eref> -->
1569
+ <xsl:template match="gb:eref">
1570
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}"> <!-- font-size="9pt" color="blue" vertical-align="super" -->
1571
+ <xsl:if test="@type = 'footnote'">
1572
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
1573
+ <xsl:attribute name="font-size">50%</xsl:attribute>
1574
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
1575
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
1576
+ </xsl:if>
1577
+ <!-- <xsl:if test="@type = 'inline'">
1578
+ <xsl:attribute name="color">blue</xsl:attribute>
1579
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1580
+ </xsl:if> -->
1581
+
1582
+ <xsl:choose>
1583
+ <xsl:when test="@citeas and normalize-space(text()) = ''">
1584
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
1585
+ </xsl:when>
1586
+ <xsl:when test="@bibitemid and normalize-space(text()) = ''">
1587
+ <xsl:value-of select="//gb:bibitem[@id = current()/@bibitemid]/gb:docidentifier"/>
1588
+ </xsl:when>
1589
+ <xsl:otherwise/>
1590
+ </xsl:choose>
1591
+ <xsl:apply-templates select="gb:localityStack"/>
1592
+ <xsl:apply-templates select="text()"/>
1593
+ </fo:basic-link>
1594
+ </xsl:template>
1595
+
1596
+ <xsl:template match="gb:locality">
1597
+ <xsl:variable name="title-clause">
1598
+ <xsl:call-template name="getTitle">
1599
+ <xsl:with-param name="name" select="'title-clause'"/>
1600
+ </xsl:call-template>
1601
+ </xsl:variable>
1602
+ <xsl:variable name="title-annex">
1603
+ <xsl:call-template name="getTitle">
1604
+ <xsl:with-param name="name" select="'title-annex'"/>
1605
+ </xsl:call-template>
1606
+ </xsl:variable>
1607
+ <xsl:variable name="title-table">
1608
+ <xsl:call-template name="getTitle">
1609
+ <xsl:with-param name="name" select="'title-table'"/>
1610
+ </xsl:call-template>
1611
+ </xsl:variable>
1612
+ <xsl:choose>
1613
+ <xsl:when test="@type ='section' and ancestor::gb:termsource">SOURCE Section </xsl:when>
1614
+ <xsl:when test="ancestor::gb:termsource"/>
1615
+ <xsl:when test="@type ='clause' and ancestor::gb:eref"/>
1616
+ <xsl:when test="@type ='clause'"><xsl:value-of select="$title-clause"/></xsl:when>
1617
+ <xsl:when test="@type ='annex'"><xsl:value-of select="$title-annex"/></xsl:when>
1618
+ <xsl:when test="@type ='table'"><xsl:value-of select="$title-table"/></xsl:when>
1619
+ <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
1620
+ </xsl:choose>
1621
+ <xsl:text> </xsl:text><xsl:value-of select="gb:referenceFrom"/>
1622
+ </xsl:template>
1623
+
1624
+ <xsl:template match="gb:admonition">
1625
+ <xsl:variable name="title-caution">
1626
+ <xsl:call-template name="getTitle">
1627
+ <xsl:with-param name="name" select="'title-caution'"/>
1628
+ </xsl:call-template>
1629
+ </xsl:variable>
1630
+ <xsl:variable name="title-warning">
1631
+ <xsl:call-template name="getTitle">
1632
+ <xsl:with-param name="name" select="'title-warning'"/>
1633
+ </xsl:call-template>
1634
+ </xsl:variable>
1635
+ <fo:block font-family="SimHei" text-align="center" margin-bottom="12pt" font-weight="bold">
1636
+ <xsl:choose>
1637
+ <xsl:when test="@type = 'caution'"><xsl:value-of select="$title-caution"/></xsl:when>
1638
+ <xsl:when test="@type = 'warning'"><xsl:value-of select="$title-warning"/></xsl:when>
1639
+ <xsl:otherwise><xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/></xsl:otherwise>
1640
+ </xsl:choose>
1641
+ </fo:block>
1642
+ <fo:block font-weight="bold">
1643
+ <xsl:apply-templates/>
1644
+ </fo:block>
1645
+ </xsl:template>
1646
+
1647
+ <xsl:template match="gb:formula">
1648
+ <fo:block id="{@id}">
1649
+ <xsl:apply-templates/>
1650
+ </fo:block>
1651
+ </xsl:template>
1652
+
1653
+ <xsl:template match="gb:formula/gb:dt/gb:stem">
1654
+ <fo:inline>
1655
+ <xsl:apply-templates/>
1656
+ </fo:inline>
1657
+ </xsl:template>
1658
+
1659
+ <xsl:template match="gb:formula/gb:stem">
1660
+ <fo:block font-size="11pt" margin-top="14pt" margin-bottom="14pt">
1661
+ <fo:table table-layout="fixed" width="170mm">
1662
+ <fo:table-column column-width="165mm"/>
1663
+ <fo:table-column column-width="5mm"/>
1664
+ <fo:table-body>
1665
+ <fo:table-row>
1666
+ <fo:table-cell display-align="center">
1667
+ <fo:block text-align="center">
1668
+ <xsl:apply-templates/>
1669
+ </fo:block>
1670
+ </fo:table-cell>
1671
+ <fo:table-cell display-align="center">
1672
+ <fo:block text-align="left">
1673
+ <xsl:choose>
1674
+ <xsl:when test="ancestor::gb:annex">
1675
+ <xsl:number format="(A.1)" level="multiple" count="gb:annex | gb:formula"/>
1676
+ </xsl:when>
1677
+ <xsl:otherwise> <!-- not(ancestor::gb:annex) -->
1678
+ <xsl:number format="(1)" level="any" count="gb:formula"/>
1679
+ </xsl:otherwise>
1680
+ </xsl:choose>
1681
+ </fo:block>
1682
+ </fo:table-cell>
1683
+ </fo:table-row>
1684
+ </fo:table-body>
1685
+ </fo:table>
1686
+ <fo:inline keep-together.within-line="always">
1687
+ </fo:inline>
1688
+ </fo:block>
1689
+ </xsl:template>
1690
+
1691
+ <xsl:template match="gb:br" priority="2">
1692
+ <!-- <fo:block>&#xA0;</fo:block> -->
1693
+ <xsl:value-of select="$linebreak"/>
1694
+ </xsl:template>
1695
+
1696
+ <xsl:template name="insertHeaderFooter">
1697
+ <fo:static-content flow-name="header">
1698
+ <fo:block-container height="30mm" display-align="after">
1699
+ <fo:block font-family="SimHei" font-size="12pt">
1700
+ <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:docidentifier[@type = 'gb']"/>
1701
+ <xsl:text>—</xsl:text>
1702
+ <xsl:value-of select="/gb:gb-standard/gb:bibdata/gb:copyright/gb:from"/>
1703
+ </fo:block>
1704
+ </fo:block-container>
1705
+ </fo:static-content>
1706
+ <fo:static-content flow-name="footer-odd">
1707
+ <fo:block-container height="100%" display-align="after">
1708
+ <fo:block-container height="14.5mm" display-align="before">
1709
+ <fo:block font-size="9pt" text-align="right" margin-right="3.5mm">
1710
+ <fo:page-number/>
1711
+ </fo:block>
1712
+ </fo:block-container>
1713
+ </fo:block-container>
1714
+ </fo:static-content>
1715
+ <fo:static-content flow-name="footer-even">
1716
+ <fo:block-container height="100%" display-align="after">
1717
+ <fo:block-container height="14.5mm" display-align="before">
1718
+ <fo:block font-size="9pt">
1719
+ <fo:page-number/>
1720
+ </fo:block>
1721
+ </fo:block-container>
1722
+ </fo:block-container>
1723
+ </fo:static-content>
1724
+ </xsl:template>
1725
+
1726
+
1727
+ <xsl:template name="getSection">
1728
+ <xsl:param name="sectionNum"/>
1729
+ <xsl:variable name="level">
1730
+ <xsl:call-template name="getLevel"/>
1731
+ </xsl:variable>
1732
+ <xsl:variable name="section">
1733
+ <xsl:choose>
1734
+ <xsl:when test="ancestor::gb:bibliography">
1735
+ <xsl:value-of select="$sectionNum"/>
1736
+ </xsl:when>
1737
+ <xsl:when test="ancestor::gb:sections">
1738
+ <!-- 1, 2, 3, 4, ... from main section (not annex, bibliography, ...) -->
1739
+ <xsl:choose>
1740
+ <xsl:when test="$level = 1">
1741
+ <xsl:value-of select="$sectionNum"/>
1742
+ </xsl:when>
1743
+ <xsl:when test="$level &gt;= 2">
1744
+ <xsl:variable name="num">
1745
+ <xsl:call-template name="getSubSection"/>
1746
+ </xsl:variable>
1747
+ <xsl:value-of select="concat($sectionNum, $num)"/>
1748
+ </xsl:when>
1749
+ <xsl:otherwise>
1750
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
1751
+ </xsl:otherwise>
1752
+ </xsl:choose>
1753
+ </xsl:when>
1754
+ <xsl:when test="ancestor::gb:annex">
1755
+ <xsl:variable name="annexid" select="normalize-space(/gb:gb-standard/gb:bibdata/gb:ext/gb:structuredidentifier/gb:annexid)"/>
1756
+ <xsl:choose>
1757
+ <xsl:when test="$level = 1">
1758
+ <xsl:variable name="title-annex">
1759
+ <xsl:call-template name="getTitle">
1760
+ <xsl:with-param name="name" select="'title-annex'"/>
1761
+ </xsl:call-template>
1762
+ </xsl:variable>
1763
+ <xsl:value-of select="$title-annex"/>
1764
+ <xsl:choose>
1765
+ <xsl:when test="count(//gb:annex) = 1 and $annexid != ''">
1766
+ <xsl:value-of select="$annexid"/>
1767
+ </xsl:when>
1768
+ <xsl:otherwise>
1769
+ <xsl:number format="A" level="any" count="gb:annex"/>
1770
+ </xsl:otherwise>
1771
+ </xsl:choose>
1772
+ </xsl:when>
1773
+ <xsl:otherwise>
1774
+ <xsl:choose>
1775
+ <xsl:when test="count(//gb:annex) = 1 and $annexid != ''">
1776
+ <xsl:value-of select="$annexid"/><xsl:number format=".1" level="multiple" count="gb:clause"/>
1777
+ </xsl:when>
1778
+ <xsl:otherwise>
1779
+ <xsl:number format="A.1" level="multiple" count="gb:annex | gb:clause"/>
1780
+ </xsl:otherwise>
1781
+ </xsl:choose>
1782
+ </xsl:otherwise>
1783
+ </xsl:choose>
1784
+ </xsl:when>
1785
+ <xsl:when test="ancestor::gb:preface"> <!-- if preface and there is clause(s) -->
1786
+ <xsl:choose>
1787
+ <xsl:when test="$level = 1 and ..//gb:clause">0</xsl:when>
1788
+ <xsl:when test="$level &gt;= 2">
1789
+ <xsl:variable name="num">
1790
+ <xsl:number format=".1" level="multiple" count="gb:clause"/>
1791
+ </xsl:variable>
1792
+ <xsl:value-of select="concat('0', $num)"/>
1793
+ </xsl:when>
1794
+ <xsl:otherwise>
1795
+ <!-- z<xsl:value-of select="$sectionNum"/>z -->
1796
+ </xsl:otherwise>
1797
+ </xsl:choose>
1798
+ </xsl:when>
1799
+ <xsl:otherwise>
1800
+ </xsl:otherwise>
1801
+ </xsl:choose>
1802
+ </xsl:variable>
1803
+ <xsl:value-of select="$section"/>
1804
+ </xsl:template>
1805
+
1806
+ <!-- <xsl:variable name="Image-GB-Logo">
1807
+ <xsl:text>R0lGODlhWAIvAcQSAEBAQL+/v39/f4CAgO/v7xAQEDAwMJ+fn8/Pz2BgYCAgIN/f31BQUK+vr4+Pj3BwcP///wAAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAABYAi8BAAX/oCSOZGmeaKqubOu+MBIcgpAAOBDtfO//wKBwSCwaj8gkEUBwIRTKqHRKrVqvWF4hh6sJGgEEbEwum8/otHqdWgRsgEJ2Tq/bpQcX487v+/+APlsMXwFsh4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XgEExgBmIe+Y1NA0CcBzLeBgZBB5Ig430L97xAh6Xg6JkgBKDgCxaehLBgDCCAutFgxJngDO4g3j3YDRLDCP5g122gDxYh2/GWENqAAJRcEgZdBCIhFF5dEDLhDRCAE1Lh3CEfkyTgFnqdDV5hDmThE4Lhr/XfFJ7hzUHZGPqQFq5hFHahDH5hHAZdAYCgG5IhHNphxamfGvbhr32MHt6B5wTiv30fIB7iHIkhITaKvi0iDVGfIkbiFDWaI0LCAggAEVaikFFiJ7IQwHQZJkICtIGiJILdJ56iZGCuTYKRIj85zyqWnrypoiyKWbC94i5MCCTaojUEXi32YkQ00Cjmop6UWzD2A90ZQB0i41YUG+UVI6KlUDMuA91R478pgLFFI18IgA7KojVe4xwZwORs42egUAIw4yqCYzjakAE8ABaVo3qYUTdyIjKuIzuyYuwMXTyGiM8JQBrhYx7GAC/i4zrUjwDkET/+DNQ5QP6k0QWlowICgCu6AO4VpDDUzwXpTwAEAEVaSAgAADs=</xsl:text>
1808
+ </xsl:variable> -->
1809
+
1810
+ <xsl:template name="addLetterSpacing">
1811
+ <xsl:param name="text"/>
1812
+ <xsl:param name="letter-spacing" select="'0.15'"/>
1813
+ <xsl:if test="string-length($text) &gt; 0">
1814
+ <xsl:variable name="char" select="substring($text, 1, 1)"/>
1815
+ <fo:inline padding-right="{$letter-spacing}mm"><xsl:value-of select="$char"/></fo:inline>
1816
+ <xsl:call-template name="addLetterSpacing">
1817
+ <xsl:with-param name="text" select="substring($text, 2)"/>
1818
+ <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
1819
+ </xsl:call-template>
1820
+ </xsl:if>
1821
+ </xsl:template>
1822
+
1823
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
1824
+
1825
+ <title-table lang="en">Table </title-table>
1826
+ <title-table lang="fr">Tableau </title-table>
1827
+
1828
+
1829
+ <title-table lang="zh">表 </title-table>
1830
+
1831
+
1832
+ <title-note lang="en">NOTE </title-note>
1833
+ <title-note lang="fr">NOTE </title-note>
1834
+
1835
+
1836
+ <title-note lang="zh">注 </title-note>
1837
+
1838
+
1839
+ <title-figure lang="en">Figure </title-figure>
1840
+ <title-figure lang="fr">Figure </title-figure>
1841
+
1842
+
1843
+ <title-figure lang="zh">图 </title-figure>
1844
+
1845
+
1846
+ <title-example lang="en">EXAMPLE </title-example>
1847
+ <title-example lang="fr">EXEMPLE </title-example>
1848
+
1849
+
1850
+ <title-example lang="zh">示例 </title-example>
1851
+
1852
+
1853
+ <title-example-xref lang="en">Example </title-example-xref>
1854
+ <title-example-xref lang="fr">Exemple </title-example-xref>
1855
+
1856
+ <title-section lang="en">Section </title-section>
1857
+ <title-section lang="fr">Section </title-section>
1858
+
1859
+ <title-inequality lang="en">Inequality </title-inequality>
1860
+ <title-inequality lang="fr">Inequality </title-inequality>
1861
+
1862
+ <title-equation lang="en">Equation </title-equation>
1863
+ <title-equation lang="fr">Equation </title-equation>
1864
+
1865
+ <title-annex lang="en">Annex </title-annex>
1866
+ <title-annex lang="fr">Annexe </title-annex>
1867
+
1868
+
1869
+ <title-annex lang="zh">附件 </title-annex>
1870
+
1871
+
1872
+ <title-appendix lang="en">Appendix </title-appendix>
1873
+ <title-appendix lang="fr">Appendix </title-appendix>
1874
+
1875
+ <title-clause lang="en">Clause </title-clause>
1876
+ <title-clause lang="fr">Article </title-clause>
1877
+
1878
+
1879
+ <title-clause lang="zh">条 </title-clause>
1880
+
1881
+
1882
+ <title-edition lang="en">
1883
+
1884
+
1885
+ </title-edition>
1886
+
1887
+ <title-formula lang="en">Formula </title-formula>
1888
+ <title-formula lang="fr">Formula </title-formula>
1889
+
1890
+ <title-toc lang="en">
1891
+
1892
+
1893
+
1894
+ <xsl:text>Table of contents</xsl:text>
1895
+
1896
+ </title-toc>
1897
+ <title-toc lang="fr">Sommaire</title-toc>
1898
+
1899
+
1900
+ <title-toc lang="zh">目次</title-toc>
1901
+
1902
+
1903
+ <title-page lang="en">Page</title-page>
1904
+ <title-page lang="fr">Page</title-page>
1905
+
1906
+ <title-key lang="en">Key</title-key>
1907
+ <title-key lang="fr">Légende</title-key>
1908
+
1909
+ <title-where lang="en">where</title-where>
1910
+ <title-where lang="fr">où</title-where>
1911
+
1912
+ <title-descriptors lang="en">Descriptors</title-descriptors>
1913
+
1914
+ <title-part lang="en">
1915
+
1916
+
1917
+ <xsl:text>Part #: </xsl:text>
1918
+
1919
+ </title-part>
1920
+ <title-part lang="fr">
1921
+
1922
+
1923
+ <xsl:text>Partie #: </xsl:text>
1924
+
1925
+ </title-part>
1926
+ <title-part lang="zh">第 # 部分:</title-part>
1927
+
1928
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
1929
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
1930
+
1931
+
1932
+ <title-note-to-entry lang="zh">注#: </title-note-to-entry>
1933
+
1934
+
1935
+ <title-modified lang="en">modified</title-modified>
1936
+ <title-modified lang="fr">modifiée</title-modified>
1937
+
1938
+
1939
+ <title-modified lang="zh">改写</title-modified>
1940
+
1941
+
1942
+ <title-source lang="en">SOURCE</title-source>
1943
+
1944
+ <title-keywords lang="en">Keywords</title-keywords>
1945
+
1946
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
1947
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
1948
+
1949
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
1950
+
1951
+ <title-list-tables lang="en">List of Tables</title-list-tables>
1952
+
1953
+ <title-list-figures lang="en">List of Figures</title-list-figures>
1954
+
1955
+ <title-recommendation lang="en">Recommendation </title-recommendation>
1956
+
1957
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
1958
+
1959
+ <title-abstract lang="en">Abstract</title-abstract>
1960
+
1961
+ <title-summary lang="en">Summary</title-summary>
1962
+
1963
+ <title-in lang="en">in </title-in>
1964
+
1965
+ <title-box lang="en">Box </title-box>
1966
+
1967
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
1968
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
1969
+
1970
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
1971
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
1972
+
1973
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
1974
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
1975
+
1976
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
1977
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
1978
+
1979
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
1980
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
1981
+
1982
+ <title-caution lang="en">CAUTION</title-caution>
1983
+ <title-caution lang="zh">注意</title-caution>
1984
+
1985
+ <title-warning lang="en">WARNING</title-warning>
1986
+ <title-warning lang="zh">警告</title-warning>
1987
+
1988
+ <title-amendment lang="en">AMENDMENT</title-amendment>
1989
+ </xsl:variable><xsl:template name="getTitle">
1990
+ <xsl:param name="name"/>
1991
+ <xsl:variable name="lang">
1992
+ <xsl:call-template name="getLang"/>
1993
+ </xsl:variable>
1994
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
1995
+ <xsl:choose>
1996
+ <xsl:when test="normalize-space($title_) != ''">
1997
+ <xsl:value-of select="$title_"/>
1998
+ </xsl:when>
1999
+ <xsl:otherwise>
2000
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2001
+ </xsl:otherwise>
2002
+ </xsl:choose>
2003
+ </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">
2004
+
2005
+
2006
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2007
+
2008
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2009
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
2010
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2011
+
2012
+
2013
+
2014
+
2015
+
2016
+
2017
+
2018
+
2019
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2020
+
2021
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
2022
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2023
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
2024
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2025
+
2026
+
2027
+
2028
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2029
+
2030
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2031
+ <xsl:attribute name="margin-top">8pt</xsl:attribute>
2032
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2033
+
2034
+
2035
+
2036
+ </xsl:attribute-set><xsl:template match="text()">
2037
+ <xsl:value-of select="."/>
2038
+ </xsl:template><xsl:template match="*[local-name()='br']">
2039
+ <xsl:value-of select="$linebreak"/>
2040
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2041
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2042
+ <xsl:call-template name="add-zero-spaces-java"/>
2043
+ </xsl:template><xsl:template match="*[local-name()='table']">
2044
+
2045
+ <xsl:variable name="simple-table">
2046
+ <!-- <xsl:copy> -->
2047
+ <xsl:call-template name="getSimpleTable"/>
2048
+ <!-- </xsl:copy> -->
2049
+ </xsl:variable>
2050
+
2051
+ <!-- DEBUG -->
2052
+ <!-- SourceTable=<xsl:copy-of select="current()"/>EndSourceTable -->
2053
+ <!-- Simpletable=<xsl:copy-of select="$simple-table"/>EndSimpltable -->
2054
+
2055
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2056
+
2057
+ <!-- <xsl:if test="$namespace = 'iso'">
2058
+ <fo:block space-before="6pt">&#xA0;</fo:block>
2059
+ </xsl:if> -->
2060
+
2061
+ <xsl:choose>
2062
+ <xsl:when test="@unnumbered = 'true'"/>
2063
+ <xsl:otherwise>
2064
+
2065
+
2066
+
2067
+ <fo:block font-weight="bold" text-align="center" margin-bottom="6pt" keep-with-next="always">
2068
+
2069
+
2070
+
2071
+
2072
+
2073
+
2074
+
2075
+ <xsl:attribute name="font-family">SimHei</xsl:attribute>
2076
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2077
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2078
+
2079
+
2080
+ <xsl:variable name="title-table">
2081
+ <xsl:call-template name="getTitle">
2082
+ <xsl:with-param name="name" select="'title-table'"/>
2083
+ </xsl:call-template>
2084
+ </xsl:variable>
2085
+ <xsl:value-of select="$title-table"/>
2086
+
2087
+ <xsl:call-template name="getTableNumber"/>
2088
+
2089
+
2090
+ <xsl:if test="*[local-name()='name']">
2091
+
2092
+
2093
+
2094
+ <xsl:text> — </xsl:text>
2095
+
2096
+ <xsl:apply-templates select="*[local-name()='name']" mode="process"/>
2097
+ </xsl:if>
2098
+ </fo:block>
2099
+
2100
+
2101
+ <xsl:call-template name="fn_name_display"/>
2102
+
2103
+ </xsl:otherwise>
2104
+ </xsl:choose>
2105
+
2106
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2107
+
2108
+ <!-- <xsl:variable name="cols-count">
2109
+ <xsl:choose>
2110
+ <xsl:when test="*[local-name()='thead']">
2111
+ <xsl:call-template name="calculate-columns-numbers">
2112
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2113
+ </xsl:call-template>
2114
+ </xsl:when>
2115
+ <xsl:otherwise>
2116
+ <xsl:call-template name="calculate-columns-numbers">
2117
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2118
+ </xsl:call-template>
2119
+ </xsl:otherwise>
2120
+ </xsl:choose>
2121
+ </xsl:variable> -->
2122
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2123
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2124
+
2125
+
2126
+
2127
+ <xsl:variable name="colwidths">
2128
+ <xsl:call-template name="calculate-column-widths">
2129
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2130
+ <xsl:with-param name="table" select="$simple-table"/>
2131
+ </xsl:call-template>
2132
+ </xsl:variable>
2133
+
2134
+ <!-- <xsl:variable name="colwidths2">
2135
+ <xsl:call-template name="calculate-column-widths">
2136
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2137
+ </xsl:call-template>
2138
+ </xsl:variable> -->
2139
+
2140
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2141
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
2142
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2143
+
2144
+ <xsl:variable name="margin-left">
2145
+ <xsl:choose>
2146
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2147
+ <xsl:otherwise>0</xsl:otherwise>
2148
+ </xsl:choose>
2149
+ </xsl:variable>
2150
+
2151
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2152
+
2153
+
2154
+
2155
+
2156
+
2157
+
2158
+
2159
+
2160
+ <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">
2161
+
2162
+
2163
+
2164
+
2165
+
2166
+
2167
+
2168
+
2169
+
2170
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2171
+
2172
+
2173
+
2174
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2175
+ <xsl:choose>
2176
+ <xsl:when test=". = 1 or . = 0">
2177
+ <fo:table-column column-width="proportional-column-width(2)"/>
2178
+ </xsl:when>
2179
+ <xsl:otherwise>
2180
+ <fo:table-column column-width="proportional-column-width({.})"/>
2181
+ </xsl:otherwise>
2182
+ </xsl:choose>
2183
+ </xsl:for-each>
2184
+
2185
+ <xsl:choose>
2186
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2187
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2188
+ </xsl:when>
2189
+ <xsl:otherwise>
2190
+ <xsl:apply-templates/>
2191
+ </xsl:otherwise>
2192
+ </xsl:choose>
2193
+
2194
+ </fo:table>
2195
+
2196
+
2197
+ <xsl:apply-templates select="*[local-name()='note']" mode="process"/>
2198
+
2199
+
2200
+ </fo:block-container>
2201
+ </xsl:template><xsl:template name="getTableNumber">
2202
+ <xsl:choose>
2203
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2204
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2205
+ </xsl:when>
2206
+ <xsl:when test="ancestor::*[local-name()='annex']">
2207
+
2208
+
2209
+ <xsl:variable name="annex-id" select="ancestor::gb:annex/@id"/>
2210
+ <xsl:number format="A." count="*[local-name()='annex']"/><xsl:number format="1" level="any" count="*[local-name()='table'][(not(@unnumbered) or @unnumbered != 'true') and ancestor::gb:annex[@id = $annex-id]]"/>
2211
+
2212
+
2213
+
2214
+
2215
+
2216
+
2217
+
2218
+ </xsl:when>
2219
+ <xsl:otherwise>
2220
+
2221
+
2222
+ <xsl:number format="A." count="*[local-name()='annex']"/>
2223
+ <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']"/>
2224
+
2225
+ </xsl:otherwise>
2226
+ </xsl:choose>
2227
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2228
+ <xsl:apply-templates/>
2229
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2230
+ <xsl:param name="table-row"/>
2231
+ <xsl:variable name="columns-count" select="count($table-row/*)"/>
2232
+ <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2233
+ <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2234
+ <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2235
+ </xsl:template><xsl:template name="calculate-column-widths">
2236
+ <xsl:param name="table"/>
2237
+ <xsl:param name="cols-count"/>
2238
+ <xsl:param name="curr-col" select="1"/>
2239
+ <xsl:param name="width" select="0"/>
2240
+
2241
+ <xsl:if test="$curr-col &lt;= $cols-count">
2242
+ <xsl:variable name="widths">
2243
+ <xsl:choose>
2244
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2245
+ <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2246
+ <xsl:variable name="words">
2247
+ <xsl:call-template name="tokenize">
2248
+ <xsl:with-param name="text" select="translate(*[local-name()='th'][$curr-col],'- —:', ' ')"/>
2249
+ </xsl:call-template>
2250
+ </xsl:variable>
2251
+ <xsl:variable name="max_length">
2252
+ <xsl:call-template name="max_length">
2253
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2254
+ </xsl:call-template>
2255
+ </xsl:variable>
2256
+ <width>
2257
+ <xsl:value-of select="$max_length"/>
2258
+ </width>
2259
+ </xsl:for-each>
2260
+ <xsl:for-each select="*[local-name()='tbody']//*[local-name()='tr']">
2261
+ <xsl:variable name="words">
2262
+ <xsl:call-template name="tokenize">
2263
+ <xsl:with-param name="text" select="translate(*[local-name()='td'][$curr-col],'- —:', ' ')"/>
2264
+ </xsl:call-template>
2265
+ </xsl:variable>
2266
+ <xsl:variable name="max_length">
2267
+ <xsl:call-template name="max_length">
2268
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2269
+ </xsl:call-template>
2270
+ </xsl:variable>
2271
+ <width>
2272
+ <xsl:value-of select="$max_length"/>
2273
+ </width>
2274
+
2275
+ </xsl:for-each>
2276
+ </xsl:when>
2277
+ <xsl:otherwise>
2278
+ <xsl:for-each select="xalan:nodeset($table)//tr">
2279
+ <xsl:variable name="td_text">
2280
+ <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2281
+ </xsl:variable>
2282
+ <xsl:variable name="words">
2283
+ <xsl:variable name="string_with_added_zerospaces">
2284
+ <xsl:call-template name="add-zero-spaces-java">
2285
+ <xsl:with-param name="text" select="$td_text"/>
2286
+ </xsl:call-template>
2287
+ </xsl:variable>
2288
+ <xsl:call-template name="tokenize">
2289
+ <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2290
+ <!-- 2009 thinspace -->
2291
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2292
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2293
+ </xsl:call-template>
2294
+ </xsl:variable>
2295
+ <xsl:variable name="max_length">
2296
+ <xsl:call-template name="max_length">
2297
+ <xsl:with-param name="words" select="xalan:nodeset($words)"/>
2298
+ </xsl:call-template>
2299
+ </xsl:variable>
2300
+ <width>
2301
+ <xsl:variable name="divider">
2302
+ <xsl:choose>
2303
+ <xsl:when test="td[$curr-col]/@divide">
2304
+ <xsl:value-of select="td[$curr-col]/@divide"/>
2305
+ </xsl:when>
2306
+ <xsl:otherwise>1</xsl:otherwise>
2307
+ </xsl:choose>
2308
+ </xsl:variable>
2309
+ <xsl:value-of select="$max_length div $divider"/>
2310
+ </width>
2311
+
2312
+ </xsl:for-each>
2313
+
2314
+ </xsl:otherwise>
2315
+ </xsl:choose>
2316
+ </xsl:variable>
2317
+
2318
+
2319
+ <column>
2320
+ <xsl:for-each select="xalan:nodeset($widths)//width">
2321
+ <xsl:sort select="." data-type="number" order="descending"/>
2322
+ <xsl:if test="position()=1">
2323
+ <xsl:value-of select="."/>
2324
+ </xsl:if>
2325
+ </xsl:for-each>
2326
+ </column>
2327
+ <xsl:call-template name="calculate-column-widths">
2328
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2329
+ <xsl:with-param name="curr-col" select="$curr-col +1"/>
2330
+ <xsl:with-param name="table" select="$table"/>
2331
+ </xsl:call-template>
2332
+ </xsl:if>
2333
+ </xsl:template><xsl:template match="text()" mode="td_text">
2334
+ <xsl:variable name="zero-space">​</xsl:variable>
2335
+ <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2336
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2337
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2338
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2339
+ <xsl:value-of select="@target"/>
2340
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2341
+ <xsl:param name="cols-count"/>
2342
+ <!-- font-weight="bold" -->
2343
+ <fo:table-header>
2344
+
2345
+ <xsl:apply-templates/>
2346
+ </fo:table-header>
2347
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
2348
+ <fo:table-body>
2349
+ <xsl:apply-templates/>
2350
+ </fo:table-body>
2351
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2352
+ <xsl:apply-templates/>
2353
+ </xsl:template><xsl:template name="insertTableFooter">
2354
+ <xsl:param name="cols-count"/>
2355
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2356
+ <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2357
+
2358
+ <fo:table-footer>
2359
+
2360
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
2361
+
2362
+ <!-- if there are note(s) or fn(s) then create footer row -->
2363
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2364
+
2365
+
2366
+
2367
+ <fo:table-row>
2368
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
2369
+
2370
+ <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
2371
+
2372
+
2373
+
2374
+ <!-- fn will be processed inside 'note' processing -->
2375
+
2376
+
2377
+ <!-- except gb -->
2378
+
2379
+
2380
+ <!-- horizontal row separator -->
2381
+
2382
+
2383
+ <!-- fn processing -->
2384
+ <xsl:call-template name="fn_display"/>
2385
+
2386
+ </fo:table-cell>
2387
+ </fo:table-row>
2388
+
2389
+ </xsl:if>
2390
+ </fo:table-footer>
2391
+
2392
+ </xsl:if>
2393
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2394
+
2395
+ <xsl:variable name="cols-count">
2396
+ <xsl:choose>
2397
+ <xsl:when test="../*[local-name()='thead']">
2398
+ <xsl:call-template name="calculate-columns-numbers">
2399
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2400
+ </xsl:call-template>
2401
+ </xsl:when>
2402
+ <xsl:otherwise>
2403
+ <xsl:call-template name="calculate-columns-numbers">
2404
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2405
+ </xsl:call-template>
2406
+ </xsl:otherwise>
2407
+ </xsl:choose>
2408
+ </xsl:variable>
2409
+
2410
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
2411
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2412
+ </xsl:apply-templates>
2413
+
2414
+ <xsl:call-template name="insertTableFooter">
2415
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2416
+ </xsl:call-template>
2417
+
2418
+ <fo:table-body>
2419
+ <xsl:apply-templates/>
2420
+ <!-- <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/> -->
2421
+
2422
+ </fo:table-body>
2423
+
2424
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2425
+ <xsl:variable name="parent-name" select="local-name(..)"/>
2426
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2427
+ <fo:table-row min-height="4mm">
2428
+ <xsl:if test="$parent-name = 'thead'">
2429
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2430
+
2431
+
2432
+
2433
+
2434
+
2435
+ </xsl:if>
2436
+ <xsl:if test="$parent-name = 'tfoot'">
2437
+
2438
+
2439
+ </xsl:if>
2440
+
2441
+ <xsl:attribute name="min-height">0mm</xsl:attribute>
2442
+ <xsl:attribute name="line-height">110%</xsl:attribute>
2443
+
2444
+
2445
+ <xsl:apply-templates/>
2446
+ </fo:table-row>
2447
+ </xsl:template><xsl:template match="*[local-name()='th']">
2448
+ <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2449
+
2450
+
2451
+
2452
+
2453
+
2454
+
2455
+
2456
+ <xsl:if test="@colspan">
2457
+ <xsl:attribute name="number-columns-spanned">
2458
+ <xsl:value-of select="@colspan"/>
2459
+ </xsl:attribute>
2460
+ </xsl:if>
2461
+ <xsl:if test="@rowspan">
2462
+ <xsl:attribute name="number-rows-spanned">
2463
+ <xsl:value-of select="@rowspan"/>
2464
+ </xsl:attribute>
2465
+ </xsl:if>
2466
+ <fo:block>
2467
+ <xsl:apply-templates/>
2468
+ </fo:block>
2469
+ </fo:table-cell>
2470
+ </xsl:template><xsl:template match="*[local-name()='td']">
2471
+ <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2472
+
2473
+
2474
+
2475
+
2476
+ <xsl:if test="ancestor::*[local-name() = 'tfoot']">
2477
+ <xsl:attribute name="border-bottom">solid black 0</xsl:attribute>
2478
+ </xsl:if>
2479
+
2480
+
2481
+
2482
+
2483
+
2484
+
2485
+ <xsl:if test="@colspan">
2486
+ <xsl:attribute name="number-columns-spanned">
2487
+ <xsl:value-of select="@colspan"/>
2488
+ </xsl:attribute>
2489
+ </xsl:if>
2490
+ <xsl:if test="@rowspan">
2491
+ <xsl:attribute name="number-rows-spanned">
2492
+ <xsl:value-of select="@rowspan"/>
2493
+ </xsl:attribute>
2494
+ </xsl:if>
2495
+ <fo:block>
2496
+
2497
+ <xsl:apply-templates/>
2498
+ </fo:block>
2499
+ <!-- <xsl:choose>
2500
+ <xsl:when test="count(*) = 1 and *[local-name() = 'p']">
2501
+ <xsl:apply-templates />
2502
+ </xsl:when>
2503
+ <xsl:otherwise>
2504
+ <fo:block>
2505
+ <xsl:apply-templates />
2506
+ </fo:block>
2507
+ </xsl:otherwise>
2508
+ </xsl:choose> -->
2509
+
2510
+
2511
+ </fo:table-cell>
2512
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
2513
+
2514
+
2515
+ <fo:block font-size="10pt" margin-bottom="12pt">
2516
+
2517
+
2518
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
2519
+ <xsl:attribute name="text-align">center</xsl:attribute>
2520
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2521
+
2522
+
2523
+
2524
+ <fo:inline padding-right="2mm">
2525
+
2526
+ <xsl:attribute name="font-family">SimHei</xsl:attribute>
2527
+
2528
+
2529
+ <xsl:variable name="title-note">
2530
+ <xsl:call-template name="getTitle">
2531
+ <xsl:with-param name="name" select="'title-note'"/>
2532
+ </xsl:call-template>
2533
+ </xsl:variable>
2534
+ <xsl:value-of select="$title-note"/>
2535
+
2536
+ <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2537
+ <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
2538
+ <xsl:number count="*[local-name()='note'][ancestor::*[@id = $id]]" level="any"/>
2539
+ </xsl:if>
2540
+ <xsl:text>:</xsl:text>
2541
+
2542
+
2543
+
2544
+ </fo:inline>
2545
+ <xsl:apply-templates mode="process"/>
2546
+ </fo:block>
2547
+
2548
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2549
+ <xsl:apply-templates/>
2550
+ </xsl:template><xsl:template name="fn_display">
2551
+ <xsl:variable name="references">
2552
+ <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2553
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2554
+
2555
+
2556
+ <xsl:apply-templates/>
2557
+ </fn>
2558
+ </xsl:for-each>
2559
+ </xsl:variable>
2560
+ <xsl:for-each select="xalan:nodeset($references)//fn">
2561
+ <xsl:variable name="reference" select="@reference"/>
2562
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2563
+ <fo:block margin-bottom="12pt">
2564
+
2565
+
2566
+ <xsl:attribute name="text-indent">7.4mm</xsl:attribute>
2567
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2568
+ <xsl:attribute name="line-height">130%</xsl:attribute>
2569
+
2570
+
2571
+
2572
+ <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2573
+
2574
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2575
+
2576
+
2577
+
2578
+
2579
+ <xsl:attribute name="font-size">50%</xsl:attribute>
2580
+
2581
+
2582
+
2583
+ <xsl:value-of select="@reference"/>
2584
+
2585
+ </fo:inline>
2586
+ <fo:inline>
2587
+
2588
+ <xsl:apply-templates/>
2589
+ </fo:inline>
2590
+ </fo:block>
2591
+ </xsl:if>
2592
+ </xsl:for-each>
2593
+ </xsl:template><xsl:template name="fn_name_display">
2594
+ <!-- <xsl:variable name="references">
2595
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2596
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2597
+ <xsl:apply-templates />
2598
+ </fn>
2599
+ </xsl:for-each>
2600
+ </xsl:variable>
2601
+ $references=<xsl:copy-of select="$references"/> -->
2602
+ <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2603
+ <xsl:variable name="reference" select="@reference"/>
2604
+ <fo:block id="{@reference}_{ancestor::*[@id][1]/@id}"><xsl:value-of select="@reference"/></fo:block>
2605
+ <fo:block margin-bottom="12pt">
2606
+ <xsl:apply-templates/>
2607
+ </fo:block>
2608
+ </xsl:for-each>
2609
+ </xsl:template><xsl:template name="fn_display_figure">
2610
+ <xsl:variable name="key_iso">
2611
+ true <!-- and (not(@class) or @class !='pseudocode') -->
2612
+ </xsl:variable>
2613
+ <xsl:variable name="references">
2614
+ <xsl:for-each select=".//*[local-name()='fn']">
2615
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2616
+ <xsl:apply-templates/>
2617
+ </fn>
2618
+ </xsl:for-each>
2619
+ </xsl:variable>
2620
+
2621
+ <!-- current hierarchy is 'figure' element -->
2622
+ <xsl:variable name="following_dl_colwidths">
2623
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
2624
+ <xsl:variable name="html-table">
2625
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2626
+ <xsl:element name="{$ns}:table">
2627
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2628
+ <tbody>
2629
+ <xsl:apply-templates mode="dl"/>
2630
+ </tbody>
2631
+ </xsl:for-each>
2632
+ </xsl:element>
2633
+ </xsl:variable>
2634
+
2635
+ <xsl:call-template name="calculate-column-widths">
2636
+ <xsl:with-param name="cols-count" select="2"/>
2637
+ <xsl:with-param name="table" select="$html-table"/>
2638
+ </xsl:call-template>
2639
+
2640
+ </xsl:if>
2641
+ </xsl:variable>
2642
+
2643
+
2644
+ <xsl:variable name="maxlength_dt">
2645
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
2646
+ <xsl:call-template name="getMaxLength_dt"/>
2647
+ </xsl:for-each>
2648
+ </xsl:variable>
2649
+
2650
+ <xsl:if test="xalan:nodeset($references)//fn">
2651
+ <fo:block>
2652
+ <fo:table width="95%" table-layout="fixed">
2653
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2654
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2655
+
2656
+ </xsl:if>
2657
+ <xsl:choose>
2658
+ <!-- if there 'dl', then set same columns width -->
2659
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
2660
+ <xsl:call-template name="setColumnWidth_dl">
2661
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
2662
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2663
+ </xsl:call-template>
2664
+ </xsl:when>
2665
+ <xsl:otherwise>
2666
+ <fo:table-column column-width="15%"/>
2667
+ <fo:table-column column-width="85%"/>
2668
+ </xsl:otherwise>
2669
+ </xsl:choose>
2670
+ <fo:table-body>
2671
+ <xsl:for-each select="xalan:nodeset($references)//fn">
2672
+ <xsl:variable name="reference" select="@reference"/>
2673
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
2674
+ <fo:table-row>
2675
+ <fo:table-cell>
2676
+ <fo:block>
2677
+ <fo:inline font-size="80%" padding-right="5mm" vertical-align="super" id="{@id}">
2678
+
2679
+ <xsl:value-of select="@reference"/>
2680
+ </fo:inline>
2681
+ </fo:block>
2682
+ </fo:table-cell>
2683
+ <fo:table-cell>
2684
+ <fo:block text-align="justify" margin-bottom="12pt">
2685
+
2686
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2687
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
2688
+ </xsl:if>
2689
+
2690
+ <xsl:apply-templates/>
2691
+ </fo:block>
2692
+ </fo:table-cell>
2693
+ </fo:table-row>
2694
+ </xsl:if>
2695
+ </xsl:for-each>
2696
+ </fo:table-body>
2697
+ </fo:table>
2698
+ </fo:block>
2699
+ </xsl:if>
2700
+
2701
+ </xsl:template><xsl:template match="*[local-name()='fn']">
2702
+ <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2703
+ <fo:inline font-size="80%" keep-with-previous.within-line="always">
2704
+
2705
+
2706
+ <xsl:attribute name="font-size">50%</xsl:attribute>
2707
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
2708
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
2709
+
2710
+
2711
+
2712
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
2713
+
2714
+ <xsl:value-of select="@reference"/>
2715
+ </fo:basic-link>
2716
+ </fo:inline>
2717
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2718
+ <fo:inline>
2719
+ <xsl:apply-templates/>
2720
+ </fo:inline>
2721
+ </xsl:template><xsl:template match="*[local-name()='dl']">
2722
+ <xsl:variable name="parent" select="local-name(..)"/>
2723
+
2724
+ <xsl:variable name="key_iso">
2725
+
2726
+ <xsl:if test="$parent = 'figure' or $parent = 'formula'">true</xsl:if>
2727
+ <!-- and (not(../@class) or ../@class !='pseudocode') -->
2728
+ </xsl:variable>
2729
+
2730
+ <xsl:choose>
2731
+ <xsl:when test="$parent = 'formula' and count(*[local-name()='dt']) = 1"> <!-- only one component -->
2732
+
2733
+ <fo:block text-align="left">
2734
+
2735
+
2736
+ <xsl:attribute name="margin-left">7.4mm</xsl:attribute>
2737
+
2738
+ <xsl:variable name="title-where">
2739
+ <xsl:call-template name="getTitle">
2740
+ <xsl:with-param name="name" select="'title-where'"/>
2741
+ </xsl:call-template>
2742
+ </xsl:variable>
2743
+ <xsl:value-of select="$title-where"/>
2744
+ </fo:block>
2745
+ <fo:block>
2746
+
2747
+ <xsl:attribute name="text-indent">7.4mm</xsl:attribute>
2748
+
2749
+ <xsl:apply-templates select="*[local-name()='dt']/*"/>
2750
+
2751
+ <xsl:text> </xsl:text>
2752
+ <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
2753
+ </fo:block>
2754
+
2755
+
2756
+ </xsl:when>
2757
+ <xsl:when test="$parent = 'formula'"> <!-- a few components -->
2758
+ <fo:block margin-bottom="12pt" text-align="left">
2759
+
2760
+
2761
+
2762
+
2763
+ <xsl:attribute name="margin-left">7.4mm</xsl:attribute>
2764
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2765
+
2766
+ <xsl:variable name="title-where">
2767
+ <xsl:call-template name="getTitle">
2768
+ <xsl:with-param name="name" select="'title-where'"/>
2769
+ </xsl:call-template>
2770
+ </xsl:variable>
2771
+ <xsl:value-of select="$title-where"/>
2772
+ </fo:block>
2773
+ </xsl:when>
2774
+ <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2775
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
2776
+
2777
+
2778
+
2779
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2780
+ <xsl:attribute name="text-indent">7.4mm</xsl:attribute>
2781
+
2782
+ <xsl:variable name="title-key">
2783
+ <xsl:call-template name="getTitle">
2784
+ <xsl:with-param name="name" select="'title-key'"/>
2785
+ </xsl:call-template>
2786
+ </xsl:variable>
2787
+ <xsl:value-of select="$title-key"/>
2788
+ </fo:block>
2789
+ </xsl:when>
2790
+ </xsl:choose>
2791
+
2792
+ <!-- a few components -->
2793
+ <xsl:if test="not($parent = 'formula' and count(*[local-name()='dt']) = 1)">
2794
+ <fo:block>
2795
+
2796
+
2797
+
2798
+
2799
+ <fo:block>
2800
+
2801
+
2802
+ <xsl:attribute name="margin-left">7.4mm</xsl:attribute>
2803
+ <xsl:if test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
2804
+ <xsl:attribute name="margin-left">15mm</xsl:attribute>
2805
+ </xsl:if>
2806
+
2807
+
2808
+
2809
+ <fo:table width="95%" table-layout="fixed">
2810
+
2811
+ <xsl:attribute name="margin-left">-3.7mm</xsl:attribute>
2812
+
2813
+ <xsl:choose>
2814
+ <xsl:when test="normalize-space($key_iso) = 'true' and $parent = 'formula'">
2815
+ <!-- <xsl:attribute name="font-size">11pt</xsl:attribute> -->
2816
+ </xsl:when>
2817
+ <xsl:when test="normalize-space($key_iso) = 'true'">
2818
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2819
+
2820
+ </xsl:when>
2821
+ </xsl:choose>
2822
+ <!-- create virtual html table for dl/[dt and dd] -->
2823
+ <xsl:variable name="html-table">
2824
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
2825
+ <xsl:element name="{$ns}:table">
2826
+ <tbody>
2827
+ <xsl:apply-templates mode="dl"/>
2828
+ </tbody>
2829
+ </xsl:element>
2830
+ </xsl:variable>
2831
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
2832
+ <xsl:variable name="colwidths">
2833
+ <xsl:call-template name="calculate-column-widths">
2834
+ <xsl:with-param name="cols-count" select="2"/>
2835
+ <xsl:with-param name="table" select="$html-table"/>
2836
+ </xsl:call-template>
2837
+ </xsl:variable>
2838
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2839
+ <xsl:variable name="maxlength_dt">
2840
+ <xsl:call-template name="getMaxLength_dt"/>
2841
+ </xsl:variable>
2842
+ <xsl:call-template name="setColumnWidth_dl">
2843
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2844
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
2845
+ </xsl:call-template>
2846
+ <fo:table-body>
2847
+ <xsl:apply-templates>
2848
+ <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
2849
+ </xsl:apply-templates>
2850
+ </fo:table-body>
2851
+ </fo:table>
2852
+ </fo:block>
2853
+ </fo:block>
2854
+ </xsl:if>
2855
+ </xsl:template><xsl:template name="setColumnWidth_dl">
2856
+ <xsl:param name="colwidths"/>
2857
+ <xsl:param name="maxlength_dt"/>
2858
+ <xsl:choose>
2859
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
2860
+ <fo:table-column column-width="50%"/>
2861
+ <fo:table-column column-width="50%"/>
2862
+ </xsl:when>
2863
+ <xsl:otherwise>
2864
+ <xsl:choose>
2865
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2866
+ <fo:table-column column-width="5%"/>
2867
+ <fo:table-column column-width="95%"/>
2868
+ </xsl:when>
2869
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2870
+ <fo:table-column column-width="10%"/>
2871
+ <fo:table-column column-width="90%"/>
2872
+ </xsl:when>
2873
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2874
+ <fo:table-column column-width="60%"/>
2875
+ <fo:table-column column-width="40%"/>
2876
+ </xsl:when> -->
2877
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
2878
+ <fo:table-column column-width="50%"/>
2879
+ <fo:table-column column-width="50%"/>
2880
+ </xsl:when>
2881
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
2882
+ <fo:table-column column-width="40%"/>
2883
+ <fo:table-column column-width="60%"/>
2884
+ </xsl:when>
2885
+ <xsl:otherwise>
2886
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2887
+ <xsl:choose>
2888
+ <xsl:when test=". = 1 or . = 0">
2889
+ <fo:table-column column-width="proportional-column-width(2)"/>
2890
+ </xsl:when>
2891
+ <xsl:otherwise>
2892
+ <fo:table-column column-width="proportional-column-width({.})"/>
2893
+ </xsl:otherwise>
2894
+ </xsl:choose>
2895
+ </xsl:for-each>
2896
+ </xsl:otherwise>
2897
+ </xsl:choose>
2898
+ <!-- <fo:table-column column-width="15%"/>
2899
+ <fo:table-column column-width="85%"/> -->
2900
+ </xsl:otherwise>
2901
+ </xsl:choose>
2902
+ </xsl:template><xsl:template name="getMaxLength_dt">
2903
+ <xsl:for-each select="*[local-name()='dt']">
2904
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2905
+ <xsl:if test="position() = 1">
2906
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2907
+ </xsl:if>
2908
+ </xsl:for-each>
2909
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
2910
+ <xsl:param name="key_iso"/>
2911
+
2912
+ <!-- <tr>
2913
+ <td>NOTE</td>
2914
+ <td>
2915
+ <xsl:apply-templates />
2916
+ </td>
2917
+ </tr>
2918
+ -->
2919
+ <fo:table-row>
2920
+ <fo:table-cell>
2921
+ <fo:block margin-top="6pt">
2922
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2923
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2924
+ </xsl:if>
2925
+ <xsl:variable name="title-note">
2926
+ <xsl:call-template name="getTitle">
2927
+ <xsl:with-param name="name" select="'title-note'"/>
2928
+ </xsl:call-template>
2929
+ </xsl:variable>
2930
+ <xsl:value-of select="$title-note"/>
2931
+ </fo:block>
2932
+ </fo:table-cell>
2933
+ <fo:table-cell>
2934
+ <fo:block>
2935
+ <xsl:apply-templates/>
2936
+ </fo:block>
2937
+ </fo:table-cell>
2938
+ </fo:table-row>
2939
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
2940
+ <tr>
2941
+ <td>
2942
+ <xsl:apply-templates/>
2943
+ </td>
2944
+ <td>
2945
+
2946
+
2947
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2948
+
2949
+ </td>
2950
+ </tr>
2951
+
2952
+ </xsl:template><xsl:template match="*[local-name()='dt']">
2953
+ <xsl:param name="key_iso"/>
2954
+
2955
+ <fo:table-row>
2956
+ <fo:table-cell>
2957
+
2958
+ <fo:block margin-top="6pt">
2959
+
2960
+
2961
+ <xsl:if test="normalize-space($key_iso) = 'true'">
2962
+ <xsl:attribute name="margin-top">0</xsl:attribute>
2963
+
2964
+ </xsl:if>
2965
+
2966
+
2967
+
2968
+
2969
+
2970
+ <xsl:apply-templates/>
2971
+ <!-- <xsl:if test="$namespace = 'gb'">
2972
+ <xsl:if test="ancestor::*[local-name()='formula']">
2973
+ <xsl:text>—</xsl:text>
2974
+ </xsl:if>
2975
+ </xsl:if> -->
2976
+ </fo:block>
2977
+ </fo:table-cell>
2978
+ <fo:table-cell>
2979
+ <fo:block>
2980
+
2981
+
2982
+
2983
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]" mode="process"/>
2984
+
2985
+ </fo:block>
2986
+ </fo:table-cell>
2987
+ </fo:table-row>
2988
+
2989
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
2990
+ <xsl:apply-templates/>
2991
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
2992
+ <xsl:apply-templates/>
2993
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
2994
+ <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
2995
+ </xsl:template><xsl:template match="*[local-name()='em']">
2996
+ <fo:inline font-style="italic">
2997
+ <xsl:apply-templates/>
2998
+ </fo:inline>
2999
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3000
+ <fo:inline font-weight="bold">
3001
+ <xsl:apply-templates/>
3002
+ </fo:inline>
3003
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3004
+ <fo:inline font-size="80%" vertical-align="super">
3005
+ <xsl:apply-templates/>
3006
+ </fo:inline>
3007
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3008
+ <fo:inline font-size="80%" vertical-align="sub">
3009
+ <xsl:apply-templates/>
3010
+ </fo:inline>
3011
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3012
+ <fo:inline font-family="Courier" font-size="10pt">
3013
+ <xsl:apply-templates/>
3014
+ </fo:inline>
3015
+ </xsl:template><xsl:template match="*[local-name()='del']">
3016
+ <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3017
+ <xsl:apply-templates/>
3018
+ </fo:inline>
3019
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3020
+ <xsl:variable name="text" select="normalize-space(.)"/>
3021
+ <fo:inline font-size="75%">
3022
+ <xsl:if test="string-length($text) &gt; 0">
3023
+ <xsl:call-template name="recursiveSmallCaps">
3024
+ <xsl:with-param name="text" select="$text"/>
3025
+ </xsl:call-template>
3026
+ </xsl:if>
3027
+ </fo:inline>
3028
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3029
+ <xsl:param name="text"/>
3030
+ <xsl:variable name="char" select="substring($text,1,1)"/>
3031
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
3032
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3033
+ <xsl:choose>
3034
+ <xsl:when test="$char=$upperCase">
3035
+ <fo:inline font-size="{100 div 0.75}%">
3036
+ <xsl:value-of select="$upperCase"/>
3037
+ </fo:inline>
3038
+ </xsl:when>
3039
+ <xsl:otherwise>
3040
+ <xsl:value-of select="$upperCase"/>
3041
+ </xsl:otherwise>
3042
+ </xsl:choose>
3043
+ <xsl:if test="string-length($text) &gt; 1">
3044
+ <xsl:call-template name="recursiveSmallCaps">
3045
+ <xsl:with-param name="text" select="substring($text,2)"/>
3046
+ </xsl:call-template>
3047
+ </xsl:if>
3048
+ </xsl:template><xsl:template name="tokenize">
3049
+ <xsl:param name="text"/>
3050
+ <xsl:param name="separator" select="' '"/>
3051
+ <xsl:choose>
3052
+ <xsl:when test="not(contains($text, $separator))">
3053
+ <word>
3054
+ <xsl:variable name="str_no_en_chars" select="normalize-space(translate($text, $en_chars, ''))"/>
3055
+ <xsl:variable name="len_str_no_en_chars" select="string-length($str_no_en_chars)"/>
3056
+ <xsl:variable name="len_str_tmp" select="string-length(normalize-space($text))"/>
3057
+ <xsl:variable name="len_str">
3058
+ <xsl:choose>
3059
+ <xsl:when test="normalize-space(translate($text, $upper, '')) = ''"> <!-- english word in CAPITAL letters -->
3060
+ <xsl:value-of select="$len_str_tmp * 1.5"/>
3061
+ </xsl:when>
3062
+ <xsl:otherwise>
3063
+ <xsl:value-of select="$len_str_tmp"/>
3064
+ </xsl:otherwise>
3065
+ </xsl:choose>
3066
+ </xsl:variable>
3067
+
3068
+ <!-- <xsl:if test="$len_str_no_en_chars div $len_str &gt; 0.8">
3069
+ <xsl:message>
3070
+ div=<xsl:value-of select="$len_str_no_en_chars div $len_str"/>
3071
+ len_str=<xsl:value-of select="$len_str"/>
3072
+ len_str_no_en_chars=<xsl:value-of select="$len_str_no_en_chars"/>
3073
+ </xsl:message>
3074
+ </xsl:if> -->
3075
+ <!-- <len_str_no_en_chars><xsl:value-of select="$len_str_no_en_chars"/></len_str_no_en_chars>
3076
+ <len_str><xsl:value-of select="$len_str"/></len_str> -->
3077
+ <xsl:choose>
3078
+ <xsl:when test="$len_str_no_en_chars div $len_str &gt; 0.8"> <!-- means non-english string -->
3079
+ <xsl:value-of select="$len_str - $len_str_no_en_chars"/>
3080
+ </xsl:when>
3081
+ <xsl:otherwise>
3082
+ <xsl:value-of select="$len_str"/>
3083
+ </xsl:otherwise>
3084
+ </xsl:choose>
3085
+ </word>
3086
+ </xsl:when>
3087
+ <xsl:otherwise>
3088
+ <word>
3089
+ <xsl:value-of select="string-length(normalize-space(substring-before($text, $separator)))"/>
3090
+ </word>
3091
+ <xsl:call-template name="tokenize">
3092
+ <xsl:with-param name="text" select="substring-after($text, $separator)"/>
3093
+ </xsl:call-template>
3094
+ </xsl:otherwise>
3095
+ </xsl:choose>
3096
+ </xsl:template><xsl:template name="max_length">
3097
+ <xsl:param name="words"/>
3098
+ <xsl:for-each select="$words//word">
3099
+ <xsl:sort select="." data-type="number" order="descending"/>
3100
+ <xsl:if test="position()=1">
3101
+ <xsl:value-of select="."/>
3102
+ </xsl:if>
3103
+ </xsl:for-each>
3104
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3105
+ <xsl:param name="text" select="."/>
3106
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3107
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3108
+ </xsl:template><xsl:template name="add-zero-spaces">
3109
+ <xsl:param name="text" select="."/>
3110
+ <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3111
+ <xsl:variable name="zero-space-after-dot">.</xsl:variable>
3112
+ <xsl:variable name="zero-space-after-colon">:</xsl:variable>
3113
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3114
+ <xsl:variable name="zero-space-after-underscore">_</xsl:variable>
3115
+ <xsl:variable name="zero-space">​</xsl:variable>
3116
+ <xsl:choose>
3117
+ <xsl:when test="contains($text, $zero-space-after-chars)">
3118
+ <xsl:value-of select="substring-before($text, $zero-space-after-chars)"/>
3119
+ <xsl:value-of select="$zero-space-after-chars"/>
3120
+ <xsl:value-of select="$zero-space"/>
3121
+ <xsl:call-template name="add-zero-spaces">
3122
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-chars)"/>
3123
+ </xsl:call-template>
3124
+ </xsl:when>
3125
+ <xsl:when test="contains($text, $zero-space-after-dot)">
3126
+ <xsl:value-of select="substring-before($text, $zero-space-after-dot)"/>
3127
+ <xsl:value-of select="$zero-space-after-dot"/>
3128
+ <xsl:value-of select="$zero-space"/>
3129
+ <xsl:call-template name="add-zero-spaces">
3130
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-dot)"/>
3131
+ </xsl:call-template>
3132
+ </xsl:when>
3133
+ <xsl:when test="contains($text, $zero-space-after-colon)">
3134
+ <xsl:value-of select="substring-before($text, $zero-space-after-colon)"/>
3135
+ <xsl:value-of select="$zero-space-after-colon"/>
3136
+ <xsl:value-of select="$zero-space"/>
3137
+ <xsl:call-template name="add-zero-spaces">
3138
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-colon)"/>
3139
+ </xsl:call-template>
3140
+ </xsl:when>
3141
+ <xsl:when test="contains($text, $zero-space-after-equal)">
3142
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3143
+ <xsl:value-of select="$zero-space-after-equal"/>
3144
+ <xsl:value-of select="$zero-space"/>
3145
+ <xsl:call-template name="add-zero-spaces">
3146
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3147
+ </xsl:call-template>
3148
+ </xsl:when>
3149
+ <xsl:when test="contains($text, $zero-space-after-underscore)">
3150
+ <xsl:value-of select="substring-before($text, $zero-space-after-underscore)"/>
3151
+ <xsl:value-of select="$zero-space-after-underscore"/>
3152
+ <xsl:value-of select="$zero-space"/>
3153
+ <xsl:call-template name="add-zero-spaces">
3154
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-underscore)"/>
3155
+ </xsl:call-template>
3156
+ </xsl:when>
3157
+ <xsl:otherwise>
3158
+ <xsl:value-of select="$text"/>
3159
+ </xsl:otherwise>
3160
+ </xsl:choose>
3161
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3162
+ <xsl:param name="text" select="."/>
3163
+ <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3164
+ <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3165
+ <xsl:variable name="zero-space">​</xsl:variable>
3166
+ <xsl:choose>
3167
+ <xsl:when test="contains($text, $zero-space-after-equals)">
3168
+ <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3169
+ <xsl:value-of select="$zero-space-after-equals"/>
3170
+ <xsl:value-of select="$zero-space"/>
3171
+ <xsl:call-template name="add-zero-spaces-equal">
3172
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3173
+ </xsl:call-template>
3174
+ </xsl:when>
3175
+ <xsl:when test="contains($text, $zero-space-after-equal)">
3176
+ <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3177
+ <xsl:value-of select="$zero-space-after-equal"/>
3178
+ <xsl:value-of select="$zero-space"/>
3179
+ <xsl:call-template name="add-zero-spaces-equal">
3180
+ <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3181
+ </xsl:call-template>
3182
+ </xsl:when>
3183
+ <xsl:otherwise>
3184
+ <xsl:value-of select="$text"/>
3185
+ </xsl:otherwise>
3186
+ </xsl:choose>
3187
+ </xsl:template><xsl:template name="getSimpleTable">
3188
+ <xsl:variable name="simple-table">
3189
+
3190
+ <!-- Step 1. colspan processing -->
3191
+ <xsl:variable name="simple-table-colspan">
3192
+ <tbody>
3193
+ <xsl:apply-templates mode="simple-table-colspan"/>
3194
+ </tbody>
3195
+ </xsl:variable>
3196
+
3197
+ <!-- Step 2. rowspan processing -->
3198
+ <xsl:variable name="simple-table-rowspan">
3199
+ <xsl:apply-templates select="xalan:nodeset($simple-table-colspan)" mode="simple-table-rowspan"/>
3200
+ </xsl:variable>
3201
+
3202
+ <xsl:copy-of select="xalan:nodeset($simple-table-rowspan)"/>
3203
+
3204
+ <!-- <xsl:choose>
3205
+ <xsl:when test="current()//*[local-name()='th'][@colspan] or current()//*[local-name()='td'][@colspan] ">
3206
+
3207
+ </xsl:when>
3208
+ <xsl:otherwise>
3209
+ <xsl:copy-of select="current()"/>
3210
+ </xsl:otherwise>
3211
+ </xsl:choose> -->
3212
+ </xsl:variable>
3213
+ <xsl:copy-of select="$simple-table"/>
3214
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3215
+ <xsl:apply-templates mode="simple-table-colspan"/>
3216
+ </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">
3217
+ <xsl:choose>
3218
+ <xsl:when test="@colspan">
3219
+ <xsl:variable name="td">
3220
+ <xsl:element name="td">
3221
+ <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
3222
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3223
+ <xsl:apply-templates mode="simple-table-colspan"/>
3224
+ </xsl:element>
3225
+ </xsl:variable>
3226
+ <xsl:call-template name="repeatNode">
3227
+ <xsl:with-param name="count" select="@colspan"/>
3228
+ <xsl:with-param name="node" select="$td"/>
3229
+ </xsl:call-template>
3230
+ </xsl:when>
3231
+ <xsl:otherwise>
3232
+ <xsl:element name="td">
3233
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3234
+ <xsl:apply-templates mode="simple-table-colspan"/>
3235
+ </xsl:element>
3236
+ </xsl:otherwise>
3237
+ </xsl:choose>
3238
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3239
+ <xsl:element name="tr">
3240
+ <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3241
+ <xsl:apply-templates mode="simple-table-colspan"/>
3242
+ </xsl:element>
3243
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3244
+ <xsl:copy>
3245
+ <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3246
+ </xsl:copy>
3247
+ </xsl:template><xsl:template name="repeatNode">
3248
+ <xsl:param name="count"/>
3249
+ <xsl:param name="node"/>
3250
+
3251
+ <xsl:if test="$count &gt; 0">
3252
+ <xsl:call-template name="repeatNode">
3253
+ <xsl:with-param name="count" select="$count - 1"/>
3254
+ <xsl:with-param name="node" select="$node"/>
3255
+ </xsl:call-template>
3256
+ <xsl:copy-of select="$node"/>
3257
+ </xsl:if>
3258
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3259
+ <xsl:copy>
3260
+ <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3261
+ </xsl:copy>
3262
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3263
+ <xsl:copy>
3264
+ <xsl:copy-of select="tr[1]"/>
3265
+ <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3266
+ <xsl:with-param name="previousRow" select="tr[1]"/>
3267
+ </xsl:apply-templates>
3268
+ </xsl:copy>
3269
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3270
+ <xsl:param name="previousRow"/>
3271
+ <xsl:variable name="currentRow" select="."/>
3272
+
3273
+ <xsl:variable name="normalizedTDs">
3274
+ <xsl:for-each select="xalan:nodeset($previousRow)//td">
3275
+ <xsl:choose>
3276
+ <xsl:when test="@rowspan &gt; 1">
3277
+ <xsl:copy>
3278
+ <xsl:attribute name="rowspan">
3279
+ <xsl:value-of select="@rowspan - 1"/>
3280
+ </xsl:attribute>
3281
+ <xsl:copy-of select="@*[not(name() = 'rowspan')]"/>
3282
+ <xsl:copy-of select="node()"/>
3283
+ </xsl:copy>
3284
+ </xsl:when>
3285
+ <xsl:otherwise>
3286
+ <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
3287
+ </xsl:otherwise>
3288
+ </xsl:choose>
3289
+ </xsl:for-each>
3290
+ </xsl:variable>
3291
+
3292
+ <xsl:variable name="newRow">
3293
+ <xsl:copy>
3294
+ <xsl:copy-of select="$currentRow/@*"/>
3295
+ <xsl:copy-of select="xalan:nodeset($normalizedTDs)"/>
3296
+ </xsl:copy>
3297
+ </xsl:variable>
3298
+ <xsl:copy-of select="$newRow"/>
3299
+
3300
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3301
+ <xsl:with-param name="previousRow" select="$newRow"/>
3302
+ </xsl:apply-templates>
3303
+ </xsl:template><xsl:template name="getLang">
3304
+ <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3305
+ <xsl:choose>
3306
+ <xsl:when test="$language = 'English'">en</xsl:when>
3307
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3308
+ </xsl:choose>
3309
+ </xsl:template><xsl:template name="capitalizeWords">
3310
+ <xsl:param name="str"/>
3311
+ <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3312
+ <xsl:choose>
3313
+ <xsl:when test="contains($str2, ' ')">
3314
+ <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3315
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3316
+ <xsl:value-of select="substring($substr, 2)"/> -->
3317
+ <xsl:call-template name="capitalize">
3318
+ <xsl:with-param name="str" select="$substr"/>
3319
+ </xsl:call-template>
3320
+ <xsl:text> </xsl:text>
3321
+ <xsl:call-template name="capitalizeWords">
3322
+ <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3323
+ </xsl:call-template>
3324
+ </xsl:when>
3325
+ <xsl:otherwise>
3326
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3327
+ <xsl:value-of select="substring($str2, 2)"/> -->
3328
+ <xsl:call-template name="capitalize">
3329
+ <xsl:with-param name="str" select="$str2"/>
3330
+ </xsl:call-template>
3331
+ </xsl:otherwise>
3332
+ </xsl:choose>
3333
+ </xsl:template><xsl:template name="capitalize">
3334
+ <xsl:param name="str"/>
3335
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3336
+ <xsl:value-of select="substring($str, 2)"/>
3337
+ </xsl:template><xsl:template match="mathml:math">
3338
+ <fo:inline font-family="STIX2Math">
3339
+ <fo:instream-foreign-object fox:alt-text="Math">
3340
+ <xsl:copy-of select="."/>
3341
+ </fo:instream-foreign-object>
3342
+ </fo:inline>
3343
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3344
+ <xsl:for-each select="*[local-name()='locality']">
3345
+ <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3346
+ <xsl:apply-templates select="."/>
3347
+ <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3348
+ </xsl:for-each>
3349
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3350
+ <xsl:variable name="target">
3351
+ <xsl:choose>
3352
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
3353
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
3354
+ </xsl:when>
3355
+ <xsl:otherwise>
3356
+ <xsl:value-of select="normalize-space(@target)"/>
3357
+ </xsl:otherwise>
3358
+ </xsl:choose>
3359
+ </xsl:variable>
3360
+ <fo:inline xsl:use-attribute-sets="link-style">
3361
+ <xsl:choose>
3362
+ <xsl:when test="$target = ''">
3363
+ <xsl:apply-templates/>
3364
+ </xsl:when>
3365
+ <xsl:otherwise>
3366
+ <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3367
+ <xsl:choose>
3368
+ <xsl:when test="normalize-space(.) = ''">
3369
+ <xsl:value-of select="$target"/>
3370
+ </xsl:when>
3371
+ <xsl:otherwise>
3372
+ <xsl:apply-templates/>
3373
+ </xsl:otherwise>
3374
+ </xsl:choose>
3375
+ </fo:basic-link>
3376
+ </xsl:otherwise>
3377
+ </xsl:choose>
3378
+ </fo:inline>
3379
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3380
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
3381
+ <!-- <xsl:choose>
3382
+ <xsl:when test="@lang = 'en'"></xsl:when>
3383
+ <xsl:otherwise> -->
3384
+ <xsl:attribute name="white-space">pre</xsl:attribute>
3385
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
3386
+ <!-- </xsl:otherwise>
3387
+ </xsl:choose> -->
3388
+ <xsl:apply-templates/>
3389
+ </fo:block>
3390
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
3391
+ <fo:inline id="{@id}"/>
3392
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
3393
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3394
+ <xsl:variable name="title-appendix">
3395
+ <xsl:call-template name="getTitle">
3396
+ <xsl:with-param name="name" select="'title-appendix'"/>
3397
+ </xsl:call-template>
3398
+ </xsl:variable>
3399
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3400
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3401
+ </fo:block>
3402
+ <xsl:apply-templates/>
3403
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3404
+ <fo:inline><xsl:apply-templates/></fo:inline>
3405
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3406
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
3407
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
3408
+ <xsl:variable name="title-example">
3409
+ <xsl:call-template name="getTitle">
3410
+ <xsl:with-param name="name" select="'title-example'"/>
3411
+ </xsl:call-template>
3412
+ </xsl:variable>
3413
+ <xsl:value-of select="$title-example"/>
3414
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3415
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
3416
+ </xsl:if>
3417
+ <xsl:if test="*[local-name()='name']">
3418
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
3419
+ </xsl:if>
3420
+ </fo:block>
3421
+ <xsl:apply-templates/>
3422
+ </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">
3423
+ <fo:inline><xsl:apply-templates/></fo:inline>
3424
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
3425
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3426
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
3427
+ <xsl:variable name="annotation-id" select="@id"/>
3428
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
3429
+ <fo:block id="{$annotation-id}" white-space="nowrap">
3430
+ <fo:inline>
3431
+ <xsl:apply-templates>
3432
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
3433
+ </xsl:apply-templates>
3434
+ </fo:inline>
3435
+ </fo:block>
3436
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3437
+ <xsl:param name="callout"/>
3438
+ <fo:inline id="{@id}">
3439
+ <!-- for first p in annotation, put <x> -->
3440
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3441
+ <xsl:apply-templates/>
3442
+ </fo:inline>
3443
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
3444
+ <xsl:variable name="title-modified">
3445
+ <xsl:call-template name="getTitle">
3446
+ <xsl:with-param name="name" select="'title-modified'"/>
3447
+ </xsl:call-template>
3448
+ </xsl:variable>
3449
+ <xsl:choose>
3450
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3451
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3452
+ </xsl:choose>
3453
+ <xsl:apply-templates/>
3454
+ </xsl:template><xsl:template name="convertDate">
3455
+ <xsl:param name="date"/>
3456
+ <xsl:param name="format" select="'short'"/>
3457
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
3458
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
3459
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
3460
+ <xsl:variable name="monthStr">
3461
+ <xsl:choose>
3462
+ <xsl:when test="$month = '01'">January</xsl:when>
3463
+ <xsl:when test="$month = '02'">February</xsl:when>
3464
+ <xsl:when test="$month = '03'">March</xsl:when>
3465
+ <xsl:when test="$month = '04'">April</xsl:when>
3466
+ <xsl:when test="$month = '05'">May</xsl:when>
3467
+ <xsl:when test="$month = '06'">June</xsl:when>
3468
+ <xsl:when test="$month = '07'">July</xsl:when>
3469
+ <xsl:when test="$month = '08'">August</xsl:when>
3470
+ <xsl:when test="$month = '09'">September</xsl:when>
3471
+ <xsl:when test="$month = '10'">October</xsl:when>
3472
+ <xsl:when test="$month = '11'">November</xsl:when>
3473
+ <xsl:when test="$month = '12'">December</xsl:when>
3474
+ </xsl:choose>
3475
+ </xsl:variable>
3476
+ <xsl:variable name="result">
3477
+ <xsl:choose>
3478
+ <xsl:when test="$format = 'short' or $day = ''">
3479
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
3480
+ </xsl:when>
3481
+ <xsl:otherwise>
3482
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
3483
+ </xsl:otherwise>
3484
+ </xsl:choose>
3485
+ </xsl:variable>
3486
+ <xsl:value-of select="$result"/>
3487
+ </xsl:template><xsl:template name="insertKeywords">
3488
+ <xsl:param name="sorting" select="'true'"/>
3489
+ <xsl:param name="charAtEnd" select="'.'"/>
3490
+ <xsl:param name="charDelim" select="', '"/>
3491
+ <xsl:choose>
3492
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
3493
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3494
+ <xsl:sort data-type="text" order="ascending"/>
3495
+ <xsl:call-template name="insertKeyword">
3496
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3497
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3498
+ </xsl:call-template>
3499
+ </xsl:for-each>
3500
+ </xsl:when>
3501
+ <xsl:otherwise>
3502
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3503
+ <xsl:call-template name="insertKeyword">
3504
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3505
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3506
+ </xsl:call-template>
3507
+ </xsl:for-each>
3508
+ </xsl:otherwise>
3509
+ </xsl:choose>
3510
+ </xsl:template><xsl:template name="insertKeyword">
3511
+ <xsl:param name="charAtEnd"/>
3512
+ <xsl:param name="charDelim"/>
3513
+ <xsl:apply-templates/>
3514
+ <xsl:choose>
3515
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3516
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3517
+ </xsl:choose>
3518
+ </xsl:template><xsl:template name="addPDFUAmeta">
3519
+ <fo:declarations>
3520
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
3521
+ <pdf:dictionary type="normal" key="ViewerPreferences">
3522
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
3523
+ </pdf:dictionary>
3524
+ </pdf:catalog>
3525
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
3526
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
3527
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
3528
+ <!-- Dublin Core properties go here -->
3529
+ <dc:title>
3530
+ <xsl:variable name="title">
3531
+
3532
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
3533
+
3534
+
3535
+
3536
+
3537
+ </xsl:variable>
3538
+ <xsl:choose>
3539
+ <xsl:when test="normalize-space($title) != ''">
3540
+ <xsl:value-of select="$title"/>
3541
+ </xsl:when>
3542
+ <xsl:otherwise>
3543
+ <xsl:text> </xsl:text>
3544
+ </xsl:otherwise>
3545
+ </xsl:choose>
3546
+ </dc:title>
3547
+ <dc:creator>
3548
+
3549
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
3550
+
3551
+
3552
+ </dc:creator>
3553
+ <dc:description>
3554
+ <xsl:variable name="abstract">
3555
+
3556
+ <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
3557
+
3558
+
3559
+
3560
+
3561
+ </xsl:variable>
3562
+ <xsl:value-of select="normalize-space($abstract)"/>
3563
+ </dc:description>
3564
+ <pdf:Keywords>
3565
+ <xsl:call-template name="insertKeywords"/>
3566
+ </pdf:Keywords>
3567
+ </rdf:Description>
3568
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
3569
+ <!-- XMP properties go here -->
3570
+ <xmp:CreatorTool/>
3571
+ </rdf:Description>
3572
+ </rdf:RDF>
3573
+ </x:xmpmeta>
3574
+ </fo:declarations>
3575
+ </xsl:template><xsl:template name="getId">
3576
+ <xsl:choose>
3577
+ <xsl:when test="../@id">
3578
+ <xsl:value-of select="../@id"/>
3579
+ </xsl:when>
3580
+ <xsl:otherwise>
3581
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
3582
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
3583
+ </xsl:otherwise>
3584
+ </xsl:choose>
3585
+ </xsl:template><xsl:template name="getLevel">
3586
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
3587
+ <xsl:variable name="level">
3588
+ <xsl:choose>
3589
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
3590
+ <xsl:value-of select="$level_total - 2"/>
3591
+ </xsl:when>
3592
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
3593
+ <xsl:value-of select="$level_total - 2"/>
3594
+ </xsl:when>
3595
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
3596
+ <xsl:value-of select="$level_total - 2"/>
3597
+ </xsl:when>
3598
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
3599
+ <xsl:otherwise>
3600
+ <xsl:value-of select="$level_total - 1"/>
3601
+ </xsl:otherwise>
3602
+ </xsl:choose>
3603
+ </xsl:variable>
3604
+ <xsl:value-of select="$level"/>
3605
+ </xsl:template><xsl:template name="getSubSection">
3606
+ <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']"/>
3607
+ </xsl:template><xsl:template name="split">
3608
+ <xsl:param name="pText" select="."/>
3609
+ <xsl:param name="sep" select="','"/>
3610
+ <xsl:if test="string-length($pText) &gt;0">
3611
+ <item>
3612
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
3613
+ </item>
3614
+ <xsl:call-template name="split">
3615
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
3616
+ <xsl:with-param name="sep" select="$sep"/>
3617
+ </xsl:call-template>
3618
+ </xsl:if>
3619
+ </xsl:template><xsl:template name="getDocumentId">
3620
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
3621
+ </xsl:template></xsl:stylesheet>