metanorma-iso 1.6.0 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +16 -29
  3. data/.rubocop.yml +0 -4
  4. data/lib/asciidoctor/iso/base.rb +13 -13
  5. data/lib/asciidoctor/iso/basicdoc.rng +5 -3
  6. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  7. data/lib/asciidoctor/iso/front.rb +5 -5
  8. data/lib/asciidoctor/iso/isodoc.rng +134 -5
  9. data/lib/asciidoctor/iso/isostandard-amd.rng +11 -4
  10. data/lib/asciidoctor/iso/isostandard.rng +33 -107
  11. data/lib/asciidoctor/iso/validate.rb +79 -0
  12. data/lib/asciidoctor/iso/validate_section.rb +12 -9
  13. data/lib/isodoc/iso/base_convert.rb +11 -0
  14. data/lib/isodoc/iso/html/header.html +12 -12
  15. data/lib/isodoc/iso/html/html_iso_intro.html +1 -1
  16. data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
  17. data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
  18. data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
  19. data/lib/isodoc/iso/html_convert.rb +2 -2
  20. data/lib/isodoc/iso/i18n-en.yaml +6 -0
  21. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  22. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  23. data/lib/isodoc/iso/index.rb +139 -0
  24. data/lib/isodoc/iso/iso.amendment.xsl +1006 -317
  25. data/lib/isodoc/iso/iso.international-standard.xsl +1006 -317
  26. data/lib/isodoc/iso/presentation_xml_convert.rb +1 -4
  27. data/lib/isodoc/iso/sections.rb +1 -1
  28. data/lib/isodoc/iso/word_convert.rb +2 -2
  29. data/lib/isodoc/iso/xref.rb +33 -12
  30. data/lib/metanorma/iso/version.rb +1 -1
  31. data/metanorma-iso.gemspec +3 -3
  32. data/spec/asciidoctor/amd_spec.rb +696 -0
  33. data/spec/asciidoctor/base_spec.rb +704 -0
  34. data/spec/asciidoctor/blocks_spec.rb +527 -0
  35. data/spec/asciidoctor/cleanup_spec.rb +1134 -0
  36. data/spec/asciidoctor/inline_spec.rb +195 -0
  37. data/spec/asciidoctor/lists_spec.rb +197 -0
  38. data/spec/asciidoctor/refs_spec.rb +375 -0
  39. data/spec/asciidoctor/section_spec.rb +393 -0
  40. data/spec/asciidoctor/table_spec.rb +329 -0
  41. data/spec/asciidoctor/validate_spec.rb +1555 -0
  42. data/spec/isodoc/amd_spec.rb +967 -946
  43. data/spec/isodoc/blocks_spec.rb +530 -507
  44. data/spec/isodoc/i18n_spec.rb +953 -911
  45. data/spec/isodoc/inline_spec.rb +355 -293
  46. data/spec/isodoc/iso_spec.rb +340 -316
  47. data/spec/isodoc/metadata_spec.rb +392 -382
  48. data/spec/isodoc/postproc_spec.rb +834 -656
  49. data/spec/isodoc/ref_spec.rb +374 -331
  50. data/spec/isodoc/section_spec.rb +821 -519
  51. data/spec/isodoc/table_spec.rb +472 -411
  52. data/spec/isodoc/terms_spec.rb +209 -185
  53. data/spec/isodoc/xref_spec.rb +1370 -1236
  54. data/spec/metanorma/processor_spec.rb +28 -26
  55. data/spec/spec_helper.rb +184 -189
  56. metadata +22 -23
  57. data/.rubocop.ribose.yml +0 -66
  58. data/spec/asciidoctor-iso/amd_spec.rb +0 -694
  59. data/spec/asciidoctor-iso/base_spec.rb +0 -713
  60. data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
  61. data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
  62. data/spec/asciidoctor-iso/inline_spec.rb +0 -170
  63. data/spec/asciidoctor-iso/lists_spec.rb +0 -190
  64. data/spec/asciidoctor-iso/refs_spec.rb +0 -317
  65. data/spec/asciidoctor-iso/section_spec.rb +0 -362
  66. data/spec/asciidoctor-iso/table_spec.rb +0 -313
  67. data/spec/asciidoctor-iso/validate_spec.rb +0 -1251
  68. data/spec/assets/xref_error.adoc +0 -7
@@ -2,7 +2,7 @@
2
2
 
3
3
  <nav>
4
4
 
5
- <h1 id="content">Contents</h1>
5
+ <h1 id="content">{{ labels["table_of_contents"] }}</h1>
6
6
  <div id="toc"></div>
7
7
 
8
8
  </nav>
@@ -8,7 +8,7 @@
8
8
  {% endif %}
9
9
 
10
10
  {% if revdate %}
11
- <p class="coverpage_docnumber">Date: {{ revdate }}</p>
11
+ <p class="coverpage_docnumber">{{ labels["date"]}}: {{ revdate }}</p>
12
12
  {% endif %}
13
13
 
14
14
  {% if tc_docnumber.size > 0 %}
@@ -8,7 +8,7 @@ margin-left:5.1pt;margin-right:5.1pt'>
8
8
  {% if doctype == "Amendment" or doctype == "Technical Corrigendum" %}
9
9
  {% else %}
10
10
 
11
- <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>
11
+ <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">{{ labels["table_of_contents"] }}</span></p>
12
12
 
13
13
  WORDTOC
14
14
  {% endif %}
@@ -11,7 +11,7 @@ style='mso-bidi-font-weight:normal'><span lang="EN-GB" style='font-size:14.0pt'>
11
11
  {% endif %}
12
12
 
13
13
  {% if revdate %}
14
- <p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB" style='mso-no-proof:yes'>Date: {{ revdate }}</span></p>
14
+ <p class="MsoNormal" align="right" style='text-align:right'><span lang="EN-GB" style='mso-no-proof:yes'>{{ labels["date"]}}: {{ revdate }}</span></p>
15
15
  {% endif %}
16
16
 
17
17
  {% if tc_docnumber.size > 0 %}
@@ -19,9 +19,9 @@ module IsoDoc
19
19
 
20
20
  def default_fonts(options)
21
21
  {
22
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
22
+ bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' :
23
23
  options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'),
24
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
24
+ headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
25
25
  options[:alt] ? '"Lato",sans-serif' : '"Cambria",serif'),
26
26
  monospacefont: (options[:alt] ? '"Space Mono",monospace' :
27
27
  '"Courier New",monospace'),
@@ -12,3 +12,9 @@ all_rights_reserved: All rights reserved
12
12
  reference_number: Reference Number
13
13
  price_based_on: Price based on % pages
14
14
  under_preparation: Under preparation. (Stage at the time of publication %).
15
+ table_of_contents: Contents
16
+ date: Date
17
+ index: Index
18
+ see: see
19
+ see_also: see also
20
+
@@ -12,4 +12,8 @@ all_rights_reserved: Tous droits réservés
12
12
  reference_number: Numéro de référence
13
13
  price_based_on: Prix basé sur % pages
14
14
  under_preparation: En cours d'élaboration. (Stade au moment de la publication %).
15
+ date: Date
16
+ index: Index
17
+ see: voir
18
+ see_also: voir aussi
15
19
 
@@ -10,4 +10,8 @@ all_rights_reserved: 版权所有
10
10
  reference_number: 参考编号
11
11
  price_based_on: 价格基于%页
12
12
  under_preparation: 制定中(出版时最新状态为%)
13
+ date: 日期
14
+ index: 索引
15
+ see: 见
16
+ see_also: 另见
13
17
 
