metanorma-iso 1.6.1 → 1.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +11 -41
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +6 -2
  5. data/lib/asciidoctor/iso/base.rb +13 -13
  6. data/lib/asciidoctor/iso/basicdoc.rng +5 -3
  7. data/lib/asciidoctor/iso/biblio.rng +4 -6
  8. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  9. data/lib/asciidoctor/iso/front.rb +6 -6
  10. data/lib/asciidoctor/iso/front_id.rb +30 -25
  11. data/lib/asciidoctor/iso/isodoc.rng +108 -2
  12. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  13. data/lib/asciidoctor/iso/isostandard.rng +17 -97
  14. data/lib/asciidoctor/iso/validate.rb +68 -1
  15. data/lib/asciidoctor/iso/validate_title.rb +21 -13
  16. data/lib/isodoc/iso/base_convert.rb +11 -0
  17. data/lib/isodoc/iso/html/header.html +12 -12
  18. data/lib/isodoc/iso/html/html_iso_intro.html +1 -1
  19. data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
  20. data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
  21. data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
  22. data/lib/isodoc/iso/html_convert.rb +2 -2
  23. data/lib/isodoc/iso/i18n-en.yaml +6 -0
  24. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  25. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  26. data/lib/isodoc/iso/index.rb +140 -0
  27. data/lib/isodoc/iso/iso.amendment.xsl +1009 -321
  28. data/lib/isodoc/iso/iso.international-standard.xsl +1009 -321
  29. data/lib/isodoc/iso/presentation_xml_convert.rb +1 -4
  30. data/lib/isodoc/iso/word_convert.rb +2 -2
  31. data/lib/isodoc/iso/xref.rb +5 -0
  32. data/lib/metanorma/iso/version.rb +1 -1
  33. data/metanorma-iso.gemspec +4 -4
  34. data/spec/asciidoctor/amd_spec.rb +696 -0
  35. data/spec/asciidoctor/base_spec.rb +704 -0
  36. data/spec/asciidoctor/blocks_spec.rb +527 -0
  37. data/spec/asciidoctor/cleanup_spec.rb +1134 -0
  38. data/spec/asciidoctor/inline_spec.rb +195 -0
  39. data/spec/asciidoctor/lists_spec.rb +197 -0
  40. data/spec/asciidoctor/refs_spec.rb +375 -0
  41. data/spec/asciidoctor/section_spec.rb +393 -0
  42. data/spec/asciidoctor/table_spec.rb +329 -0
  43. data/spec/asciidoctor/validate_spec.rb +1572 -0
  44. data/spec/isodoc/amd_spec.rb +967 -946
  45. data/spec/isodoc/blocks_spec.rb +530 -507
  46. data/spec/isodoc/i18n_spec.rb +953 -911
  47. data/spec/isodoc/inline_spec.rb +355 -293
  48. data/spec/isodoc/iso_spec.rb +340 -316
  49. data/spec/isodoc/metadata_spec.rb +392 -382
  50. data/spec/isodoc/postproc_spec.rb +834 -656
  51. data/spec/isodoc/ref_spec.rb +374 -331
  52. data/spec/isodoc/section_spec.rb +821 -519
  53. data/spec/isodoc/table_spec.rb +472 -411
  54. data/spec/isodoc/terms_spec.rb +209 -185
  55. data/spec/isodoc/xref_spec.rb +1370 -1236
  56. data/spec/metanorma/processor_spec.rb +28 -26
  57. data/spec/spec_helper.rb +186 -189
  58. metadata +26 -27
  59. data/.rubocop.ribose.yml +0 -66
  60. data/spec/asciidoctor-iso/amd_spec.rb +0 -694
  61. data/spec/asciidoctor-iso/base_spec.rb +0 -713
  62. data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
  63. data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
  64. data/spec/asciidoctor-iso/inline_spec.rb +0 -170
  65. data/spec/asciidoctor-iso/lists_spec.rb +0 -190
  66. data/spec/asciidoctor-iso/refs_spec.rb +0 -317
  67. data/spec/asciidoctor-iso/section_spec.rb +0 -362
  68. data/spec/asciidoctor-iso/table_spec.rb +0 -313
  69. data/spec/asciidoctor-iso/validate_spec.rb +0 -1550
  70. data/spec/assets/xref_error.adoc +0 -7
@@ -1,19 +1,34 @@
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)"/>
8
+ <xsl:param name="basepath"/>
7
9
 
8
10
 
9
11
 
10
12
  <xsl:key name="kfn" match="iso:p/iso:fn" use="@reference"/>
11
13
 
14
+ <xsl:key name="attachments" match="iso:eref[contains(@bibitemid, '.exp')]" use="@bibitemid"/>
15
+
12
16
 
13
17
 
14
18
  <xsl:variable name="debug">false</xsl:variable>
15
- <xsl:variable name="pageWidth" select="'210mm'"/>
16
- <xsl:variable name="pageHeight" select="'297mm'"/>
19
+ <xsl:variable name="pageWidth" select="210"/>
20
+ <xsl:variable name="pageHeight" select="297"/>
21
+ <xsl:variable name="marginLeftRight1" select="25"/>
22
+ <xsl:variable name="marginLeftRight2" select="12.5"/>
23
+ <xsl:variable name="marginTop" select="27.4"/>
24
+ <xsl:variable name="marginBottom" select="13"/>
25
+
26
+ <xsl:variable name="figure_name_height">14</xsl:variable>
27
+ <xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><!-- paper width minus margins -->
28
+ <xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><!-- paper height minus margins and title height -->
29
+ <xsl:variable name="image_dpi" select="96"/>
30
+ <xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/>
31
+ <xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/>
17
32
 
18
33
  <xsl:variable name="docidentifierISO" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso'] | /iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'ISO']"/>
19
34
 
@@ -157,6 +172,7 @@
157
172
  <contents>
158
173
  <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
159
174
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
175
+ <xsl:apply-templates select="//iso:indexsect" mode="contents"/>
160
176
  </contents>
161
177
  </xsl:variable>
162
178
 
@@ -170,10 +186,11 @@
170
186
  <xsl:if test="$lang = 'zh'">
171
187
  <xsl:attribute name="font-family">Source Han Sans, Times New Roman, Cambria Math</xsl:attribute>
172
188
  </xsl:if>
189
+
173
190
  <fo:layout-master-set>
174
191
 
175
192
  <!-- cover page -->
176
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
193
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
177
194
  <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="31.7mm" margin-right="31.7mm"/>
178
195
  <fo:region-before region-name="cover-page-header" extent="25.4mm"/>
179
196
  <fo:region-after/>
@@ -181,7 +198,7 @@
181
198
  <fo:region-end region-name="cover-right-region" extent="31.7mm"/>
182
199
  </fo:simple-page-master>
183
200
 
184
- <fo:simple-page-master master-name="cover-page-published" page-width="{$pageWidth}" page-height="{$pageHeight}">
201
+ <fo:simple-page-master master-name="cover-page-published" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
185
202
  <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="78mm" margin-right="18.5mm"/>
186
203
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
187
204
  <fo:region-after region-name="cover-page-footer" extent="40mm" display-align="after"/>
@@ -190,19 +207,19 @@
190
207
  </fo:simple-page-master>
191
208
 
192
209
 
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"/>
210
+ <fo:simple-page-master master-name="cover-page-publishedISO-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
211
+ <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
195
212
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
196
213
  <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"/>
214
+ <fo:region-start region-name="cover-left-region" extent="{$marginLeftRight1}mm"/>
215
+ <fo:region-end region-name="cover-right-region" extent="{$marginLeftRight2}mm"/>
199
216
  </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"/>
