metanorma-iec 1.0.9 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b6ff62f9dcd74b090c2c917d2f3cf3a9e9189871366b83f04b21a2a1ee44571
4
- data.tar.gz: 758d89c6fb5a0216f88015336dab11e0932c3c175e13c3841f48d56e62e66b8c
3
+ metadata.gz: 73f6a5fb51eb303f54144b691345af51ccc377c41ddf33b650cc0ed2f637bb4c
4
+ data.tar.gz: 76742b35fa520a2dceb24a7897320cf082eb3877c9fb2dd945301a866e711949
5
5
  SHA512:
6
- metadata.gz: a41f914c5b7ea225c7d3adf8ea80fa6690be071dc91461c1e35a4385f54a9cabe4f7bffe9755c087d0bbe88593f18f978cb3ff448e5bb86e6444efc1300b7aa3
7
- data.tar.gz: af7f0b65f1ffd961edbad483ec865f3bd26a25cf247bff849c5950239f434a046b84f1b432eec91b117ea9cedf822f0d1f06dcb62ee74c66fe7ceb62445f5f4b
6
+ metadata.gz: db944a8f3d3d00dd39ed88562e1ed4cdc5e51a60274f58da717e1feba2380666283d4d4d6cb65ba136996dff667c1b06bc72fdc01108e4ea3dc645701a133c5a
7
+ data.tar.gz: d1b2393b0dcaabdf2e7e83fa4005880292e3b13994ab40d0aeccc196cf6c3dae1b8ccc58e2139de2b05c98a913174938b4fde93e2798da772f6790842a90fb09
@@ -66,6 +66,11 @@ module Asciidoctor
66
66
  node.nil? ? IsoDoc::Iec::PdfConvert.new({}) :
67
67
  IsoDoc::Iec::PdfConvert.new(doc_extract_attributes(node))
68
68
  end
69
+
70
+ def presentation_xml_converter(node)
71
+ node.nil? ? IsoDoc::Iec::PresentationXMLConvert.new({}) :
72
+ IsoDoc::Iec::PresentationXMLConvert.new(doc_extract_attributes(node))
73
+ end
69
74
 
70
75
  def norm_ref_preface(f)
71
76
  return super unless @is_iev
@@ -8,6 +8,10 @@ module IsoDoc
8
8
  @meta = Metadata.new(lang, script, labels)
9
9
  end
10
10
 
11
+ def xref_init(lang, script, klass, labels, options)
12
+ @xrefs = Xref.new(lang, script, klass, labels, options)
13
+ end
14
+
11
15
  def boilerplate(node, out)
12
16
  # processed in foreword instead
13
17
  end
@@ -71,17 +75,9 @@ module IsoDoc
71
75
  super.merge(y)
72
76
  end
73
77
 
74
- def annex_name_lbl(clause, num)
75
- obl = l10n("(#{@inform_annex_lbl})")
76
- obl = l10n("(#{@norm_annex_lbl})") if clause["obligation"] == "normative"
77
- l10n("<b>#{@annex_lbl} #{num}</b><br/><br/>#{obl}")
78
- end
79
-
80
78
  def convert1(docxml, filename, dir)
81
79
  id = docxml&.at(ns("//bibdata/docnumber"))&.text
82
80
  @is_iev = id == "60050"
83
- id = docxml&.at(ns("//bibdata/docidentifier[@type = 'ISO']"))&.text
84
- m = /60050-(\d+)/.match(id) and @iev_part = m[1]
85
81
  super
86
82
  end
87
83
 
@@ -98,10 +94,6 @@ module IsoDoc
98
94
  end
99
95
  end
100
96
 
101
- def introduction_names(clause)
102
- return super unless @is_iev
103
- end
104
-
105
97
  def bibliography(isoxml, out)
106
98
  return super unless @is_iev
107
99
  end
@@ -120,7 +112,7 @@ module IsoDoc
120
112
  out.div **attr_code(id: node["id"]) do |div|
121
113
  out.p(**{ class: "zzSTDTitle2" }) do |p|
122
114
  p.b do |b|
123
- b << "#{anchor(node['id'], :label)} "
115
+ b << "#{@xrefs.anchor(node['id'], :label)} "
124
116
  node&.at(ns("./title"))&.children&.each { |c2| parse(c2, b) }
125
117
  end
126
118
  end
@@ -130,28 +122,6 @@ module IsoDoc
130
122
  end
131
123
  end
132
124
 
133
- def initial_anchor_names(d)
134
- super
135
- return unless @is_iev
136
- terms_iev_names(d)
137
- middle_section_asset_names(d)
138
- termnote_anchor_names(d)
139
- termexample_anchor_names(d)
140
- end
141
-
142
- def terms_iev_names(d)
143
- d.xpath(ns("//sections/clause/terms")).each_with_index do |t, i|
144
- num = "#{@iev_part}-%02d" % [i+1]
145
- @anchors[t["id"]] =
146
- { label: num, xref: l10n("#{@labels["section_iev"]}-#{num}"), level: 2,
147
- type: "clause" }
148
- t.xpath(ns("./term")).each_with_index do |c, i|
149
- num2 = "%02d" % [i+1]
150
- section_names1(c, "#{num}-#{num2}", 3)
151
- end
152
- end
153
- end
154
-
155
125
  def termref_cleanup(docxml)
156
126
  return super unless @is_iev
157
127
  docxml.
@@ -1,9 +1,17 @@
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:iec="https://www.metanorma.org/ns/iec" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" version="1.0">
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:iec="https://www.metanorma.org/ns/iec" 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
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
 
6
6
 
7
+ <xsl:param name="additionalXMLs" select="''"/> <!-- iec-rice.fr.xml -->
8
+
9
+ <xsl:variable name="additionalXMLsArray">
10
+ <xsl:call-template name="split">
11
+ <xsl:with-param name="pText" select="normalize-space($additionalXMLs)"/>
12
+ </xsl:call-template>
13
+ </xsl:variable>
14
+
7
15
 
8
16
 
9
17
  <xsl:variable name="debug">false</xsl:variable>
@@ -15,23 +23,18 @@
15
23
  <xsl:variable name="lang-1st-letter" select="''"/>
16
24
  <xsl:variable name="ISOname" select="/iec:iec-standard/iec:bibdata/iec:docidentifier[@type='iso']"/>
17
25
 
18
- <!-- Information and documentation — Codes for transcription systems -->
19
- <xsl:variable name="title-en" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'main']"/>
20
- <xsl:variable name="title-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'main']"/>
21
-
22
26
  <xsl:variable name="title-intro" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-intro']"/>
23
27
  <xsl:variable name="title-intro-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'title-intro']"/>
24
28
  <xsl:variable name="title-main" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-main']"/>
25
29
  <xsl:variable name="title-main-fr" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'fr' and @type = 'title-main']"/>
26
30
  <xsl:variable name="part" select="/iec:iec-standard/iec:bibdata/iec:ext/iec:structuredidentifier/iec:project-number/@part"/>
27
31
 
32
+ <xsl:variable name="doctype_uppercased" select="java:toUpperCase(java:java.lang.String.new(translate(/iec:iec-standard/iec:bibdata/iec:ext/iec:doctype,'-',' ')))"/>
33
+
28
34
 
29
- <xsl:variable name="doctype_uppercased" select="translate(translate(/iec:iec-standard/iec:bibdata/iec:ext/iec:doctype,'-',' '), $lower,$upper)"/>
30
-
31
- <xsl:variable name="organization" select="translate(/iec:iec-standard/iec:bibdata/iec:contributor/iec:organization/iec:name, $lower, $upper)"/>
32
-
33
- <xsl:variable name="publisher" select="translate(/iec:iec-standard/iec:bibdata/iec:contributor[iec:role/@type = 'publisher']/iec:organization/iec:name, $lower, $upper)"/>
34
-
35
+
36
+ <xsl:variable name="publisher" select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:contributor[iec:role/@type = 'publisher']/iec:organization/iec:name))"/>
37
+
35
38
  <xsl:variable name="stage" select="number(/iec:iec-standard/iec:bibdata/iec:status/iec:stage)"/>
36
39
  <xsl:variable name="substage" select="number(/iec:iec-standard/iec:bibdata/iec:status/iec:substage)"/>
37
40
  <xsl:variable name="stagename" select="normalize-space(/iec:iec-standard/iec:bibdata/iec:ext/iec:stagename)"/>
@@ -56,8 +59,8 @@
56
59
 
57
60
  <xsl:variable name="stage-fullname-uppercased">
58
61
  <xsl:choose>
59
- <xsl:when test="$stagename != ''">
60
- <xsl:value-of select="translate($stagename, $lower, $upper)"/>
62
+ <xsl:when test="$stagename != ''">
63
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename))"/>
61
64
  </xsl:when>
62
65
  <xsl:when test="$stage-abbreviation = 'NWIP' or $stage-abbreviation = 'NP'">NEW WORK ITEM PROPOSAL</xsl:when>
63
66
  <xsl:when test="$stage-abbreviation = 'PWI'">PRELIMINARY WORK ITEM</xsl:when>
@@ -77,33 +80,65 @@
77
80
  <item id="term-script" display="false">3.2</item>
78
81
  -->
79
82
  <xsl:variable name="contents">
83
+ <xsl:variable name="docid">
84
+ <xsl:call-template name="getDocumentId"/>
85
+ </xsl:variable>
86
+ <doc id="{$docid}">
87
+ <xsl:call-template name="generateContents"/>
88
+ </doc>
89
+
90
+ <xsl:for-each select="xalan:nodeset($additionalXMLsArray)/*">
91
+ <xsl:for-each select="document(.)">
92
+ <xsl:variable name="lang">
93
+ <xsl:call-template name="getLang"/>
94
+ </xsl:variable>
95
+ <xsl:variable name="document">
96
+ <xsl:apply-templates mode="change_id">
97
+ <xsl:with-param name="lang" select="$lang"/>
98
+ </xsl:apply-templates>
99
+ </xsl:variable>
100
+ <xsl:for-each select="xalan:nodeset($document)">
101
+ <xsl:variable name="docid">
102
+ <xsl:call-template name="getDocumentId"/>
103
+ </xsl:variable>
104
+ <doc id="{$docid}">
105
+ <xsl:call-template name="generateContents"/>
106
+ </doc>
107
+ </xsl:for-each>
108
+ </xsl:for-each>
109
+ </xsl:for-each>
110
+
111
+
112
+ </xsl:variable>
113
+
114
+ <xsl:template name="generateContents">
80
115
  <contents>
81
116
 
82
117
  <xsl:apply-templates select="/iec:iec-standard/iec:preface/node()" mode="contents"/>
83
118
  <!-- <xsl:with-param name="sectionNum" select="'0'"/>
84
119
  </xsl:apply-templates> -->
85
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:clause[@id='_scope']" mode="contents"> <!-- [@id = '_scope'] -->
120
+ <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]" mode="contents"> <!-- [@id = '_scope'] -->
86
121
  <xsl:with-param name="sectionNum" select="'1'"/>
87
122
  </xsl:apply-templates>
88
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']" mode="contents"> <!-- [@id = '_normative_references'] -->
89
- <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + 1"/>
123
+ <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]" mode="contents"> <!-- [@id = '_normative_references'] -->
124
+ <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + 1"/>
90
125
  </xsl:apply-templates>
91
126
 
92
127
  <!-- Terms and definitions -->
93
128
  <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:terms" mode="contents">
94
- <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + count(/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']) + 1"/>
129
+ <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + count(/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]) + 1"/>
95
130
  </xsl:apply-templates>
96
131
 
97
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[local-name() != 'terms' and not(@id='_scope')]" mode="contents">
98
- <xsl:with-param name="sectionNumSkew" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + count(/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']) + count(/iec:iec-standard/iec:sections/iec:terms)"/>
132
+ <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[local-name() != 'terms' and not(starts-with(@id, '_scope'))]" mode="contents">
133
+ <xsl:with-param name="sectionNumSkew" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + count(/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]) + count(/iec:iec-standard/iec:sections/iec:terms)"/>
99
134
  </xsl:apply-templates>
100
135
 
101
136
  <xsl:apply-templates select="/iec:iec-standard/iec:annex" mode="contents"/>
102
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[not(@id = '_normative_references' or @id = '_references')]" mode="contents"/> <!-- @id = '_bibliography' -->
137
+ <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]" mode="contents"/> <!-- @id = '_bibliography' -->
103
138
 
104
139
  </contents>
105
- </xsl:variable>
106
-
140
+ </xsl:template>
141
+
107
142
  <xsl:variable name="color_blue">rgb(0, 90, 162)</xsl:variable>
108
143
  <xsl:variable name="color_gray">rgb(157, 158, 160)</xsl:variable>
109
144
 
@@ -167,46 +202,7 @@
167
202
  </fo:simple-page-master>
168
203
  </fo:layout-master-set>
169
204
 
170
-
171
-
172
- <fo:declarations>
173
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
174
- <pdf:dictionary type="normal" key="ViewerPreferences">
175
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
176
- </pdf:dictionary>
177
- </pdf:catalog>
178
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
179
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
180
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
181
- <!-- Dublin Core properties go here -->
182
- <dc:title>
183
- <xsl:choose>
184
- <xsl:when test="$title-en != ''">
185
- <xsl:value-of select="$title-en"/>
186
- </xsl:when>
187
- <xsl:otherwise>
188
- <xsl:text> </xsl:text>
189
- </xsl:otherwise>
190
- </xsl:choose>
191
- </dc:title>
192
- <dc:creator/>
193
- <dc:description>
194
- <xsl:variable name="abstract">
195
- <xsl:copy-of select="/iec:iec-standard/iec:bibliography/iec:references/iec:bibitem/iec:abstract[@language = 'en']//text()"/>
196
- </xsl:variable>
197
- <xsl:value-of select="normalize-space($abstract)"/>
198
- </dc:description>
199
- <pdf:Keywords>
200
- <xsl:call-template name="insertKeywords"/>
201
- </pdf:Keywords>
202
- </rdf:Description>
203
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
204
- <!-- XMP properties go here -->
205
- <xmp:CreatorTool/>
206
- </rdf:Description>
207
- </rdf:RDF>
208
- </x:xmpmeta>
209
- </fo:declarations>
205
+ <xsl:call-template name="addPDFUAmeta"/>
210
206
 
211
207
  <!-- For 'Published' documents insert two cover pages -->
212
208
  <xsl:if test="$stage &gt;= 60">
@@ -921,230 +917,77 @@
921
917
  <xsl:call-template name="insertHeaderFooter"/>
922
918
  <fo:flow flow-name="xsl-region-body">
923
919
 
