metanorma-iec 1.0.8 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -1
  3. data/.github/workflows/ubuntu.yml +10 -7
  4. data/.github/workflows/windows.yml +0 -1
  5. data/Rakefile +2 -0
  6. data/lib/asciidoctor/iec/biblio.rng +1 -1
  7. data/lib/asciidoctor/iec/converter.rb +5 -0
  8. data/lib/asciidoctor/iec/front.rb +1 -1
  9. data/lib/asciidoctor/iec/isodoc.rng +427 -0
  10. data/lib/asciidoctor/iec/isostandard.rng +3 -0
  11. data/lib/asciidoctor/iec/reqt.rng +23 -0
  12. data/lib/isodoc/iec/base_convert.rb +10 -65
  13. data/lib/isodoc/iec/html/htmlstyle.css +962 -0
  14. data/lib/isodoc/iec/html/htmlstyle.scss +0 -3
  15. data/lib/isodoc/iec/html/isodoc.css +845 -0
  16. data/lib/isodoc/iec/html/isodoc.scss +0 -1
  17. data/lib/isodoc/iec/html/wordstyle.css +2013 -0
  18. data/lib/isodoc/iec/html/wordstyle.scss +0 -1
  19. data/lib/isodoc/iec/iec.international-standard.xsl +1130 -524
  20. data/lib/isodoc/iec/pdf_convert.rb +2 -12
  21. data/lib/isodoc/iec/presentation_xml_convert.rb +10 -0
  22. data/lib/isodoc/iec/word_convert.rb +4 -4
  23. data/lib/isodoc/iec/xref.rb +45 -0
  24. data/lib/metanorma-iec.rb +2 -0
  25. data/lib/metanorma/iec/processor.rb +6 -8
  26. data/lib/metanorma/iec/version.rb +1 -1
  27. data/metanorma-iec.gemspec +3 -2
  28. data/spec/asciidoctor-iec/base_spec.rb +5 -5
  29. data/spec/asciidoctor-iec/cleanup_spec.rb +1 -1
  30. data/spec/asciidoctor-iec/iev_spec.rb +2 -2
  31. data/spec/isodoc/blocks_spec.rb +12 -18
  32. data/spec/isodoc/i18n_spec.rb +4 -4
  33. data/spec/isodoc/iev_spec.rb +7 -10
  34. data/spec/isodoc/inline_spec.rb +9 -9
  35. data/spec/isodoc/iso_spec.rb +4 -4
  36. data/spec/isodoc/metadata_spec.rb +2 -2
  37. data/spec/isodoc/postproc_spec.rb +3 -3
  38. data/spec/isodoc/ref_spec.rb +5 -5
  39. data/spec/isodoc/section_spec.rb +9 -9
  40. data/spec/isodoc/terms_spec.rb +10 -12
  41. data/spec/metanorma/processor_spec.rb +2 -5
  42. data/spec/spec_helper.rb +7 -0
  43. metadata +29 -11
@@ -1852,4 +1852,3 @@ ol
1852
1852
  ul
1853
1853
  {margin-bottom:0cm;
1854
1854
  margin-left:18pt;}
1855
-
@@ -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
+
2680
2911
 
2681
- <xsl:text>Table </xsl:text>
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>
2682
2919
 
2683
2920
 
2684
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-note">
2685
2921
 
2686
- <xsl:text>NOTE </xsl:text>
2922
+ <title-edition lang="en">
2923
+
2924
+ <xsl:text>Edition </xsl:text>
2925
+
2926
+
2927
+ </title-edition>
2687
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>
2688
2940
 
2689
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-figure">
2941
+ <title-toc lang="zh">Contents</title-toc>
2690
2942
 
2691
- <xsl:text>Figure </xsl:text>
2692
2943
 
2693
2944
 
2694
- </xsl:variable><xsl:variable xmlns:java="http://xml.apache.org/xalan/java" name="title-example">
2945
+ <title-page lang="en">Page</title-page>
2946
+ <title-page lang="fr">Page</title-page>
2695
2947
 
2696
- <xsl:text>EXAMPLE </xsl:text>
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>
2697
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>
2698
2969
 
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">
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>
2700
2972
 
2701
- <xsl:text>Annex </xsl:text>
2973
+ <title-note-to-entry lang="zh">Note # to entry: </title-note-to-entry>
2702
2974
 
2703
2975
 
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">
2707
2976
 
2708
- <xsl:text>Clause </xsl:text>
2977
+ <title-modified lang="en">modified</title-modified>
2978
+ <title-modified lang="fr">modifiée</title-modified>
2709
2979
 
2980
+ <title-modified lang="zh">modified</title-modified>
2710
2981
 
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">
2714
2982
 
2715
2983
 
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">
2984
+ <title-source lang="en">SOURCE</title-source>
2717
2985
 