217
+ <fo:simple-page-master master-name="cover-page-publishedISO-even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
218
+ <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
202
219
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
203
220
  <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"/>
221
+ <fo:region-start region-name="cover-left-region" extent="{$marginLeftRight2}mm"/>
222
+ <fo:region-end region-name="cover-right-region" extent="{$marginLeftRight1}mm"/>
206
223
  </fo:simple-page-master>
207
224
  <fo:page-sequence-master master-name="cover-page-publishedISO">
208
225
  <fo:repeatable-page-master-alternatives>
@@ -214,7 +231,7 @@
214
231
 
215
232
  <!-- contents pages -->
216
233
  <!-- odd pages -->
217
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
234
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
218
235
  <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="19mm" margin-right="19mm"/>
219
236
  <fo:region-before region-name="header-odd" extent="27.4mm"/> <!-- display-align="center" -->
220
237
  <fo:region-after region-name="footer-odd" extent="13mm"/>
@@ -222,7 +239,7 @@
222
239
  <fo:region-end region-name="right-region" extent="19mm"/>
223
240
  </fo:simple-page-master>
224
241
  <!-- even pages -->
225
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
242
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
226
243
  <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="19mm" margin-right="19mm"/>
227
244
  <fo:region-before region-name="header-even" extent="27.4mm"/> <!-- display-align="center" -->
228
245
  <fo:region-after region-name="footer-even" extent="13mm"/>
@@ -244,35 +261,35 @@
244
261
 
245
262
 
246
263
  <!-- 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"/>
264
+ <fo:simple-page-master master-name="first-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
265
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
266
+ <fo:region-before region-name="header-first" extent="{$marginTop}mm"/> <!-- display-align="center" -->
267
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
268
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
269
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
253
270
  </fo:simple-page-master>
254
271
  <!-- 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"/>
272
+ <fo:simple-page-master master-name="odd-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
273
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
274
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/> <!-- display-align="center" -->
275
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
276
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
277
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
261
278
  </fo:simple-page-master>
262
279
  <!-- 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"/>
280
+ <fo:simple-page-master master-name="even-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
281
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
282
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
283
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
284
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
285
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
269
286
  </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"/>
287
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
288
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
289
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
290
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
291
+ <fo:region-start region-name="left" extent="{$marginLeftRight2}mm"/>
292
+ <fo:region-end region-name="right" extent="{$marginLeftRight1}mm"/>
276
293
  </fo:simple-page-master>
277
294
  <fo:page-sequence-master master-name="preface-publishedISO">
278
295
  <fo:repeatable-page-master-alternatives>
@@ -291,17 +308,48 @@
291
308
  </fo:repeatable-page-master-alternatives>
292
309
  </fo:page-sequence-master>
293
310
 
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"/>
311
+ <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
312
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
313
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
314
+ <fo:region-after region-name="last-page-footer" extent="{$marginBottom}mm"/>
315
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
316
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
300
317
  </fo:simple-page-master>
301
318
 
319
+ <!-- Index pages -->
320
+ <fo:simple-page-master master-name="index-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
321
+ <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"/>
322
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
323
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
324
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
325
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
326
+ </fo:simple-page-master>
327
+ <fo:simple-page-master master-name="index-even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
328
+ <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"/>
329
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
330
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
331
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
332
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
333
+ </fo:simple-page-master>
334
+ <fo:page-sequence-master master-name="index">
335
+ <fo:repeatable-page-master-alternatives>
336
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="index-even"/>
337
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="index-odd"/>
338
+ </fo:repeatable-page-master-alternatives>
339
+ </fo:page-sequence-master>
340
+
341
+
302
342
  </fo:layout-master-set>
343
+
344
+ <fo:declarations>
345
+ <xsl:call-template name="addPDFUAmeta"/>
346
+ <xsl:for-each select="//*[local-name() = 'eref'][generate-id(.)=generate-id(key('attachments',@bibitemid)[1])]">
347
+ <xsl:variable name="url" select="concat('url(file:',$basepath, @bibitemid, ')')"/>
348
+ <pdf:embedded-file src="{$url}" filename="{@bibitemid}"/>
349
+ </xsl:for-each>
350
+ </fo:declarations>
303
351
 
304
- <xsl:call-template name="addPDFUAmeta"/>
352
+
305
353
 
306
354
  <xsl:call-template name="addBookmarks">
307
355
  <xsl:with-param name="contents" select="$contents"/>
@@ -1024,20 +1072,20 @@
1024
1072
  <fo:block-container font-weight="bold">
1025
1073
 
1026
1074
  <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'"/>
1075
+ <fo:inline font-size="16pt" font-weight="bold">
1076
+ <!-- Contents -->
1077
+ <xsl:call-template name="getLocalizedString">
1078
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1030
1079
  </xsl:call-template>
1031
- </xsl:variable>
1032
- <fo:inline font-size="16pt" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:inline>
1080
+ </fo:inline>
1033
1081
  <fo:inline keep-together.within-line="always">
1034
1082
  <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>
1083
+ <fo:inline font-weight="normal" font-size="10pt">
1084
+ <!-- Page -->
1085
+ <xsl:call-template name="getLocalizedString">
1086
+ <xsl:with-param name="key">locality.page</xsl:with-param>
1087
+ </xsl:call-template>
1088
+ </fo:inline>
1041
1089
  </fo:inline>
1042
1090
  </fo:block>
1043
1091
 
@@ -1182,6 +1230,10 @@
1182
1230
  </fo:flow>
1183
1231
  </fo:page-sequence>
1184
1232
 
1233
+
1234
+ <!-- Index -->
1235
+ <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1236
+
1185
1237
  <xsl:if test="$isPublished = 'true'">
1186
1238
  <fo:page-sequence master-reference="last-page" force-page-count="no-force">
1187
1239
  <xsl:call-template name="insertHeaderEven"/>
@@ -1314,7 +1366,10 @@
1314
1366
  </xsl:variable>
1315
1367
 
1316
1368
  <xsl:variable name="type">
1317
- <xsl:value-of select="local-name()"/>
1369
+ <xsl:choose>
1370
+ <xsl:when test="local-name() = 'indexsect'">index</xsl:when>
1371
+ <xsl:otherwise><xsl:value-of select="local-name()"/></xsl:otherwise>
1372
+ </xsl:choose>
1318
1373
  </xsl:variable>
1319
1374
 
1320
1375
  <xsl:variable name="display">
@@ -1347,10 +1402,15 @@
1347
1402
  </xsl:variable>
1348
1403
 
1349
1404
  <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
1405
+ <xsl:if test="$type = 'index'">
1406
+ <xsl:attribute name="level">1</xsl:attribute>
1407
+ </xsl:if>
1350
1408
  <title>
1351
1409
  <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
1352
1410
  </title>
1353
- <xsl:apply-templates mode="contents"/>
1411
+ <xsl:if test="$type != 'index'">
1412
+ <xsl:apply-templates mode="contents"/>
1413
+ </xsl:if>
1354
1414
  </item>
1355
1415
  </xsl:if>
1356
1416
  </xsl:template>
@@ -1588,6 +1648,15 @@
1588
1648
  </xsl:choose>
1589
1649
  </xsl:attribute>
1590
1650
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1651
+ <xsl:if test="@id">
1652
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1653
+ </xsl:if>
1654
+ <!-- bookmarks only in paragraph -->
1655
+ <xsl:if test="count(iso:bookmark) != 0 and count(*) = count(iso:bookmark) and normalize-space() = ''">
1656
+ <xsl:attribute name="font-size">0</xsl:attribute>
1657
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1658
+ <xsl:attribute name="line-height">0</xsl:attribute>
1659
+ </xsl:if>
1591
1660
  <xsl:apply-templates/>