924
- <fo:block-container>
925
- <fo:block font-size="12pt" text-align="center" margin-bottom="22pt">
926
- <xsl:call-template name="addLetterSpacing">
927
- <xsl:with-param name="text" select="'CONTENTS'"/>
928
- </xsl:call-template>
929
- </fo:block>
930
-
931
- <xsl:if test="$debug = 'true'">
932
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
933
- DEBUG
934
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
935
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
936
- </xsl:if>
937
-
938
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'] [@level &lt;= 3] [not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
939
- <fo:block text-align-last="justify">
940
- <xsl:if test="@level = 1">
941
- <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
942
- </xsl:if>
943
- <xsl:if test="@level = 2">
944
- <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
945
- </xsl:if>
946
- <xsl:if test="@level = 3">
947
- <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
948
- </xsl:if>
949
- <!-- <xsl:if test="@level &gt;= 2 and @section != ''">
950
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
951
- </xsl:if> -->
952
-
953
- <!-- <xsl:choose>
954
- <xsl:when test="@section != '' and not(@display-section = 'false')"> -->
955
- <fo:list-block>
956
- <xsl:attribute name="margin-left">
957
- <xsl:choose>
958
- <xsl:when test="@level = 2">8mm</xsl:when>
959
- <xsl:when test="@level = 3">23mm</xsl:when>
960
- <xsl:otherwise>0mm</xsl:otherwise>
961
- </xsl:choose>
962
- </xsl:attribute>
963
- <xsl:attribute name="provisional-distance-between-starts">
964
- <xsl:choose>
965
- <xsl:when test="@display-section = 'false' or @section = ''">0mm</xsl:when>
966
- <xsl:when test="@level = 1">8mm</xsl:when>
967
- <xsl:when test="@level = 2">15mm</xsl:when>
968
- <xsl:when test="@level = 3">19mm</xsl:when>
969
- <xsl:otherwise>0mm</xsl:otherwise>
970
- </xsl:choose>
971
- </xsl:attribute>
972
- <fo:list-item>
973
- <fo:list-item-label end-indent="label-end()">
974
- <fo:block>
975
- <xsl:if test="not(@display-section = 'false')">
976
- <xsl:value-of select="@section"/>
977
- </xsl:if>
978
- </fo:block>
979
- </fo:list-item-label>
980
- <fo:list-item-body start-indent="body-start()">
981
- <fo:block text-align-last="justify">
982
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
983
- <xsl:if test="@type = 'annex'">
984
- <fo:inline><xsl:value-of select="@section"/></fo:inline>
985
- <xsl:if test="@addon != ''">
986
- <fo:inline> (<xsl:value-of select="@addon"/>) </fo:inline>
987
- </xsl:if>
988
- </xsl:if>
989
- <xsl:call-template name="addLetterSpacing">
990
- <xsl:with-param name="text" select="text()"/>
991
- </xsl:call-template>
992
- <xsl:text> </xsl:text>
993
- <fo:inline keep-together.within-line="always">
994
- <fo:leader leader-pattern="dots"/>
995
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
996
- </fo:inline>
997
- </fo:basic-link>
998
- </fo:block>
999
- </fo:list-item-body>
1000
- </fo:list-item>
1001
- </fo:list-block>
1002
- </fo:block>
1003
- </xsl:for-each>
1004
-
1005
- <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
1006
- <fo:block margin-bottom="5pt"> </fo:block>
1007
- <!-- <fo:block margin-top="5pt" margin-bottom="10pt">&#xA0;</fo:block> -->
1008
- <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
1009
- <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm">
1010
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
1011
- <xsl:value-of select="@section"/>
1012
- <xsl:if test="text() != ''">
1013
- <xsl:text> – </xsl:text>
1014
- <xsl:value-of select="text()"/><xsl:text> </xsl:text>
1015
- </xsl:if>
1016
- <fo:inline keep-together.within-line="always">
1017
- <fo:leader leader-pattern="dots"/>
1018
- <fo:page-number-citation ref-id="{@id}"/>
1019
- </fo:inline>
1020
- </fo:basic-link>
1021
- </fo:block>
1022
- </xsl:for-each>
1023
- </xsl:if>
1024
-
1025
- <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
1026
- <fo:block margin-bottom="5pt"> </fo:block>
1027
- <!-- <fo:block margin-top="5pt" margin-bottom="10pt">&#xA0;</fo:block> -->
1028
- <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table' and @display = 'true']">
1029
- <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm">
1030
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
1031
- <xsl:value-of select="@section"/>
1032
- <xsl:if test="text() != ''">
1033
- <xsl:text> – </xsl:text>
1034
- <xsl:value-of select="text()"/><xsl:text> </xsl:text>
1035
- </xsl:if>
1036
- <fo:inline keep-together.within-line="always">
1037
- <fo:leader leader-pattern="dots"/>
1038
- <fo:page-number-citation ref-id="{@id}"/>
1039
- </fo:inline>
1040
- </fo:basic-link>
1041
- </fo:block>
1042
- </xsl:for-each>
1043
- </xsl:if>
1044
-
1045
- </fo:block-container>
920
+ <xsl:variable name="docid">
921
+ <xsl:call-template name="getDocumentId"/>
922
+ </xsl:variable>
1046
923
 
1047
- <fo:block break-after="page"/>
924
+ <xsl:if test="$debug = 'true'">
925
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
926
+ DEBUG
927
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
928
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
929
+ </xsl:if>
1048
930
 
1049
- <fo:block-container font-size="12pt" text-align="center" margin-bottom="18pt">
1050
- <fo:block><xsl:value-of select="$organization"/></fo:block>
1051
- <fo:block>___________</fo:block>
1052
- <fo:block> </fo:block>
1053
- <fo:block font-weight="bold">
1054
- <xsl:value-of select="translate($title-intro, $lower, $upper)"/>
1055
- <xsl:text> — </xsl:text>
1056
- <xsl:value-of select="translate($title-main, $lower, $upper)"/>
1057
-
1058
- <xsl:variable name="part-en" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-part']"/>
1059
- <xsl:if test="$part-en != ''">
1060
- <xsl:text> — </xsl:text>
1061
- <fo:block> </fo:block>
1062
- <fo:block>
1063
- <xsl:if test="$part != ''">
1064
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1065
- <xsl:text>: </xsl:text>
1066
- </xsl:if>
1067
- <xsl:value-of select="$part-en"/>
1068
- </fo:block>
1069
- </xsl:if>
1070
- </fo:block>
1071
- </fo:block-container>
931
+ <xsl:call-template name="insertTOCpages">
932
+ <xsl:with-param name="contents" select="xalan:nodeset($contents)/doc[@id = $docid]"/>
933
+ </xsl:call-template>
934
+
935
+ <xsl:call-template name="insertPrefacepages"/>
1072
936
 
1073
- <!-- Foreword, Introduction -->
1074
- <xsl:apply-templates select="/iec:iec-standard/iec:preface/*"/>
1075
-
1076
937
  </fo:flow>
1077
938
  </fo:page-sequence>
1078
939
 
1079
- <!-- BODY -->
1080
- <fo:page-sequence master-reference="document" force-page-count="no-force">
1081
- <fo:static-content flow-name="xsl-footnote-separator">
1082
- <fo:block>
1083
- <fo:leader leader-pattern="rule" leader-length="30%"/>
1084
- </fo:block>
1085
- </fo:static-content>
1086
- <xsl:call-template name="insertHeaderFooter"/>
1087
- <fo:flow flow-name="xsl-region-body">
1088
-
1089
- <fo:block-container font-size="12pt" text-align="center" margin-bottom="36pt">
1090
- <!-- <fo:block><xsl:value-of select="$organization"/></fo:block>
1091
- <fo:block>____________</fo:block>
1092
- <fo:block>&#xa0;</fo:block> -->
1093
- <fo:block font-weight="bold">
1094
- <xsl:value-of select="translate($title-intro, $lower, $upper)"/>
1095
- <xsl:text> — </xsl:text>
1096
- <xsl:value-of select="translate($title-main, $lower, $upper)"/>
1097
- <xsl:variable name="part-en" select="/iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-part']"/>
1098
- <xsl:if test="$part-en != ''">
1099
- <xsl:text> — </xsl:text>
1100
- <fo:block> </fo:block>
1101
- <fo:block>
1102
- <xsl:if test="$part != ''">
1103
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1104
- <xsl:text>: </xsl:text>
1105
- </xsl:if>
1106
- <xsl:value-of select="$part-en"/>
1107
- </fo:block>
1108
- </xsl:if>
1109
- <fo:block> </fo:block>
1110
- </fo:block>
1111
- </fo:block-container>
1112
-
1113
- <!-- Clause(s) -->
1114
- <fo:block>
1115
-
1116
-
1117
- <!-- Scope -->
1118
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:clause[@id='_scope']">
1119
- <xsl:with-param name="sectionNum" select="'1'"/>
1120
- </xsl:apply-templates>
940
+
941
+ <xsl:call-template name="insertBodypages"/>
942
+
943
+
944
+
945
+ <!-- Test=<xsl:copy-of select="$additionalDocs"/> Test -->
946
+ <xsl:for-each select="xalan:nodeset($additionalXMLsArray)/*">
1121
947
 
1122
- <!-- Normative references -->
1123
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']">
1124
- <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + 1"/>
1125
- </xsl:apply-templates>
1126
-
1127
- <!-- Terms and definitions -->
1128
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:terms">
1129
- <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + count(/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']) + 1"/>
1130
- </xsl:apply-templates>
1131
-
1132
- <!-- main sections -->
1133
- <!-- *[position() &gt; 1] -->
1134
- <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[local-name() != 'terms' and not(@id='_scope')]">
1135
- <xsl:with-param name="sectionNumSkew" select="count(/iec:iec-standard/iec:sections/iec:clause[@id='_scope']) + count(/iec:iec-standard/iec:bibliography/iec:references[@id = '_normative_references' or @id = '_references']) + count(/iec:iec-standard/iec:sections/iec:terms)"/>
948
+ <xsl:for-each select="document(.)">
949
+ <xsl:variable name="lang">
950
+ <xsl:call-template name="getLang"/>
951
+ </xsl:variable>
952
+ <xsl:variable name="document">
953
+ <xsl:apply-templates mode="change_id">
954
+ <xsl:with-param name="lang" select="$lang"/>
1136
955
  </xsl:apply-templates>
956
+ </xsl:variable>
957
+
958
+
959
+ <xsl:for-each select="xalan:nodeset($document)">
960
+
961
+ <fo:page-sequence master-reference="document" force-page-count="no-force">
962
+ <xsl:call-template name="insertHeaderFooter"/>
963
+ <fo:flow flow-name="xsl-region-body">
964
+
965
+ <xsl:variable name="docid">
966
+ <xsl:call-template name="getDocumentId"/>
967
+ </xsl:variable>
1137
968
 
1138
- <!-- Annex(s) -->
1139
- <xsl:apply-templates select="/iec:iec-standard/iec:annex"/>
1140
-
1141
- <!-- Bibliography -->
1142
- <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[not(@id = '_normative_references' or @id = '_references')]"/>
1143
-
1144
- </fo:block>
969
+ <xsl:call-template name="insertTOCpages">
970
+ <xsl:with-param name="contents" select="xalan:nodeset($contents)/doc[@id = $docid]"/>
971
+ </xsl:call-template>
972
+
973
+ <xsl:call-template name="insertPrefacepages">
974
+ <xsl:with-param name="lang" select="$lang"/>
975
+ </xsl:call-template>
976
+
977
+ </fo:flow>
978
+ </fo:page-sequence>
1145
979
 
1146
- </fo:flow>
1147
- </fo:page-sequence>
980
+ <xsl:call-template name="insertBodypages">
981
+ <xsl:with-param name="lang" select="$lang"/>
982
+ </xsl:call-template>
983
+
984
+
985
+ </xsl:for-each>
986
+ </xsl:for-each>
987
+ </xsl:for-each>
988
+
989
+
990
+
1148
991
 
1149
992
  <xsl:if test="$stage &gt;= 60">
1150
993
  <fo:page-sequence master-reference="blank-page">
@@ -1200,8 +1043,13 @@
1200
1043
  <fo:inline font-size="8pt" padding-left="0.5mm" color="rgb(88, 88, 90)">®</fo:inline>
1201
1044
  <fo:inline keep-together.within-line="always" font-size="25pt" font-weight="bold" color="{$color_gray}" border-bottom="0.5pt solid {$color_gray}" padding-bottom="3.5mm" baseline-shift="5.5mm"><fo:leader leader-pattern="space"/><xsl:value-of select="/iec:iec-standard/iec:bibdata/iec:docidentifier[@type = 'iso']"/></fo:inline>
1202
1045
  </fo:block>
1203
- <fo:block font-size="10.5pt" text-align="right" margin-top="0.5mm">
1204
- <xsl:text>Edition </xsl:text>
1046
+ <fo:block font-size="10.5pt" text-align="right" margin-top="0.5mm">
1047
+ <xsl:variable name="title-edition">
1048
+ <xsl:call-template name="getTitle">
1049
+ <xsl:with-param name="name" select="'title-edition'"/>
1050
+ </xsl:call-template>
1051
+ </xsl:variable>
1052
+ <xsl:value-of select="$title-edition"/>
1205
1053
  <fo:inline>
1206
1054
  <xsl:value-of select="/iec:iec-standard/iec:bibdata/iec:edition"/>
1207
1055
  <xsl:if test="not(contains(/iec:iec-standard/iec:bibdata/iec:edition, '.'))">.0</xsl:if>
@@ -1290,8 +1138,9 @@
1290
1138
  <xsl:text> — </xsl:text>
1291
1139
  <xsl:value-of select="$linebreak"/>
1292
1140
  <xsl:if test="$part != ''">
1293
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1294
- <xsl:text>: </xsl:text>
1141
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
1142
+ <!-- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1143
+ <xsl:text>: </xsl:text> -->
1295
1144
  </xsl:if>
1296
1145
  <xsl:value-of select="$part-en"/>
1297
1146
  </xsl:if>
@@ -1310,8 +1159,9 @@
1310
1159
  <xsl:text> — </xsl:text>
1311
1160
  <xsl:value-of select="$linebreak"/>
1312
1161
  <xsl:if test="$part != ''">
1313
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1314
- <xsl:text>: </xsl:text>
1162
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part)"/>
1163
+ <!-- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1164
+ <xsl:text>: </xsl:text> -->
1315
1165
  </xsl:if>
1316
1166
  <xsl:value-of select="$part-fr"/>
1317
1167
  </xsl:if>
@@ -1320,6 +1170,235 @@
1320
1170
  </fo:block-container>
1321
1171
  </xsl:template>
1322
1172
 