2986
+ <title-keywords lang="en">Keywords</title-keywords>
2718
2987
 
2719
- </xsl:attribute-set><xsl:attribute-set xmlns:java="http://xml.apache.org/xalan/java" name="sourcecode-style">
2988
+ <title-deprecated lang="en">DEPRECATED</title-deprecated>
2989
+ <title-deprecated lang="fr">DEPRECATED</title-deprecated>
2990
+
2991
+ <title-submitting-organizations lang="en">Submitting Organizations</title-submitting-organizations>
2992
+
2993
+ <title-list-tables lang="en">List of Tables</title-list-tables>
2994
+
2995
+ <title-list-figures lang="en">List of Figures</title-list-figures>
2996
+
2997
+ <title-recommendation lang="en">Recommendation </title-recommendation>
2998
+
2999
+ <title-acknowledgements lang="en">Acknowledgements</title-acknowledgements>
3000
+
3001
+ <title-abstract lang="en">Abstract</title-abstract>
3002
+
3003
+ <title-summary lang="en">Summary</title-summary>
3004
+
3005
+ <title-in lang="en">in </title-in>
3006
+
3007
+ <title-box lang="en">Box </title-box>
3008
+
3009
+ <title-partly-supercedes lang="en">Partly Supercedes </title-partly-supercedes>
3010
+ <title-partly-supercedes lang="zh">部分代替 </title-partly-supercedes>
3011
+
3012
+ <title-completion-date lang="en">Completion date for this manuscript</title-completion-date>
3013
+ <title-completion-date lang="zh">本稿完成日期</title-completion-date>
3014
+
3015
+ <title-issuance-date lang="en">Issuance Date: #</title-issuance-date>
3016
+ <title-issuance-date lang="zh"># 发布</title-issuance-date>
3017
+
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>
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>
3029
+
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">
3046
+
3047
+
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,12 @@
3261
3607
  <fo:inline padding-right="2mm">
3262
3608
 
3263
3609
 
3610
+
3611
+ <xsl:variable name="title-note">
3612
+ <xsl:call-template name="getTitle">
3613
+ <xsl:with-param name="name" select="'title-note'"/>
3614
+ </xsl:call-template>
3615
+ </xsl:variable>
3264
3616
  <xsl:value-of select="$title-note"/>
3265
3617
 
3266
3618
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
@@ -3275,9 +3627,9 @@
3275
3627
  <xsl:apply-templates mode="process"/>
3276
3628
  </fo:block>
3277
3629
 
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">
3630
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3279
3631
  <xsl:apply-templates/>
3280
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display">
3632
+ </xsl:template><xsl:template name="fn_display">
3281
3633
  <xsl:variable name="references">
3282
3634
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
3283
3635
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3320,7 +3672,7 @@
3320
3672
  </fo:block>
3321
3673
  </xsl:if>
3322
3674
  </xsl:for-each>
3323
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_name_display">
3675
+ </xsl:template><xsl:template name="fn_name_display">
3324
3676
  <!-- <xsl:variable name="references">
3325
3677
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
3326
3678
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -3336,7 +3688,7 @@
3336
3688
  <xsl:apply-templates/>
3337
3689
  </fo:block>
3338
3690
  </xsl:for-each>
3339
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="fn_display_figure">
3691
+ </xsl:template><xsl:template name="fn_display_figure">
3340
3692
  <xsl:variable name="key_iso">
3341
3693
  true <!-- and (not(@class) or @class !='pseudocode') -->
3342
3694
  </xsl:variable>
@@ -3347,6 +3699,36 @@
3347
3699
  </fn>
3348
3700
  </xsl:for-each>
3349
3701
  </xsl:variable>
3702
+
3703
+ <!-- current hierarchy is 'figure' element -->
3704
+ <xsl:variable name="following_dl_colwidths">
3705
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3706
+ <xsl:variable name="html-table">
3707
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3708
+ <xsl:element name="{$ns}:table">
3709
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3710
+ <tbody>
3711
+ <xsl:apply-templates mode="dl"/>
3712
+ </tbody>
3713
+ </xsl:for-each>
3714
+ </xsl:element>
3715
+ </xsl:variable>
3716
+
3717
+ <xsl:call-template name="calculate-column-widths">
3718
+ <xsl:with-param name="cols-count" select="2"/>
3719
+ <xsl:with-param name="table" select="$html-table"/>
3720
+ </xsl:call-template>
3721
+
3722
+ </xsl:if>
3723
+ </xsl:variable>
3724
+
3725
+
3726
+ <xsl:variable name="maxlength_dt">
3727
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
3728
+ <xsl:call-template name="getMaxLength_dt"/>
3729
+ </xsl:for-each>
3730
+ </xsl:variable>
3731
+
3350
3732
  <xsl:if test="xalan:nodeset($references)//fn">
3351
3733
  <fo:block>