1592
1661
  </xsl:element>
1593
1662
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
@@ -1891,7 +1960,308 @@
1891
1960
  </fo:block>
1892
1961
  </xsl:template>
1893
1962
 
1963
+ <!-- =================== -->
1964
+ <!-- SVG images processing -->
1965
+ <!-- =================== -->
1966
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/>
1967
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2">
1968
+
1969
+ <xsl:choose>
1970
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
1971
+ <fo:block>
1972
+ <xsl:variable name="width" select="@width"/>
1973
+ <xsl:variable name="height" select="@height"/>
1974
+
1975
+ <xsl:variable name="scale_x">
1976
+ <xsl:choose>
1977
+ <xsl:when test="$width &gt; $width_effective_px">
1978
+ <xsl:value-of select="$width_effective_px div $width"/>
1979
+ </xsl:when>
1980
+ <xsl:otherwise>1</xsl:otherwise>
1981
+ </xsl:choose>
1982
+ </xsl:variable>
1983
+
1984
+ <xsl:variable name="scale_y">
1985
+ <xsl:choose>
1986
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
1987
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
1988
+ </xsl:when>
1989
+ <xsl:otherwise>1</xsl:otherwise>
1990
+ </xsl:choose>
1991
+ </xsl:variable>
1992
+
1993
+ <xsl:variable name="scale">
1994
+ <xsl:choose>
1995
+ <xsl:when test="$scale_y != 1">
1996
+ <xsl:value-of select="$scale_x * $scale_y"/>
1997
+ </xsl:when>
1998
+ <xsl:otherwise>
1999
+ <xsl:value-of select="$scale_x"/>
2000
+ </xsl:otherwise>
2001
+ </xsl:choose>
2002
+ </xsl:variable>
2003
+
2004
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
2005
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
2006
+
2007
+ <fo:table table-layout="fixed" width="100%">
2008
+ <fo:table-column column-width="proportional-column-width(1)"/>
2009
+ <fo:table-column column-width="{$width_scale}px"/>
2010
+ <fo:table-column column-width="proportional-column-width(1)"/>
2011
+ <fo:table-body>
2012
+ <fo:table-row>
2013
+ <fo:table-cell column-number="2">
2014
+ <fo:block>
2015
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
2016
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
2017
+ <fo:block line-height="0" font-size="0">
2018
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
2019
+ <xsl:call-template name="bookmark"/>
2020
+ </xsl:for-each>
2021
+ </fo:block>
2022
+ </xsl:if>
2023
+ <fo:block text-depth="0" line-height="0" font-size="0">
2024
+ <fo:instream-foreign-object fox:alt-text="{../*[local-name() = 'name']}">
2025
+ <xsl:attribute name="width">100%</xsl:attribute>
2026
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2027
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2028
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
1894
2029
 
2030
+ <xsl:apply-templates select="." mode="svg_remove_a"/>
2031
+ </fo:instream-foreign-object>
2032
+ </fo:block>
2033
+
2034
+ <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">
2035
+ <xsl:with-param name="scale" select="$scale"/>
2036
+ </xsl:apply-templates>
2037
+ </fo:block-container>
2038
+ </fo:block>
2039
+ </fo:table-cell>
2040
+ </fo:table-row>
2041
+ </fo:table-body>
2042
+ </fo:table>
2043
+ </fo:block>
2044
+
2045
+ </xsl:when>
2046
+ <xsl:otherwise>
2047
+ <fo:block xsl:use-attribute-sets="image-style">
2048
+ <fo:instream-foreign-object fox:alt-text="{../*[local-name() = 'name']}">
2049
+ <xsl:attribute name="width">100%</xsl:attribute>
2050
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2051
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2052
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
2053
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
2054
+ <!-- effective height / width = 1.48, 1.4 - with title -->
2055
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
2056
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
2057
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
2058
+ </xsl:if>
2059
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2060
+ <xsl:copy-of select="."/>
2061
+ </fo:instream-foreign-object>
2062
+ </fo:block>
2063
+ </xsl:otherwise>
2064
+ </xsl:choose>
2065
+ </xsl:template>
2066
+
2067
+ <xsl:template match="@*|node()" mode="svg_remove_a">
2068
+ <xsl:copy>
2069
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
2070
+ </xsl:copy>
2071
+ </xsl:template>
2072
+
2073
+ <xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
2074
+ <xsl:apply-templates mode="svg_remove_a"/>
2075
+ </xsl:template>
2076
+
2077
+ <xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
2078
+ <xsl:param name="scale"/>
2079
+ <xsl:variable name="dest">
2080
+ <xsl:choose>
2081
+ <xsl:when test="starts-with(@href, '#')">
2082
+ <xsl:value-of select="substring-after(@href, '#')"/>
2083
+ </xsl:when>
2084
+ <xsl:otherwise>
2085
+ <xsl:value-of select="@href"/>
2086
+ </xsl:otherwise>
2087
+ </xsl:choose>
2088
+ </xsl:variable>
2089
+ <xsl:for-each select="./*[local-name() = 'rect']">
2090
+ <xsl:call-template name="insertSVGMapLink">
2091
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
2092
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
2093
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
2094
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
2095
+ <xsl:with-param name="dest" select="$dest"/>
2096
+ </xsl:call-template>
2097
+ </xsl:for-each>
2098
+
2099
+ <xsl:for-each select="./*[local-name() = 'polygon']">
2100
+ <xsl:variable name="points">
2101
+ <xsl:call-template name="split">
2102
+ <xsl:with-param name="pText" select="@points"/>
2103
+ </xsl:call-template>
2104
+ </xsl:variable>
2105
+ <xsl:variable name="x_coords">
2106
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
2107
+ <xsl:sort select="." data-type="number"/>
2108
+ <x><xsl:value-of select="."/></x>
2109
+ </xsl:for-each>
2110
+ </xsl:variable>
2111
+ <xsl:variable name="y_coords">
2112
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
2113
+ <xsl:sort select="." data-type="number"/>
2114
+ <y><xsl:value-of select="."/></y>
2115
+ </xsl:for-each>
2116
+ </xsl:variable>
2117
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
2118
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
2119
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
2120
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
2121
+ <xsl:call-template name="insertSVGMapLink">
2122
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
2123
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
2124
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
2125
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
2126
+ <xsl:with-param name="dest" select="$dest"/>
2127
+ </xsl:call-template>
2128
+ </xsl:for-each>
2129
+
2130
+ <xsl:for-each select="./*[local-name() = 'circle']">
2131
+ <xsl:call-template name="insertSVGMapLink">
2132
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
2133
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
2134
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
2135
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
2136
+ <xsl:with-param name="dest" select="$dest"/>
2137
+ </xsl:call-template>
2138
+ </xsl:for-each>
2139
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
2140
+ <xsl:call-template name="insertSVGMapLink">
2141
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
2142
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
2143
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
2144
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
2145
+ <xsl:with-param name="dest" select="$dest"/>
2146
+ </xsl:call-template>
2147
+ </xsl:for-each>
2148
+ </xsl:template>
2149
+
2150
+ <xsl:template name="insertSVGMapLink">
2151
+ <xsl:param name="left"/>
2152
+ <xsl:param name="top"/>
2153
+ <xsl:param name="width"/>
2154
+ <xsl:param name="height"/>
2155
+ <xsl:param name="dest"/>
2156
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
2157
+ <fo:block font-size="1pt">
2158
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
2159
+ <fo:inline-container inline-progression-dimension="100%">
2160
+ <fo:block-container height="{$height - 1}px" width="100%">
2161
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
2162
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
2163
+ </xsl:if> -->
2164
+ <fo:block> </fo:block></fo:block-container>
2165
+ </fo:inline-container>
2166
+ </fo:basic-link>
2167
+ </fo:block>
2168
+ </fo:block-container>
2169
+ </xsl:template>
2170
+
2171
+ <!-- =================== -->
2172
+ <!-- End SVG images processing -->
2173
+ <!-- =================== -->
2174
+
2175
+ <!-- For express listings PDF attachments -->
2176
+ <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid, '.exp')]" priority="2">
2177
+ <fo:inline xsl:use-attribute-sets="eref-style">
2178
+ <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
2179
+ <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
2180
+ <xsl:if test="normalize-space(@citeas) = ''">
2181
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
2182
+ </xsl:if>
2183
+ <xsl:apply-templates/>
2184
+ </fo:basic-link>
2185
+ </fo:inline>
2186
+ </xsl:template>
2187
+
2188
+
2189
+ <!-- =================== -->
2190
+ <!-- Index processing -->
2191
+ <!-- =================== -->
2192
+
2193
+ <xsl:template match="iso:indexsect"/>
2194
+ <xsl:template match="iso:indexsect" mode="index">
2195
+
2196
+ <fo:page-sequence master-reference="index" force-page-count="no-force">
2197
+ <xsl:variable name="header-title">
2198
+ <xsl:choose>
2199
+ <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2200
+ <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
2201
+ </xsl:when>
2202
+ <xsl:otherwise>
2203
+ <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2204
+ </xsl:otherwise>
2205
+ </xsl:choose>
2206
+ </xsl:variable>
2207
+ <xsl:call-template name="insertHeaderFooter">
2208
+ <xsl:with-param name="header-title" select="$header-title"/>
2209
+ </xsl:call-template>
2210
+
2211
+ <fo:flow flow-name="xsl-region-body">
2212
+ <fo:block id="{@id}" span="all">
2213
+ <xsl:apply-templates select="iso:title"/>
2214
+ </fo:block>
2215
+ <fo:block>
2216
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
2217
+ </fo:block>
2218
+ </fo:flow>
2219
+ </fo:page-sequence>
2220
+ </xsl:template>
2221
+
2222
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:title" priority="4"> -->
2223
+ <xsl:template match="iso:indexsect/iso:title" priority="4">
2224
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt">
2225
+ <!-- Index -->
2226
+ <xsl:apply-templates/>
2227
+ </fo:block>
2228
+ </xsl:template>
2229
+
2230
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:clause/iso:title" priority="4"> -->
2231
+ <xsl:template match="iso:indexsect/iso:clause/iso:title" priority="4">
2232
+ <!-- Letter A, B, C, ... -->
2233
+ <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
2234
+ <xsl:apply-templates/>
2235
+ </fo:block>
2236
+ </xsl:template>
2237
+
2238
+ <xsl:template match="iso:indexsect//iso:li/text()">
2239
+ <!-- to split by '_' and other chars -->
2240
+ <xsl:call-template name="add-zero-spaces-java"/>
2241
+ </xsl:template>
2242
+
2243
+ <xsl:template match="iso:xref" priority="2">
2244
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2245
+ <xsl:choose>
2246
+ <xsl:when test="@pagenumber='true'">
2247
+ <fo:inline>
2248
+ <xsl:if test="@id">
2249
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2250
+ </xsl:if>
2251
+ <fo:page-number-citation ref-id="{@target}"/>
2252
+ </fo:inline>
2253
+ </xsl:when>
2254
+ <xsl:otherwise>
2255
+ <xsl:apply-templates/>
2256
+ </xsl:otherwise>
2257
+ </xsl:choose>
2258
+ </fo:basic-link>
2259
+ </xsl:template>
2260
+
2261
+ <!-- =================== -->
2262
+ <!-- End of Index processing -->
2263
+ <!-- =================== -->
2264
+
1895
2265
 