1173
+ <xsl:template name="insertTOCpages">
1174
+ <xsl:param name="contents"/>
1175
+ <fo:block-container>
1176
+ <fo:block font-size="12pt" text-align="center" margin-bottom="22pt">
1177
+ <xsl:variable name="title-toc">
1178
+ <xsl:call-template name="getTitle">
1179
+ <xsl:with-param name="name" select="'title-toc'"/>
1180
+ </xsl:call-template>
1181
+ </xsl:variable>
1182
+ <xsl:call-template name="addLetterSpacing">
1183
+ <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new($title-toc))"/>
1184
+ </xsl:call-template>
1185
+ </fo:block>
1186
+
1187
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true'] [@level &lt;= 3] [not(@level = 2 and starts-with(@section, '0'))]"><!-- skip clause from preface -->
1188
+ <fo:block text-align-last="justify">
1189
+ <xsl:if test="@level = 1">
1190
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
1191
+ </xsl:if>
1192
+ <xsl:if test="@level = 2">
1193
+ <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
1194
+ </xsl:if>
1195
+ <xsl:if test="@level = 3">
1196
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1197
+ </xsl:if>
1198
+ <!-- <xsl:if test="@level &gt;= 2 and @section != ''">
1199
+ <xsl:attribute name="margin-left">5mm</xsl:attribute>
1200
+ </xsl:if> -->
1201
+
1202
+ <!-- <xsl:choose>
1203
+ <xsl:when test="@section != '' and not(@display-section = 'false')"> -->
1204
+ <fo:list-block>
1205
+ <xsl:attribute name="margin-left">
1206
+ <xsl:choose>
1207
+ <xsl:when test="@level = 2">8mm</xsl:when>
1208
+ <xsl:when test="@level = 3">23mm</xsl:when>
1209
+ <xsl:otherwise>0mm</xsl:otherwise>
1210
+ </xsl:choose>
1211
+ </xsl:attribute>
1212
+ <xsl:attribute name="provisional-distance-between-starts">
1213
+ <xsl:choose>
1214
+ <xsl:when test="@display-section = 'false' or @section = ''">0mm</xsl:when>
1215
+ <xsl:when test="@level = 1">8mm</xsl:when>
1216
+ <xsl:when test="@level = 2">15mm</xsl:when>
1217
+ <xsl:when test="@level = 3">19mm</xsl:when>
1218
+ <xsl:otherwise>0mm</xsl:otherwise>
1219
+ </xsl:choose>
1220
+ </xsl:attribute>
1221
+ <fo:list-item>
1222
+ <fo:list-item-label end-indent="label-end()">
1223
+ <fo:block>
1224
+ <xsl:if test="not(@display-section = 'false')">
1225
+ <xsl:value-of select="@section"/>
1226
+ </xsl:if>
1227
+ </fo:block>
1228
+ </fo:list-item-label>
1229
+ <fo:list-item-body start-indent="body-start()">
1230
+ <fo:block text-align-last="justify">
1231
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
1232
+ <xsl:if test="@type = 'annex'">
1233
+ <fo:inline><xsl:value-of select="@section"/></fo:inline>
1234
+ <xsl:if test="@addon != ''">
1235
+ <fo:inline> (<xsl:value-of select="@addon"/>) </fo:inline>
1236
+ </xsl:if>
1237
+ </xsl:if>
1238
+ <xsl:call-template name="addLetterSpacing">
1239
+ <xsl:with-param name="text" select="text()"/>
1240
+ </xsl:call-template>
1241
+ <xsl:text> </xsl:text>
1242
+ <fo:inline keep-together.within-line="always">
1243
+ <fo:leader leader-pattern="dots"/>
1244
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1245
+ </fo:inline>
1246
+ </fo:basic-link>
1247
+ </fo:block>
1248
+ </fo:list-item-body>
1249
+ </fo:list-item>
1250
+ </fo:list-block>
1251
+ </fo:block>
1252
+ </xsl:for-each>
1253
+
1254
+ <xsl:if test="xalan:nodeset($contents)//item[@type = 'figure']">
1255
+ <fo:block margin-bottom="5pt"> </fo:block>
1256
+ <!-- <fo:block margin-top="5pt" margin-bottom="10pt">&#xA0;</fo:block> -->
1257
+ <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'figure']">
1258
+ <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm">
1259
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
1260
+ <xsl:value-of select="@section"/>
1261
+ <xsl:if test="text() != ''">
1262
+ <xsl:text> – </xsl:text>
1263
+ <xsl:value-of select="text()"/><xsl:text> </xsl:text>
1264
+ </xsl:if>
1265
+ <fo:inline keep-together.within-line="always">
1266
+ <fo:leader leader-pattern="dots"/>
1267
+ <fo:page-number-citation ref-id="{@id}"/>
1268
+ </fo:inline>
1269
+ </fo:basic-link>
1270
+ </fo:block>
1271
+ </xsl:for-each>
1272
+ </xsl:if>
1273
+
1274
+ <xsl:if test="xalan:nodeset($contents)//item[@type = 'table']">
1275
+ <fo:block margin-bottom="5pt"> </fo:block>
1276
+ <!-- <fo:block margin-top="5pt" margin-bottom="10pt">&#xA0;</fo:block> -->
1277
+ <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'table' and @display = 'true']">
1278
+ <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm">
1279
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
1280
+ <xsl:value-of select="@section"/>
1281
+ <xsl:if test="text() != ''">
1282
+ <xsl:text> – </xsl:text>
1283
+ <xsl:value-of select="text()"/><xsl:text> </xsl:text>
1284
+ </xsl:if>
1285
+ <fo:inline keep-together.within-line="always">
1286
+ <fo:leader leader-pattern="dots"/>
1287
+ <fo:page-number-citation ref-id="{@id}"/>
1288
+ </fo:inline>
1289
+ </fo:basic-link>
1290
+ </fo:block>
1291
+ </xsl:for-each>
1292
+ </xsl:if>
1293
+
1294
+ </fo:block-container>
1295
+ </xsl:template>
1296
+
1297
+ <xsl:template name="insertPrefacepages">
1298
+ <xsl:param name="lang" select="$lang"/>
1299
+ <fo:block break-after="page"/>
1300
+ <fo:block-container font-size="12pt" text-align="center" margin-bottom="18pt">
1301
+ <fo:block><xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:contributor/iec:organization/iec:name))"/></fo:block>
1302
+ <fo:block>___________</fo:block>
1303
+ <fo:block> </fo:block>
1304
+ <fo:block font-weight="bold">
1305
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-intro']))"/>
1306
+ <xsl:text> — </xsl:text>
1307
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-main']))"/>
1308
+
1309
+ <xsl:variable name="title-part" select="/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-part']"/>
1310
+ <xsl:if test="$title-part != ''">
1311
+ <xsl:text> — </xsl:text>
1312
+ <fo:block> </fo:block>
1313
+ <fo:block>
1314
+ <xsl:if test="$part != ''">
1315
+ <!-- Example: Part 1: Riz -->
1316
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang = $lang]),'#',$part)"/>
1317
+ </xsl:if>
1318
+ <xsl:value-of select="$title-part"/>
1319
+ </fo:block>
1320
+ </xsl:if>
1321
+ </fo:block>
1322
+ </fo:block-container>
1323
+
1324
+ <!-- Foreword, Introduction -->
1325
+ <xsl:apply-templates select="/iec:iec-standard/iec:preface/*"/>
1326
+ </xsl:template>
1327
+
1328
+
1329
+ <xsl:template name="insertBodypages">
1330
+ <xsl:param name="lang" select="'en'"/>
1331
+ <!-- BODY -->
1332
+ <fo:page-sequence master-reference="document" force-page-count="no-force">
1333
+ <fo:static-content flow-name="xsl-footnote-separator">
1334
+ <fo:block>
1335
+ <fo:leader leader-pattern="rule" leader-length="30%"/>
1336
+ </fo:block>
1337
+ </fo:static-content>
1338
+ <xsl:call-template name="insertHeaderFooter"/>
1339
+ <fo:flow flow-name="xsl-region-body">
1340
+
1341
+ <fo:block-container font-size="12pt" text-align="center" margin-bottom="36pt">
1342
+ <!-- <fo:block><xsl:value-of select="$organization"/></fo:block>
1343
+ <fo:block>____________</fo:block>
1344
+ <fo:block>&#xa0;</fo:block> -->
1345
+ <fo:block font-weight="bold">
1346
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-intro']))"/>
1347
+ <xsl:text> — </xsl:text>
1348
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-main']))"/>
1349
+ <xsl:variable name="title-part" select="/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-part']"/>
1350
+ <xsl:if test="$title-part != ''">
1351
+ <xsl:text> — </xsl:text>
1352
+ <fo:block> </fo:block>
1353
+ <fo:block>
1354
+ <xsl:if test="$part != ''">
1355
+ <!-- Example: Part 1: Rice -->
1356
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang = $lang]),'#',$part)"/>
1357
+ </xsl:if>
1358
+ <xsl:value-of select="$title-part"/>
1359
+ </fo:block>
1360
+ </xsl:if>
1361
+ <fo:block> </fo:block>
1362
+ </fo:block>
1363
+ </fo:block-container>
1364
+
1365
+ <!-- Clause(s) -->
1366
+ <fo:block>
1367
+
1368
+
1369
+ <!-- Scope -->
1370
+ <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]">
1371
+ <xsl:with-param name="sectionNum" select="'1'"/>
1372
+ </xsl:apply-templates>
1373
+
1374
+ <!-- Normative references -->
1375
+ <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]">
1376
+ <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + 1"/>
1377
+ </xsl:apply-templates>
1378
+
1379
+ <!-- Terms and definitions -->
1380
+ <xsl:apply-templates select="/iec:iec-standard/iec:sections/iec:terms">
1381
+ <xsl:with-param name="sectionNum" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + count(/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]) + 1"/>
1382
+ </xsl:apply-templates>
1383
+
1384
+ <!-- main sections -->
1385
+ <!-- *[position() &gt; 1] -->
1386
+ <xsl:apply-templates select="/iec:iec-standard/iec:sections/*[local-name() != 'terms' and not(starts-with(@id, '_scope'))]">
1387
+ <xsl:with-param name="sectionNumSkew" select="count(/iec:iec-standard/iec:sections/iec:clause[starts-with(@id, '_scope')]) + count(/iec:iec-standard/iec:bibliography/iec:references[starts-with(@id, '_normative_references') or starts-with(@id, '_references')]) + count(/iec:iec-standard/iec:sections/iec:terms)"/>
1388
+ </xsl:apply-templates>
1389
+
1390
+ <!-- Annex(s) -->
1391
+ <xsl:apply-templates select="/iec:iec-standard/iec:annex"/>
1392
+
1393
+ <!-- Bibliography -->
1394
+ <xsl:apply-templates select="/iec:iec-standard/iec:bibliography/iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]"/>
1395
+
1396
+ </fo:block>
1397
+
1398
+ </fo:flow>
1399
+ </fo:page-sequence>
1400
+ </xsl:template>
1401
+
1323
1402
  <!-- for pass the paremeter 'sectionNum' over templates, like 'tunnel' parameter in XSLT 2.0 -->
1324
1403
  <xsl:template match="node()">
1325
1404
  <xsl:param name="sectionNum"/>
@@ -1352,7 +1431,7 @@
1352
1431
  <xsl:choose>
1353
1432
  <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
1354
1433
  <xsl:when test="$sectionNumSkew != 0">
1355
- <xsl:variable name="number"><xsl:number count="iec:sections/*[local-name() != 'terms' and not(@id='_scope')]"/></xsl:variable><!-- <xsl:number count="*"/> -->
1434
+ <xsl:variable name="number"><xsl:number count="iec:sections/*[local-name() != 'terms' and not(starts-with(@id, '_scope'))]"/></xsl:variable><!-- <xsl:number count="*"/> -->
1356
1435
  <xsl:value-of select="$number + $sectionNumSkew"/>
1357
1436
  </xsl:when>
1358
1437
  <xsl:otherwise>
@@ -1416,8 +1495,8 @@
1416
1495
  <xsl:if test="local-name(..) = 'annex'"><xsl:value-of select="../@obligation"/></xsl:if>
1417
1496
  </xsl:attribute>
1418
1497
  <xsl:choose>
1419
- <xsl:when test="ancestor::iec:preface">
1420
- <xsl:value-of select="translate(., $lower, $upper)"/>
1498
+ <xsl:when test="ancestor::iec:preface">
1499
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
1421
1500
  </xsl:when>
1422
1501
  <xsl:otherwise>
1423
1502
  <xsl:value-of select="."/>
@@ -1439,7 +1518,12 @@
1439
1518
  </xsl:apply-templates>
1440
1519
  <item level="" id="{@id}" display="false" type="figure">
1441
1520
  <xsl:attribute name="section">
1442
- <xsl:text>Figure </xsl:text>
1521
+ <xsl:variable name="title-figure">
1522
+ <xsl:call-template name="getTitle">
1523
+ <xsl:with-param name="name" select="'title-figure'"/>
1524
+ </xsl:call-template>
1525
+ </xsl:variable>
1526
+ <xsl:value-of select="$title-figure"/>
1443
1527
  <xsl:choose>
1444
1528
  <xsl:when test="ancestor::iec:annex">
1445
1529
  <xsl:choose>
@@ -1475,7 +1559,12 @@
1475
1559
  <xsl:attribute name="display">false</xsl:attribute>
1476
1560
  </xsl:if>
1477
1561
  <xsl:attribute name="section">
1478
- <xsl:text>Table </xsl:text>
1562
+ <xsl:variable name="title-table">
1563
+ <xsl:call-template name="getTitle">
1564
+ <xsl:with-param name="name" select="'title-table'"/>
1565
+ </xsl:call-template>
1566
+ </xsl:variable>
1567
+ <xsl:value-of select="$title-table"/>
1479
1568
  <xsl:choose>
1480
1569
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
1481
1570
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table']"/>
@@ -1504,7 +1593,12 @@
1504
1593
  <item level="" id="{@id}" display="false" type="formula">
1505
1594
  <xsl:attribute name="section">
1506
1595
  <!-- Formula -->
1507
- <xsl:text>Equation (</xsl:text><xsl:number format="A.1" level="multiple" count="iec:annex | iec:formula"/><xsl:text>)</xsl:text>
1596
+ <xsl:variable name="title-equation">
1597
+ <xsl:call-template name="getTitle">
1598
+ <xsl:with-param name="name" select="'title-equation'"/>
1599
+ </xsl:call-template>
1600
+ </xsl:variable>
1601
+ <xsl:value-of select="$title-equation"/><xsl:number format="(A.1)" level="multiple" count="iec:annex | iec:formula"/>
1508
1602
  </xsl:attribute>
1509
1603
  <xsl:attribute name="parentsection">
1510
1604
  <xsl:for-each select="parent::*[1]/iec:title">
@@ -1574,7 +1668,7 @@
1574
1668
  <xsl:template match="iec:iec-standard/iec:preface/iec:foreword" priority="2">
1575
1669
  <fo:block id="{@id}" margin-bottom="12pt" font-size="12pt" text-align="center">