3352
3734
  <fo:table width="95%" table-layout="fixed">
@@ -3356,8 +3738,19 @@
3356
3738
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3357
3739
 
3358
3740
  </xsl:if>
3359
- <fo:table-column column-width="15%"/>
3360
- <fo:table-column column-width="85%"/>
3741
+ <xsl:choose>
3742
+ <!-- if there 'dl', then set same columns width -->
3743
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
3744
+ <xsl:call-template name="setColumnWidth_dl">
3745
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
3746
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3747
+ </xsl:call-template>
3748
+ </xsl:when>
3749
+ <xsl:otherwise>
3750
+ <fo:table-column column-width="15%"/>
3751
+ <fo:table-column column-width="85%"/>
3752
+ </xsl:otherwise>
3753
+ </xsl:choose>
3361
3754
  <fo:table-body>
3362
3755
  <xsl:for-each select="xalan:nodeset($references)//fn">
3363
3756
  <xsl:variable name="reference" select="@reference"/>
@@ -3396,7 +3789,7 @@
3396
3789
  </fo:block>
3397
3790
  </xsl:if>
3398
3791
 
3399
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']">
3792
+ </xsl:template><xsl:template match="*[local-name()='fn']">
3400
3793
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3401
3794
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3402
3795
 
@@ -3414,11 +3807,11 @@
3414
3807
  <xsl:value-of select="@reference"/>
3415
3808
  </fo:basic-link>
3416
3809
  </fo:inline>