@@ -0,0 +1,139 @@
1
+ module IsoDoc
2
+ module Iso
3
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
4
+ def add_id
5
+ %(id="_#{UUIDTools::UUID.random_create}")
6
+ end
7
+
8
+ def index(docxml)
9
+ unless docxml.at(ns("//index"))
10
+ docxml.xpath(ns("//indexsect")).each { |i| i.remove }
11
+ return
12
+ end
13
+ i = docxml.at(ns("//indexsect")) ||
14
+ docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}</title></indexsect>").first
15
+ index = sort_indexterms(docxml.xpath(ns("//index")), docxml.xpath(ns("//index-xref[@also = 'false']")),
16
+ docxml.xpath(ns("//index-xref[@also = 'true']")))
17
+ index1(docxml, i, index)
18
+ end
19
+
20
+ def index1(docxml, i, index)
21
+ c = i.add_child("<ul></ul>").first
22
+ index.keys.sort.each do |k|
23
+ #c = i.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
24
+ words = index[k].keys.each_with_object({}) { |w, v| v[sortable(w).downcase] = w }
25
+ words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
26
+ #c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
27
+ c.add_child index_entries(words, index[k], w)
28
+ end
29
+ end
30
+ @xrefs.bookmark_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
31
+ end
32
+
33
+ def sortable(s)
34
+ HTMLEntities.new.decode(Nokogiri::XML.fragment(s).text)
35
+ end
36
+
37
+ def index_entries_opt
38
+ { xref_lbl: ", ", see_lbl: ", #{see_lbl}", also_lbl: ", #{also_lbl}" }
39
+ end
40
+
41
+ def index_entries(words, index, primary)
42
+ ret = index_entries_head(words[primary], index.dig(words[primary], nil, nil), index_entries_opt)
43
+ words2 = index[words[primary]]&.keys&.reject { |k| k.nil?}&.each_with_object({}) { |w, v| v[w.downcase] = w }
44
+ unless words2.empty?
45
+ ret += "<ul>"
46
+ words2.keys.localize(@lang.to_sym).sort.to_a.each do |w|
47
+ ret += index_entries2(words2, index[words[primary]], w)
48
+ end
49
+ ret += "</ul>"
50
+ end
51
+ ret + "</li>"
52
+ end
53
+
54
+ def index_entries2(words, index, secondary)
55
+ ret = index_entries_head(words[secondary], index.dig(words[secondary], nil), index_entries_opt)
56
+ words3 = index[words[secondary]]&.keys&.reject { |k| k.nil?}&.each_with_object({}) { |w, v| v[w.downcase] = w }
57
+ unless words3.empty?
58
+ ret += "<ul>"
59
+ words3.keys.localize(@lang.to_sym).sort.to_a.each do |w|
60
+ ret += (index_entries_head(words3[w], index[words[secondary]][words3[w]], index_entries_opt) + "</li>")
61
+ end
62
+ ret += "</ul>"
63
+ end
64
+ ret + "</li>"
65
+ end
66
+
67
+ def index_entries_head(head, entries, opt)
68
+ ret = "<li>#{head}"
69
+ xref = entries&.dig(:xref)&.join(", ")
70
+ see_sort = entries&.dig(:see)&.each_with_object({}) { |w, v| v[sortable(w).downcase] = w }
71
+ see = see_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map { |k| see_sort[k] }&.join(", ")
72
+ also_sort = entries&.dig(:also)&.each_with_object({}) { |w, v| v[sortable(w).downcase] = w }
73
+ also = also_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map { |k| also_sort[k] }&.join(", ")
74
+ ret += "#{opt[:xref_lbl]} #{xref}" if xref
75
+ ret += "#{opt[:see_lbl]} #{see}" if see
76
+ ret += "#{opt[:also_lbl]} #{also}" if also
77
+ ret
78
+ end
79
+
80
+ def see_lbl
81
+ @lang == "en" ? @i18n.see : "<em>#{@i18n.see}</em>"
82
+ end
83
+
84
+ def also_lbl
85
+ @lang == "en" ? @i18n.see_also : "<em>#{@i18n.see_also}</em>"
86
+ end
87
+
88
+ def sort_indexterms(terms, see, also)
89
+ index = extract_indexterms(terms)
90
+ index = extract_indexsee(index, see, :see)
91
+ index = extract_indexsee(index, also, :also)
92
+ index.keys.sort.each_with_object({}) do |k, v|
93
+ v[sortable(k)[0].upcase.transliterate] ||= {}
94
+ v[sortable(k)[0].upcase.transliterate][k] = index[k]
95
+ end
96
+ end
97
+
98
+ def extract_indexsee(v, terms, label)
99
+ terms.each_with_object(v) do |t, v|
100
+ term = t&.at(ns("./primary"))&.children&.to_xml
101
+ term2 = t&.at(ns("./secondary"))&.children&.to_xml
102
+ term3 = t&.at(ns("./tertiary"))&.children&.to_xml
103
+ v[term] ||= {}
104
+ v[term][term2] ||= {}
105
+ v[term][term2][term3] ||= {}
106
+ v[term][term2][term3][label] ||= []
107
+ v[term][term2][term3][label] << t&.at(ns("./target"))&.children&.to_xml
108
+ t.remove
109
+ end
110
+ end
111
+
112
+ def xml_encode_attr(s)
113
+ HTMLEntities.new.encode(s, :basic, :hexadecimal).gsub(/\&#x([^;]+);/) { |x| "&#x#{$1.upcase};" }
114
+ end
115
+
116
+ # attributes are decoded into UTF-8, elements in extract_indexsee are still in entities
117
+ def extract_indexterms(terms)
118
+ terms.each_with_object({}) do |t, v|
119
+ term = t&.at(ns("./primary"))&.children&.to_xml
120
+ term2 = t&.at(ns("./secondary"))&.children&.to_xml
121
+ term3 = t&.at(ns("./tertiary"))&.children&.to_xml
122
+ index2bookmark(t)
123
+ v[term] ||= {}
124
+ v[term][term2] ||= {}
125
+ v[term][term2][term3] ||= {}
126
+ v[term][term2][term3][:xref] ||= []
127
+ to = t["to"] ? "to='#{t['to']}' " : ""
128
+ v[term][term2][term3][:xref] << "<xref target='#{t['id']}' #{to}pagenumber='true'/>"
129
+ end
130
+ end
131
+
132
+ def index2bookmark(t)
133
+ t.name = "bookmark"
134
+ t.children.each { |x| x.remove }
135
+ t["id"] = "_#{UUIDTools::UUID.random_create}"
136
+ end
137
+ end
138
+ end
139
+ end
@@ -1,19 +1,33 @@
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:iso="https://www.metanorma.org/ns/iso" 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">
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:iso="https://www.metanorma.org/ns/iso" 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:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" 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
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
7
8
 
8
9
 
9
10
 
10
11
  <xsl:key name="kfn" match="iso:p/iso:fn" use="@reference"/>
11
12
 
13
+ <xsl:key name="attachments" match="iso:eref[contains(@bibitemid, '.exp')]" use="@bibitemid"/>
14
+
12
15
 
13
16
 
14
17
  <xsl:variable name="debug">false</xsl:variable>
15
- <xsl:variable name="pageWidth" select="'210mm'"/>
16
- <xsl:variable name="pageHeight" select="'297mm'"/>
18
+ <xsl:variable name="pageWidth" select="210"/>
19
+ <xsl:variable name="pageHeight" select="297"/>
20
+ <xsl:variable name="marginLeftRight1" select="25"/>
21
+ <xsl:variable name="marginLeftRight2" select="12.5"/>
22
+ <xsl:variable name="marginTop" select="27.4"/>
23
+ <xsl:variable name="marginBottom" select="13"/>
24
+
25
+ <xsl:variable name="figure_name_height">14</xsl:variable>
26
+ <xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><!-- paper width minus margins -->
27
+ <xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><!-- paper height minus margins and title height -->
28
+ <xsl:variable name="image_dpi" select="96"/>
29
+ <xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/>
30
+ <xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/>
17
31
 
18
32
  <xsl:variable name="docidentifierISO" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso'] | /iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'ISO']"/>
19
33
 
@@ -157,6 +171,7 @@
157
171
  <contents>
158
172
  <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
159
173
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
174
+ <xsl:apply-templates select="//iso:indexsect" mode="contents"/>
160
175
  </contents>
161
176
  </xsl:variable>
162
177
 
@@ -170,10 +185,11 @@
170
185
  <xsl:if test="$lang = 'zh'">
171
186
  <xsl:attribute name="font-family">Source Han Sans, Times New Roman, Cambria Math</xsl:attribute>
172
187
  </xsl:if>
188
+
173
189
  <fo:layout-master-set>
174
190
 
175
191
  <!-- cover page -->
176
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
192
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
177
193
  <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="31.7mm" margin-right="31.7mm"/>
178
194
  <fo:region-before region-name="cover-page-header" extent="25.4mm"/>
179
195
  <fo:region-after/>
@@ -181,7 +197,7 @@
181
197
  <fo:region-end region-name="cover-right-region" extent="31.7mm"/>
182
198
  </fo:simple-page-master>
183
199
 
184
- <fo:simple-page-master master-name="cover-page-published" page-width="{$pageWidth}" page-height="{$pageHeight}">
200
+ <fo:simple-page-master master-name="cover-page-published" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
185
201
  <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="78mm" margin-right="18.5mm"/>
186
202
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
187
203
  <fo:region-after region-name="cover-page-footer" extent="40mm" display-align="after"/>
@@ -190,19 +206,19 @@
190
206
  </fo:simple-page-master>
191
207
 
192
208
 
193
- <fo:simple-page-master master-name="cover-page-publishedISO-odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
194
- <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="25mm" margin-right="12.5mm"/>
209
+ <fo:simple-page-master master-name="cover-page-publishedISO-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
210
+ <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
195
211
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
196
212
  <fo:region-after region-name="cover-page-footer" extent="40mm" display-align="after"/>
197
- <fo:region-start region-name="cover-left-region" extent="25mm"/>
198
- <fo:region-end region-name="cover-right-region" extent="12.5mm"/>
213
+ <fo:region-start region-name="cover-left-region" extent="{$marginLeftRight1}mm"/>
214
+ <fo:region-end region-name="cover-right-region" extent="{$marginLeftRight2}mm"/>
199
215
  </fo:simple-page-master>
200
- <fo:simple-page-master master-name="cover-page-publishedISO-even" page-width="{$pageWidth}" page-height="{$pageHeight}">
201
- <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="12.5mm" margin-right="25mm"/>
216
+ <fo:simple-page-master master-name="cover-page-publishedISO-even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
217
+ <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
202
218
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
203
219
  <fo:region-after region-name="cover-page-footer" extent="40mm" display-align="after"/>
204
- <fo:region-start region-name="cover-left-region" extent="12.5mm"/>
205
- <fo:region-end region-name="cover-right-region" extent="25mm"/>
220
+ <fo:region-start region-name="cover-left-region" extent="{$marginLeftRight2}mm"/>
221
+ <fo:region-end region-name="cover-right-region" extent="{$marginLeftRight1}mm"/>
206
222
  </fo:simple-page-master>
207
223
  <fo:page-sequence-master master-name="cover-page-publishedISO">
208
224
  <fo:repeatable-page-master-alternatives>
@@ -214,7 +230,7 @@
214
230
 
215
231
  <!-- contents pages -->
216
232
  <!-- odd pages -->
217
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
233
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
218
234
  <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="19mm" margin-right="19mm"/>
219
235
  <fo:region-before region-name="header-odd" extent="27.4mm"/> <!-- display-align="center" -->
220
236
  <fo:region-after region-name="footer-odd" extent="13mm"/>
@@ -222,7 +238,7 @@
222
238
  <fo:region-end region-name="right-region" extent="19mm"/>
223
239
  </fo:simple-page-master>
224
240
  <!-- even pages -->
225
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
241
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
226
242
  <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="19mm" margin-right="19mm"/>
227
243
  <fo:region-before region-name="header-even" extent="27.4mm"/> <!-- display-align="center" -->
228
244
  <fo:region-after region-name="footer-even" extent="13mm"/>
@@ -244,35 +260,35 @@
244
260
 
245
261
 
246
262
  <!-- first page -->
247
- <fo:simple-page-master master-name="first-publishedISO" page-width="{$pageWidth}" page-height="{$pageHeight}">
248
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="25mm" margin-right="12.5mm"/>
249
- <fo:region-before region-name="header-first" extent="27.4mm"/> <!-- display-align="center" -->
250
- <fo:region-after region-name="footer-odd" extent="13mm"/>
251
- <fo:region-start region-name="left-region" extent="25mm"/>
252
- <fo:region-end region-name="right-region" extent="12.5mm"/>
263
+ <fo:simple-page-master master-name="first-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
264
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
265
+ <fo:region-before region-name="header-first" extent="{$marginTop}mm"/> <!-- display-align="center" -->
266
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
267
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
268
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
253
269
  </fo:simple-page-master>
254
270
  <!-- odd pages -->
255
- <fo:simple-page-master master-name="odd-publishedISO" page-width="{$pageWidth}" page-height="{$pageHeight}">
256
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="25mm" margin-right="12.5mm"/>
257
- <fo:region-before region-name="header-odd" extent="27.4mm"/> <!-- display-align="center" -->
258
- <fo:region-after region-name="footer-odd" extent="13mm"/>
259
- <fo:region-start region-name="left-region" extent="25mm"/>
260
- <fo:region-end region-name="right-region" extent="12.5mm"/>
271
+ <fo:simple-page-master master-name="odd-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
272
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
273
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/> <!-- display-align="center" -->
274
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
275
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
276
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
261
277
  </fo:simple-page-master>
262
278
  <!-- even pages -->
263
- <fo:simple-page-master master-name="even-publishedISO" page-width="{$pageWidth}" page-height="{$pageHeight}">
264
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
265
- <fo:region-before region-name="header-even" extent="27.4mm"/>
266
- <fo:region-after region-name="footer-even" extent="13mm"/>
267
- <fo:region-start region-name="left-region" extent="12.5mm"/>
268
- <fo:region-end region-name="right-region" extent="25mm"/>
279
+ <fo:simple-page-master master-name="even-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
280
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
281
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
282
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
283
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
284
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
269
285
  </fo:simple-page-master>
270
- <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
271
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
272
- <fo:region-before region-name="header" extent="27.4mm"/>
273
- <fo:region-after region-name="footer" extent="13mm"/>
274
- <fo:region-start region-name="left" extent="12.5mm"/>
275
- <fo:region-end region-name="right" extent="25mm"/>
286
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
287
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
288
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
289
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
290
+ <fo:region-start region-name="left" extent="{$marginLeftRight2}mm"/>
291
+ <fo:region-end region-name="right" extent="{$marginLeftRight1}mm"/>
276
292
  </fo:simple-page-master>
277
293
  <fo:page-sequence-master master-name="preface-publishedISO">
278
294
  <fo:repeatable-page-master-alternatives>
@@ -291,17 +307,48 @@
291
307
  </fo:repeatable-page-master-alternatives>
292
308
  </fo:page-sequence-master>
293
309
 
294
- <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
295
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
296
- <fo:region-before region-name="header-even" extent="27.4mm"/>
297
- <fo:region-after region-name="last-page-footer" extent="13mm"/>
298
- <fo:region-start region-name="left-region" extent="12.5mm"/>
299
- <fo:region-end region-name="right-region" extent="25mm"/>
310
+ <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
311
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
312
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
313
+ <fo:region-after region-name="last-page-footer" extent="{$marginBottom}mm"/>
314
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
315
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
300
316
  </fo:simple-page-master>
301
317
 
318
+ <!-- Index pages -->
319
+ <fo:simple-page-master master-name="index-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
320
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm" column-count="2" column-gap="10mm"/>
321
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
322
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
323
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
324
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
325
+ </fo:simple-page-master>
326
+ <fo:simple-page-master master-name="index-even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
327
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm" column-count="2" column-gap="10mm"/>
328
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
329
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
330
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
331
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
332
+ </fo:simple-page-master>
333
+ <fo:page-sequence-master master-name="index">
334
+ <fo:repeatable-page-master-alternatives>
335
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="index-even"/>
336
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="index-odd"/>
337
+ </fo:repeatable-page-master-alternatives>
338
+ </fo:page-sequence-master>
339
+
340
+
302
341
  </fo:layout-master-set>
342
+
343
+ <fo:declarations>
344
+ <xsl:call-template name="addPDFUAmeta"/>
345
+ <xsl:for-each select="//*[local-name() = 'eref'][generate-id(.)=generate-id(key('attachments',@bibitemid)[1])]">
346
+ <xsl:variable name="url" select="concat('url(', ., ')')"/>
347
+ <pdf:embedded-file src="{$url}"/>
348
+ </xsl:for-each>
349
+ </fo:declarations>
303
350
 
304
- <xsl:call-template name="addPDFUAmeta"/>
351
+
305
352
 
306
353
  <xsl:call-template name="addBookmarks">
307
354
  <xsl:with-param name="contents" select="$contents"/>
@@ -1024,20 +1071,20 @@
1024
1071
  <fo:block-container font-weight="bold">
1025
1072
 
1026
1073
  <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1027
- <xsl:variable name="title-toc">
1028
- <xsl:call-template name="getTitle">
1029
- <xsl:with-param name="name" select="'title-toc'"/>
1074
+ <fo:inline font-size="16pt" font-weight="bold">
1075
+ <!-- Contents -->
1076
+ <xsl:call-template name="getLocalizedString">
1077
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1030
1078
  </xsl:call-template>
1031
- </xsl:variable>
1032
- <fo:inline font-size="16pt" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:inline>
1079
+ </fo:inline>
1033
1080
  <fo:inline keep-together.within-line="always">
1034
1081
  <fo:leader leader-pattern="space"/>
1035
- <xsl:variable name="title-page">
1036
- <xsl:call-template name="getTitle">
1037
- <xsl:with-param name="name" select="'title-page'"/>
1038
- </xsl:call-template>
1039
- </xsl:variable>
1040
- <fo:inline font-weight="normal" font-size="10pt"><xsl:value-of select="$title-page"/></fo:inline>
1082
+ <fo:inline font-weight="normal" font-size="10pt">
1083
+ <!-- Page -->
1084
+ <xsl:call-template name="getLocalizedString">
1085
+ <xsl:with-param name="key">locality.page</xsl:with-param>
1086
+ </xsl:call-template>
1087
+ </fo:inline>
1041
1088
  </fo:inline>
1042
1089
  </fo:block>
1043
1090
 
@@ -1182,6 +1229,10 @@
1182
1229
  </fo:flow>
1183
1230
  </fo:page-sequence>
1184
1231
 
1232
+
1233
+ <!-- Index -->
1234
+ <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1235
+
1185
1236
  <xsl:if test="$isPublished = 'true'">
1186
1237
  <fo:page-sequence master-reference="last-page" force-page-count="no-force">
1187
1238
  <xsl:call-template name="insertHeaderEven"/>
@@ -1314,7 +1365,10 @@
1314
1365
  </xsl:variable>
1315
1366
 
1316
1367
  <xsl:variable name="type">
1317
- <xsl:value-of select="local-name()"/>
1368
+ <xsl:choose>
1369
+ <xsl:when test="local-name() = 'indexsect'">index</xsl:when>
1370
+ <xsl:otherwise><xsl:value-of select="local-name()"/></xsl:otherwise>
1371
+ </xsl:choose>
1318
1372
  </xsl:variable>
1319
1373
 
1320
1374
  <xsl:variable name="display">
@@ -1347,10 +1401,15 @@
1347
1401
  </xsl:variable>
1348
1402
 
1349
1403
  <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
1404
+ <xsl:if test="$type = 'index'">
1405
+ <xsl:attribute name="level">1</xsl:attribute>
1406
+ </xsl:if>
1350
1407
  <title>
1351
1408
  <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
1352
1409
  </title>
1353
- <xsl:apply-templates mode="contents"/>
1410
+ <xsl:if test="$type != 'index'">
1411
+ <xsl:apply-templates mode="contents"/>
1412
+ </xsl:if>
1354
1413
  </item>
1355
1414
  </xsl:if>
1356
1415
  </xsl:template>
@@ -1588,6 +1647,9 @@
1588
1647
  </xsl:choose>
1589
1648
  </xsl:attribute>
1590
1649
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1650
+ <xsl:if test="@id">
1651
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1652
+ </xsl:if>
1591
1653
  <xsl:apply-templates/>
1592
1654
  </xsl:element>
1593
1655
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
@@ -1891,7 +1953,300 @@
1891
1953
  </fo:block>
1892
1954
  </xsl:template>
1893
1955
 
1956
+ <!-- =================== -->
1957
+ <!-- SVG images processing -->
1958
+ <!-- =================== -->
1959
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2">
1960
+
1961
+ <xsl:choose>
1962
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
1963
+ <fo:block>
1964
+ <xsl:variable name="width" select="@width"/>
1965
+ <xsl:variable name="height" select="@height"/>
1966
+
1967
+ <xsl:variable name="scale_x">
1968
+ <xsl:choose>
1969
+ <xsl:when test="$width &gt; $width_effective_px">
1970
+ <xsl:value-of select="$width_effective_px div $width"/>
1971
+ </xsl:when>
1972
+ <xsl:otherwise>1</xsl:otherwise>
1973
+ </xsl:choose>
1974
+ </xsl:variable>
1975
+
1976
+ <xsl:variable name="scale_y">
1977
+ <xsl:choose>
1978
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
1979
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
1980
+ </xsl:when>
1981
+ <xsl:otherwise>1</xsl:otherwise>
1982
+ </xsl:choose>
1983
+ </xsl:variable>
1984
+
1985
+ <xsl:variable name="scale">
1986
+ <xsl:choose>
1987
+ <xsl:when test="$scale_y != 1">
1988
+ <xsl:value-of select="$scale_x * $scale_y"/>
1989
+ </xsl:when>
1990
+ <xsl:otherwise>
1991
+ <xsl:value-of select="$scale_x"/>
1992
+ </xsl:otherwise>
1993
+ </xsl:choose>
1994
+ </xsl:variable>
1995
+
1996
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
1997
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
1998
+
1999
+ <fo:table table-layout="fixed" width="100%">
2000
+ <fo:table-column column-width="proportional-column-width(1)"/>
2001
+ <fo:table-column column-width="{$width_scale}px"/>
2002
+ <fo:table-column column-width="proportional-column-width(1)"/>
2003
+ <fo:table-body>
2004
+ <fo:table-row>
2005
+ <fo:table-cell column-number="2">
2006
+ <fo:block>
2007
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
2008
+ <fo:block text-depth="0" line-height="0" font-size="0">
2009
+ <fo:instream-foreign-object fox:alt-text="{../*[local-name() = 'name']}">
2010
+ <xsl:attribute name="width">100%</xsl:attribute>
2011
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2012
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2013
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2014
+
2015
+ <xsl:apply-templates select="." mode="svg_remove_a"/>
2016
+ </fo:instream-foreign-object>
2017
+ </fo:block>
2018
+
2019
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
2020
+ <xsl:with-param name="scale" select="$scale"/>
2021
+ </xsl:apply-templates>
2022
+ </fo:block-container>
2023
+ </fo:block>
2024
+ </fo:table-cell>
2025
+ </fo:table-row>
2026
+ </fo:table-body>
2027
+ </fo:table>
2028
+ </fo:block>
2029
+
2030
+ </xsl:when>
2031
+ <xsl:otherwise>
2032
+ <fo:block xsl:use-attribute-sets="image-style">
2033
+ <fo:instream-foreign-object fox:alt-text="{../*[local-name() = 'name']}">
2034
+ <xsl:attribute name="width">100%</xsl:attribute>
2035
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2036
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2037
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
2038
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
2039
+ <!-- effective height / width = 1.48, 1.4 - with title -->
2040
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
2041
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
2042
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
2043
+ </xsl:if>
2044
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2045
+ <xsl:copy-of select="."/>
2046
+ </fo:instream-foreign-object>
2047
+ </fo:block>
2048
+ </xsl:otherwise>
2049
+ </xsl:choose>
2050
+ </xsl:template>
2051
+
2052
+ <xsl:template match="@*|node()" mode="svg_remove_a">
2053
+ <xsl:copy>
2054
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
2055
+ </xsl:copy>
2056
+ </xsl:template>
2057
+
2058
+ <xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
2059
+ <xsl:apply-templates mode="svg_remove_a"/>
2060
+ </xsl:template>
2061
+
2062
+ <xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
2063
+ <xsl:param name="scale"/>
2064
+ <xsl:variable name="dest">
2065
+ <xsl:choose>
2066
+ <xsl:when test="starts-with(@href, '#')">
2067
+ <xsl:value-of select="substring-after(@href, '#')"/>
2068
+ </xsl:when>
2069
+ <xsl:otherwise>
2070
+ <xsl:value-of select="@href"/>
2071
+ </xsl:otherwise>
2072
+ </xsl:choose>
2073
+ </xsl:variable>
2074
+ <xsl:for-each select="./*[local-name() = 'rect']">
2075
+ <xsl:call-template name="insertSVGMapLink">
2076
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
2077
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
2078
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
2079
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
2080
+ <xsl:with-param name="dest" select="$dest"/>
2081
+ </xsl:call-template>
2082
+ </xsl:for-each>
2083
+
2084
+ <xsl:for-each select="./*[local-name() = 'polygon']">
2085
+ <xsl:variable name="points">
2086
+ <xsl:call-template name="split">
2087
+ <xsl:with-param name="pText" select="@points"/>
2088
+ </xsl:call-template>
2089
+ </xsl:variable>
2090
+ <xsl:variable name="x_coords">
2091
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
2092
+ <xsl:sort select="." data-type="number"/>
2093
+ <x><xsl:value-of select="."/></x>
2094
+ </xsl:for-each>
2095
+ </xsl:variable>
2096
+ <xsl:variable name="y_coords">
2097
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
2098
+ <xsl:sort select="." data-type="number"/>
2099
+ <y><xsl:value-of select="."/></y>
2100
+ </xsl:for-each>
2101
+ </xsl:variable>
2102
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
2103
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
2104
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
2105
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
2106
+ <xsl:call-template name="insertSVGMapLink">
2107
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
2108
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
2109
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
2110
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
2111
+ <xsl:with-param name="dest" select="$dest"/>
2112
+ </xsl:call-template>
2113
+ </xsl:for-each>
2114
+
2115
+ <xsl:for-each select="./*[local-name() = 'circle']">
2116
+ <xsl:call-template name="insertSVGMapLink">
2117
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
2118
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
2119
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
2120
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
2121
+ <xsl:with-param name="dest" select="$dest"/>
2122
+ </xsl:call-template>
2123
+ </xsl:for-each>
2124
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
2125
+ <xsl:call-template name="insertSVGMapLink">
2126
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
2127
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
2128
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
2129
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
2130
+ <xsl:with-param name="dest" select="$dest"/>
2131
+ </xsl:call-template>
2132
+ </xsl:for-each>
2133
+ </xsl:template>
2134
+
2135
+ <xsl:template name="insertSVGMapLink">
2136
+ <xsl:param name="left"/>
2137
+ <xsl:param name="top"/>
2138
+ <xsl:param name="width"/>
2139
+ <xsl:param name="height"/>
2140
+ <xsl:param name="dest"/>
2141
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
2142
+ <fo:block font-size="1pt">
2143
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
2144
+ <fo:inline-container inline-progression-dimension="100%">
2145
+ <fo:block-container height="{$height - 1}px" width="100%">
2146
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
2147
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
2148
+ </xsl:if> -->
2149
+ <fo:block> </fo:block></fo:block-container>
2150
+ </fo:inline-container>
2151
+ </fo:basic-link>
2152
+ </fo:block>
2153
+ </fo:block-container>
2154
+ </xsl:template>
2155
+
2156
+ <!-- =================== -->
2157
+ <!-- End SVG images processing -->
2158
+ <!-- =================== -->
2159
+
2160
+ <!-- For express listings PDF attachments -->
2161
+ <xsl:template match="*[local-name() = 'eref'][contains(., '.exp')]" priority="2">
2162
+ <fo:inline xsl:use-attribute-sets="eref-style">
2163
+ <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
2164
+ <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
2165
+ <xsl:if test="normalize-space(@citeas) = ''">
2166
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
2167
+ </xsl:if>
2168
+ <xsl:apply-templates/>
2169
+ </fo:basic-link>
2170
+ </fo:inline>
2171
+ </xsl:template>
2172
+
1894
2173
 
2174
+ <!-- =================== -->
2175
+ <!-- Index processing -->
2176
+ <!-- =================== -->
2177
+
2178
+ <xsl:template match="iso:indexsect"/>
2179
+ <xsl:template match="iso:indexsect" mode="index">
2180
+
2181
+ <fo:page-sequence master-reference="index" force-page-count="no-force">
2182
+ <xsl:variable name="header-title">
2183
+ <xsl:choose>
2184
+ <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2185
+ <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
2186
+ </xsl:when>
2187
+ <xsl:otherwise>
2188
+ <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2189
+ </xsl:otherwise>
2190
+ </xsl:choose>
2191
+ </xsl:variable>
2192
+ <xsl:call-template name="insertHeaderFooter">
2193
+ <xsl:with-param name="header-title" select="$header-title"/>
2194
+ </xsl:call-template>
2195
+
2196
+ <fo:flow flow-name="xsl-region-body">
2197
+ <fo:block id="{@id}" span="all">
2198
+ <xsl:apply-templates select="iso:title"/>
2199
+ </fo:block>
2200
+ <fo:block>
2201
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
2202
+ </fo:block>
2203
+ </fo:flow>
2204
+ </fo:page-sequence>
2205
+ </xsl:template>
2206
+
2207
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:title" priority="4"> -->
2208
+ <xsl:template match="iso:indexsect/iso:title" priority="4">
2209
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt">
2210
+ <!-- Index -->
2211
+ <xsl:apply-templates/>
2212
+ </fo:block>
2213
+ </xsl:template>
2214
+
2215
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:clause/iso:title" priority="4"> -->
2216
+ <xsl:template match="iso:indexsect/iso:clause/iso:title" priority="4">
2217
+ <!-- Letter A, B, C, ... -->
2218
+ <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
2219
+ <xsl:apply-templates/>
2220
+ </fo:block>
2221
+ </xsl:template>
2222
+
2223
+ <xsl:template match="iso:indexsect//iso:li/text()">
2224
+ <!-- to split by '_' and other chars -->
2225
+ <xsl:call-template name="add-zero-spaces-java"/>
2226
+ </xsl:template>
2227
+
2228
+ <xsl:template match="iso:xref" priority="2">
2229
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2230
+ <xsl:choose>
2231
+ <xsl:when test="@pagenumber='true'">
2232
+ <fo:inline>
2233
+ <xsl:if test="@id">
2234
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2235
+ </xsl:if>
2236
+ <fo:page-number-citation ref-id="{@target}"/>
2237
+ </fo:inline>
2238
+ </xsl:when>
2239
+ <xsl:otherwise>
2240
+ <xsl:apply-templates/>
2241
+ </xsl:otherwise>
2242
+ </xsl:choose>
2243
+ </fo:basic-link>
2244
+ </xsl:template>
2245
+
2246
+ <!-- =================== -->
2247
+ <!-- End of Index processing -->
2248
+ <!-- =================== -->
2249
+
1895
2250
 
1896
2251
  <xsl:template name="insertHeaderFooter">
1897
2252
  <xsl:param name="font-weight" select="'bold'"/>
@@ -2393,6 +2748,9 @@
2393
2748
 
2394
2749
 
2395
2750
 
2751
+ <xsl:attribute name="text-align">justify</xsl:attribute>
2752
+
2753
+
2396
2754
 
2397
2755
 
2398
2756
 
@@ -2534,6 +2892,7 @@
2534
2892
 
2535
2893
 
2536
2894
 
2895
+
2537
2896
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2538
2897
 
2539
2898
 
@@ -2670,201 +3029,240 @@
2670
3029
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2671
3030
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2672
3031
  <xsl:call-template name="add-zero-spaces-java"/>
2673
- </xsl:template><xsl:template match="*[local-name()='table']">
3032
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2674
3033
 
2675
- <xsl:variable name="simple-table">
2676
- <xsl:call-template name="getSimpleTable"/>
2677
- </xsl:variable>
3034
+ <xsl:variable name="table">
2678
3035
 
2679
-
2680
-
2681
-
2682
-
2683
- <!-- <xsl:if test="$namespace = 'bipm'">
2684
- <fo:block>&#xA0;</fo:block>
2685
- </xsl:if> -->
2686
-
2687
- <!-- $namespace = 'iso' or -->
2688
-
2689
-
3036
+ <xsl:variable name="simple-table">
3037
+ <xsl:call-template name="getSimpleTable"/>
3038
+ </xsl:variable>
2690
3039
 
2691
3040
 
2692
-
2693
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2694
-
2695
- <!-- <xsl:variable name="cols-count">
2696
- <xsl:choose>
2697
- <xsl:when test="*[local-name()='thead']">
2698
- <xsl:call-template name="calculate-columns-numbers">
2699
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2700
- </xsl:call-template>
2701
- </xsl:when>
2702
- <xsl:otherwise>
2703
- <xsl:call-template name="calculate-columns-numbers">
2704
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2705
- </xsl:call-template>
2706
- </xsl:otherwise>
2707
- </xsl:choose>
2708
- </xsl:variable> -->
2709
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2710
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2711
-
2712
-
2713
-
2714
- <xsl:variable name="colwidths">
2715
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2716
- <xsl:call-template name="calculate-column-widths">
2717
- <xsl:with-param name="cols-count" select="$cols-count"/>
2718
- <xsl:with-param name="table" select="$simple-table"/>
2719
- </xsl:call-template>
2720
- </xsl:if>
2721
- </xsl:variable>
2722
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2723
-
2724
- <!-- <xsl:variable name="colwidths2">
2725
- <xsl:call-template name="calculate-column-widths">
2726
- <xsl:with-param name="cols-count" select="$cols-count"/>
2727
- </xsl:call-template>
2728
- </xsl:variable> -->
2729
-
2730
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2731
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
2732
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2733
-
2734
- <xsl:variable name="margin-left">
2735
- <xsl:choose>
2736
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2737
- <xsl:otherwise>0</xsl:otherwise>
2738
- </xsl:choose>
2739
- </xsl:variable>
2740
-
2741
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2742
3041
 
2743
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2744
3042
 
2745
3043
 
2746
-
2747
-
2748
-
3044
+ <!-- <xsl:if test="$namespace = 'bipm'">
3045
+ <fo:block>&#xA0;</fo:block>
3046
+ </xsl:if> -->
2749
3047
 
3048
+ <!-- $namespace = 'iso' or -->
2750
3049
 
2751
-
3050
+
2752
3051
 
3052
+
3053
+
3054
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3055
+
3056
+ <!-- <xsl:variable name="cols-count">
3057
+ <xsl:choose>
3058
+ <xsl:when test="*[local-name()='thead']">
3059
+ <xsl:call-template name="calculate-columns-numbers">
3060
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
3061
+ </xsl:call-template>
3062
+ </xsl:when>
3063
+ <xsl:otherwise>
3064
+ <xsl:call-template name="calculate-columns-numbers">
3065
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
3066
+ </xsl:call-template>
3067
+ </xsl:otherwise>
3068
+ </xsl:choose>
3069
+ </xsl:variable> -->
3070
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3071
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2753
3072
 
2754
- <xsl:attribute name="margin-top">12pt</xsl:attribute>
2755
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2756
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2757
- <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2758
3073
 
2759
3074
 
3075
+ <xsl:variable name="colwidths">
3076
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3077
+ <xsl:call-template name="calculate-column-widths">
3078
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3079
+ <xsl:with-param name="table" select="$simple-table"/>
3080
+ </xsl:call-template>
3081
+ </xsl:if>
3082
+ </xsl:variable>
3083
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2760
3084
 
3085
+ <!-- <xsl:variable name="colwidths2">
3086
+ <xsl:call-template name="calculate-column-widths">
3087
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3088
+ </xsl:call-template>
3089
+ </xsl:variable> -->
2761
3090
 
3091
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
3092
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
3093
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2762
3094
 
3095
+ <xsl:variable name="margin-left">
3096
+ <xsl:choose>
3097
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
3098
+ <xsl:otherwise>0</xsl:otherwise>
3099
+ </xsl:choose>
3100
+ </xsl:variable>
2763
3101
 
2764
- <xsl:variable name="table_attributes">
2765
- <attribute name="table-layout">fixed</attribute>
2766
- <attribute name="width">100%</attribute>
2767
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2768
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3102
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3103
+
3104
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2769
3105
 
2770
- <attribute name="border">1.5pt solid black</attribute>
2771
- <xsl:if test="*[local-name()='thead']">
2772
- <attribute name="border-top">1pt solid black</attribute>
2773
- </xsl:if>
2774
3106
 
3107
+
3108
+
3109
+
2775
3110
 
2776
3111
 
3112
+
2777
3113
 
2778
- <attribute name="margin-left">0mm</attribute>
2779
- <attribute name="margin-right">0mm</attribute>
2780
3114
 
2781
-
2782
-
2783
-
3115
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
3116
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3117
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3118
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3119
+
3120
+
3121
+
3122
+
3123
+
3124
+ <xsl:variable name="table_width">
3125
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3126
+ 100%
3127
+
3128
+
3129
+ </xsl:variable>
3130
+
3131
+ <xsl:variable name="table_attributes">
3132
+ <attribute name="table-layout">fixed</attribute>
3133
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
3134
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
3135
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3136
+
3137
+ <attribute name="border">1.5pt solid black</attribute>
3138
+ <xsl:if test="*[local-name()='thead']">
3139
+ <attribute name="border-top">1pt solid black</attribute>
3140
+ </xsl:if>
3141
+
3142
+
3143
+
3144
+
3145
+ <attribute name="margin-left">0mm</attribute>
3146
+ <attribute name="margin-right">0mm</attribute>
3147
+
3148
+
3149
+
3150
+
3151
+
3152
+
3153
+
3154
+ </xsl:variable>
3155
+
3156
+
3157
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
3158
+
3159
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
3160
+ <xsl:attribute name="{@name}">
3161
+ <xsl:value-of select="."/>
3162
+ </xsl:attribute>
3163
+ </xsl:for-each>
3164
+
3165
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
3166
+ <xsl:if test="$isNoteOrFnExist = 'true'">
3167
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3168
+ </xsl:if>
3169
+
3170
+ <xsl:choose>
3171
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3172
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3173
+ <fo:table-column column-width="{@width}"/>
3174
+ </xsl:for-each>
3175
+ </xsl:when>
3176
+ <xsl:otherwise>
3177
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3178
+ <xsl:choose>
3179
+ <xsl:when test=". = 1 or . = 0">
3180
+ <fo:table-column column-width="proportional-column-width(2)"/>
3181
+ </xsl:when>
3182
+ <xsl:otherwise>
3183
+ <fo:table-column column-width="proportional-column-width({.})"/>
3184
+ </xsl:otherwise>
3185
+ </xsl:choose>
3186
+ </xsl:for-each>
3187
+ </xsl:otherwise>
3188
+ </xsl:choose>
3189
+
3190
+ <xsl:choose>
3191
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3192
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3193
+ </xsl:when>
3194
+ <xsl:otherwise>
3195
+ <xsl:apply-templates/>
3196
+ </xsl:otherwise>
3197
+ </xsl:choose>
3198
+
3199
+ </fo:table>
3200
+
3201
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3202
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3203
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3204
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3205
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3206
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3207
+ </xsl:call-template>
3208
+ </xsl:for-each>
3209
+
3210
+ <!-- insert footer as table -->
3211
+ <!-- <fo:table>
3212
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
3213
+ <xsl:attribute name="{@name}">
3214
+ <xsl:value-of select="."/>
3215
+ </xsl:attribute>
3216
+ </xsl:for-each>
3217
+
3218
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3219
+ <xsl:choose>
3220
+ <xsl:when test=". = 1 or . = 0">
3221
+ <fo:table-column column-width="proportional-column-width(2)"/>
3222
+ </xsl:when>
3223
+ <xsl:otherwise>
3224
+ <fo:table-column column-width="proportional-column-width({.})"/>
3225
+ </xsl:otherwise>
3226
+ </xsl:choose>
3227
+ </xsl:for-each>
3228
+ </fo:table>-->
2784
3229
 
2785
-
2786
3230
 
2787
- </xsl:variable>
2788
-
2789
-
2790
- <fo:table id="{@id}" table-omit-footer-at-break="true">
2791
3231
 
2792
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2793
- <xsl:attribute name="{@name}">
2794
- <xsl:value-of select="."/>
2795
- </xsl:attribute>
2796
- </xsl:for-each>
2797
3232
 
2798
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2799
- <xsl:if test="$isNoteOrFnExist = 'true'">
2800
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2801
- </xsl:if>
2802
3233
 
2803
- <xsl:choose>
2804
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2805
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2806
- <fo:table-column column-width="{@width}"/>
2807
- </xsl:for-each>
2808
- </xsl:when>
2809
- <xsl:otherwise>
2810
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2811
- <xsl:choose>
2812
- <xsl:when test=". = 1 or . = 0">
2813
- <fo:table-column column-width="proportional-column-width(2)"/>
2814
- </xsl:when>
2815
- <xsl:otherwise>
2816
- <fo:table-column column-width="proportional-column-width({.})"/>
2817
- </xsl:otherwise>
2818
- </xsl:choose>
2819
- </xsl:for-each>
2820
- </xsl:otherwise>
2821
- </xsl:choose>
3234
+ </fo:block-container>
3235
+ </xsl:variable>
3236
+
3237
+
3238
+
3239
+ <xsl:choose>
3240
+ <xsl:when test="@width">
3241
+
3242
+ <!-- centered table when table name is centered (see table-name-style) -->
2822
3243
 
2823
- <xsl:choose>
2824
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2825
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2826
- </xsl:when>
2827
- <xsl:otherwise>
2828
- <xsl:apply-templates/>
2829
- </xsl:otherwise>
2830
- </xsl:choose>
3244
+ <fo:table table-layout="fixed" width="100%">
3245
+ <fo:table-column column-width="proportional-column-width(1)"/>
3246
+ <fo:table-column column-width="{@width}"/>
3247
+ <fo:table-column column-width="proportional-column-width(1)"/>
3248
+ <fo:table-body>
3249
+ <fo:table-row>
3250
+ <fo:table-cell column-number="2">
3251
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
3252
+ </fo:table-cell>
3253
+ </fo:table-row>
3254
+ </fo:table-body>
3255
+ </fo:table>
2831
3256
 
2832
- </fo:table>
2833
-
2834
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2835
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2836
- <xsl:call-template name="insertTableFooterInSeparateTable">
2837
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
2838
- <xsl:with-param name="colwidths" select="$colwidths"/>
2839
- <xsl:with-param name="colgroup" select="$colgroup"/>
2840
- </xsl:call-template>
2841
- </xsl:for-each>
2842
-
2843
- <!-- insert footer as table -->
2844
- <!-- <fo:table>
2845
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2846
- <xsl:attribute name="{@name}">
2847
- <xsl:value-of select="."/>
2848
- </xsl:attribute>
2849
- </xsl:for-each>
2850
3257
 
2851
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2852
- <xsl:choose>
2853
- <xsl:when test=". = 1 or . = 0">
2854
- <fo:table-column column-width="proportional-column-width(2)"/>
2855
- </xsl:when>
2856
- <xsl:otherwise>
2857
- <fo:table-column column-width="proportional-column-width({.})"/>
2858
- </xsl:otherwise>
2859
- </xsl:choose>
2860
- </xsl:for-each>
2861
- </fo:table>-->
2862
-
2863
-
2864
-
2865
-
2866
-
2867
- </fo:block-container>
3258
+
3259
+
3260
+ </xsl:when>
3261
+ <xsl:otherwise>
3262
+ <xsl:copy-of select="$table"/>
3263
+ </xsl:otherwise>
3264
+ </xsl:choose>
3265
+
2868
3266
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2869
3267
  <xsl:if test="normalize-space() != ''">
2870
3268
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -2994,7 +3392,15 @@
2994
3392
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2995
3393
  <xsl:value-of select="@target"/>
2996
3394
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2997
- <xsl:variable name="math_text" select="normalize-space(.)"/>
3395
+ <xsl:variable name="mathml">
3396
+ <xsl:for-each select="*">
3397
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3398
+ <xsl:copy-of select="."/>
3399
+ </xsl:if>
3400
+ </xsl:for-each>
3401
+ </xsl:variable>
3402
+
3403
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2998
3404
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2999
3405
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3000
3406
  <xsl:param name="cols-count"/>
@@ -3771,7 +4177,7 @@
3771
4177
  <xsl:with-param name="table" select="$html-table"/>
3772
4178
  </xsl:call-template>
3773
4179
  </xsl:variable>
3774
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4180
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3775
4181
  <xsl:variable name="maxlength_dt">
3776
4182
  <xsl:call-template name="getMaxLength_dt"/>
3777
4183
  </xsl:variable>
@@ -3800,13 +4206,22 @@
3800
4206
  </xsl:when>
3801
4207
  <xsl:otherwise>
3802
4208
  <xsl:choose>
4209
+ <!-- to set width check most wide chars like `W` -->
3803
4210
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3804
- <fo:table-column column-width="5%"/>
3805
- <fo:table-column column-width="95%"/>
4211
+ <fo:table-column column-width="7%"/>
4212
+ <fo:table-column column-width="93%"/>
4213
+ </xsl:when>
4214
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
4215
+ <fo:table-column column-width="15%"/>
4216
+ <fo:table-column column-width="85%"/>
4217
+ </xsl:when>
4218
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
4219
+ <fo:table-column column-width="20%"/>
4220
+ <fo:table-column column-width="80%"/>
3806
4221
  </xsl:when>
3807
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3808
- <fo:table-column column-width="10%"/>
3809
- <fo:table-column column-width="90%"/>
4222
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
4223
+ <fo:table-column column-width="25%"/>
4224
+ <fo:table-column column-width="75%"/>
3810
4225
  </xsl:when>
3811
4226
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3812
4227
  <fo:table-column column-width="60%"/>
@@ -4004,6 +4419,7 @@
4004
4419
 
4005
4420
 
4006
4421
 
4422
+
4007
4423
 
4008
4424
  </xsl:variable>
4009
4425
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4017,10 +4433,18 @@
4017
4433
  </xsl:if>
4018
4434
  <xsl:apply-templates/>
4019
4435
  </fo:inline>
4436
+ </xsl:template><xsl:template match="*[local-name()='underline']">
4437
+ <fo:inline text-decoration="underline">
4438
+ <xsl:apply-templates/>
4439
+ </fo:inline>
4020
4440
  </xsl:template><xsl:template match="*[local-name()='del']">
4021
4441
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4022
4442
  <xsl:apply-templates/>
4023
4443
  </fo:inline>
4444
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4445
+ <fo:inline background-color="yellow">
4446
+ <xsl:apply-templates/>
4447
+ </fo:inline>
4024
4448
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
4025
4449
  <xsl:variable name="text" select="normalize-space(.)"/>
4026
4450
  <fo:inline font-size="75%">
@@ -4110,6 +4534,10 @@
4110
4534
  <xsl:param name="text" select="."/>
4111
4535
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4112
4536
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4537
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
4538
+ <xsl:param name="text" select="."/>
4539
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4540
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4113
4541
  </xsl:template><xsl:template name="add-zero-spaces">
4114
4542
  <xsl:param name="text" select="."/>
4115
4543
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -4357,6 +4785,7 @@
4357
4785
  <xsl:apply-templates select="." mode="mathml"/>
4358
4786
  </xsl:variable>
4359
4787
  <fo:instream-foreign-object fox:alt-text="Math">
4788
+
4360
4789
  <!-- <xsl:copy-of select="."/> -->
4361
4790
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4362
4791
  </fo:instream-foreign-object>
@@ -4370,7 +4799,12 @@
4370
4799
  <!-- replace start and end spaces to non-break space -->
4371
4800
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4372
4801
  </xsl:copy>
4373
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4802
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
4803
+ <xsl:copy>
4804
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
4805
+ </xsl:copy>
4806
+ <mathml:mspace width="0.5ex"/>
4807
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4374
4808
  <xsl:variable name="target">
4375
4809
  <xsl:choose>
4376
4810
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4391,7 +4825,10 @@
4391
4825
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4392
4826
  <xsl:choose>
4393
4827
  <xsl:when test="normalize-space(.) = ''">
4394
- <xsl:value-of select="$target"/>
4828
+ <!-- <xsl:value-of select="$target"/> -->
4829
+ <xsl:call-template name="add-zero-spaces-link-java">
4830
+ <xsl:with-param name="text" select="$target"/>
4831
+ </xsl:call-template>
4395
4832
  </xsl:when>
4396
4833
  <xsl:otherwise>
4397
4834
  <xsl:apply-templates/>
@@ -4401,8 +4838,6 @@
4401
4838
  </xsl:otherwise>
4402
4839
  </xsl:choose>
4403
4840
  </fo:inline>
4404
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4405
- <fo:inline id="{@id}"/>
4406
4841
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4407
4842
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4408
4843
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4595,7 +5030,7 @@
4595
5030
  </xsl:if> -->
4596
5031
  </fo:inline>
4597
5032
  </xsl:if>
4598
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
5033
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4599
5034
  <fo:block-container id="{@id}">
4600
5035
 
4601
5036
  <fo:block>
@@ -4611,6 +5046,7 @@
4611
5046
  <fo:block id="{@id}">
4612
5047
  <xsl:apply-templates/>
4613
5048
  </fo:block>
5049
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4614
5050
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4615
5051
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4616
5052
  <xsl:apply-templates/>
@@ -4802,6 +5238,12 @@
4802
5238
  <!-- <xsl:text> </xsl:text> -->
4803
5239
  </xsl:template><xsl:template name="getSection">
4804
5240
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5241
+ <!--
5242
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
5243
+ <xsl:value-of select="."/>
5244
+ </xsl:for-each>
5245
+ -->
5246
+
4805
5247
  </xsl:template><xsl:template name="getName">
4806
5248
  <xsl:choose>
4807
5249
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -4854,6 +5296,12 @@
4854
5296
  <xsl:copy>
4855
5297
  <xsl:apply-templates mode="contents_item"/>
4856
5298
  </xsl:copy>
5299
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
5300
+ <xsl:copy>
5301
+ <xsl:apply-templates mode="contents_item"/>
5302
+ </xsl:copy>
5303
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
5304
+ <xsl:copy-of select="."/>
4857
5305
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4858
5306
  <xsl:text> </xsl:text>
4859
5307
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4879,6 +5327,7 @@
4879
5327
 
4880
5328
  9
4881
5329
 
5330
+
4882
5331
 
4883
5332
 
4884
5333
 
@@ -5137,8 +5586,8 @@
5137
5586
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5138
5587
 
5139
5588
  <xsl:variable name="element">
5140
- block
5141
-
5589
+
5590
+ inline
5142
5591
  <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5143
5592
  </xsl:variable>
5144
5593
 
@@ -5181,9 +5630,15 @@
5181
5630
  </xsl:choose>
5182
5631
 
5183
5632
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5184
-
5633
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5185
5634
  <xsl:variable name="element">
5186
- block
5635
+
5636
+
5637
+ <xsl:choose>
5638
+ <xsl:when test="$num = 1">inline</xsl:when>
5639
+ <xsl:otherwise>block</xsl:otherwise>
5640
+ </xsl:choose>
5641
+
5187
5642
 
5188
5643
  </xsl:variable>
5189
5644
  <xsl:choose>
@@ -5259,11 +5714,13 @@
5259
5714
  </xsl:if>
5260
5715
  </xsl:if>
5261
5716
 
5717
+
5262
5718
  <fo:block-container margin-left="0mm">
5263
5719
 
5264
5720
  <fo:block xsl:use-attribute-sets="quote-style">
5265
5721
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
5266
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5722
+
5723
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5267
5724
  </fo:block>
5268
5725
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5269
5726
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -5286,29 +5743,47 @@
5286
5743
  <xsl:text>— </xsl:text>
5287
5744
  <xsl:apply-templates/>
5288
5745
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5289
- <fo:inline xsl:use-attribute-sets="eref-style">
5290
- <xsl:if test="@type = 'footnote'">
5291
-
5292
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5293
- <xsl:attribute name="font-size">80%</xsl:attribute>
5294
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5295
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5296
-
5297
-
5298
- </xsl:if>
5299
-
5300
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5301
-
5302
- <xsl:if test="@type = 'inline'">
5303
-
5304
-
5305
-
5306
- </xsl:if>
5307
-
5308
-
5309
- <xsl:apply-templates/>
5310
- </fo:basic-link>
5311
- </fo:inline>
5746
+
5747
+ <xsl:variable name="bibitemid">
5748
+ <xsl:choose>
5749
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5750
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5751
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5752
+ </xsl:choose>
5753
+ </xsl:variable>
5754
+
5755
+ <xsl:choose>
5756
+ <xsl:when test="normalize-space($bibitemid) != ''">
5757
+ <fo:inline xsl:use-attribute-sets="eref-style">
5758
+ <xsl:if test="@type = 'footnote'">
5759
+
5760
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5761
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5762
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5763
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5764
+
5765
+
5766
+ </xsl:if>
5767
+
5768
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5769
+ <xsl:if test="normalize-space(@citeas) = ''">
5770
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5771
+ </xsl:if>
5772
+ <xsl:if test="@type = 'inline'">
5773
+
5774
+
5775
+
5776
+ </xsl:if>
5777
+
5778
+ <xsl:apply-templates/>
5779
+ </fo:basic-link>
5780
+
5781
+ </fo:inline>
5782
+ </xsl:when>
5783
+ <xsl:otherwise>
5784
+ <fo:inline><xsl:apply-templates/></fo:inline>
5785
+ </xsl:otherwise>
5786
+ </xsl:choose>
5312
5787
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5313
5788
  <!-- zero-space char -->
5314
5789
  <xsl:variable name="depth">
@@ -5419,6 +5894,7 @@
5419
5894
  <xsl:attribute name="space-before">18pt</xsl:attribute>
5420
5895
  </xsl:if>
5421
5896
 
5897
+
5422
5898
 
5423
5899
 
5424
5900
 
@@ -5430,7 +5906,7 @@
5430
5906
 
5431
5907
 
5432
5908
 
5433
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
5909
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
5434
5910
  <fo:block break-after="page"/>
5435
5911
  <fo:block>
5436
5912
  <xsl:call-template name="setId"/>
@@ -5438,7 +5914,8 @@
5438
5914
  </fo:block>
5439
5915
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
5440
5916
  <fo:block>
5441
- <xsl:call-template name="setId"/>
5917
+ <xsl:call-template name="setId"/>
5918
+
5442
5919
 
5443
5920
  <xsl:apply-templates/>
5444
5921
  </fo:block>
@@ -5489,6 +5966,153 @@
5489
5966
  </fo:block>
5490
5967
  </xsl:otherwise>
5491
5968
  </xsl:choose>
5969
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5970
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5971
+ <bookmark><xsl:value-of select="@id"/></bookmark>
5972
+ </xsl:for-each>
5973
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
5974
+ <xsl:copy>
5975
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
5976
+ </xsl:copy>
5977
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
5978
+ <xsl:variable name="id">
5979
+ <xsl:call-template name="generateIndexXrefId"/>
5980
+ </xsl:variable>
5981
+ <xsl:copy> <!-- add id to xref -->
5982
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
5983
+ <xsl:attribute name="id">
5984
+ <xsl:value-of select="$id"/>
5985
+ </xsl:attribute>
5986
+ <xsl:apply-templates mode="index_add_id"/>
5987
+ </xsl:copy>
5988
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5989
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5990
+ <xsl:if test="@to">
5991
+ <xsl:value-of select="$dash"/>
5992
+ <xsl:copy>
5993
+ <xsl:copy-of select="@*"/>
5994
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
5995
+ <xsl:attribute name="id">
5996
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
5997
+ </xsl:attribute>
5998
+ <xsl:apply-templates mode="index_add_id"/>
5999
+ </xsl:copy>
6000
+ </xsl:if>
6001
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
6002
+ <xsl:copy>
6003
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
6004
+ </xsl:copy>
6005
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
6006
+ <xsl:copy>
6007
+ <xsl:apply-templates select="@*" mode="index_update"/>
6008
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
6009
+ </xsl:copy>
6010
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
6011
+ <xsl:param name="element"/>
6012
+ <xsl:param name="remove" select="'false'"/>
6013
+ <xsl:param name="target"/>
6014
+ <!-- <node></node> -->
6015
+ <xsl:choose>
6016
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6017
+ <!-- skip text (i.e. remove it) and process next element -->
6018
+ <!-- [removed_<xsl:value-of select="."/>] -->
6019
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6020
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
6021
+ </xsl:apply-templates>
6022
+ </xsl:when>
6023
+ <xsl:when test="self::text()">
6024
+ <xsl:value-of select="."/>
6025
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6026
+ </xsl:when>
6027
+ <xsl:when test="self::* and local-name(.) = 'xref'">
6028
+ <xsl:variable name="id" select="@id"/>
6029
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
6030
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
6031
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
6032
+
6033
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
6034
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
6035
+
6036
+ <xsl:choose>
6037
+ <!-- 2nd pass -->
6038
+ <!-- if page is equal to page for next and page is not the end of range -->
6039
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
6040
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
6041
+ <!-- [removed_xref] -->
6042
+
6043
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6044
+ <xsl:with-param name="remove">true</xsl:with-param>
6045
+ <xsl:with-param name="target">
6046
+ <xsl:choose>
6047
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
6048
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
6049
+ </xsl:choose>
6050
+ </xsl:with-param>
6051
+ </xsl:apply-templates>
6052
+ </xsl:when>
6053
+
6054
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
6055
+ <!-- remove xref -->
6056
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6057
+ <xsl:with-param name="remove">true</xsl:with-param>
6058
+ </xsl:apply-templates>
6059
+ </xsl:when>
6060
+
6061
+ <xsl:otherwise>
6062
+ <xsl:apply-templates select="." mode="xref_copy">
6063
+ <xsl:with-param name="target" select="$target"/>
6064
+ </xsl:apply-templates>
6065
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6066
+ </xsl:otherwise>
6067
+ </xsl:choose>
6068
+ </xsl:when>
6069
+ <xsl:when test="self::* and local-name(.) = 'ul'">
6070
+ <!-- ul -->
6071
+ <xsl:apply-templates select="." mode="index_update"/>
6072
+ </xsl:when>
6073
+ <xsl:otherwise>
6074
+ <xsl:apply-templates select="." mode="xref_copy">
6075
+ <xsl:with-param name="target" select="$target"/>
6076
+ </xsl:apply-templates>
6077
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6078
+ </xsl:otherwise>
6079
+ </xsl:choose>
6080
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
6081
+ <xsl:param name="target"/>
6082
+ <xsl:copy>
6083
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
6084
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
6085
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
6086
+ </xsl:if>
6087
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
6088
+ </xsl:copy>
6089
+ </xsl:template><xsl:template name="generateIndexXrefId">
6090
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6091
+
6092
+ <xsl:variable name="docid">
6093
+ <xsl:call-template name="getDocumentId"/>
6094
+ </xsl:variable>
6095
+ <xsl:variable name="item_number">
6096
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
6097
+ </xsl:variable>
6098
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6099
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6100
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6101
+ <xsl:apply-templates/>
6102
+ <fo:block>
6103
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6104
+ <fo:block> </fo:block>
6105
+ </xsl:if>
6106
+ </fo:block>
6107
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6108
+ <xsl:apply-templates/>
6109
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6110
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6111
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6112
+ <xsl:apply-templates/>
6113
+ </fo:block>
6114
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
6115
+ <fo:inline id="{@id}"/>
5492
6116
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5493
6117
  <!-- <row>
5494
6118
  <date>05-07-2013</date>
@@ -5584,6 +6208,8 @@
5584
6208
  <xsl:value-of select="translate(.,'. ','')"/>
5585
6209
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
5586
6210
  <xsl:value-of select="substring(.,1,1)"/>
6211
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
6212
+ <fo:inline><xsl:apply-templates/></fo:inline>
5587
6213
  </xsl:template><xsl:template name="convertDate">
5588
6214
  <xsl:param name="date"/>
5589
6215
  <xsl:param name="format" select="'short'"/>
@@ -5608,6 +6234,57 @@
5608
6234
  </xsl:variable>
5609
6235
  <xsl:variable name="result">
5610
6236
  <xsl:choose>
6237
+ <xsl:when test="$format = 'ddMMyyyy'">
6238
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
6239
+ <xsl:text> </xsl:text>
6240
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
6241
+ </xsl:when>
6242
+ <xsl:when test="$format = 'ddMM'">
6243
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
6244
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
6245
+ </xsl:when>
6246
+ <xsl:when test="$format = 'short' or $day = ''">
6247
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
6248
+ </xsl:when>
6249
+ <xsl:otherwise>
6250
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
6251
+ </xsl:otherwise>
6252
+ </xsl:choose>
6253
+ </xsl:variable>
6254
+ <xsl:value-of select="$result"/>
6255
+ </xsl:template><xsl:template name="convertDateLocalized">
6256
+ <xsl:param name="date"/>
6257
+ <xsl:param name="format" select="'short'"/>
6258
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
6259
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
6260
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
6261
+ <xsl:variable name="monthStr">
6262
+ <xsl:choose>
6263
+ <xsl:when test="$month = '01'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_january</xsl:with-param></xsl:call-template></xsl:when>
6264
+ <xsl:when test="$month = '02'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_february</xsl:with-param></xsl:call-template></xsl:when>
6265
+ <xsl:when test="$month = '03'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_march</xsl:with-param></xsl:call-template></xsl:when>
6266
+ <xsl:when test="$month = '04'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_april</xsl:with-param></xsl:call-template></xsl:when>
6267
+ <xsl:when test="$month = '05'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_may</xsl:with-param></xsl:call-template></xsl:when>
6268
+ <xsl:when test="$month = '06'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_june</xsl:with-param></xsl:call-template></xsl:when>
6269
+ <xsl:when test="$month = '07'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_july</xsl:with-param></xsl:call-template></xsl:when>
6270
+ <xsl:when test="$month = '08'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_august</xsl:with-param></xsl:call-template></xsl:when>
6271
+ <xsl:when test="$month = '09'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_september</xsl:with-param></xsl:call-template></xsl:when>
6272
+ <xsl:when test="$month = '10'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_october</xsl:with-param></xsl:call-template></xsl:when>
6273
+ <xsl:when test="$month = '11'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_november</xsl:with-param></xsl:call-template></xsl:when>
6274
+ <xsl:when test="$month = '12'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_december</xsl:with-param></xsl:call-template></xsl:when>
6275
+ </xsl:choose>
6276
+ </xsl:variable>
6277
+ <xsl:variable name="result">
6278
+ <xsl:choose>
6279
+ <xsl:when test="$format = 'ddMMyyyy'">
6280
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
6281
+ <xsl:text> </xsl:text>
6282
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
6283
+ </xsl:when>
6284
+ <xsl:when test="$format = 'ddMM'">
6285
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
6286
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
6287
+ </xsl:when>
5611
6288
  <xsl:when test="$format = 'short' or $day = ''">
5612
6289
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5613
6290
  </xsl:when>
@@ -5623,7 +6300,7 @@
5623
6300
  <xsl:param name="charDelim" select="', '"/>
5624
6301
  <xsl:choose>
5625
6302
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
5626
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
6303
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5627
6304
  <xsl:sort data-type="text" order="ascending"/>
5628
6305
  <xsl:call-template name="insertKeyword">
5629
6306
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -5632,7 +6309,7 @@
5632
6309
  </xsl:for-each>
5633
6310
  </xsl:when>
5634
6311
  <xsl:otherwise>
5635
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
6312
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5636
6313
  <xsl:call-template name="insertKeyword">
5637
6314
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
5638
6315
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -5649,65 +6326,71 @@
5649
6326
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5650
6327
  </xsl:choose>
5651
6328
  </xsl:template><xsl:template name="addPDFUAmeta">
5652
- <fo:declarations>
5653
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5654
- <pdf:dictionary type="normal" key="ViewerPreferences">
5655
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5656
- </pdf:dictionary>
5657
- </pdf:catalog>
5658
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5659
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5660
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5661
- <!-- Dublin Core properties go here -->
5662
- <dc:title>
5663
- <xsl:variable name="title">
6329
+ <xsl:variable name="lang">
6330
+ <xsl:call-template name="getLang"/>
6331
+ </xsl:variable>
6332
+ <pdf:catalog>
6333
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6334
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6335
+ </pdf:dictionary>
6336
+ </pdf:catalog>
6337
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6338
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6339
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6340
+ <!-- Dublin Core properties go here -->
6341
+ <dc:title>
6342
+ <xsl:variable name="title">
6343
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6344
+
6345
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5664
6346
 
5665
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
5666
6347
 
5667
6348
 
5668
6349
 
5669
6350
 
5670
6351
 
5671
- </xsl:variable>
5672
- <xsl:choose>
5673
- <xsl:when test="normalize-space($title) != ''">
5674
- <xsl:value-of select="$title"/>
5675
- </xsl:when>
5676
- <xsl:otherwise>
5677
- <xsl:text> </xsl:text>
5678
- </xsl:otherwise>
5679
- </xsl:choose>
5680
- </dc:title>
5681
- <dc:creator>
6352
+ </xsl:for-each>
6353
+ </xsl:variable>
6354
+ <xsl:choose>
6355
+ <xsl:when test="normalize-space($title) != ''">
6356
+ <xsl:value-of select="$title"/>
6357
+ </xsl:when>
6358
+ <xsl:otherwise>
6359
+ <xsl:text> </xsl:text>
6360
+ </xsl:otherwise>
6361
+ </xsl:choose>
6362
+ </dc:title>
6363
+ <dc:creator>
6364
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6365
+
6366
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6367
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6368
+ <xsl:if test="position() != last()">; </xsl:if>
6369
+ </xsl:for-each>
5682
6370
 
5683
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
5684
6371
 
5685
6372
 
6373
+ </xsl:for-each>
6374
+ </dc:creator>
6375
+ <dc:description>
6376
+ <xsl:variable name="abstract">
5686
6377
 
5687
- </dc:creator>
5688
- <dc:description>
5689
- <xsl:variable name="abstract">
5690
-
5691
- <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
5692
-
5693
-
5694
-
5695
-
5696
-
5697
- </xsl:variable>
5698
- <xsl:value-of select="normalize-space($abstract)"/>
5699
- </dc:description>
5700
- <pdf:Keywords>
5701
- <xsl:call-template name="insertKeywords"/>
5702
- </pdf:Keywords>
5703
- </rdf:Description>
5704
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5705
- <!-- XMP properties go here -->
5706
- <xmp:CreatorTool/>
5707
- </rdf:Description>
5708
- </rdf:RDF>
5709
- </x:xmpmeta>
5710
- </fo:declarations>
6378
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6379
+
6380
+
6381
+ </xsl:variable>
6382
+ <xsl:value-of select="normalize-space($abstract)"/>
6383
+ </dc:description>
6384
+ <pdf:Keywords>
6385
+ <xsl:call-template name="insertKeywords"/>
6386
+ </pdf:Keywords>
6387
+ </rdf:Description>
6388
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6389
+ <!-- XMP properties go here -->
6390
+ <xmp:CreatorTool/>
6391
+ </rdf:Description>
6392
+ </rdf:RDF>
6393
+ </x:xmpmeta>
5711
6394
  </xsl:template><xsl:template name="getId">
5712
6395
  <xsl:choose>
5713
6396
  <xsl:when test="../@id">
@@ -5804,6 +6487,7 @@
5804
6487
 
5805
6488
 
5806
6489
 
6490
+
5807
6491
  </xsl:variable>
5808
6492
  <xsl:if test="$documentNS != $XSLNS">
5809
6493
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -5863,6 +6547,11 @@
5863
6547
  <xsl:call-template name="getLang"/>
5864
6548
  </xsl:variable>
5865
6549
 
5866
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6550
+ <xsl:choose>
6551
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6552
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6553
+ </xsl:when>
6554
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6555
+ </xsl:choose>
5867
6556
 
5868
6557
  </xsl:template></xsl:stylesheet>