1576
1670
  <xsl:call-template name="addLetterSpacing">
1577
- <xsl:with-param name="text" select="translate(iec:title, $lower, $upper)"/>
1671
+ <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(iec:title))"/>
1578
1672
  </xsl:call-template>
1579
1673
  </fo:block>
1580
1674
  <fo:block font-size="8.2pt" text-align="justify"> <!-- margin-left="6.3mm" -->
@@ -1589,7 +1683,7 @@
1589
1683
  <fo:block break-after="page"/>
1590
1684
  <fo:block id="{@id}" margin-bottom="12pt" font-size="12pt" text-align="center">
1591
1685
  <xsl:call-template name="addLetterSpacing">
1592
- <xsl:with-param name="text" select="translate(iec:title, $lower, $upper)"/>
1686
+ <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(iec:title))"/>
1593
1687
  </xsl:call-template>
1594
1688
  </fo:block>
1595
1689
  <fo:block>
@@ -1621,7 +1715,7 @@
1621
1715
  <xsl:when test="$sectionNum"><xsl:value-of select="$sectionNum"/></xsl:when>
1622
1716
  <xsl:when test="$sectionNumSkew != 0">
1623
1717
  <!-- <xsl:variable name="number"><xsl:number count="iec:sections/iec:clause | iec:sections/iec:terms"/></xsl:variable> -->
1624
- <xsl:variable name="number"><xsl:number count="iec:sections/*[local-name() != 'terms' and not(@id='_scope')]"/></xsl:variable>
1718
+ <xsl:variable name="number"><xsl:number count="iec:sections/*[local-name() != 'terms' and not(starts-with(@id, '_scope'))]"/></xsl:variable>
1625
1719
  <xsl:value-of select="$number + $sectionNumSkew"/>
1626
1720
  </xsl:when>
1627
1721
  </xsl:choose>
@@ -1735,7 +1829,7 @@
1735
1829
  <xsl:apply-templates/>
1736
1830
  </fo:block>
1737
1831
  </xsl:when>
1738
- <xsl:when test="$parent-name = 'references' and not(../@id = '_normative_references' or ../@id = '_references')"> <!-- Bibliography -->
1832
+ <xsl:when test="$parent-name = 'references' and not(starts-with(../@id, '_normative_references') or starts-with(../@id, '_references'))"> <!-- Bibliography -->
1739
1833
  <fo:block id="{$id}" font-size="12pt" text-align="center" margin-bottom="12pt" keep-with-next="always">
1740
1834
  <xsl:call-template name="addLetterSpacing">
1741
1835
  <xsl:with-param name="text" select="."/>
@@ -1744,8 +1838,8 @@
1744
1838
  </fo:block>
1745
1839
  </xsl:when>
1746
1840
  <xsl:when test="$parent-name = 'introduction'">
1747
- <fo:block id="{$id}" font-size="12pt" text-align="center" margin-bottom="10pt">
1748
- <xsl:value-of select="translate(text(), $lower, $upper)"/>
1841
+ <fo:block id="{$id}" font-size="12pt" text-align="center" margin-bottom="10pt">
1842
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(text()))"/>
1749
1843
  </fo:block>
1750
1844
  </xsl:when>
1751
1845
  <xsl:otherwise>
@@ -1903,15 +1997,18 @@
1903
1997
  <xsl:variable name="number">
1904
1998
  <xsl:number level="any" count="iec:p/iec:fn"/>
1905
1999
  </xsl:variable>
2000
+ <xsl:variable name="lang">
2001
+ <xsl:call-template name="getLang"/>
2002
+ </xsl:variable>
1906
2003
  <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="15%"> <!-- font-size="80%" vertical-align="super"-->
1907
- <fo:basic-link internal-destination="footnote_{@reference}" fox:alt-text="footnote {@reference}">
2004
+ <fo:basic-link internal-destination="{$lang}_footnote_{@reference}" fox:alt-text="footnote {@reference}">
1908
2005
  <!-- <xsl:value-of select="@reference"/> -->
1909
2006
  <xsl:value-of select="$number + count(//iec:bibitem/iec:note)"/><!-- <xsl:text>)</xsl:text> -->
1910
2007
  </fo:basic-link>
1911
2008
  </fo:inline>
1912
2009
  <fo:footnote-body>
1913
2010
  <fo:block font-size="8pt" margin-bottom="5pt">
1914
- <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" baseline-shift="15%" padding-right="3mm"> <!-- padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
2011
+ <fo:inline id="{$lang}_footnote_{@reference}" keep-with-next.within-line="always" baseline-shift="15%" padding-right="3mm"> <!-- padding-right="3mm" font-size="60%" alignment-baseline="hanging" -->
1915
2012
  <xsl:value-of select="$number + count(//iec:bibitem/iec:note)"/><!-- <xsl:text>)</xsl:text> -->
1916
2013
  </fo:inline>
1917
2014
  <xsl:for-each select="iec:p">
@@ -1951,16 +2048,17 @@
1951
2048
  <fo:block>
1952
2049
  <fo:external-graphic src="{@src}" fox:alt-text="Image"/>
1953
2050
  </fo:block>
1954
- <fo:block font-weight="bold" margin-top="12pt" margin-bottom="12pt">Figure <xsl:number format="1" level="any"/></fo:block>
2051
+ <xsl:variable name="title-figure">
2052
+ <xsl:call-template name="getTitle">
2053
+ <xsl:with-param name="name" select="'title-figure'"/>
2054
+ </xsl:call-template>
2055
+ </xsl:variable>
2056
+ <fo:block font-weight="bold" margin-top="12pt" margin-bottom="12pt"><xsl:value-of select="$title-figure"/><xsl:number format="1" level="any"/></fo:block>
1955
2057
  </fo:block-container>
1956
2058
 
1957
2059
  </xsl:template>
1958
2060
 
1959
- <xsl:template match="iec:figure">
1960
- <xsl:variable name="title">
1961
- <xsl:text>Figure </xsl:text>
1962
- </xsl:variable>
1963
-
2061
+ <xsl:template match="iec:figure">
1964
2062
  <fo:block-container id="{@id}">
1965
2063
  <fo:block>
1966
2064
  <xsl:apply-templates/>
@@ -1970,6 +2068,11 @@
1970
2068
  <xsl:call-template name="note"/>
1971
2069
  </xsl:for-each>
1972
2070
  <fo:block font-weight="bold" text-align="center" margin-top="12pt" margin-bottom="12pt" keep-with-previous="always">
2071
+ <xsl:variable name="title-figure">
2072
+ <xsl:call-template name="getTitle">
2073
+ <xsl:with-param name="name" select="'title-figure'"/>
2074
+ </xsl:call-template>
2075
+ </xsl:variable>
1973
2076
  <xsl:choose>
1974
2077
  <xsl:when test="ancestor::iec:annex">
1975
2078
 
@@ -1979,13 +2082,14 @@
1979
2082
  <xsl:number format="a) "/>
1980
2083
  </xsl:when>
1981
2084
  <xsl:otherwise> -->
1982
- <xsl:value-of select="$title"/><xsl:number format="A.1-1" level="multiple" count="iec:annex | iec:figure"/>
2085
+
2086
+ <xsl:value-of select="$title-figure"/><xsl:number format="A.1-1" level="multiple" count="iec:annex | iec:figure"/>
1983
2087
  <!-- </xsl:otherwise>
1984
2088
  </xsl:choose> -->
1985
2089
 
1986
2090
  </xsl:when>
1987
2091
  <xsl:otherwise>
1988
- <xsl:value-of select="$title"/><xsl:number format="1" level="any"/>
2092
+ <xsl:value-of select="$title-figure"/><xsl:number format="1" level="any"/>
1989
2093
  </xsl:otherwise>
1990
2094
  </xsl:choose>
1991
2095
  <xsl:if test="iec:name">
@@ -2043,13 +2147,13 @@
2043
2147
  <xsl:number level="any" count="iec:bibitem/iec:note"/>
2044
2148
  </xsl:variable>
2045
2149
  <fo:inline font-size="8pt" keep-with-previous.within-line="always" baseline-shift="15%"> <!--font-size="85%" vertical-align="super"60% -->
2046
- <fo:basic-link internal-destination="footnote_{../@id}" fox:alt-text="footnote {$number}">
2150
+ <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
2047
2151
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
2048
2152
  </fo:basic-link>
2049
2153
  </fo:inline>
2050
2154
  <fo:footnote-body>
2051
2155
  <fo:block font-size="8pt" margin-bottom="5pt">
2052
- <fo:inline id="footnote_{../@id}" keep-with-next.within-line="always" baseline-shift="15%" padding-right="3mm"><!-- padding-right="9mm" alignment-baseline="hanging" font-size="60%" -->
2156
+ <fo:inline id="{generate-id()}" keep-with-next.within-line="always" baseline-shift="15%" padding-right="3mm"><!-- padding-right="9mm" alignment-baseline="hanging" font-size="60%" -->
2053
2157
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
2054
2158
  </fo:inline>
2055
2159
  <xsl:apply-templates/>
@@ -2118,11 +2222,20 @@
2118
2222
  </fo:block>
2119
2223
  </xsl:template>
2120
2224
 
2225
+ <xsl:template match="iec:term">
2226
+ <xsl:param name="sectionNum"/>
2227
+ <fo:block id="{@id}">
2228
+ <xsl:apply-templates>
2229
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
2230
+ </xsl:apply-templates>
2231
+ </fo:block>
2232
+ </xsl:template>
2233
+
2121
2234
  <xsl:template match="iec:preferred">
2122
2235
  <xsl:param name="sectionNum"/>
2123
2236
  <fo:block line-height="1.1" space-before="14pt">
2124
2237
  <fo:block font-weight="bold" keep-with-next="always">
2125
- <fo:inline id="{../@id}">
2238
+ <fo:inline>
2126
2239
  <xsl:value-of select="$sectionNum"/>.<xsl:number count="iec:term"/>
2127
2240
  </fo:inline>
2128
2241
  </fo:block>
@@ -2139,7 +2252,12 @@
2139
2252
  </xsl:template>
2140
2253
 
2141
2254
  <xsl:template match="iec:deprecates">
2142
- <fo:block font-size="8pt" margin-top="5pt" margin-bottom="5pt">DEPRECATED: <xsl:apply-templates/></fo:block>
2255
+ <xsl:variable name="title-deprecated">
2256
+ <xsl:call-template name="getTitle">
2257
+ <xsl:with-param name="name" select="'title-deprecated'"/>
2258
+ </xsl:call-template>
2259
+ </xsl:variable>
2260
+ <fo:block font-size="8pt" margin-top="5pt" margin-bottom="5pt"><xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/></fo:block>
2143
2261
  </xsl:template>
2144
2262
 
2145
2263
  <xsl:template match="iec:definition[preceding-sibling::iec:domain]">
@@ -2160,7 +2278,14 @@
2160
2278
  <fo:block margin-bottom="8pt" keep-with-previous="always">
2161
2279
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
2162
2280
  <fo:basic-link internal-destination="{iec:origin/@bibitemid}" fox:alt-text="{iec:origin/@citeas}">