3417
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='fn']/*[local-name()='p']">
3810
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3418
3811
  <fo:inline>
3419
3812
  <xsl:apply-templates/>
3420
3813
  </fo:inline>
3421
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']">
3814
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3422
3815
  <xsl:variable name="parent" select="local-name(..)"/>
3423
3816
 
3424
3817
  <xsl:variable name="key_iso">
@@ -3435,6 +3828,11 @@
3435
3828
  <xsl:attribute name="margin-bottom">15pt</xsl:attribute>
3436
3829
 
3437
3830
 
3831
+ <xsl:variable name="title-where">
3832
+ <xsl:call-template name="getTitle">
3833
+ <xsl:with-param name="name" select="'title-where'"/>
3834
+ </xsl:call-template>
3835
+ </xsl:variable>
3438
3836
  <xsl:value-of select="$title-where"/>
3439
3837
  </fo:block>
3440
3838
  <fo:block>
@@ -3455,17 +3853,27 @@
3455
3853
 
3456
3854
 
3457
3855
 
3856
+ <xsl:variable name="title-where">
3857
+ <xsl:call-template name="getTitle">
3858
+ <xsl:with-param name="name" select="'title-where'"/>
3859
+ </xsl:call-template>
3860
+ </xsl:variable>
3458
3861
  <xsl:value-of select="$title-where"/>
3459
3862
  </fo:block>
3460
3863
  </xsl:when>
3461
3864
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
3462
- <fo:block font-weight="bold" text-align="left" margin-bottom="12pt">
3865
+ <fo:block font-weight="bold" text-align="left" margin-bottom="12pt" keep-with-next="always">
3463
3866
 
3464
3867
 
3465
3868
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3466
3869
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3467
3870
 
3468
3871
 
3872
+ <xsl:variable name="title-key">
3873
+ <xsl:call-template name="getTitle">
3874
+ <xsl:with-param name="name" select="'title-key'"/>
3875
+ </xsl:call-template>
3876
+ </xsl:variable>
3469
3877
  <xsl:value-of select="$title-key"/>
3470
3878
  </fo:block>
3471
3879
  </xsl:when>
@@ -3482,23 +3890,6 @@
3482
3890
 
3483
3891
 
3484
3892
 
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
3893
 
3503
3894
  <fo:table width="95%" table-layout="fixed">
3504
3895
 
@@ -3513,42 +3904,30 @@
3513
3904
 
3514
3905
  </xsl:when>
3515
3906
  </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>
3907
+ <!-- create virtual html table for dl/[dt and dd] -->
3908
+ <xsl:variable name="html-table">
3909
+ <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3910
+ <xsl:element name="{$ns}:table">
3911
+ <tbody>
3912
+ <xsl:apply-templates mode="dl"/>
3913
+ </tbody>
3914
+ </xsl:element>
3915
+ </xsl:variable>
3916
+ <!-- html-table<xsl:copy-of select="$html-table"/> -->
3917
+ <xsl:variable name="colwidths">
3918
+ <xsl:call-template name="calculate-column-widths">
3919
+ <xsl:with-param name="cols-count" select="2"/>
3920
+ <xsl:with-param name="table" select="$html-table"/>
3921
+ </xsl:call-template>
3922
+ </xsl:variable>
3923
+ <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3924
+ <xsl:variable name="maxlength_dt">
3925
+ <xsl:call-template name="getMaxLength_dt"/>
3926
+ </xsl:variable>
3927
+ <xsl:call-template name="setColumnWidth_dl">
3928
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3929
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3930
+ </xsl:call-template>
3552
3931
  <fo:table-body>
3553
3932
  <xsl:apply-templates>
3554
3933
  <xsl:with-param name="key_iso" select="normalize-space($key_iso)"/>
@@ -3558,7 +3937,61 @@
3558
3937
  </fo:block>
3559
3938
  </fo:block>
3560
3939
  </xsl:if>
3561
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dl']/*[local-name()='note']">
3940
+ </xsl:template><xsl:template name="setColumnWidth_dl">
3941
+ <xsl:param name="colwidths"/>
3942
+ <xsl:param name="maxlength_dt"/>
3943
+ <xsl:choose>
3944
+ <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3945
+ <fo:table-column column-width="50%"/>
3946
+ <fo:table-column column-width="50%"/>
3947
+ </xsl:when>
3948
+ <xsl:otherwise>
3949
+ <xsl:choose>
3950
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3951
+ <fo:table-column column-width="5%"/>
3952
+ <fo:table-column column-width="95%"/>
3953
+ </xsl:when>
3954
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3955
+ <fo:table-column column-width="10%"/>
3956
+ <fo:table-column column-width="90%"/>
3957
+ </xsl:when>
3958
+ <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3959
+ <fo:table-column column-width="60%"/>
3960
+ <fo:table-column column-width="40%"/>
3961
+ </xsl:when> -->
3962
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.3">
3963
+ <fo:table-column column-width="50%"/>
3964
+ <fo:table-column column-width="50%"/>
3965
+ </xsl:when>
3966
+ <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 0.5">
3967
+ <fo:table-column column-width="40%"/>
3968
+ <fo:table-column column-width="60%"/>
3969
+ </xsl:when>
3970
+ <xsl:otherwise>
3971
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3972
+ <xsl:choose>
3973
+ <xsl:when test=". = 1 or . = 0">
3974
+ <fo:table-column column-width="proportional-column-width(2)"/>
3975
+ </xsl:when>
3976
+ <xsl:otherwise>
3977
+ <fo:table-column column-width="proportional-column-width({.})"/>
3978
+ </xsl:otherwise>
3979
+ </xsl:choose>
3980
+ </xsl:for-each>
3981
+ </xsl:otherwise>
3982
+ </xsl:choose>
3983
+ <!-- <fo:table-column column-width="15%"/>
3984
+ <fo:table-column column-width="85%"/> -->
3985
+ </xsl:otherwise>
3986
+ </xsl:choose>
3987
+ </xsl:template><xsl:template name="getMaxLength_dt">
3988
+ <xsl:for-each select="*[local-name()='dt']">
3989
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3990
+ <xsl:if test="position() = 1">
3991
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3992
+ </xsl:if>
3993
+ </xsl:for-each>
3994
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3562
3995
  <xsl:param name="key_iso"/>
3563
3996
 
3564
3997
  <!-- <tr>
@@ -3574,6 +4007,11 @@
3574
4007
  <xsl:if test="normalize-space($key_iso) = 'true'">
3575
4008
  <xsl:attribute name="margin-top">0</xsl:attribute>
3576
4009
  </xsl:if>
4010
+ <xsl:variable name="title-note">
4011
+ <xsl:call-template name="getTitle">
4012
+ <xsl:with-param name="name" select="'title-note'"/>
4013
+ </xsl:call-template>
4014
+ </xsl:variable>
3577
4015
  <xsl:value-of select="$title-note"/>
3578
4016
  </fo:block>
3579
4017
  </fo:table-cell>
@@ -3583,7 +4021,7 @@
3583
4021
  </fo:block>
3584
4022
  </fo:table-cell>
3585
4023
  </fo:table-row>
3586
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']" mode="dl">
4024
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3587
4025
  <tr>
3588
4026
  <td>
3589
4027
  <xsl:apply-templates/>
@@ -3596,7 +4034,7 @@
3596
4034
  </td>
3597
4035
  </tr>
3598
4036
 
3599
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='dt']">
4037
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3600
4038
  <xsl:param name="key_iso"/>
3601
4039
 
3602
4040
  <fo:table-row>
@@ -3619,7 +4057,11 @@
3619
4057
 
3620
4058
 
3621
4059
  <xsl:apply-templates/>
3622
-
4060
+ <!-- <xsl:if test="$namespace = 'gb'">
4061
+ <xsl:if test="ancestor::*[local-name()='formula']">
4062
+ <xsl:text>—</xsl:text>
4063
+ </xsl:if>
4064
+ </xsl:if> -->
3623
4065
  </fo:block>
3624
4066
  </fo:table-cell>
3625
4067
  <fo:table-cell>
@@ -3633,37 +4075,37 @@
3633
4075
  </fo:table-cell>
3634
4076
  </fo:table-row>
3635
4077
 
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">
4078
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3637
4079
  <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">
4080
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3639
4081
  <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">
4082
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3641
4083
  <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']">
4084
+ </xsl:template><xsl:template match="*[local-name()='em']">
3643
4085
  <fo:inline font-style="italic">
3644
4086
  <xsl:apply-templates/>
3645
4087
  </fo:inline>
3646
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='strong']">
4088
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3647
4089
  <fo:inline font-weight="bold">
3648
4090
  <xsl:apply-templates/>
3649
4091
  </fo:inline>
3650
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sup']">
4092
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3651
4093
  <fo:inline font-size="80%" vertical-align="super">
3652
4094
  <xsl:apply-templates/>
3653
4095
  </fo:inline>
3654
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sub']">
4096
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3655
4097
  <fo:inline font-size="80%" vertical-align="sub">
3656
4098
  <xsl:apply-templates/>
3657
4099
  </fo:inline>
3658
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='tt']">
4100
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3659
4101
  <fo:inline font-family="Courier" font-size="10pt">
3660
4102
  <xsl:apply-templates/>
3661
4103
  </fo:inline>
3662
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='del']">
4104
+ </xsl:template><xsl:template match="*[local-name()='del']">
3663
4105
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3664
4106
  <xsl:apply-templates/>
3665
4107
  </fo:inline>
3666
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="text()[ancestor::*[local-name()='smallcap']]">
4108
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3667
4109
  <xsl:variable name="text" select="normalize-space(.)"/>
3668
4110
  <fo:inline font-size="75%">
3669
4111
  <xsl:if test="string-length($text) &gt; 0">
@@ -3672,10 +4114,11 @@
3672
4114
  </xsl:call-template>
3673
4115
  </xsl:if>
3674
4116
  </fo:inline>
3675
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="recursiveSmallCaps">
4117
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3676
4118
  <xsl:param name="text"/>
3677
4119
  <xsl:variable name="char" select="substring($text,1,1)"/>
3678
- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
4120
+ <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
4121
+ <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
3679
4122
  <xsl:choose>
3680
4123
  <xsl:when test="$char=$upperCase">
3681
4124
  <fo:inline font-size="{100 div 0.75}%">
@@ -3691,7 +4134,7 @@
3691
4134
  <xsl:with-param name="text" select="substring($text,2)"/>
3692
4135
  </xsl:call-template>
3693
4136
  </xsl:if>
3694
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="tokenize">
4137
+ </xsl:template><xsl:template name="tokenize">
3695
4138
  <xsl:param name="text"/>
3696
4139
  <xsl:param name="separator" select="' '"/>
3697
4140
  <xsl:choose>
@@ -3739,7 +4182,7 @@
3739
4182
  </xsl:call-template>
3740
4183
  </xsl:otherwise>
3741
4184
  </xsl:choose>
3742
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="max_length">
4185
+ </xsl:template><xsl:template name="max_length">
3743
4186
  <xsl:param name="words"/>
3744
4187
  <xsl:for-each select="$words//word">
3745
4188
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3747,11 +4190,11 @@
3747
4190
  <xsl:value-of select="."/>
3748
4191
  </xsl:if>
3749
4192
  </xsl:for-each>
3750
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-java">
4193
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3751
4194
  <xsl:param name="text" select="."/>
3752
4195
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3753
4196
  <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">
4197
+ </xsl:template><xsl:template name="add-zero-spaces">
3755
4198
  <xsl:param name="text" select="."/>
3756
4199
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3757
4200
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3804,7 +4247,7 @@
3804
4247
  <xsl:value-of select="$text"/>
3805
4248
  </xsl:otherwise>
3806
4249
  </xsl:choose>
3807
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="add-zero-spaces-equal">
4250
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3808
4251
  <xsl:param name="text" select="."/>
3809
4252
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3810
4253
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3830,7 +4273,7 @@
3830
4273
  <xsl:value-of select="$text"/>
3831
4274
  </xsl:otherwise>
3832
4275
  </xsl:choose>
3833
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getSimpleTable">
4276
+ </xsl:template><xsl:template name="getSimpleTable">
3834
4277
  <xsl:variable name="simple-table">
3835
4278
 
3836
4279
  <!-- Step 1. colspan processing -->
@@ -3857,9 +4300,9 @@
3857
4300
  </xsl:choose> -->
3858
4301
  </xsl:variable>
3859
4302
  <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">
4303
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3861
4304
  <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">
4305
+ </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
4306
  <xsl:choose>
3864
4307
  <xsl:when test="@colspan">
3865
4308
  <xsl:variable name="td">
@@ -3881,16 +4324,16 @@
3881
4324
  </xsl:element>
3882
4325
  </xsl:otherwise>
3883
4326
  </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">
4327
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3885
4328
  <xsl:element name="tr">
3886
4329
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3887
4330
  <xsl:apply-templates mode="simple-table-colspan"/>
3888
4331
  </xsl:element>
3889
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-colspan">
4332
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3890
4333
  <xsl:copy>
3891
4334
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3892
4335
  </xsl:copy>
3893
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="repeatNode">
4336
+ </xsl:template><xsl:template name="repeatNode">
3894
4337
  <xsl:param name="count"/>
3895
4338
  <xsl:param name="node"/>
3896
4339
 
@@ -3901,18 +4344,18 @@
3901
4344
  </xsl:call-template>
3902
4345
  <xsl:copy-of select="$node"/>
3903
4346
  </xsl:if>
3904
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="@*|node()" mode="simple-table-rowspan">
4347
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3905
4348
  <xsl:copy>
3906
4349
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3907
4350
  </xsl:copy>
3908
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tbody" mode="simple-table-rowspan">
4351
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3909
4352
  <xsl:copy>
3910
4353
  <xsl:copy-of select="tr[1]"/>
3911
4354
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3912
4355
  <xsl:with-param name="previousRow" select="tr[1]"/>
3913
4356
  </xsl:apply-templates>
3914
4357
  </xsl:copy>
3915
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="tr" mode="simple-table-rowspan">
4358
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3916
4359
  <xsl:param name="previousRow"/>
3917
4360
  <xsl:variable name="currentRow" select="."/>
3918
4361
 
@@ -3946,43 +4389,53 @@
3946
4389
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3947
4390
  <xsl:with-param name="previousRow" select="$newRow"/>
3948
4391
  </xsl:apply-templates>
3949
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="getLang">
4392
+ </xsl:template><xsl:template name="getLang">
3950
4393
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3951
4394
  <xsl:choose>
3952
4395
  <xsl:when test="$language = 'English'">en</xsl:when>
3953
4396
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3954
4397
  </xsl:choose>
3955
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="capitalizeWords">
4398
+ </xsl:template><xsl:template name="capitalizeWords">
3956
4399
  <xsl:param name="str"/>
3957
4400
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3958
4401
  <xsl:choose>
3959
4402
  <xsl:when test="contains($str2, ' ')">
3960
4403
  <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)"/>
4404
+ <!-- <xsl:value-of select="translate(substring($substr, 1, 1), $lower, $upper)"/>
4405
+ <xsl:value-of select="substring($substr, 2)"/> -->
4406
+ <xsl:call-template name="capitalize">
4407
+ <xsl:with-param name="str" select="$substr"/>
4408
+ </xsl:call-template>
3963
4409
  <xsl:text> </xsl:text>
3964
4410
  <xsl:call-template name="capitalizeWords">
3965
4411
  <xsl:with-param name="str" select="substring-after($str2, ' ')"/>
3966
4412
  </xsl:call-template>
3967
4413
  </xsl:when>
3968
4414
  <xsl:otherwise>
3969
- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
3970
- <xsl:value-of select="substring($str2, 2)"/>
4415
+ <!-- <xsl:value-of select="translate(substring($str2, 1, 1), $lower, $upper)"/>
4416
+ <xsl:value-of select="substring($str2, 2)"/> -->
4417
+ <xsl:call-template name="capitalize">
4418
+ <xsl:with-param name="str" select="$str2"/>
4419
+ </xsl:call-template>
3971
4420
  </xsl:otherwise>
3972
4421
  </xsl:choose>
3973
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="mathml:math">
4422
+ </xsl:template><xsl:template name="capitalize">
4423
+ <xsl:param name="str"/>
4424
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4425
+ <xsl:value-of select="substring($str, 2)"/>
4426
+ </xsl:template><xsl:template match="mathml:math">
3974
4427
  <fo:inline font-family="STIX2Math">
3975
4428
  <fo:instream-foreign-object fox:alt-text="Math">
3976
4429
  <xsl:copy-of select="."/>
3977
4430
  </fo:instream-foreign-object>
3978
4431
  </fo:inline>
3979
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='localityStack']">
4432
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3980
4433
  <xsl:for-each select="*[local-name()='locality']">
3981
4434
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3982
4435
  <xsl:apply-templates select="."/>
3983
4436
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3984
4437
  </xsl:for-each>
3985
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='link']" name="link">
4438
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3986
4439
  <xsl:variable name="target">
3987
4440
  <xsl:choose>
3988
4441
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4012,7 +4465,7 @@
4012
4465
  </xsl:otherwise>
4013
4466
  </xsl:choose>
4014
4467
  </fo:inline>
4015
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='sourcecode']" name="sourcecode">
4468
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
4016
4469
  <fo:block xsl:use-attribute-sets="sourcecode-style">
4017
4470
  <!-- <xsl:choose>
4018
4471
  <xsl:when test="@lang = 'en'"></xsl:when>
@@ -4023,19 +4476,29 @@
4023
4476
  </xsl:choose> -->
4024
4477
  <xsl:apply-templates/>
4025
4478
  </fo:block>
4026
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='bookmark']">
4479
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
4027
4480
  <fo:inline id="{@id}"/>
4028
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name()='appendix']">
4481
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
4029
4482
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4483
+ <xsl:variable name="title-appendix">
4484
+ <xsl:call-template name="getTitle">
4485
+ <xsl:with-param name="name" select="'title-appendix'"/>
4486
+ </xsl:call-template>
4487
+ </xsl:variable>
4030
4488
  <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
4031
4489
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
4032
4490
  </fo:block>
4033
4491
  <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">
4492
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
4035
4493
  <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']">
4494
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
4037
4495
  <fo:block xsl:use-attribute-sets="appendix-example-style">
4038
4496
  <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
4497
+ <xsl:variable name="title-example">
4498
+ <xsl:call-template name="getTitle">
4499
+ <xsl:with-param name="name" select="'title-example'"/>
4500
+ </xsl:call-template>
4501
+ </xsl:variable>
4039
4502
  <xsl:value-of select="$title-example"/>
4040
4503
  <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
4041
4504
  <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
@@ -4045,11 +4508,11 @@
4045
4508
  </xsl:if>
4046
4509
  </fo:block>
4047
4510
  <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">
4511
+ </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
4512
  <fo:inline><xsl:apply-templates/></fo:inline>
4050
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'callout']">
4513
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
4051
4514
  <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']">
4515
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
4053
4516
  <xsl:variable name="annotation-id" select="@id"/>
4054
4517
  <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
4055
4518
  <fo:block id="{$annotation-id}" white-space="nowrap">
@@ -4059,14 +4522,25 @@
4059
4522
  </xsl:apply-templates>
4060
4523
  </fo:inline>
4061
4524
  </fo:block>
4062
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4525
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
4063
4526
  <xsl:param name="callout"/>
4064
4527
  <fo:inline id="{@id}">
4065
4528
  <!-- for first p in annotation, put <x> -->
4066
4529
  <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
4067
4530
  <xsl:apply-templates/>
4068
4531
  </fo:inline>
4069
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="convertDate">
4532
+ </xsl:template><xsl:template match="*[local-name() = 'modification']">
4533
+ <xsl:variable name="title-modified">
4534
+ <xsl:call-template name="getTitle">
4535
+ <xsl:with-param name="name" select="'title-modified'"/>
4536
+ </xsl:call-template>
4537
+ </xsl:variable>
4538
+ <xsl:choose>
4539
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
4540
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
4541
+ </xsl:choose>
4542
+ <xsl:apply-templates/>
4543
+ </xsl:template><xsl:template name="convertDate">
4070
4544
  <xsl:param name="date"/>
4071
4545
  <xsl:param name="format" select="'short'"/>
4072
4546
  <xsl:variable name="year" select="substring($date, 1, 4)"/>
@@ -4099,7 +4573,7 @@
4099
4573
  </xsl:choose>
4100
4574
  </xsl:variable>
4101
4575
  <xsl:value-of select="$result"/>
4102
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeywords">
4576
+ </xsl:template><xsl:template name="insertKeywords">
4103
4577
  <xsl:param name="sorting" select="'true'"/>
4104
4578
  <xsl:param name="charAtEnd" select="'.'"/>
4105
4579
  <xsl:param name="charDelim" select="', '"/>
@@ -4122,7 +4596,7 @@
4122
4596
  </xsl:for-each>
4123
4597
  </xsl:otherwise>
4124
4598
  </xsl:choose>
4125
- </xsl:template><xsl:template xmlns:java="http://xml.apache.org/xalan/java" name="insertKeyword">
4599
+ </xsl:template><xsl:template name="insertKeyword">
4126
4600
  <xsl:param name="charAtEnd"/>
4127
4601
  <xsl:param name="charDelim"/>
4128
4602
  <xsl:apply-templates/>
@@ -4130,4 +4604,136 @@
4130
4604
  <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
4131
4605
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4132
4606
  </xsl:choose>
4607
+ </xsl:template><xsl:template name="addPDFUAmeta">
4608
+ <fo:declarations>
4609
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4610
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4611
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4612
+ </pdf:dictionary>
4613
+ </pdf:catalog>
4614
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4615
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4616
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4617
+ <!-- Dublin Core properties go here -->
4618
+ <dc:title>
4619
+ <xsl:variable name="title">
4620
+
4621
+ <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4622
+
4623
+
4624
+
4625
+
4626
+ </xsl:variable>
4627
+ <xsl:choose>
4628
+ <xsl:when test="normalize-space($title) != ''">
4629
+ <xsl:value-of select="$title"/>
4630
+ </xsl:when>
4631
+ <xsl:otherwise>
4632
+ <xsl:text> </xsl:text>
4633
+ </xsl:otherwise>
4634
+ </xsl:choose>
4635
+ </dc:title>
4636
+ <dc:creator>
4637
+
4638
+
4639
+ </dc:creator>
4640
+ <dc:description>
4641
+ <xsl:variable name="abstract">
4642
+
4643
+
4644
+ <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract'][@language = 'en']//text()"/>
4645
+
4646
+
4647
+
4648
+ </xsl:variable>
4649
+ <xsl:value-of select="normalize-space($abstract)"/>
4650
+ </dc:description>
4651
+ <pdf:Keywords>
4652
+ <xsl:call-template name="insertKeywords"/>
4653
+ </pdf:Keywords>
4654
+ </rdf:Description>
4655
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4656
+ <!-- XMP properties go here -->
4657
+ <xmp:CreatorTool/>
4658
+ </rdf:Description>
4659
+ </rdf:RDF>
4660
+ </x:xmpmeta>
4661
+ </fo:declarations>
4662
+ </xsl:template><xsl:template name="getId">
4663
+ <xsl:choose>
4664
+ <xsl:when test="../@id">
4665
+ <xsl:value-of select="../@id"/>
4666
+ </xsl:when>
4667
+ <xsl:otherwise>
4668
+ <!-- <xsl:value-of select="concat(local-name(..), '_', text())"/> -->
4669
+ <xsl:value-of select="concat(generate-id(..), '_', text())"/>
4670
+ </xsl:otherwise>
4671
+ </xsl:choose>
4672
+ </xsl:template><xsl:template name="getLevel">
4673
+ <xsl:variable name="level_total" select="count(ancestor::*)"/>
4674
+ <xsl:variable name="level">
4675
+ <xsl:choose>
4676
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
4677
+ <xsl:value-of select="$level_total - 2"/>
4678
+ </xsl:when>
4679
+ <xsl:when test="ancestor::*[local-name() = 'sections']">
4680
+ <xsl:value-of select="$level_total - 2"/>
4681
+ </xsl:when>
4682
+ <xsl:when test="ancestor::*[local-name() = 'bibliography']">
4683
+ <xsl:value-of select="$level_total - 2"/>
4684
+ </xsl:when>
4685
+ <xsl:when test="local-name(ancestor::*[1]) = 'annex'">1</xsl:when>
4686
+ <xsl:otherwise>
4687
+ <xsl:value-of select="$level_total - 1"/>
4688
+ </xsl:otherwise>
4689
+ </xsl:choose>
4690
+ </xsl:variable>
4691
+ <xsl:value-of select="$level"/>
4692
+ </xsl:template><xsl:template name="getSubSection">
4693
+ <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']"/>
4694
+ </xsl:template><xsl:template name="split">
4695
+ <xsl:param name="pText" select="."/>
4696
+ <xsl:param name="sep" select="','"/>
4697
+ <xsl:if test="string-length($pText) &gt;0">
4698
+ <item>
4699
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4700
+ </item>
4701
+ <xsl:call-template name="split">
4702
+ <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4703
+ <xsl:with-param name="sep" select="$sep"/>
4704
+ </xsl:call-template>
4705
+ </xsl:if>
4706
+ </xsl:template><xsl:template name="getDocumentId">
4707
+ <xsl:call-template name="getLang"/><xsl:value-of select="//*[local-name() = 'p'][1]/@id"/>
4708
+ </xsl:template><xsl:template name="namespaceCheck">
4709
+ <xsl:variable name="documentNS" select="namespace-uri(/*)"/>
4710
+ <xsl:variable name="XSLNS">
4711
+
4712
+
4713
+ <xsl:value-of select="document('')//*/namespace::iec"/>
4714
+
4715
+
4716
+
4717
+
4718
+
4719
+
4720
+
4721
+
4722
+
4723
+
4724
+
4725
+ </xsl:variable>
4726
+ <xsl:if test="$documentNS != $XSLNS">
4727
+ <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
4728
+ </xsl:if>
4729
+ </xsl:template><xsl:template name="getLanguage">
4730
+ <xsl:param name="lang"/>
4731
+ <xsl:variable name="language" select="java:toLowerCase(java:java.lang.String.new($lang))"/>
4732
+ <xsl:choose>
4733
+ <xsl:when test="$language = 'en'">English</xsl:when>
4734
+ <xsl:when test="$language = 'fr'">French</xsl:when>
4735
+ <xsl:when test="$language = 'de'">Deutsch</xsl:when>
4736
+ <xsl:when test="$language = 'cn'">Chinese</xsl:when>
4737
+ <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
4738
+ </xsl:choose>
4133
4739
  </xsl:template></xsl:stylesheet>