1896
2266
  <xsl:template name="insertHeaderFooter">
1897
2267
  <xsl:param name="font-weight" select="'bold'"/>
@@ -2393,6 +2763,9 @@
2393
2763
 
2394
2764
 
2395
2765
 
2766
+ <xsl:attribute name="text-align">justify</xsl:attribute>
2767
+
2768
+
2396
2769
 
2397
2770
 
2398
2771
 
@@ -2534,6 +2907,7 @@
2534
2907
 
2535
2908
 
2536
2909
 
2910
+
2537
2911
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2538
2912
 
2539
2913
 
@@ -2670,206 +3044,240 @@
2670
3044
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2671
3045
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2672
3046
  <xsl:call-template name="add-zero-spaces-java"/>
2673
- </xsl:template><xsl:template match="*[local-name()='table']">
3047
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2674
3048
 
2675
- <xsl:variable name="simple-table">
2676
- <xsl:call-template name="getSimpleTable"/>
2677
- </xsl:variable>
3049
+ <xsl:variable name="table">
2678
3050
 
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
-
3051
+ <xsl:variable name="simple-table">
3052
+ <xsl:call-template name="getSimpleTable"/>
3053
+ </xsl:variable>
2690
3054
 
2691
3055
 
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
3056
 
2743
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2744
3057
 
2745
3058
 
2746
-
2747
-
2748
-
3059
+ <!-- <xsl:if test="$namespace = 'bipm'">
3060
+ <fo:block>&#xA0;</fo:block>
3061
+ </xsl:if> -->
2749
3062
 
3063
+ <!-- $namespace = 'iso' or -->
2750
3064
 
2751
-
3065
+
2752
3066
 
3067
+
2753
3068
 
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>
3069
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2758
3070
 
3071
+ <!-- <xsl:variable name="cols-count">
3072
+ <xsl:choose>
3073
+ <xsl:when test="*[local-name()='thead']">
3074
+ <xsl:call-template name="calculate-columns-numbers">
3075
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
3076
+ </xsl:call-template>
3077
+ </xsl:when>
3078
+ <xsl:otherwise>
3079
+ <xsl:call-template name="calculate-columns-numbers">
3080
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
3081
+ </xsl:call-template>
3082
+ </xsl:otherwise>
3083
+ </xsl:choose>
3084
+ </xsl:variable> -->
3085
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3086
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2759
3087
 
2760
3088
 
2761
3089
 
3090
+ <xsl:variable name="colwidths">
3091
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3092
+ <xsl:call-template name="calculate-column-widths">
3093
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3094
+ <xsl:with-param name="table" select="$simple-table"/>
3095
+ </xsl:call-template>
3096
+ </xsl:if>
3097
+ </xsl:variable>
3098
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2762
3099
 
3100
+ <!-- <xsl:variable name="colwidths2">
3101
+ <xsl:call-template name="calculate-column-widths">
3102
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3103
+ </xsl:call-template>
3104
+ </xsl:variable> -->
2763
3105
 
2764
- <xsl:variable name="table_attributes">
2765
- <attribute name="table-layout">fixed</attribute>
2766
- <attribute name="width">
2767
- <xsl:choose>
2768
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2769
- <xsl:otherwise>100%</xsl:otherwise>
2770
- </xsl:choose>
2771
- </attribute>
2772
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2773
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3106
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
3107
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
3108
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
3109
+
3110
+ <xsl:variable name="margin-left">
3111
+ <xsl:choose>
3112
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
3113
+ <xsl:otherwise>0</xsl:otherwise>
3114
+ </xsl:choose>
3115
+ </xsl:variable>
3116
+
3117
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2774
3118
 