2163
- <xsl:text>[SOURCE: </xsl:text>
2281
+ <xsl:text>[</xsl:text>
2282
+ <xsl:variable name="title-source">
2283
+ <xsl:call-template name="getTitle">
2284
+ <xsl:with-param name="name" select="'title-source'"/>
2285
+ </xsl:call-template>
2286
+ </xsl:variable>
2287
+ <xsl:value-of select="$title-source"/>
2288
+ <xsl:text>: </xsl:text>
2164
2289
  <xsl:value-of select="iec:origin/@citeas"/>
2165
2290
  <xsl:apply-templates select="iec:origin/iec:localityStack"/>
2166
2291
  </fo:basic-link>
@@ -2169,19 +2294,20 @@
2169
2294
  </fo:block>
2170
2295
  </xsl:template>
2171
2296
 
2172
- <xsl:template match="iec:modification">
2173
- <xsl:text>, modified — </xsl:text>
2174
- <xsl:apply-templates/>
2175
- </xsl:template>
2297
+
2176
2298
  <xsl:template match="iec:modification/iec:p">
2177
2299
  <fo:inline><xsl:apply-templates/></fo:inline>
2178
2300
  </xsl:template>
2179
2301
 
2180
2302
  <xsl:template match="iec:termnote">
2181
- <fo:block font-size="8pt" margin-top="5pt" margin-bottom="5pt">
2182
- <xsl:text>Note </xsl:text>
2183
- <xsl:number/>
2184
- <xsl:text> to entry: </xsl:text>
2303
+ <fo:block font-size="8pt" margin-top="5pt" margin-bottom="5pt">
2304
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
2305
+ <xsl:variable name="title-note-to-entry">
2306
+ <xsl:call-template name="getTitle">
2307
+ <xsl:with-param name="name" select="'title-note-to-entry'"/>
2308
+ </xsl:call-template>
2309
+ </xsl:variable>
2310
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($title-note-to-entry),'#',$num)"/>
2185
2311
  <xsl:apply-templates/>
2186
2312
  </fo:block>
2187
2313
  </xsl:template>
@@ -2197,7 +2323,12 @@
2197
2323
 
2198
2324
  <xsl:template match="iec:termexample">
2199
2325
  <fo:block margin-top="14pt" margin-bottom="10pt">
2200
- <fo:inline padding-right="10mm">EXAMPLE</fo:inline>
2326
+ <xsl:variable name="title-example">
2327
+ <xsl:call-template name="getTitle">
2328
+ <xsl:with-param name="name" select="'title-example'"/>
2329
+ </xsl:call-template>
2330
+ </xsl:variable>
2331
+ <fo:inline padding-right="10mm"><xsl:value-of select="normalize-space($title-example)"/></fo:inline>
2201
2332
  <xsl:apply-templates/>
2202
2333
  </fo:block>
2203
2334
  </xsl:template>
@@ -2214,7 +2345,7 @@
2214
2345
 
2215
2346
 
2216
2347
  <!-- <xsl:template match="iec:references[@id = '_bibliography']"> -->
2217
- <xsl:template match="iec:references[not(@id = '_normative_references' or @id = '_references')]">
2348
+ <xsl:template match="iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]">
2218
2349
  <fo:block break-after="page"/>
2219
2350
  <xsl:apply-templates/>
2220
2351
  <fo:block-container text-align="center" margin-top="10mm">
@@ -2225,7 +2356,7 @@
2225
2356
 
2226
2357
  <!-- Example: [1] ISO 9:1995, Information and documentation – Transliteration of Cyrillic characters into Latin characters – Slavic and non-Slavic languages -->
2227
2358
  <!-- <xsl:template match="iec:references[@id = '_bibliography']/iec:bibitem"> -->
2228
- <xsl:template match="iec:references[not(@id = '_normative_references' or @id = '_references')]/iec:bibitem">
2359
+ <xsl:template match="iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]/iec:bibitem">
2229
2360
  <fo:list-block margin-top="5pt" margin-bottom="14pt" provisional-distance-between-starts="0mm"> <!-- provisional-distance-between-starts="12mm" -->
2230
2361
  <fo:list-item>
2231
2362
  <fo:list-item-label end-indent="label-end()">
@@ -2258,10 +2389,10 @@
2258
2389
  </xsl:template>
2259
2390
 
2260
2391
  <!-- <xsl:template match="iec:references[@id = '_bibliography']/iec:bibitem" mode="contents"/> -->
2261
- <xsl:template match="iec:references[not(@id = '_normative_references' or @id = '_references')]/iec:bibitem" mode="contents"/>
2392
+ <xsl:template match="iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]/iec:bibitem" mode="contents"/>
2262
2393
 
2263
2394
  <!-- <xsl:template match="iec:references[@id = '_bibliography']/iec:bibitem/iec:title"> -->
2264
- <xsl:template match="iec:references[not(@id = '_normative_references' or @id = '_references')]/iec:bibitem/iec:title">
2395
+ <xsl:template match="iec:references[not(starts-with(@id, '_normative_references') or starts-with(@id, '_references'))]/iec:bibitem/iec:title">
2265
2396
  <fo:inline font-style="italic">
2266
2397
  <xsl:apply-templates/>
2267
2398
  </fo:inline>
@@ -2283,20 +2414,34 @@
2283
2414
 
2284
2415
  <xsl:template match="iec:source">
2285
2416
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
2286
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2417
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2287
2418
  <xsl:apply-templates select="iec:localityStack"/>
2288
2419
  </fo:basic-link>
2289
2420
  </xsl:template>
2290
2421
 
2291
2422
 
2292
2423
  <xsl:template match="iec:xref">
2424
+
2425
+ <xsl:variable name="docid">
2426
+ <xsl:call-template name="getDocumentId"/>
2427
+ </xsl:variable>
2428
+ <xsl:variable name="contents" select="xalan:nodeset($contents)/doc[@id = $docid]"/>
2429
+ <!-- <xsl:call-template name="generateContents"/>
2430
+ </xsl:variable>
2431
+ -->
2432
+
2293
2433
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
2294
2434
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{$section}">
2295
2435
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
2296
2436
  <xsl:variable name="root" select="xalan:nodeset($contents)//item[@id = current()/@target]/@root"/>
2297
2437
  <xsl:variable name="parentsection" select="xalan:nodeset($contents)//item[@id = current()/@target]/@parentsection"/>
2438
+ <xsl:variable name="title-clause">
2439
+ <xsl:call-template name="getTitle">
2440
+ <xsl:with-param name="name" select="'title-clause'"/>
2441
+ </xsl:call-template>
2442
+ </xsl:variable>
2298
2443
  <xsl:choose>
2299
- <xsl:when test="$type = 'clause' and $root != 'annex'">Clause </xsl:when><!-- and not (ancestor::annex) -->
2444
+ <xsl:when test="$type = 'clause' and $root != 'annex'"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
2300
2445
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
2301
2446
  </xsl:choose>
2302
2447
  <xsl:variable name="currentsection">
@@ -2313,7 +2458,12 @@
2313
2458
 
2314
2459
  <xsl:template match="iec:example/iec:p">
2315
2460
  <fo:block>
2316
- <fo:inline padding-right="9mm">EXAMPLE</fo:inline>
2461
+ <xsl:variable name="title-example">
2462
+ <xsl:call-template name="getTitle">
2463
+ <xsl:with-param name="name" select="'title-example'"/>
2464
+ </xsl:call-template>
2465
+ </xsl:variable>
2466
+ <fo:inline padding-right="9mm"><xsl:value-of select="normalize-space($title-example)"/></fo:inline>
2317
2467
  <xsl:apply-templates/>
2318
2468
  </fo:block>
2319
2469
  </xsl:template>
@@ -2324,7 +2474,12 @@
2324
2474
  <xsl:attribute name="margin-bottom">9pt</xsl:attribute>
2325
2475
  </xsl:if>
2326
2476
  <fo:inline padding-right="6mm">
2327
- <xsl:text>NOTE </xsl:text>
2477
+ <xsl:variable name="title-note">
2478
+ <xsl:call-template name="getTitle">
2479
+ <xsl:with-param name="name" select="'title-note'"/>
2480
+ </xsl:call-template>
2481
+ </xsl:variable>
2482
+ <xsl:value-of select="$title-note"/>
2328
2483
  <xsl:if test="ancestor::iec:figure">
2329
2484
  <xsl:variable name="id" select="ancestor::iec:figure[1]/@id"/>
2330
2485
  <xsl:if test="count(//iec:note[ancestor::*[@id = $id]]) &gt; 1">
@@ -2345,16 +2500,31 @@
2345
2500
  <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
2346
2501
  <xsl:attribute name="vertical-align">super</xsl:attribute>
2347
2502
  </xsl:if>
2348
- <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
2503
+ <xsl:value-of select="@citeas"/> <!-- disable-output-escaping="yes" -->
2349
2504
  <xsl:apply-templates select="iec:localityStack"/>
2350
2505
  </fo:basic-link>
2351
2506
  </xsl:template>
2352
2507
 
2353
2508
  <xsl:template match="iec:locality">
2509
+ <xsl:variable name="title-clause">
2510
+ <xsl:call-template name="getTitle">
2511
+ <xsl:with-param name="name" select="'title-clause'"/>
2512
+ </xsl:call-template>
2513
+ </xsl:variable>
2514
+ <xsl:variable name="title-annex">
2515
+ <xsl:call-template name="getTitle">
2516
+ <xsl:with-param name="name" select="'title-annex'"/>
2517
+ </xsl:call-template>
2518
+ </xsl:variable>
2519
+ <xsl:variable name="title-table">
2520
+ <xsl:call-template name="getTitle">
2521
+ <xsl:with-param name="name" select="'title-table'"/>
2522
+ </xsl:call-template>
2523
+ </xsl:variable>
2354
2524
  <xsl:choose>
2355
- <xsl:when test="@type ='clause'">Clause </xsl:when>
2356
- <xsl:when test="@type ='annex'">Annex </xsl:when>
2357
- <xsl:when test="@type ='table'">Table </xsl:when>
2525
+ <xsl:when test="@type ='clause'"><xsl:value-of select="$title-clause"/></xsl:when>
2526
+ <xsl:when test="@type ='annex'"><xsl:value-of select="$title-annex"/></xsl:when>
2527
+ <xsl:when test="@type ='table'"><xsl:value-of select="$title-table"/></xsl:when>
2358
2528
  <xsl:otherwise><xsl:value-of select="@type"/></xsl:otherwise>
2359
2529
  </xsl:choose>
2360
2530
  <xsl:text> </xsl:text><xsl:value-of select="iec:referenceFrom"/>
@@ -2364,7 +2534,7 @@
2364
2534
  <fo:block-container border="0.5pt solid black" margin-left="-2mm" margin-right="-2mm" space-before="18pt" space-after="12pt">
2365
2535
  <fo:block-container margin-left="0mm" margin-right="0mm" font-weight="bold" padding="1mm" padding-top="2mm">
2366
2536
  <fo:block text-align="justify">
2367
- <fo:inline><xsl:value-of select="translate(@type, $lower, $upper)"/> – </fo:inline>
2537
+ <fo:inline><xsl:value-of select="java:toUpperCase(java:java.lang.String.new(@type))"/> – </fo:inline>
2368
2538
  <xsl:apply-templates/>
2369
2539
  </fo:block>
2370
2540
  </fo:block-container>
@@ -2383,6 +2553,12 @@
2383
2553
  </xsl:call-template>
2384
2554
  </xsl:template>
2385
2555
 
2556
+ <xsl:template match="iec:formula">
2557
+ <fo:block id="{@id}">
2558
+ <xsl:apply-templates/>
2559
+ </fo:block>
2560
+ </xsl:template>
2561
+
2386
2562
  <xsl:template match="iec:formula/iec:dt/iec:stem">
2387
2563
  <fo:inline>
2388
2564
  <xsl:apply-templates/>
@@ -2396,7 +2572,7 @@
2396
2572
  </xsl:template>
2397
2573
 
2398
2574
  <xsl:template match="iec:formula/iec:stem">
2399
- <fo:block id="{../@id}" margin-top="6pt" margin-bottom="12pt">
2575
+ <fo:block margin-top="6pt" margin-bottom="12pt">
2400
2576
  <fo:table table-layout="fixed" width="100%">
2401
2577
  <fo:table-column column-width="95%"/>
2402
2578
  <fo:table-column column-width="5%"/>
@@ -2411,7 +2587,7 @@
2411
2587
  <fo:block text-align="right" margin-right="-10mm">
2412
2588
  <xsl:choose>
2413
2589
  <xsl:when test="ancestor::iec:annex">
2414
- <xsl:text>(</xsl:text><xsl:number format="A.1" level="multiple" count="iec:annex | iec:formula"/><xsl:text>)</xsl:text>
2590
+ <xsl:number format="(A.1)" level="multiple" count="iec:annex | iec:formula"/>
2415
2591
  </xsl:when>
2416
2592
  <xsl:otherwise> <!-- not(ancestor::iec:annex) -->
2417
2593
  <xsl:text>(</xsl:text><xsl:number level="any" count="iec:formula"/><xsl:text>)</xsl:text>
@@ -2485,38 +2661,6 @@
2485
2661
  </fo:static-content>
2486
2662
  </xsl:template>
2487
2663
 
2488
- <xsl:template name="getId">
2489
- <xsl:choose>
2490
- <xsl:when test="../@id">
2491
- <xsl:value-of select="../@id"/>
2492
- </xsl:when>
2493
- <xsl:otherwise>
2494
- <xsl:value-of select="text()"/>
2495
- </xsl:otherwise>
2496
- </xsl:choose>
2497
- </xsl:template>
2498
-
2499
- <xsl:template name="getLevel">
2500
- <xsl:variable name="level_total" select="count(ancestor::*)"/>
2501
- <xsl:variable name="level">
2502
- <xsl:choose>
2503
- <xsl:when test="ancestor::iec:preface">
2504
- <xsl:value-of select="$level_total - 2"/>
2505
- </xsl:when>
2506
- <xsl:when test="ancestor::iec:sections">
2507
- <xsl:value-of select="$level_total - 2"/>
2508
- </xsl:when>
2509
- <xsl:when test="ancestor::iec:bibliography">
2510
- <xsl:value-of select="$level_total - 2"/>
2511
- </xsl:when>
2512
- <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
2513
- <xsl:otherwise>
2514
- <xsl:value-of select="$level_total - 1"/>
2515
- </xsl:otherwise>
2516
- </xsl:choose>
2517
- </xsl:variable>
2518
- <xsl:value-of select="$level"/>
2519
- </xsl:template>
2520
2664
 
2521
2665
  <xsl:template name="getSection">
2522
2666
  <xsl:param name="sectionNum"/>
@@ -2536,7 +2680,7 @@
2536
2680
  </xsl:when>
2537
2681
  <xsl:when test="$level &gt;= 2">
2538
2682
  <xsl:variable name="num">
2539
- <xsl:number format=".1" level="multiple" count="iec:clause/iec:clause | iec:clause/iec:terms | iec:terms/iec:term | iec:clause/iec:term"/>
2683
+ <xsl:call-template name="getSubSection"/>
2540
2684
  </xsl:variable>
2541
2685
  <xsl:value-of select="concat($sectionNum, $num)"/>
2542
2686
  </xsl:when>
@@ -2559,7 +2703,12 @@
2559
2703
  <xsl:when test="ancestor::iec:annex">
2560
2704
  <xsl:choose>
2561
2705
  <xsl:when test="$level = 1">
2562
- <xsl:text>Annex </xsl:text>
2706
+ <xsl:variable name="title-annex">
2707
+ <xsl:call-template name="getTitle">
2708
+ <xsl:with-param name="name" select="'title-annex'"/>
2709
+ </xsl:call-template>
2710
+ </xsl:variable>
2711
+ <xsl:value-of select="$title-annex"/>
2563
2712
  <xsl:choose>
2564
2713
  <xsl:when test="count(//iec:annex) = 1">
2565
2714
  <xsl:value-of select="/iec:iec-standard/iec:bibdata/iec:ext/iec:structuredidentifier/iec:annexid"/>
@@ -2644,7 +2793,7 @@
2644
2793
  <xsl:param name="letter-spacing" select="'0.15'"/>
2645
2794
  <xsl:if test="string-length($text) &gt; 0">
2646
2795
  <xsl:variable name="char" select="substring($text,1,1)"/>
2647
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
2796
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
2648
2797
  <xsl:choose>
2649
2798
  <xsl:when test="$char=$upperCase">
2650
2799
  <fo:inline font-size="{100 div 0.75}%">
@@ -2676,47 +2825,227 @@
2676
2825
  </fo:inline>
2677
2826
  </xsl:template>
2678
2827
 
2679
- <xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-table">
2828
+ <xsl:template match="node()" mode="change_id">
2829
+ <xsl:param name="lang"/>
2830
+ <xsl:copy>
2831
+ <xsl:apply-templates select="@*|node()" mode="change_id">
2832
+ <xsl:with-param name="lang" select="$lang"/>
2833
+ </xsl:apply-templates>
2834
+ </xsl:copy>
2835
+ </xsl:template>
2836
+
2837
+ <xsl:template match="@*" mode="change_id">
2838
+ <xsl:param name="lang"/>
2839
+ <xsl:choose>
2840
+ <xsl:when test="local-name() = 'id' or local-name() = 'bibitemid' or (local-name() = 'target' and local-name(..) = 'xref')">
2841
+ <xsl:attribute name="{local-name()}">
2842
+ <xsl:value-of select="."/>_<xsl:value-of select="$lang"/>
2843
+ </xsl:attribute>
2844
+ </xsl:when>
2845
+ <xsl:otherwise>
2846
+ <xsl:copy>
2847
+ <xsl:apply-templates select="@*" mode="change_id">
2848
+ <xsl:with-param name="lang" select="$lang"/>
2849
+ </xsl:apply-templates>
2850
+ </xsl:copy>
2851
+ </xsl:otherwise>
2852
+ </xsl:choose>
2853
+ </xsl:template>
2854
+ <!-- DEBUG ONLY -->
2855
+ <!-- <xsl:template match="iec:title" mode="change_id">
2856
+ <xsl:copy>
2857
+ <xsl:apply-templates select="@*" mode="change_id">
2858
+ <xsl:with-param name="lang" select="$lang"/>
2859
+ </xsl:apply-templates>FR <xsl:apply-templates mode="change_id"/>
2860
+ </xsl:copy>
2861
+ </xsl:template> -->
2862
+
2863
+ <xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="titles_">
2864
+
2865
+ <title-table lang="en">Table </title-table>
2866
+ <title-table lang="fr">Tableau </title-table>
2867
+
2868
+ <title-table lang="zh">Table </title-table>
2869
+
2870
+
2871
+
2872
+ <title-note lang="en">NOTE </title-note>
2873
+ <title-note lang="fr">NOTE </title-note>
2874
+
2875
+ <title-note lang="zh">NOTE </title-note>
2876
+
2877
+
2878
+
2879
+ <title-figure lang="en">Figure </title-figure>
2880
+ <title-figure lang="fr">Figure </title-figure>
2881
+
2882
+ <title-figure lang="zh">Figure </title-figure>
2883
+
2884
+
2885
+
2886
+ <title-example lang="en">EXAMPLE </title-example>
2887
+ <title-example lang="fr">EXEMPLE </title-example>
2888
+
2889
+ <title-example lang="zh">EXAMPLE </title-example>
2890
+
2891
+
2892
+
2893
+ <title-example-xref lang="en">Example </title-example-xref>
2894
+ <title-example-xref lang="fr">Exemple </title-example-xref>
2895
+
2896
+ <title-section lang="en">Section </title-section>
2897
+ <title-section lang="fr">Section </title-section>
2898
+
2899
+ <title-inequality lang="en">Inequality </title-inequality>
2900
+ <title-inequality lang="fr">Inequality </title-inequality>
2901
+
2902
+ <title-equation lang="en">Equation </title-equation>
2903
+ <title-equation lang="fr">Equation </title-equation>
2904
+
2905
+ <title-annex lang="en">Annex </title-annex>
2906
+ <title-annex lang="fr">Annexe </title-annex>
2907
+
2908
+ <title-annex lang="zh">Annex </title-annex>
2909
+
2910
+
2911
+
2912
+ <title-appendix lang="en">Appendix </title-appendix>
2913
+ <title-appendix lang="fr">Appendix </title-appendix>
2914
+
2915
+ <title-clause lang="en">Clause </title-clause>
2916
+ <title-clause lang="fr">Article </title-clause>
2917
+
2918
+ <title-clause lang="zh">Clause </title-clause>
2919
+
2920
+
2921
+
2922
+ <title-edition lang="en">
2923
+
2924
+ <xsl:text>Edition </xsl:text>
2925
+
2926
+
2927
+ </title-edition>
2928
+
2929
+ <title-formula lang="en">Formula </title-formula>
2930
+ <title-formula lang="fr">Formula </title-formula>
2931
+
2932
+ <title-toc lang="en">
2933
+
2934
+ <xsl:text>Contents</xsl:text>
2935
+
2936
+
2937
+
2938
+ </title-toc>
2939
+ <title-toc lang="fr">Sommaire</title-toc>
2940
+
2941
+ <title-toc lang="zh">Contents</title-toc>
2942
+
2943
+
2944
+
2945
+ <title-page lang="en">Page</title-page>
2946
+ <title-page lang="fr">Page</title-page>
2947
+
2948
+ <title-key lang="en">Key</title-key>
2949
+ <title-key lang="fr">Légende</title-key>
2950
+
2951
+ <title-where lang="en">where</title-where>
2952
+ <title-where lang="fr">où</title-where>
2953
+
2954
+ <title-descriptors lang="en">Descriptors</title-descriptors>
2955
+
2956
+ <title-part lang="en">
2957
+
2958
+
2959
+ <xsl:text>Part #: </xsl:text>
2960
+
2961
+ </title-part>
2962
+ <title-part lang="fr">
2963
+
2964
+
2965
+ <xsl:text>Partie #: </xsl:text>
2966
+
2967
+ </title-part>
2968
+ <title-part lang="zh">第 # 部分:</title-part>
2969
+
2970
+ <title-note-to-entry lang="en">Note # to entry: </title-note-to-entry>
2971
+ <title-note-to-entry lang="fr">Note # à l'article: </title-note-to-entry>
2972
+
2973
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2974
+
2975
+
2976
+
2977
+ <title-modified lang="en">modified</title-modified>
2978
+ <title-modified lang="fr">modifiée</title-modified>
2979
+
2980
+ <title-modified lang="zh">modified</title-modified>
2680
2981
 
2681
- <xsl:text>Table </xsl:text>
2682
2982
 
2683
2983
 
2684
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note">
2984
+ <title-source lang="en">SOURCE</title-source>
2685
2985
 
2686
- <xsl:text>NOTE </xsl:text>
2986
+ <title-keywords lang="en">Keywords</title-keywords>
2687
2987
 
2988
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2989
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2688
2990
 
2689
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-figure">
2991
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2690
2992
 
2691
- <xsl:text>Figure </xsl:text>
2993
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2692
2994
 
2995
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2693
2996
 
2694
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-example">
2997
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2695
2998
 
2696
- <xsl:text>EXAMPLE </xsl:text>
2999
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
2697
3000
 
3001
+ <title-abstract lang="en">Abstract</title-abstract>
2698
3002
 
2699
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-inequality">Inequality </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-equation">Equation </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-annex">
3003
+ <title-summary lang="en">Summary</title-summary>
2700
3004
 
2701
- <xsl:text>Annex </xsl:text>
3005
+ <title-in lang="en">in </title-in>
2702
3006
 
3007
+ <title-box lang="en">Box </title-box>
2703
3008
 
2704
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-appendix">
2705
- <xsl:text>Appendix </xsl:text>
2706
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-clause">
3009
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
3010
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
2707
3011
 
2708
- <xsl:text>Clause </xsl:text>
3012
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
3013
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
2709
3014
 
3015
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
3016
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
2710
3017
 
2711
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-edition">
2712
- <xsl:text>Edition </xsl:text>
2713
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-toc">
3018
+ <title-implementation-date lang="en">Implementation Date: #</title-implementation-date>
3019
+ <title-implementation-date lang="zh"># 实施</title-implementation-date>
3020
+
3021
+ <title-obligation-normative lang="en">normative</title-obligation-normative>
3022
+ <title-obligation-normative lang="zh">规范性附录</title-obligation-normative>
2714
3023
 
3024
+ <title-caution lang="en">CAUTION</title-caution>
3025
+ <title-caution lang="zh">注意</title-caution>
3026
+
3027
+ <title-warning lang="en">WARNING</title-warning>
3028
+ <title-warning lang="zh">警告</title-warning>
2715
3029
 
2716
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-page">Page</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-key">Key</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-where">where</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-descriptors">Descriptors</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-en">Part </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-part-fr">Partie </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note-to-entry">Note # to entry: </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-modified">modified</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-source">SOURCE</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-keywords">Keywords</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="link-style">
3030
+ <title-amendment lang="en">AMENDMENT</title-amendment>
3031
+ </xsl:variable><xsl:template name="getTitle">
3032
+ <xsl:param name="name"/>
3033
+ <xsl:variable name="lang">
3034
+ <xsl:call-template name="getLang"/>
3035
+ </xsl:variable>
3036
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
3037
+ <xsl:choose>
3038
+ <xsl:when test="normalize-space($title_) != ''">
3039
+ <xsl:value-of select="$title_"/>
3040
+ </xsl:when>
3041
+ <xsl:otherwise>
3042
+ <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
3043
+ </xsl:otherwise>
3044
+ </xsl:choose>
3045
+ </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">
2717
3046
 
2718
3047
 
2719
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="sourcecode-style">
3048
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2720
3049
 
2721
3050
 
2722
3051
 
@@ -2730,7 +3059,7 @@
2730
3059
 
2731
3060
 
2732
3061
 
2733
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-style">
3062
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2734
3063
 
2735
3064
 
2736
3065
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -2738,21 +3067,21 @@
2738
3067
  <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
2739
3068
 
2740
3069
 
2741
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="appendix-example-style">
3070
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2742
3071
 
2743
3072
 
2744
3073
  <xsl:attribute name="margin-top">14pt</xsl:attribute>
2745
3074
  <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
2746
3075
 
2747
3076
 
2748
- </xsl:attribute-set><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()">
3077
+ </xsl:attribute-set><xsl:template match="text()">
2749
3078
  <xsl:value-of select="."/>
2750
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='br']">
3079
+ </xsl:template><xsl:template match="*[local-name()='br']">
2751
3080
  <xsl:value-of select="$linebreak"/>
2752
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3081
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2753
3082
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2754
3083
  <xsl:call-template name="add-zero-spaces-java"/>
2755
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']">
3084
+ </xsl:template><xsl:template match="*[local-name()='table']">
2756
3085
 
2757
3086
  <xsl:variable name="simple-table">
2758
3087
  <!-- <xsl:copy> -->
@@ -2798,7 +3127,11 @@
2798
3127
 
2799
3128
 
2800
3129
 
2801
-
3130
+ <xsl:variable name="title-table">
3131
+ <xsl:call-template name="getTitle">
3132
+ <xsl:with-param name="name" select="'title-table'"/>
3133
+ </xsl:call-template>
3134
+ </xsl:variable>
2802
3135
  <xsl:value-of select="$title-table"/>
2803
3136
 
2804
3137
  <xsl:call-template name="getTableNumber"/>
@@ -2906,13 +3239,22 @@
2906
3239
  </xsl:otherwise>
2907
3240
  </xsl:choose>
2908
3241
  </xsl:for-each>
2909
- <xsl:apply-templates/>
3242
+
3243
+ <xsl:choose>
3244
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3245
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3246
+ </xsl:when>
3247
+ <xsl:otherwise>
3248
+ <xsl:apply-templates/>
3249
+ </xsl:otherwise>
3250
+ </xsl:choose>
3251
+
2910
3252
  </fo:table>
2911
3253
 
2912
3254
 
2913
3255
 
2914
3256
  </fo:block-container>
2915
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getTableNumber">
3257
+ </xsl:template><xsl:template name="getTableNumber">
2916
3258
  <xsl:choose>
2917
3259
  <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2918
3260
  <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
@@ -2936,15 +3278,15 @@
2936
3278
 
2937
3279
  </xsl:otherwise>
2938
3280
  </xsl:choose>
2939
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='name']" mode="process">
3281
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2940
3282
  <xsl:apply-templates/>
2941
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-columns-numbers">
3283
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2942
3284
  <xsl:param name="table-row"/>
2943
3285
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2944
3286
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2945
3287
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2946
3288
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2947
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="calculate-column-widths">
3289
+ </xsl:template><xsl:template name="calculate-column-widths">
2948
3290
  <xsl:param name="table"/>
2949
3291
  <xsl:param name="cols-count"/>
2950
3292
  <xsl:param name="curr-col" select="1"/>
@@ -3042,23 +3384,27 @@
3042
3384
  <xsl:with-param name="table" select="$table"/>
3043
3385
  </xsl:call-template>
3044
3386
  </xsl:if>
3045
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()" mode="td_text">
3387
+ </xsl:template><xsl:template match="text()" mode="td_text">
3046
3388
  <xsl:variable name="zero-space">​</xsl:variable>
3047
3389
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3048
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='termsource']" mode="td_text">
3390
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3049
3391
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3050
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" mode="td_text">
3392
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3051
3393
  <xsl:value-of select="@target"/>
3052
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table2']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead']" mode="process">
3394
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3053
3395
  <xsl:param name="cols-count"/>
3054
3396
  <!-- font-weight="bold" -->
3055
3397
  <fo:table-header>
3056
3398
 
3057
3399
  <xsl:apply-templates/>
3058
3400
  </fo:table-header>
3059
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tfoot']" mode="process">
3401
+ </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
3402
+ <fo:table-body>
3403
+ <xsl:apply-templates/>
3404
+ </fo:table-body>
3405
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
3060
3406
  <xsl:apply-templates/>
3061
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertTableFooter">
3407
+ </xsl:template><xsl:template name="insertTableFooter">
3062
3408
  <xsl:param name="cols-count"/>
3063
3409
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3064
3410
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
@@ -3110,7 +3456,7 @@
3110
3456
  </fo:table-footer>
3111
3457
 
3112
3458
  </xsl:if>
3113
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tbody']">
3459
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
3114
3460
 
3115
3461
  <xsl:variable name="cols-count">
3116
3462
  <xsl:choose>
@@ -3141,7 +3487,7 @@
3141
3487
 
3142
3488
  </fo:table-body>
3143
3489
 
3144
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']">
3490
+ </xsl:template><xsl:template match="*[local-name()='tr']">
3145
3491
  <xsl:variable name="parent-name" select="local-name(..)"/>
3146
3492
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3147
3493
  <fo:table-row min-height="4mm">
@@ -3167,7 +3513,7 @@
3167
3513
 
3168
3514
  <xsl:apply-templates/>
3169
3515
  </fo:table-row>
3170
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th']">
3516
+ </xsl:template><xsl:template match="*[local-name()='th']">
3171
3517
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
3172
3518
 
3173
3519
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
@@ -3198,7 +3544,7 @@
3198
3544
  <xsl:apply-templates/>
3199
3545
  </fo:block>
3200
3546
  </fo:table-cell>
3201
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='td']">
3547
+ </xsl:template><xsl:template match="*[local-name()='td']">
3202
3548
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
3203
3549
  <!-- and ancestor::*[local-name() = 'thead'] -->
3204
3550
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
@@ -3247,7 +3593,7 @@
3247
3593
 
3248
3594
 
3249
3595
  </fo:table-cell>
3250
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']" mode="process">
3596
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
3251
3597
 
3252
3598
 
3253
3599
  <fo:block font-size="10pt" margin-bottom="12pt">
@@ -3261,6 +3607,11 @@
3261
3607
  <fo:inline padding-right="2mm">
3262
3608
 
3263
3609
 
3610
+ <xsl:variable name="title-note">
3611
+ <xsl:call-template name="getTitle">
3612
+ <xsl:with-param name="name" select="'title-note'"/>
3613
+ </xsl:call-template>
3614
+ </xsl:variable>
3264
3615
  <xsl:value-of select="$title-note"/>
3265
3616
 
3266
3617
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
@@ -3275,9 +3626,9 @@
3275
3626
  <xsl:apply-templates mode="process"/>
3276
3627
  </fo:block>
3277
3628
 
3278
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3629
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3279
3630
  <xsl:apply-templates/>
3280
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display">
3631
+ </xsl:template><xsl:template name="fn_display">
3281
3632
  <xsl:variable name="references">
3282
3633
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3283
3634
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3320,7 +3671,7 @@
3320
3671
  </fo:block>
3321
3672
  </xsl:if>
3322
3673
  </xsl:for-each>
3323
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_name_display">
3674
+ </xsl:template><xsl:template name="fn_name_display">
3324
3675
  <!-- <xsl:variable name="references">
3325
3676
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3326
3677
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3336,7 +3687,7 @@
3336
3687
  <xsl:apply-templates/>