2775
- <attribute name="border">1.5pt solid black</attribute>
2776
- <xsl:if test="*[local-name()='thead']">
2777
- <attribute name="border-top">1pt solid black</attribute>
2778
- </xsl:if>
3119
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3120
+
3121
+
3122
+
3123
+
3124
+
3125
+
3126
+
3127
+
3128
+
3129
+
3130
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
3131
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3132
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3133
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3134
+
3135
+
3136
+
3137
+
3138
+
3139
+ <xsl:variable name="table_width">
3140
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3141
+ 100%
3142
+
3143
+
3144
+ </xsl:variable>
3145
+
3146
+ <xsl:variable name="table_attributes">
3147
+ <attribute name="table-layout">fixed</attribute>
3148
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
3149
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
3150
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3151
+
3152
+ <attribute name="border">1.5pt solid black</attribute>
3153
+ <xsl:if test="*[local-name()='thead']">
3154
+ <attribute name="border-top">1pt solid black</attribute>
3155
+ </xsl:if>
3156
+
3157
+
3158
+
3159
+
3160
+ <attribute name="margin-left">0mm</attribute>
3161
+ <attribute name="margin-right">0mm</attribute>
3162
+
3163
+
3164
+
3165
+
3166
+
3167
+
3168
+
3169
+ </xsl:variable>
2779
3170
 
2780
3171
 
3172
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
3173
+
3174
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
3175
+ <xsl:attribute name="{@name}">
3176
+ <xsl:value-of select="."/>
3177
+ </xsl:attribute>
3178
+ </xsl:for-each>
3179
+
3180
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
3181
+ <xsl:if test="$isNoteOrFnExist = 'true'">
3182
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3183
+ </xsl:if>
3184
+
3185
+ <xsl:choose>
3186
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3187
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3188
+ <fo:table-column column-width="{@width}"/>
3189
+ </xsl:for-each>
3190
+ </xsl:when>
3191
+ <xsl:otherwise>
3192
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3193
+ <xsl:choose>
3194
+ <xsl:when test=". = 1 or . = 0">
3195
+ <fo:table-column column-width="proportional-column-width(2)"/>
3196
+ </xsl:when>
3197
+ <xsl:otherwise>
3198
+ <fo:table-column column-width="proportional-column-width({.})"/>
3199
+ </xsl:otherwise>
3200
+ </xsl:choose>
3201
+ </xsl:for-each>
3202
+ </xsl:otherwise>
3203
+ </xsl:choose>
3204
+
3205
+ <xsl:choose>
3206
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3207
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3208
+ </xsl:when>
3209
+ <xsl:otherwise>
3210
+ <xsl:apply-templates/>
3211
+ </xsl:otherwise>
3212
+ </xsl:choose>
3213
+
3214
+ </fo:table>
3215
+
3216
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3217
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3218
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3219
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3220
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3221
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3222
+ </xsl:call-template>
3223
+ </xsl:for-each>
2781
3224
 
3225
+ <!-- insert footer as table -->
3226
+ <!-- <fo:table>
3227
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
3228
+ <xsl:attribute name="{@name}">
3229
+ <xsl:value-of select="."/>
3230
+ </xsl:attribute>
3231
+ </xsl:for-each>
3232
+
3233
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3234
+ <xsl:choose>
3235
+ <xsl:when test=". = 1 or . = 0">
3236
+ <fo:table-column column-width="proportional-column-width(2)"/>
3237
+ </xsl:when>
3238
+ <xsl:otherwise>
3239
+ <fo:table-column column-width="proportional-column-width({.})"/>
3240
+ </xsl:otherwise>
3241
+ </xsl:choose>
3242
+ </xsl:for-each>
3243
+ </fo:table>-->
2782
3244
 
2783
- <attribute name="margin-left">0mm</attribute>
2784
- <attribute name="margin-right">0mm</attribute>
2785
3245
 
2786
-
2787
-
2788
-
2789
3246
 
2790
-
2791
3247
 
2792
- </xsl:variable>
2793
-
2794
-
2795
- <fo:table id="{@id}" table-omit-footer-at-break="true">
2796
3248
 
2797
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2798
- <xsl:attribute name="{@name}">
2799
- <xsl:value-of select="."/>
2800
- </xsl:attribute>
2801
- </xsl:for-each>
3249
+ </fo:block-container>
3250
+ </xsl:variable>
3251
+
3252
+
3253
+
3254
+ <xsl:choose>
3255
+ <xsl:when test="@width">
3256
+
3257
+ <!-- centered table when table name is centered (see table-name-style) -->
2802
3258
 
2803
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2804
- <xsl:if test="$isNoteOrFnExist = 'true'">
2805
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2806
- </xsl:if>
3259
+ <fo:table table-layout="fixed" width="100%">
3260
+ <fo:table-column column-width="proportional-column-width(1)"/>
3261
+ <fo:table-column column-width="{@width}"/>
3262
+ <fo:table-column column-width="proportional-column-width(1)"/>
3263
+ <fo:table-body>
3264
+ <fo:table-row>
3265
+ <fo:table-cell column-number="2">
3266
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
3267
+ </fo:table-cell>
3268
+ </fo:table-row>
3269
+ </fo:table-body>
3270
+ </fo:table>
2807
3271
 
2808
- <xsl:choose>
2809
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2810
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2811
- <fo:table-column column-width="{@width}"/>
2812
- </xsl:for-each>
2813
- </xsl:when>
2814
- <xsl:otherwise>
2815
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2816
- <xsl:choose>
2817
- <xsl:when test=". = 1 or . = 0">
2818
- <fo:table-column column-width="proportional-column-width(2)"/>
2819
- </xsl:when>
2820
- <xsl:otherwise>
2821
- <fo:table-column column-width="proportional-column-width({.})"/>
2822
- </xsl:otherwise>
2823
- </xsl:choose>
2824
- </xsl:for-each>
2825
- </xsl:otherwise>
2826
- </xsl:choose>
2827
3272
 
2828
- <xsl:choose>
2829
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2830
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2831
- </xsl:when>
2832
- <xsl:otherwise>
2833
- <xsl:apply-templates/>
2834
- </xsl:otherwise>
2835
- </xsl:choose>
2836
3273
 
2837
- </fo:table>
2838
-
2839
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2840
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2841
- <xsl:call-template name="insertTableFooterInSeparateTable">
2842
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
2843
- <xsl:with-param name="colwidths" select="$colwidths"/>
2844
- <xsl:with-param name="colgroup" select="$colgroup"/>
2845
- </xsl:call-template>
2846
- </xsl:for-each>
2847
-
2848
- <!-- insert footer as table -->
2849
- <!-- <fo:table>
2850
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2851
- <xsl:attribute name="{@name}">
2852
- <xsl:value-of select="."/>
2853
- </xsl:attribute>
2854
- </xsl:for-each>
2855
3274
 
2856
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2857
- <xsl:choose>
2858
- <xsl:when test=". = 1 or . = 0">
2859
- <fo:table-column column-width="proportional-column-width(2)"/>
2860
- </xsl:when>
2861
- <xsl:otherwise>
2862
- <fo:table-column column-width="proportional-column-width({.})"/>
2863
- </xsl:otherwise>
2864
- </xsl:choose>
2865
- </xsl:for-each>
2866
- </fo:table>-->
2867
-
2868
-
2869
-
2870
-
2871
-
2872
- </fo:block-container>
3275
+ </xsl:when>
3276
+ <xsl:otherwise>
3277
+ <xsl:copy-of select="$table"/>
3278
+ </xsl:otherwise>
3279
+ </xsl:choose>
3280
+
2873
3281
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2874
3282
  <xsl:if test="normalize-space() != ''">