3337
3688
  </fo:block>
3338
3689
  </xsl:for-each>
3339
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display_figure">
3690
+ </xsl:template><xsl:template name="fn_display_figure">
3340
3691
  <xsl:variable name="key_iso">
3341
3692
  true <!-- and (not(@class) or @class !='pseudocode') -->
3342
3693
  </xsl:variable>
@@ -3347,6 +3698,36 @@
3347
3698
  </fn>
3348
3699
  </xsl:for-each>
3349
3700
  </xsl:variable>
3701
+
3702
+ <!-- current hierarchy is 'figure' element -->
3703
+ <xsl:variable name="following_dl_colwidths">
3704
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3705
+ <xsl:variable name="html-table">
3706
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3707
+ <xsl:element name="{$ns}:table">
3708
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3709
+ <tbody>
3710
+ <xsl:apply-templates mode="dl"/>
3711
+ </tbody>
3712
+ </xsl:for-each>
3713
+ </xsl:element>
3714
+ </xsl:variable>
3715
+
3716
+ <xsl:call-template name="calculate-column-widths">
3717
+ <xsl:with-param name="cols-count" select="2"/>
3718
+ <xsl:with-param name="table" select="$html-table"/>
3719
+ </xsl:call-template>
3720
+
3721
+ </xsl:if>
3722
+ </xsl:variable>
3723
+
3724
+
3725
+ <xsl:variable name="maxlength_dt">
3726
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3727
+ <xsl:call-template name="getMaxLength_dt"/>
3728
+ </xsl:for-each>
3729
+ </xsl:variable>
3730
+
3350
3731
  <xsl:if test="xalan:nodeset($references)//fn">
3351
3732
  <fo:block>
3352
3733
  <fo:table width="95%" table-layout="fixed">
@@ -3356,8 +3737,19 @@
3356
3737
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3357
3738
 
3358
3739
  </xsl:if>
3359
- <fo:table-column column-width="15%"/>
3360
- <fo:table-column column-width="85%"/>
3740
+ <xsl:choose>
3741
+ <!-- if there 'dl', then set same columns width -->
3742
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3743
+ <xsl:call-template name="setColumnWidth_dl">
3744
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3745
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3746
+ </xsl:call-template>
3747
+ </xsl:when>
3748
+ <xsl:otherwise>
3749
+ <fo:table-column column-width="15%"/>
3750
+ <fo:table-column column-width="85%"/>
3751
+ </xsl:otherwise>
3752
+ </xsl:choose>
3361
3753
  <fo:table-body>
3362
3754
  <xsl:for-each select="xalan:nodeset($references)//fn">
3363
3755
  <xsl:variable name="reference" select="@reference"/>
@@ -3396,7 +3788,7 @@
3396
3788
  </fo:block>
3397
3789
  </xsl:if>
3398
3790
 
3399
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']">
3791
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3400
3792
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3401
3793
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3402
3794
 
@@ -3414,11 +3806,11 @@
3414
3806
  <xsl:value-of select="@reference"/>
3415
3807
  </fo:basic-link>
3416
3808
  </fo:inline>
3417
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']/*[local-name()='p']">
3809
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3418
3810
  <fo:inline>
3419
3811
  <xsl:apply-templates/>
3420
3812
  </fo:inline>
3421
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']">
3813
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3422
3814
  <xsl:variable name="parent" select="local-name(..)"/>
3423
3815
 
3424
3816
  <xsl:variable name="key_iso">
@@ -3435,6 +3827,11 @@
3435
3827
  <xsl:attribute name="margin-bottom">15pt</xsl:attribute>
3436
3828
 
3437
3829
 
3830
+ <xsl:variable name="title-where">
3831
+ <xsl:call-template name="getTitle">
3832
+ <xsl:with-param name="name" select="'title-where'"/>
3833
+ </xsl:call-template>
3834
+ </xsl:variable>
3438
3835
  <xsl:value-of select="$title-where"/>
3439
3836
  </fo:block>
3440
3837
  <fo:block>
@@ -3455,17 +3852,27 @@
3455
3852
 
3456
3853
 
3457
3854
 
3855
+ <xsl:variable name="title-where">
3856
+ <xsl:call-template name="getTitle">
3857
+ <xsl:with-param name="name" select="'title-where'"/>
3858
+ </xsl:call-template>
3859
+ </xsl:variable>
3458
3860
  <xsl:value-of select="$title-where"/>
3459
3861
  </fo:block>
3460
3862
  </xsl:when>
3461
3863
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3462
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3864
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3463
3865
 
3464
3866
 
3465
3867
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3466
3868
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3467
3869
 
3468
3870
 
3871
+ <xsl:variable name="title-key">
3872
+ <xsl:call-template name="getTitle">
3873
+ <xsl:with-param name="name" select="'title-key'"/>
3874
+ </xsl:call-template>
3875
+ </xsl:variable>
3469
3876
  <xsl:value-of select="$title-key"/>
3470
3877
  </fo:block>
3471
3878
  </xsl:when>
@@ -3482,23 +3889,6 @@
3482
3889
 
3483
3890
 
3484
3891
 
3485
- <!-- create virtual html table for dl/[dt and dd] -->
3486
- <xsl:variable name="html-table">
3487
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3488
- <xsl:element name="{$ns}:table">
3489
- <tbody>
3490
- <xsl:apply-templates mode="dl"/>
3491
- </tbody>
3492
- </xsl:element>
3493
- </xsl:variable>
3494
- <!-- html-table<xsl:copy-of select="$html-table"/> -->
3495
- <xsl:variable name="colwidths">
3496
- <xsl:call-template name="calculate-column-widths">
3497
- <xsl:with-param name="cols-count" select="2"/>
3498
- <xsl:with-param name="table" select="$html-table"/>
3499
- </xsl:call-template>
3500
- </xsl:variable>
3501
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3502
3892
 
3503
3893
  <fo:table width="95%" table-layout="fixed">
3504
3894
 
@@ -3513,42 +3903,30 @@
3513
3903
 
3514
3904
  </xsl:when>
3515
3905
  </xsl:choose>
3516
- <xsl:choose>
3517
- <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3518
- <fo:table-column column-width="50%"/>
3519
- <fo:table-column column-width="50%"/>
3520
- </xsl:when>
3521
- <xsl:otherwise>
3522
- <xsl:choose>
3523
- <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3524
- <fo:table-column column-width="60%"/>
3525
- <fo:table-column column-width="40%"/>
3526
- </xsl:when> -->
3527
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3528
- <fo:table-column column-width="50%"/>
3529
- <fo:table-column column-width="50%"/>
3530
- </xsl:when>
3531
- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3532
- <fo:table-column column-width="40%"/>
3533
- <fo:table-column column-width="60%"/>
3534
- </xsl:when>
3535
- <xsl:otherwise>
3536
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3537
- <xsl:choose>
3538
- <xsl:when test=". = 1 or . = 0">
3539
- <fo:table-column column-width="proportional-column-width(2)"/>
3540
- </xsl:when>
3541
- <xsl:otherwise>
3542
- <fo:table-column column-width="proportional-column-width({.})"/>
3543
- </xsl:otherwise>
3544
- </xsl:choose>
3545
- </xsl:for-each>
3546
- </xsl:otherwise>
3547
- </xsl:choose>
3548
- <!-- <fo:table-column column-width="15%"/>
3549
- <fo:table-column column-width="85%"/> -->
3550
- </xsl:otherwise>
3551
- </xsl:choose>
3906
+ <!-- create virtual html table for dl/[dt and dd] -->
3907
+ <xsl:variable name="html-table">
3908
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3909
+ <xsl:element name="{$ns}:table">
3910
+ <tbody>
3911
+ <xsl:apply-templates mode="dl"/>
3912
+ </tbody>
3913
+ </xsl:element>
3914
+ </xsl:variable>
3915
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3916
+ <xsl:variable name="colwidths">
3917
+ <xsl:call-template name="calculate-column-widths">
3918
+ <xsl:with-param name="cols-count" select="2"/>
3919
+ <xsl:with-param name="table" select="$html-table"/>
3920
+ </xsl:call-template>
3921
+ </xsl:variable>
3922
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3923
+ <xsl:variable name="maxlength_dt">
3924
+ <xsl:call-template name="getMaxLength_dt"/>
3925
+ </xsl:variable>
3926
+ <xsl:call-template name="setColumnWidth_dl">
3927
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3928
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3929
+ </xsl:call-template>
3552
3930
  <fo:table-body>
3553
3931
  <xsl:apply-templates>
3554
3932
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3558,7 +3936,61 @@
3558
3936
  </fo:block>
3559
3937
  </fo:block>
3560
3938
  </xsl:if>
3561
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']/*[local-name()='note']">
3939
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3940
+ <xsl:param name="colwidths"/>
3941
+ <xsl:param name="maxlength_dt"/>
3942
+ <xsl:choose>
3943
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3944
+ <fo:table-column column-width="50%"/>
3945
+ <fo:table-column column-width="50%"/>
3946
+ </xsl:when>
3947
+ <xsl:otherwise>
3948
+ <xsl:choose>
3949
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3950
+ <fo:table-column column-width="5%"/>
3951
+ <fo:table-column column-width="95%"/>
3952
+ </xsl:when>
3953
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3954
+ <fo:table-column column-width="10%"/>
3955
+ <fo:table-column column-width="90%"/>
3956
+ </xsl:when>
3957
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3958
+ <fo:table-column column-width="60%"/>
3959
+ <fo:table-column column-width="40%"/>
3960
+ </xsl:when> -->
3961
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3962
+ <fo:table-column column-width="50%"/>
3963
+ <fo:table-column column-width="50%"/>
3964
+ </xsl:when>
3965
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3966
+ <fo:table-column column-width="40%"/>
3967
+ <fo:table-column column-width="60%"/>
3968
+ </xsl:when>
3969
+ <xsl:otherwise>
3970
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3971
+ <xsl:choose>
3972
+ <xsl:when test=". = 1 or . = 0">
3973
+ <fo:table-column column-width="proportional-column-width(2)"/>
3974
+ </xsl:when>
3975
+ <xsl:otherwise>
3976
+ <fo:table-column column-width="proportional-column-width({.})"/>
3977
+ </xsl:otherwise>
3978
+ </xsl:choose>
3979
+ </xsl:for-each>
3980
+ </xsl:otherwise>
3981
+ </xsl:choose>
3982
+ <!-- <fo:table-column column-width="15%"/>
3983
+ <fo:table-column column-width="85%"/> -->
3984
+ </xsl:otherwise>
3985
+ </xsl:choose>
3986
+ </xsl:template><xsl:template name="getMaxLength_dt">
3987
+ <xsl:for-each select="*[local-name()='dt']">
3988
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3989
+ <xsl:if test="position() = 1">
3990
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3991
+ </xsl:if>
3992
+ </xsl:for-each>
3993
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3562
3994
  <xsl:param name="key_iso"/>
3563
3995
 
3564
3996
  <!-- <tr>
@@ -3574,6 +4006,11 @@
3574
4006
  <xsl:if test="normalize-space($key_iso) = 'true'">
3575
4007
  <xsl:attribute name="margin-top">0</xsl:attribute>
3576
4008
  </xsl:if>
4009
+ <xsl:variable name="title-note">
4010
+ <xsl:call-template name="getTitle">
4011
+ <xsl:with-param name="name" select="'title-note'"/>
4012
+ </xsl:call-template>
4013
+ </xsl:variable>
3577
4014
  <xsl:value-of select="$title-note"/>
3578
4015
  </fo:block>
3579
4016
  </fo:table-cell>
@@ -3583,7 +4020,7 @@
3583
4020
  </fo:block>
3584
4021
  </fo:table-cell>
3585
4022
  </fo:table-row>
3586
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']" mode="dl">
4023
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3587
4024
  <tr>
3588
4025
  <td>
3589
4026
  <xsl:apply-templates/>
@@ -3596,7 +4033,7 @@
3596
4033
  </td>
3597
4034
  </tr>
3598
4035
 
3599
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']">
4036
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3600
4037
  <xsl:param name="key_iso"/>
3601
4038
 
3602
4039
  <fo:table-row>
@@ -3619,7 +4056,11 @@
3619
4056
 
3620
4057
 
3621
4058
  <xsl:apply-templates/>
3622
-
4059
+ <!-- <xsl:if test="$namespace = 'gb'">
4060
+ <xsl:if test="ancestor::*[local-name()='formula']">
4061
+ <xsl:text>—</xsl:text>
4062
+ </xsl:if>
4063
+ </xsl:if> -->
3623
4064
  </fo:block>
3624
4065
  </fo:table-cell>
3625
4066
  <fo:table-cell>
@@ -3633,37 +4074,37 @@
3633
4074
  </fo:table-cell>
3634
4075
  </fo:table-row>
3635
4076
 
3636
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="dl_process">
4077
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3637
4078
  <xsl:apply-templates/>
3638
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']" mode="process">
4079
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3639
4080
  <xsl:apply-templates/>
3640
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
4081
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3641
4082
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3642
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='em']">
4083
+ </xsl:template><xsl:template match="*[local-name()='em']">
3643
4084
  <fo:inline font-style="italic">
3644
4085
  <xsl:apply-templates/>
3645
4086
  </fo:inline>
3646
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='strong']">
4087
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3647
4088
  <fo:inline font-weight="bold">
3648
4089
  <xsl:apply-templates/>
3649
4090
  </fo:inline>
3650
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sup']">
4091
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3651
4092
  <fo:inline font-size="80%" vertical-align="super">
3652
4093
  <xsl:apply-templates/>
3653
4094
  </fo:inline>
3654
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sub']">
4095
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3655
4096
  <fo:inline font-size="80%" vertical-align="sub">
3656
4097
  <xsl:apply-templates/>
3657
4098
  </fo:inline>
3658
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tt']">
4099
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3659
4100
  <fo:inline font-family="Courier" font-size="10pt">
3660
4101
  <xsl:apply-templates/>
3661
4102
  </fo:inline>
3662
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='del']">
4103
+ </xsl:template><xsl:template match="*[local-name()='del']">
3663
4104
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3664
4105
  <xsl:apply-templates/>
3665
4106
  </fo:inline>
3666
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()[ancestor::*[local-name()='smallcap']]">
4107
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3667
4108
  <xsl:variable name="text" select="normalize-space(.)"/>
3668
4109
  <fo:inline font-size="75%">
3669
4110
  <xsl:if test="string-length($text) &gt; 0">
@@ -3672,10 +4113,11 @@
3672
4113
  </xsl:call-template>
3673
4114
  </xsl:if>
3674
4115
  </fo:inline>
3675
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="recursiveSmallCaps">
4116
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3676
4117
  <xsl:param name="text"/>
3677
4118
  <xsl:variable name="char" select="substring($text,1,1)"/>
3678
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
4119
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
4120
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3679
4121
  <xsl:choose>
3680
4122
  <xsl:when test="$char=$upperCase">
3681
4123
  <fo:inline font-size="{100 div 0.75}%">
@@ -3691,7 +4133,7 @@
3691
4133
  <xsl:with-param name="text" select="substring($text,2)"/>
3692
4134
  </xsl:call-template>
3693
4135
  </xsl:if>
3694
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="tokenize">
4136
+ </xsl:template><xsl:template name="tokenize">
3695
4137
  <xsl:param name="text"/>
3696
4138
  <xsl:param name="separator" select="' '"/>
3697
4139
  <xsl:choose>
@@ -3739,7 +4181,7 @@
3739
4181
  </xsl:call-template>
3740
4182
  </xsl:otherwise>
3741
4183
  </xsl:choose>
3742
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="max_length">
4184
+ </xsl:template><xsl:template name="max_length">
3743
4185
  <xsl:param name="words"/>
3744
4186
  <xsl:for-each select="$words//word">
3745
4187
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3747,11 +4189,11 @@
3747
4189
  <xsl:value-of select="."/>
3748
4190
  </xsl:if>
3749
4191
  </xsl:for-each>
3750
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-java">
4192
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3751
4193
  <xsl:param name="text" select="."/>
3752
4194
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3753
4195
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3754
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces">
4196
+ </xsl:template><xsl:template name="add-zero-spaces">
3755
4197
  <xsl:param name="text" select="."/>
3756
4198
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3757
4199
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3804,7 +4246,7 @@
3804
4246
  <xsl:value-of select="$text"/>
3805
4247
  </xsl:otherwise>
3806
4248
  </xsl:choose>
3807
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-equal">
4249
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3808
4250
  <xsl:param name="text" select="."/>
3809
4251
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3810
4252
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3830,7 +4272,7 @@
3830
4272
  <xsl:value-of select="$text"/>
3831
4273
  </xsl:otherwise>
3832
4274
  </xsl:choose>
3833
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getSimpleTable">
4275
+ </xsl:template><xsl:template name="getSimpleTable">
3834
4276
  <xsl:variable name="simple-table">
3835
4277
 
3836
4278
  <!-- Step 1. colspan processing -->
@@ -3857,9 +4299,9 @@
3857
4299
  </xsl:choose> -->
3858
4300
  </xsl:variable>
3859
4301
  <xsl:copy-of select="$simple-table"/>
3860
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
4302
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3861
4303
  <xsl:apply-templates mode="simple-table-colspan"/>
3862
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
4304
+ </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">
3863
4305
  <xsl:choose>
3864
4306
  <xsl:when test="@colspan">
3865
4307
  <xsl:variable name="td">
@@ -3881,16 +4323,16 @@
3881
4323
  </xsl:element>
3882
4324
  </xsl:otherwise>
3883
4325
  </xsl:choose>
3884
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tr']" mode="simple-table-colspan">
4326
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3885
4327
  <xsl:element name="tr">
3886
4328
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3887
4329
  <xsl:apply-templates mode="simple-table-colspan"/>
3888
4330
  </xsl:element>
3889
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-colspan">
4331
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3890
4332
  <xsl:copy>
3891
4333
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3892
4334
  </xsl:copy>
3893
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="repeatNode">
4335
+ </xsl:template><xsl:template name="repeatNode">
3894
4336
  <xsl:param name="count"/>
3895
4337
  <xsl:param name="node"/>
3896
4338
 
@@ -3901,18 +4343,18 @@
3901
4343
  </xsl:call-template>
3902
4344
  <xsl:copy-of select="$node"/>
3903
4345
  </xsl:if>
3904
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-rowspan">
4346
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3905
4347
  <xsl:copy>
3906
4348
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3907
4349
  </xsl:copy>
3908
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tbody" mode="simple-table-rowspan">
4350
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3909
4351
  <xsl:copy>
3910
4352
  <xsl:copy-of select="tr[1]"/>
3911
4353
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3912
4354
  <xsl:with-param name="previousRow" select="tr[1]"/>
3913
4355
  </xsl:apply-templates>
3914
4356
  </xsl:copy>
3915
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tr" mode="simple-table-rowspan">
4357
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3916
4358
  <xsl:param name="previousRow"/>
3917
4359
  <xsl:variable name="currentRow" select="."/>
3918
4360
 
@@ -3946,43 +4388,53 @@
3946
4388
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3947
4389
  <xsl:with-param name="previousRow" select="$newRow"/>
3948
4390
  </xsl:apply-templates>
3949
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getLang">
4391
+ </xsl:template><xsl:template name="getLang">
3950
4392
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3951
4393
  <xsl:choose>
3952
4394
  <xsl:when test="$language = 'English'">en</xsl:when>
3953
4395
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3954
4396
  </xsl:choose>
3955
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="capitalizeWords">
4397
+ </xsl:template><xsl:template name="capitalizeWords">
3956
4398
  <xsl:param name="str"/>
3957
4399
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3958
4400
  <xsl:choose>
3959
4401
  <xsl:when test="contains($str2, ' ')">
3960
4402
  <xsl:variable name="substr" select="substring-before($str2, ' ')"/>
3961
- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
3962
- <xsl:value-of select="substring($substr, 2)"/>
4403
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4404
+ <xsl:value-of select="substring($substr, 2)"/> -->
4405
+ <xsl:call-template name="capitalize">
4406
+ <xsl:with-param name="str" select="$substr"/>
4407
+ </xsl:call-template>
3963
4408
  <xsl:text> </xsl:text>
3964
4409
  <xsl:call-template name="capitalizeWords">
3965
4410
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3966
4411
  </xsl:call-template>
3967
4412
  </xsl:when>
3968
4413
  <xsl:otherwise>
3969
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3970
- <xsl:value-of select="substring($str2, 2)"/>
4414
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4415
+ <xsl:value-of select="substring($str2, 2)"/> -->
4416
+ <xsl:call-template name="capitalize">
4417
+ <xsl:with-param name="str" select="$str2"/>
4418
+ </xsl:call-template>
3971
4419
  </xsl:otherwise>
3972
4420
  </xsl:choose>
3973
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="mathml:math">
4421
+ </xsl:template><xsl:template name="capitalize">
4422
+ <xsl:param name="str"/>
4423
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4424
+ <xsl:value-of select="substring($str, 2)"/>
4425
+ </xsl:template><xsl:template match="mathml:math">
3974
4426
  <fo:inline font-family="STIX2Math">
3975
4427
  <fo:instream-foreign-object fox:alt-text="Math">
3976
4428
  <xsl:copy-of select="."/>
3977
4429
  </fo:instream-foreign-object>
3978
4430
  </fo:inline>
3979
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='localityStack']">
4431
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3980
4432
  <xsl:for-each select="*[local-name()='locality']">
3981
4433
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3982
4434
  <xsl:apply-templates select="."/>
3983
4435
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3984
4436
  </xsl:for-each>
3985
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" name="link">
4437
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3986
4438
  <xsl:variable name="target">
3987
4439
  <xsl:choose>
3988
4440
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4012,7 +4464,7 @@
4012
4464
  </xsl:otherwise>
4013
4465
  </xsl:choose>
4014
4466
  </fo:inline>
4015
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sourcecode']" name="sourcecode">
4467
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4016
4468
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4017
4469
  <!-- <xsl:choose>
4018
4470
  <xsl:when test="@lang = 'en'"></xsl:when>
@@ -4023,19 +4475,29 @@
4023
4475
  </xsl:choose> -->
4024
4476
  <xsl:apply-templates/>
4025
4477
  </fo:block>
4026
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='bookmark']">
4478
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4027
4479
  <fo:inline id="{@id}"/>
4028
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']">
4480
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
4029
4481
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4482
+ <xsl:variable name="title-appendix">
4483
+ <xsl:call-template name="getTitle">
4484
+ <xsl:with-param name="name" select="'title-appendix'"/>
4485
+ </xsl:call-template>
4486
+ </xsl:variable>
4030
4487
  <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4031
4488
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4032
4489
  </fo:block>
4033
4490
  <xsl:apply-templates/>
4034
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4491
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4035
4492
  <fo:inline><xsl:apply-templates/></fo:inline>
4036
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']">
4493
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4037
4494
  <fo:block xsl:use-attribute-sets="appendix-example-style">
4038
4495
  <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4496
+ <xsl:variable name="title-example">
4497
+ <xsl:call-template name="getTitle">
4498
+ <xsl:with-param name="name" select="'title-example'"/>
4499
+ </xsl:call-template>
4500
+ </xsl:variable>
4039
4501
  <xsl:value-of select="$title-example"/>
4040
4502
  <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4041
4503
  <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
@@ -4045,11 +4507,11 @@
4045
4507
  </xsl:if>
4046
4508
  </fo:block>
4047
4509
  <xsl:apply-templates/>
4048
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
4510
+ </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">
4049
4511
  <fo:inline><xsl:apply-templates/></fo:inline>
4050
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'callout']">
4512
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4051
4513
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
4052
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']">
4514
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4053
4515
  <xsl:variable name="annotation-id" select="@id"/>
4054
4516
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4055
4517
  <fo:block id="{$annotation-id}" white-space="nowrap">
@@ -4059,14 +4521,25 @@
4059
4521
  </xsl:apply-templates>
4060
4522
  </fo:inline>
4061
4523
  </fo:block>
4062
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4524
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4063
4525
  <xsl:param name="callout"/>
4064
4526
  <fo:inline id="{@id}">
4065
4527
  <!-- for first p in annotation, put <x> -->
4066
4528
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4067
4529
  <xsl:apply-templates/>
4068
4530
  </fo:inline>
4069
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="convertDate">
4531
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4532
+ <xsl:variable name="title-modified">
4533
+ <xsl:call-template name="getTitle">
4534
+ <xsl:with-param name="name" select="'title-modified'"/>
4535
+ </xsl:call-template>
4536
+ </xsl:variable>
4537
+ <xsl:choose>
4538
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4539
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4540
+ </xsl:choose>
4541
+ <xsl:apply-templates/>
4542
+ </xsl:template><xsl:template name="convertDate">
4070
4543
  <xsl:param name="date"/>
4071
4544
  <xsl:param name="format" select="'short'"/>
4072
4545
  <xsl:variable name="year" select="substring($date, 1, 4)"/>
@@ -4099,7 +4572,7 @@
4099
4572
  </xsl:choose>
4100
4573
  </xsl:variable>
4101
4574
  <xsl:value-of select="$result"/>
4102
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeywords">
4575
+ </xsl:template><xsl:template name="insertKeywords">
4103
4576
  <xsl:param name="sorting" select="'true'"/>
4104
4577
  <xsl:param name="charAtEnd" select="'.'"/>
4105
4578
  <xsl:param name="charDelim" select="', '"/>
@@ -4122,7 +4595,7 @@
4122
4595
  </xsl:for-each>
4123
4596
  </xsl:otherwise>
4124
4597
  </xsl:choose>
4125
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeyword">
4598
+ </xsl:template><xsl:template name="insertKeyword">
4126
4599
  <xsl:param name="charAtEnd"/>
4127
4600
  <xsl:param name="charDelim"/>
4128
4601
  <xsl:apply-templates/>
@@ -4130,4 +4603,105 @@
4130
4603
  <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4131
4604
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4132
4605
  </xsl:choose>
4606
+ </xsl:template><xsl:template name="addPDFUAmeta">
4607
+ <fo:declarations>
4608
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4609
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4610
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4611
+ </pdf:dictionary>
4612
+ </pdf:catalog>
4613
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4614
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4615
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4616
+ <!-- Dublin Core properties go here -->
4617
+ <dc:title>
4618
+ <xsl:variable name="title">
4619
+
4620
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4621
+
4622
+
4623
+
4624
+
4625
+ </xsl:variable>
4626
+ <xsl:choose>
4627
+ <xsl:when test="normalize-space($title) != ''">
4628
+ <xsl:value-of select="$title"/>
4629
+ </xsl:when>
4630
+ <xsl:otherwise>
4631
+ <xsl:text> </xsl:text>
4632
+ </xsl:otherwise>
4633
+ </xsl:choose>
4634
+ </dc:title>
4635
+ <dc:creator>
4636
+
4637
+
4638
+ </dc:creator>
4639
+ <dc:description>
4640
+ <xsl:variable name="abstract">
4641
+
4642
+
4643
+ <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract'][@language = 'en']//text()"/>
4644
+
4645
+
4646
+
4647
+ </xsl:variable>
4648
+ <xsl:value-of select="normalize-space($abstract)"/>
4649
+ </dc:description>
4650
+ <pdf:Keywords>
4651
+ <xsl:call-template name="insertKeywords"/>
4652
+ </pdf:Keywords>
4653
+ </rdf:Description>
4654
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4655
+ <!-- XMP properties go here -->
4656
+ <xmp:CreatorTool/>
4657
+ </rdf:Description>
4658
+ </rdf:RDF>
4659
+ </x:xmpmeta>
4660
+ </fo:declarations>
4661
+ </xsl:template><xsl:template name="getId">
4662
+ <xsl:choose>
4663
+ <xsl:when test="../@id">
4664
+ <xsl:value-of select="../@id"/>
4665
+ </xsl:when>
4666
+ <xsl:otherwise>
4667
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4668
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4669
+ </xsl:otherwise>
4670
+ </xsl:choose>
4671
+ </xsl:template><xsl:template name="getLevel">
4672
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4673
+ <xsl:variable name="level">
4674
+ <xsl:choose>
4675
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4676
+ <xsl:value-of select="$level_total - 2"/>
4677
+ </xsl:when>
4678
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4679
+ <xsl:value-of select="$level_total - 2"/>
4680
+ </xsl:when>
4681
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4682
+ <xsl:value-of select="$level_total - 2"/>
4683
+ </xsl:when>
4684
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4685
+ <xsl:otherwise>
4686
+ <xsl:value-of select="$level_total - 1"/>
4687
+ </xsl:otherwise>
4688
+ </xsl:choose>
4689
+ </xsl:variable>
4690
+ <xsl:value-of select="$level"/>
4691
+ </xsl:template><xsl:template name="getSubSection">
4692
+ <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']"/>
4693
+ </xsl:template><xsl:template name="split">
4694
+ <xsl:param name="pText" select="."/>
4695
+ <xsl:param name="sep" select="','"/>
4696
+ <xsl:if test="string-length($pText) &gt;0">
4697
+ <item>
4698
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4699
+ </item>
4700
+ <xsl:call-template name="split">
4701
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4702
+ <xsl:with-param name="sep" select="$sep"/>
4703
+ </xsl:call-template>
4704
+ </xsl:if>
4705
+ </xsl:template><xsl:template name="getDocumentId">
4706
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
4133
4707
  </xsl:template></xsl:stylesheet>