2875
3283
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -2999,7 +3407,15 @@
2999
3407
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3000
3408
  <xsl:value-of select="@target"/>
3001
3409
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3002
- <xsl:variable name="math_text" select="normalize-space(.)"/>
3410
+ <xsl:variable name="mathml">
3411
+ <xsl:for-each select="*">
3412
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3413
+ <xsl:copy-of select="."/>
3414
+ </xsl:if>
3415
+ </xsl:for-each>
3416
+ </xsl:variable>
3417
+
3418
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3003
3419
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3004
3420
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3005
3421
  <xsl:param name="cols-count"/>
@@ -3776,7 +4192,7 @@
3776
4192
  <xsl:with-param name="table" select="$html-table"/>
3777
4193
  </xsl:call-template>
3778
4194
  </xsl:variable>
3779
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4195
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3780
4196
  <xsl:variable name="maxlength_dt">
3781
4197
  <xsl:call-template name="getMaxLength_dt"/>
3782
4198
  </xsl:variable>
@@ -3805,13 +4221,22 @@
3805
4221
  </xsl:when>
3806
4222
  <xsl:otherwise>
3807
4223
  <xsl:choose>
4224
+ <!-- to set width check most wide chars like `W` -->
3808
4225
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3809
- <fo:table-column column-width="5%"/>
3810
- <fo:table-column column-width="95%"/>
4226
+ <fo:table-column column-width="7%"/>
4227
+ <fo:table-column column-width="93%"/>
4228
+ </xsl:when>
4229
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
4230
+ <fo:table-column column-width="15%"/>
4231
+ <fo:table-column column-width="85%"/>
4232
+ </xsl:when>
4233
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
4234
+ <fo:table-column column-width="20%"/>
4235
+ <fo:table-column column-width="80%"/>
3811
4236
  </xsl:when>
3812
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3813
- <fo:table-column column-width="10%"/>
3814
- <fo:table-column column-width="90%"/>
4237
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
4238
+ <fo:table-column column-width="25%"/>
4239
+ <fo:table-column column-width="75%"/>
3815
4240
  </xsl:when>
3816
4241
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3817
4242
  <fo:table-column column-width="60%"/>
@@ -4009,6 +4434,7 @@
4009
4434
 
4010
4435
 
4011
4436
 
4437
+
4012
4438
 
4013
4439
  </xsl:variable>
4014
4440
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4030,6 +4456,10 @@
4030
4456
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4031
4457
  <xsl:apply-templates/>
4032
4458
  </fo:inline>
4459
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4460
+ <fo:inline background-color="yellow">
4461
+ <xsl:apply-templates/>
4462
+ </fo:inline>
4033
4463
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
4034
4464
  <xsl:variable name="text" select="normalize-space(.)"/>
4035
4465
  <fo:inline font-size="75%">
@@ -4119,6 +4549,10 @@
4119
4549
  <xsl:param name="text" select="."/>
4120
4550
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4121
4551
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4552
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
4553
+ <xsl:param name="text" select="."/>
4554
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4555
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4122
4556
  </xsl:template><xsl:template name="add-zero-spaces">
4123
4557
  <xsl:param name="text" select="."/>
4124
4558
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -4366,6 +4800,7 @@
4366
4800
  <xsl:apply-templates select="." mode="mathml"/>
4367
4801
  </xsl:variable>
4368
4802
  <fo:instream-foreign-object fox:alt-text="Math">
4803
+
4369
4804
  <!-- <xsl:copy-of select="."/> -->
4370
4805
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4371
4806
  </fo:instream-foreign-object>
@@ -4379,7 +4814,12 @@
4379
4814
  <!-- replace start and end spaces to non-break space -->
4380
4815
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4381
4816
  </xsl:copy>
4382
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4817
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
4818
+ <xsl:copy>
4819
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
4820
+ </xsl:copy>
4821
+ <mathml:mspace width="0.5ex"/>
4822
+ </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">
4383
4823
  <xsl:variable name="target">
4384
4824
  <xsl:choose>
4385
4825
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4400,7 +4840,10 @@
4400
4840
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4401
4841
  <xsl:choose>
4402
4842
  <xsl:when test="normalize-space(.) = ''">
4403
- <xsl:value-of select="$target"/>
4843
+ <!-- <xsl:value-of select="$target"/> -->
4844
+ <xsl:call-template name="add-zero-spaces-link-java">
4845
+ <xsl:with-param name="text" select="$target"/>
4846
+ </xsl:call-template>
4404
4847
  </xsl:when>
4405
4848
  <xsl:otherwise>
4406
4849
  <xsl:apply-templates/>
@@ -4410,8 +4853,6 @@
4410
4853
  </xsl:otherwise>
4411
4854
  </xsl:choose>
4412
4855
  </fo:inline>
4413
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4414
- <fo:inline id="{@id}"/>
4415
4856
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4416
4857
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4417
4858
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4604,7 +5045,7 @@
4604
5045
  </xsl:if> -->
4605
5046
  </fo:inline>
4606
5047
  </xsl:if>
4607
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
5048
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4608
5049
  <fo:block-container id="{@id}">
4609
5050
 
4610
5051
  <fo:block>
@@ -4620,6 +5061,7 @@
4620
5061
  <fo:block id="{@id}">
4621
5062
  <xsl:apply-templates/>
4622
5063
  </fo:block>
5064
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4623
5065
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4624
5066
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4625
5067
  <xsl:apply-templates/>
@@ -4811,6 +5253,12 @@
4811
5253
  <!-- <xsl:text> </xsl:text> -->
4812
5254
  </xsl:template><xsl:template name="getSection">
4813
5255
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5256
+ <!--
5257
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
5258
+ <xsl:value-of select="."/>
5259
+ </xsl:for-each>
5260
+ -->
5261
+
4814
5262
  </xsl:template><xsl:template name="getName">
4815
5263
  <xsl:choose>
4816
5264
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -4863,6 +5311,12 @@
4863
5311
  <xsl:copy>
4864
5312
  <xsl:apply-templates mode="contents_item"/>
4865
5313
  </xsl:copy>
5314
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
5315
+ <xsl:copy>
5316
+ <xsl:apply-templates mode="contents_item"/>
5317
+ </xsl:copy>
5318
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
5319
+ <xsl:copy-of select="."/>
4866
5320
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4867
5321
  <xsl:text> </xsl:text>
4868
5322
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4888,6 +5342,7 @@
4888
5342
 
4889
5343
  9
4890
5344
 
5345
+
4891
5346
 
4892
5347
 
4893
5348
 
@@ -5146,8 +5601,8 @@
5146
5601
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5147
5602
 
5148
5603
  <xsl:variable name="element">
5149
- block
5150
-
5604
+
5605
+ inline
5151
5606
  <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5152
5607
  </xsl:variable>
5153
5608
 
@@ -5190,9 +5645,15 @@
5190
5645
  </xsl:choose>
5191
5646
 
5192
5647
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5193
-
5648
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5194
5649
  <xsl:variable name="element">
5195
- block
5650
+
5651
+
5652
+ <xsl:choose>
5653
+ <xsl:when test="$num = 1">inline</xsl:when>
5654
+ <xsl:otherwise>block</xsl:otherwise>
5655
+ </xsl:choose>
5656
+
5196
5657
 
5197
5658
  </xsl:variable>
5198
5659
  <xsl:choose>
@@ -5268,11 +5729,13 @@
5268
5729
  </xsl:if>
5269
5730
  </xsl:if>
5270
5731
 
5732
+
5271
5733
  <fo:block-container margin-left="0mm">
5272
5734
 
5273
5735
  <fo:block xsl:use-attribute-sets="quote-style">
5274
5736
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
5275
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5737
+
5738
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5276
5739
  </fo:block>
5277
5740
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5278
5741
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -5295,29 +5758,47 @@
5295
5758
  <xsl:text>— </xsl:text>
5296
5759
  <xsl:apply-templates/>
5297
5760
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5298
- <fo:inline xsl:use-attribute-sets="eref-style">
5299
- <xsl:if test="@type = 'footnote'">
5300
-
5301
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5302
- <xsl:attribute name="font-size">80%</xsl:attribute>
5303
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5304
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5305
-
5306
-
5307
- </xsl:if>
5308
-
5309
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5310
-
5311
- <xsl:if test="@type = 'inline'">
5312
-
5313
-
5314
-
5315
- </xsl:if>
5316
-
5317
-
5318
- <xsl:apply-templates/>
5319
- </fo:basic-link>
5320
- </fo:inline>
5761
+
5762
+ <xsl:variable name="bibitemid">
5763
+ <xsl:choose>
5764
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5765
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5766
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5767
+ </xsl:choose>
5768
+ </xsl:variable>
5769
+
5770
+ <xsl:choose>
5771
+ <xsl:when test="normalize-space($bibitemid) != ''">
5772
+ <fo:inline xsl:use-attribute-sets="eref-style">
5773
+ <xsl:if test="@type = 'footnote'">
5774
+
5775
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5776
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5777
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5778
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5779
+
5780
+
5781
+ </xsl:if>
5782
+
5783
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5784
+ <xsl:if test="normalize-space(@citeas) = ''">
5785
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5786
+ </xsl:if>
5787
+ <xsl:if test="@type = 'inline'">
5788
+
5789
+
5790
+
5791
+ </xsl:if>
5792
+
5793
+ <xsl:apply-templates/>
5794
+ </fo:basic-link>
5795
+
5796
+ </fo:inline>
5797
+ </xsl:when>
5798
+ <xsl:otherwise>
5799
+ <fo:inline><xsl:apply-templates/></fo:inline>
5800
+ </xsl:otherwise>
5801
+ </xsl:choose>
5321
5802
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5322
5803
  <!-- zero-space char -->
5323
5804
  <xsl:variable name="depth">
@@ -5428,6 +5909,7 @@
5428
5909
  <xsl:attribute name="space-before">18pt</xsl:attribute>
5429
5910
  </xsl:if>
5430
5911
 
5912
+
5431
5913
 
5432
5914
 
5433
5915
 
@@ -5439,7 +5921,7 @@
5439
5921
 
5440
5922
 
5441
5923
 
5442
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
5924
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
5443
5925
  <fo:block break-after="page"/>
5444
5926
  <fo:block>
5445
5927
  <xsl:call-template name="setId"/>
@@ -5447,7 +5929,8 @@
5447
5929
  </fo:block>
5448
5930
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
5449
5931
  <fo:block>
5450
- <xsl:call-template name="setId"/>
5932
+ <xsl:call-template name="setId"/>
5933
+
5451
5934
 
5452
5935
  <xsl:apply-templates/>
5453
5936
  </fo:block>
@@ -5498,6 +5981,153 @@
5498
5981
  </fo:block>
5499
5982
  </xsl:otherwise>
5500
5983
  </xsl:choose>
5984
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5985
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5986
+ <bookmark><xsl:value-of select="@id"/></bookmark>
5987
+ </xsl:for-each>
5988
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
5989
+ <xsl:copy>
5990
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
5991
+ </xsl:copy>
5992
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
5993
+ <xsl:variable name="id">
5994
+ <xsl:call-template name="generateIndexXrefId"/>
5995
+ </xsl:variable>
5996
+ <xsl:copy> <!-- add id to xref -->
5997
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
5998
+ <xsl:attribute name="id">
5999
+ <xsl:value-of select="$id"/>
6000
+ </xsl:attribute>
6001
+ <xsl:apply-templates mode="index_add_id"/>
6002
+ </xsl:copy>
6003
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6004
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6005
+ <xsl:if test="@to">
6006
+ <xsl:value-of select="$dash"/>
6007
+ <xsl:copy>
6008
+ <xsl:copy-of select="@*"/>
6009
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
6010
+ <xsl:attribute name="id">
6011
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
6012
+ </xsl:attribute>
6013
+ <xsl:apply-templates mode="index_add_id"/>
6014
+ </xsl:copy>
6015
+ </xsl:if>
6016
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
6017
+ <xsl:copy>
6018
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
6019
+ </xsl:copy>
6020
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
6021
+ <xsl:copy>
6022
+ <xsl:apply-templates select="@*" mode="index_update"/>
6023
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
6024
+ </xsl:copy>
6025
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
6026
+ <xsl:param name="element"/>
6027
+ <xsl:param name="remove" select="'false'"/>
6028
+ <xsl:param name="target"/>
6029
+ <!-- <node></node> -->
6030
+ <xsl:choose>
6031
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6032
+ <!-- skip text (i.e. remove it) and process next element -->
6033
+ <!-- [removed_<xsl:value-of select="."/>] -->
6034
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6035
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
6036
+ </xsl:apply-templates>
6037
+ </xsl:when>
6038
+ <xsl:when test="self::text()">
6039
+ <xsl:value-of select="."/>
6040
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6041
+ </xsl:when>
6042
+ <xsl:when test="self::* and local-name(.) = 'xref'">
6043
+ <xsl:variable name="id" select="@id"/>
6044
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
6045
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
6046
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
6047
+
6048
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
6049
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
6050
+
6051
+ <xsl:choose>
6052
+ <!-- 2nd pass -->
6053
+ <!-- if page is equal to page for next and page is not the end of range -->
6054
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
6055
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
6056
+ <!-- [removed_xref] -->
6057
+
6058
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6059
+ <xsl:with-param name="remove">true</xsl:with-param>
6060
+ <xsl:with-param name="target">
6061
+ <xsl:choose>
6062
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
6063
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
6064
+ </xsl:choose>
6065
+ </xsl:with-param>
6066
+ </xsl:apply-templates>
6067
+ </xsl:when>
6068
+
6069
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
6070
+ <!-- remove xref -->
6071
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6072
+ <xsl:with-param name="remove">true</xsl:with-param>
6073
+ </xsl:apply-templates>
6074
+ </xsl:when>
6075
+
6076
+ <xsl:otherwise>
6077
+ <xsl:apply-templates select="." mode="xref_copy">
6078
+ <xsl:with-param name="target" select="$target"/>
6079
+ </xsl:apply-templates>
6080
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6081
+ </xsl:otherwise>
6082
+ </xsl:choose>
6083
+ </xsl:when>
6084
+ <xsl:when test="self::* and local-name(.) = 'ul'">
6085
+ <!-- ul -->
6086
+ <xsl:apply-templates select="." mode="index_update"/>
6087
+ </xsl:when>
6088
+ <xsl:otherwise>
6089
+ <xsl:apply-templates select="." mode="xref_copy">
6090
+ <xsl:with-param name="target" select="$target"/>
6091
+ </xsl:apply-templates>
6092
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6093
+ </xsl:otherwise>
6094
+ </xsl:choose>
6095
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
6096
+ <xsl:param name="target"/>
6097
+ <xsl:copy>
6098
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
6099
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
6100
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
6101
+ </xsl:if>
6102
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
6103
+ </xsl:copy>
6104
+ </xsl:template><xsl:template name="generateIndexXrefId">
6105
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6106
+
6107
+ <xsl:variable name="docid">
6108
+ <xsl:call-template name="getDocumentId"/>
6109
+ </xsl:variable>
6110
+ <xsl:variable name="item_number">
6111
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
6112
+ </xsl:variable>
6113
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6114
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6115
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6116
+ <xsl:apply-templates/>
6117
+ <fo:block>
6118
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6119
+ <fo:block> </fo:block>
6120
+ </xsl:if>
6121
+ </fo:block>
6122
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6123
+ <xsl:apply-templates/>
6124
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6125
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6126
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6127
+ <xsl:apply-templates/>
6128
+ </fo:block>
6129
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6130
+ <fo:inline id="{@id}" font-size="1pt"/>
5501
6131
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5502
6132
  <!-- <row>
5503
6133
  <date>05-07-2013</date>
@@ -5619,6 +6249,57 @@
5619
6249
  </xsl:variable>
5620
6250
  <xsl:variable name="result">
5621
6251
  <xsl:choose>
6252
+ <xsl:when test="$format = 'ddMMyyyy'">
6253
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
6254
+ <xsl:text> </xsl:text>
6255
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
6256
+ </xsl:when>
6257
+ <xsl:when test="$format = 'ddMM'">
6258
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
6259
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
6260
+ </xsl:when>
6261
+ <xsl:when test="$format = 'short' or $day = ''">
6262
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
6263
+ </xsl:when>
6264
+ <xsl:otherwise>
6265
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
6266
+ </xsl:otherwise>
6267
+ </xsl:choose>
6268
+ </xsl:variable>
6269
+ <xsl:value-of select="$result"/>
6270
+ </xsl:template><xsl:template name="convertDateLocalized">
6271
+ <xsl:param name="date"/>
6272
+ <xsl:param name="format" select="'short'"/>
6273
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
6274
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
6275
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
6276
+ <xsl:variable name="monthStr">
6277
+ <xsl:choose>
6278
+ <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>
6279
+ <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>
6280
+ <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>
6281
+ <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>
6282
+ <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>
6283
+ <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>
6284
+ <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>
6285
+ <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>
6286
+ <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>
6287
+ <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>
6288
+ <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>
6289
+ <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>
6290
+ </xsl:choose>
6291
+ </xsl:variable>
6292
+ <xsl:variable name="result">
6293
+ <xsl:choose>
6294
+ <xsl:when test="$format = 'ddMMyyyy'">
6295
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
6296
+ <xsl:text> </xsl:text>
6297
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
6298
+ </xsl:when>
6299
+ <xsl:when test="$format = 'ddMM'">
6300
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
6301
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
6302
+ </xsl:when>
5622
6303
  <xsl:when test="$format = 'short' or $day = ''">
5623
6304
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5624
6305
  </xsl:when>
@@ -5634,7 +6315,7 @@
5634
6315
  <xsl:param name="charDelim" select="', '"/>
5635
6316
  <xsl:choose>
5636
6317
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
5637
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
6318
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5638
6319
  <xsl:sort data-type="text" order="ascending"/>
5639
6320
  <xsl:call-template name="insertKeyword">
5640
6321
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -5643,7 +6324,7 @@
5643
6324
  </xsl:for-each>
5644
6325
  </xsl:when>
5645
6326
  <xsl:otherwise>
5646
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
6327
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5647
6328
  <xsl:call-template name="insertKeyword">
5648
6329
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
5649
6330
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -5660,65 +6341,71 @@
5660
6341
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5661
6342
  </xsl:choose>
5662
6343
  </xsl:template><xsl:template name="addPDFUAmeta">
5663
- <fo:declarations>
5664
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5665
- <pdf:dictionary type="normal" key="ViewerPreferences">
5666
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5667
- </pdf:dictionary>
5668
- </pdf:catalog>
5669
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5670
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5671
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5672
- <!-- Dublin Core properties go here -->
5673
- <dc:title>
5674
- <xsl:variable name="title">
6344
+ <xsl:variable name="lang">
6345
+ <xsl:call-template name="getLang"/>
6346
+ </xsl:variable>
6347
+ <pdf:catalog>
6348
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6349
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6350
+ </pdf:dictionary>
6351
+ </pdf:catalog>
6352
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6353
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6354
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6355
+ <!-- Dublin Core properties go here -->
6356
+ <dc:title>
6357
+ <xsl:variable name="title">
6358
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6359
+
6360
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5675
6361
 
5676
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
5677
6362
 
5678
6363
 
5679
6364
 
5680
6365
 
5681
6366
 
5682
- </xsl:variable>
5683
- <xsl:choose>
5684
- <xsl:when test="normalize-space($title) != ''">
5685
- <xsl:value-of select="$title"/>
5686
- </xsl:when>
5687
- <xsl:otherwise>
5688
- <xsl:text> </xsl:text>
5689
- </xsl:otherwise>
5690
- </xsl:choose>
5691
- </dc:title>
5692
- <dc:creator>
6367
+ </xsl:for-each>
6368
+ </xsl:variable>
6369
+ <xsl:choose>
6370
+ <xsl:when test="normalize-space($title) != ''">
6371
+ <xsl:value-of select="$title"/>
6372
+ </xsl:when>
6373
+ <xsl:otherwise>
6374
+ <xsl:text> </xsl:text>
6375
+ </xsl:otherwise>
6376
+ </xsl:choose>
6377
+ </dc:title>
6378
+ <dc:creator>
6379
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5693
6380
 
5694
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
6381
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6382
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6383
+ <xsl:if test="position() != last()">; </xsl:if>
6384
+ </xsl:for-each>
5695
6385
 
5696
6386
 
5697
6387
 
5698
- </dc:creator>
5699
- <dc:description>
5700
- <xsl:variable name="abstract">
5701
-
5702
- <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
5703
-
5704
-
5705
-
5706
-
5707
-
5708
- </xsl:variable>
5709
- <xsl:value-of select="normalize-space($abstract)"/>
5710
- </dc:description>
5711
- <pdf:Keywords>
5712
- <xsl:call-template name="insertKeywords"/>
5713
- </pdf:Keywords>
5714
- </rdf:Description>
5715
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5716
- <!-- XMP properties go here -->
5717
- <xmp:CreatorTool/>
5718
- </rdf:Description>
5719
- </rdf:RDF>
5720
- </x:xmpmeta>
5721
- </fo:declarations>
6388
+ </xsl:for-each>
6389
+ </dc:creator>
6390
+ <dc:description>
6391
+ <xsl:variable name="abstract">
6392
+
6393
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6394
+
6395
+
6396
+ </xsl:variable>
6397
+ <xsl:value-of select="normalize-space($abstract)"/>
6398
+ </dc:description>
6399
+ <pdf:Keywords>
6400
+ <xsl:call-template name="insertKeywords"/>
6401
+ </pdf:Keywords>
6402
+ </rdf:Description>
6403
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6404
+ <!-- XMP properties go here -->
6405
+ <xmp:CreatorTool/>
6406
+ </rdf:Description>
6407
+ </rdf:RDF>
6408
+ </x:xmpmeta>
5722
6409
  </xsl:template><xsl:template name="getId">
5723
6410
  <xsl:choose>
5724
6411
  <xsl:when test="../@id">
@@ -5815,6 +6502,7 @@
5815
6502
 
5816
6503
 
5817
6504
 
6505
+
5818
6506
  </xsl:variable>
5819
6507
  <xsl:if test="$documentNS != $XSLNS">
5820
6508
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>