metanorma-iso 1.7.0 → 1.8.0

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 (67) 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 +12 -12
  6. data/lib/asciidoctor/iso/biblio.rng +4 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  8. data/lib/asciidoctor/iso/front.rb +1 -1
  9. data/lib/asciidoctor/iso/front_id.rb +30 -25
  10. data/lib/asciidoctor/iso/isodoc.rng +235 -3
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +17 -97
  13. data/lib/asciidoctor/iso/validate.rb +1 -0
  14. data/lib/asciidoctor/iso/validate_title.rb +21 -13
  15. data/lib/isodoc/iso/base_convert.rb +11 -0
  16. data/lib/isodoc/iso/html/style-human.css +7 -0
  17. data/lib/isodoc/iso/html/style-iso.css +7 -0
  18. data/lib/isodoc/iso/html_convert.rb +0 -1
  19. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  20. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  21. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  22. data/lib/isodoc/iso/index.rb +140 -0
  23. data/lib/isodoc/iso/iso.amendment.xsl +1010 -324
  24. data/lib/isodoc/iso/iso.international-standard.xsl +1010 -324
  25. data/lib/isodoc/iso/presentation_xml_convert.rb +32 -25
  26. data/lib/isodoc/iso/word_convert.rb +0 -1
  27. data/lib/isodoc/iso/xref.rb +13 -5
  28. data/lib/metanorma/iso/version.rb +1 -1
  29. data/metanorma-iso.gemspec +8 -8
  30. data/spec/asciidoctor/amd_spec.rb +696 -0
  31. data/spec/asciidoctor/base_spec.rb +704 -0
  32. data/spec/asciidoctor/blocks_spec.rb +527 -0
  33. data/spec/asciidoctor/cleanup_spec.rb +1134 -0
  34. data/spec/asciidoctor/inline_spec.rb +195 -0
  35. data/spec/asciidoctor/lists_spec.rb +197 -0
  36. data/spec/asciidoctor/refs_spec.rb +375 -0
  37. data/spec/asciidoctor/section_spec.rb +393 -0
  38. data/spec/asciidoctor/table_spec.rb +329 -0
  39. data/spec/asciidoctor/validate_spec.rb +1572 -0
  40. data/spec/isodoc/amd_spec.rb +967 -946
  41. data/spec/isodoc/blocks_spec.rb +530 -507
  42. data/spec/isodoc/i18n_spec.rb +953 -911
  43. data/spec/isodoc/inline_spec.rb +355 -293
  44. data/spec/isodoc/iso_spec.rb +338 -314
  45. data/spec/isodoc/metadata_spec.rb +392 -382
  46. data/spec/isodoc/postproc_spec.rb +837 -657
  47. data/spec/isodoc/ref_spec.rb +374 -331
  48. data/spec/isodoc/section_spec.rb +821 -519
  49. data/spec/isodoc/table_spec.rb +472 -411
  50. data/spec/isodoc/terms_spec.rb +209 -185
  51. data/spec/isodoc/xref_spec.rb +1370 -1236
  52. data/spec/metanorma/processor_spec.rb +28 -26
  53. data/spec/spec_helper.rb +186 -189
  54. metadata +65 -67
  55. data/.rubocop.ribose.yml +0 -66
  56. data/lib/isodoc/iso/html/scripts.html +0 -178
  57. data/spec/asciidoctor-iso/amd_spec.rb +0 -694
  58. data/spec/asciidoctor-iso/base_spec.rb +0 -713
  59. data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
  60. data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
  61. data/spec/asciidoctor-iso/inline_spec.rb +0 -170
  62. data/spec/asciidoctor-iso/lists_spec.rb +0 -190
  63. data/spec/asciidoctor-iso/refs_spec.rb +0 -317
  64. data/spec/asciidoctor-iso/section_spec.rb +0 -362
  65. data/spec/asciidoctor-iso/table_spec.rb +0 -313
  66. data/spec/asciidoctor-iso/validate_spec.rb +0 -1619
  67. 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:xlink="http://www.w3.org/1999/xlink" 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"/>
@@ -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,348 @@
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" name="image_svg">
1968
+ <xsl:param name="name"/>
1969
+
1970
+ <xsl:variable name="svg_content">
1971
+ <xsl:apply-templates select="." mode="svg_update"/>
1972
+ </xsl:variable>
1973
+
1974
+ <xsl:variable name="alt-text">
1975
+ <xsl:choose>
1976
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
1977
+ <xsl:value-of select="../*[local-name() = 'name']"/>
1978
+ </xsl:when>
1979
+ <xsl:when test="normalize-space($name) != ''">
1980
+ <xsl:value-of select="$name"/>
1981
+ </xsl:when>
1982
+ <xsl:otherwise>Figure</xsl:otherwise>
1983
+ </xsl:choose>
1984
+ </xsl:variable>
1985
+
1986
+ <xsl:choose>
1987
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
1988
+ <fo:block>
1989
+ <xsl:variable name="width" select="@width"/>
1990
+ <xsl:variable name="height" select="@height"/>
1991
+
1992
+ <xsl:variable name="scale_x">
1993
+ <xsl:choose>
1994
+ <xsl:when test="$width &gt; $width_effective_px">
1995
+ <xsl:value-of select="$width_effective_px div $width"/>
1996
+ </xsl:when>
1997
+ <xsl:otherwise>1</xsl:otherwise>
1998
+ </xsl:choose>
1999
+ </xsl:variable>
2000
+
2001
+ <xsl:variable name="scale_y">
2002
+ <xsl:choose>
2003
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
2004
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
2005
+ </xsl:when>
2006
+ <xsl:otherwise>1</xsl:otherwise>
2007
+ </xsl:choose>
2008
+ </xsl:variable>
2009
+
2010
+ <xsl:variable name="scale">
2011
+ <xsl:choose>
2012
+ <xsl:when test="$scale_y != 1">
2013
+ <xsl:value-of select="$scale_x * $scale_y"/>
2014
+ </xsl:when>
2015
+ <xsl:otherwise>
2016
+ <xsl:value-of select="$scale_x"/>
2017
+ </xsl:otherwise>
2018
+ </xsl:choose>
2019
+ </xsl:variable>
2020
+
2021
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
2022
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
2023
+
2024
+ <fo:table table-layout="fixed" width="100%">
2025
+ <fo:table-column column-width="proportional-column-width(1)"/>
2026
+ <fo:table-column column-width="{$width_scale}px"/>
2027
+ <fo:table-column column-width="proportional-column-width(1)"/>
2028
+ <fo:table-body>
2029
+ <fo:table-row>
2030
+ <fo:table-cell column-number="2">
2031
+ <fo:block>
2032
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
2033
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
2034
+ <fo:block line-height="0" font-size="0">
2035
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
2036
+ <xsl:call-template name="bookmark"/>
2037
+ </xsl:for-each>
2038
+ </fo:block>
2039
+ </xsl:if>
2040
+ <fo:block text-depth="0" line-height="0" font-size="0">
2041
+
2042
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2043
+ <xsl:attribute name="width">100%</xsl:attribute>
2044
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2045
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2046
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2047
+
2048
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
2049
+ </fo:instream-foreign-object>
2050
+ </fo:block>
2051
+
2052
+ <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">
2053
+ <xsl:with-param name="scale" select="$scale"/>
2054
+ </xsl:apply-templates>
2055
+ </fo:block-container>
2056
+ </fo:block>
2057
+ </fo:table-cell>
2058
+ </fo:table-row>
2059
+ </fo:table-body>
2060
+ </fo:table>
2061
+ </fo:block>
2062
+
2063
+ </xsl:when>
2064
+ <xsl:otherwise>
2065
+ <fo:block xsl:use-attribute-sets="image-style">
2066
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2067
+ <xsl:attribute name="width">100%</xsl:attribute>
2068
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2069
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2070
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
2071
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
2072
+ <!-- effective height / width = 1.48, 1.4 - with title -->
2073
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
2074
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
2075
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
2076
+ </xsl:if>
2077
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2078
+ <xsl:copy-of select="$svg_content"/>
2079
+ </fo:instream-foreign-object>
2080
+ </fo:block>
2081
+ </xsl:otherwise>
2082
+ </xsl:choose>
2083
+ </xsl:template>
2084
+
2085
+ <xsl:template match="@*|node()" mode="svg_update">
2086
+ <xsl:copy>
2087
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
2088
+ </xsl:copy>
2089
+ </xsl:template>
2090
+
2091
+ <xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
2092
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
2093
+ <xsl:value-of select="."/>
2094
+ </xsl:attribute>
2095
+ </xsl:template>
2096
+
2097
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
2098
+ <xsl:variable name="svg_content" select="document(@src)"/>
2099
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
2100
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
2101
+ <xsl:call-template name="image_svg">
2102
+ <xsl:with-param name="name" select="$name"/>
2103
+ </xsl:call-template>
2104
+ </xsl:for-each>
2105
+ </xsl:template>
2106
+
2107
+ <xsl:template match="@*|node()" mode="svg_remove_a">
2108
+ <xsl:copy>
2109
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
2110
+ </xsl:copy>
2111
+ </xsl:template>
2112
+
2113
+ <xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
2114
+ <xsl:apply-templates mode="svg_remove_a"/>
2115
+ </xsl:template>
2116
+
2117
+ <xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
2118
+ <xsl:param name="scale"/>
2119
+ <xsl:variable name="dest">
2120
+ <xsl:choose>
2121
+ <xsl:when test="starts-with(@href, '#')">
2122
+ <xsl:value-of select="substring-after(@href, '#')"/>
2123
+ </xsl:when>
2124
+ <xsl:otherwise>
2125
+ <xsl:value-of select="@href"/>
2126
+ </xsl:otherwise>
2127
+ </xsl:choose>
2128
+ </xsl:variable>
2129
+ <xsl:for-each select="./*[local-name() = 'rect']">
2130
+ <xsl:call-template name="insertSVGMapLink">
2131
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
2132
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
2133
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
2134
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
2135
+ <xsl:with-param name="dest" select="$dest"/>
2136
+ </xsl:call-template>
2137
+ </xsl:for-each>
2138
+
2139
+ <xsl:for-each select="./*[local-name() = 'polygon']">
2140
+ <xsl:variable name="points">
2141
+ <xsl:call-template name="split">
2142
+ <xsl:with-param name="pText" select="@points"/>
2143
+ </xsl:call-template>
2144
+ </xsl:variable>
2145
+ <xsl:variable name="x_coords">
2146
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
2147
+ <xsl:sort select="." data-type="number"/>
2148
+ <x><xsl:value-of select="."/></x>
2149
+ </xsl:for-each>
2150
+ </xsl:variable>
2151
+ <xsl:variable name="y_coords">
2152
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
2153
+ <xsl:sort select="." data-type="number"/>
2154
+ <y><xsl:value-of select="."/></y>
2155
+ </xsl:for-each>
2156
+ </xsl:variable>
2157
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
2158
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
2159
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
2160
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
2161
+ <xsl:call-template name="insertSVGMapLink">
2162
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
2163
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
2164
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
2165
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
2166
+ <xsl:with-param name="dest" select="$dest"/>
2167
+ </xsl:call-template>
2168
+ </xsl:for-each>
2169
+
2170
+ <xsl:for-each select="./*[local-name() = 'circle']">
2171
+ <xsl:call-template name="insertSVGMapLink">
2172
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
2173
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
2174
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
2175
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
2176
+ <xsl:with-param name="dest" select="$dest"/>
2177
+ </xsl:call-template>
2178
+ </xsl:for-each>
2179
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
2180
+ <xsl:call-template name="insertSVGMapLink">
2181
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
2182
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
2183
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
2184
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
2185
+ <xsl:with-param name="dest" select="$dest"/>
2186
+ </xsl:call-template>
2187
+ </xsl:for-each>
2188
+ </xsl:template>
2189
+
2190
+ <xsl:template name="insertSVGMapLink">
2191
+ <xsl:param name="left"/>
2192
+ <xsl:param name="top"/>
2193
+ <xsl:param name="width"/>
2194
+ <xsl:param name="height"/>
2195
+ <xsl:param name="dest"/>
2196
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
2197
+ <fo:block font-size="1pt">
2198
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
2199
+ <fo:inline-container inline-progression-dimension="100%">
2200
+ <fo:block-container height="{$height - 1}px" width="100%">
2201
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
2202
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
2203
+ </xsl:if> -->
2204
+ <fo:block> </fo:block></fo:block-container>
2205
+ </fo:inline-container>
2206
+ </fo:basic-link>
2207
+ </fo:block>
2208
+ </fo:block-container>
2209
+ </xsl:template>
2210
+
2211
+ <!-- =================== -->
2212
+ <!-- End SVG images processing -->
2213
+ <!-- =================== -->
2214
+
2215
+ <!-- For express listings PDF attachments -->
2216
+ <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid, '.exp')]" priority="2">
2217
+ <fo:inline xsl:use-attribute-sets="eref-style">
2218
+ <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
2219
+ <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
2220
+ <xsl:if test="normalize-space(@citeas) = ''">
2221
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
2222
+ </xsl:if>
2223
+ <xsl:apply-templates/>
2224
+ </fo:basic-link>
2225
+ </fo:inline>
2226
+ </xsl:template>
2227
+
1894
2228
 
2229
+ <!-- =================== -->
2230
+ <!-- Index processing -->
2231
+ <!-- =================== -->
2232
+
2233
+ <xsl:template match="iso:indexsect"/>
2234
+ <xsl:template match="iso:indexsect" mode="index">
2235
+
2236
+ <fo:page-sequence master-reference="index" force-page-count="no-force">
2237
+ <xsl:variable name="header-title">
2238
+ <xsl:choose>
2239
+ <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2240
+ <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
2241
+ </xsl:when>
2242
+ <xsl:otherwise>
2243
+ <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2244
+ </xsl:otherwise>
2245
+ </xsl:choose>
2246
+ </xsl:variable>
2247
+ <xsl:call-template name="insertHeaderFooter">
2248
+ <xsl:with-param name="header-title" select="$header-title"/>
2249
+ </xsl:call-template>
2250
+
2251
+ <fo:flow flow-name="xsl-region-body">
2252
+ <fo:block id="{@id}" span="all">
2253
+ <xsl:apply-templates select="iso:title"/>
2254
+ </fo:block>
2255
+ <fo:block>
2256
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
2257
+ </fo:block>
2258
+ </fo:flow>
2259
+ </fo:page-sequence>
2260
+ </xsl:template>
2261
+
2262
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:title" priority="4"> -->
2263
+ <xsl:template match="iso:indexsect/iso:title" priority="4">
2264
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt">
2265
+ <!-- Index -->
2266
+ <xsl:apply-templates/>
2267
+ </fo:block>
2268
+ </xsl:template>
2269
+
2270
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:clause/iso:title" priority="4"> -->
2271
+ <xsl:template match="iso:indexsect/iso:clause/iso:title" priority="4">
2272
+ <!-- Letter A, B, C, ... -->
2273
+ <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
2274
+ <xsl:apply-templates/>
2275
+ </fo:block>
2276
+ </xsl:template>
2277
+
2278
+ <xsl:template match="iso:indexsect//iso:li/text()">
2279
+ <!-- to split by '_' and other chars -->
2280
+ <xsl:call-template name="add-zero-spaces-java"/>
2281
+ </xsl:template>
2282
+
2283
+ <xsl:template match="iso:xref" priority="2">
2284
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2285
+ <xsl:choose>
2286
+ <xsl:when test="@pagenumber='true'">
2287
+ <fo:inline>
2288
+ <xsl:if test="@id">
2289
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2290
+ </xsl:if>
2291
+ <fo:page-number-citation ref-id="{@target}"/>
2292
+ </fo:inline>
2293
+ </xsl:when>
2294
+ <xsl:otherwise>
2295
+ <xsl:apply-templates/>
2296
+ </xsl:otherwise>
2297
+ </xsl:choose>
2298
+ </fo:basic-link>
2299
+ </xsl:template>
2300
+
2301
+ <!-- =================== -->
2302
+ <!-- End of Index processing -->
2303
+ <!-- =================== -->
2304
+
1895
2305
 
1896
2306
  <xsl:template name="insertHeaderFooter">
1897
2307
  <xsl:param name="font-weight" select="'bold'"/>
@@ -2393,6 +2803,9 @@
2393
2803
 
2394
2804
 
2395
2805
 
2806
+ <xsl:attribute name="text-align">justify</xsl:attribute>
2807
+
2808
+
2396
2809
 
2397
2810
 
2398
2811
 
@@ -2620,7 +3033,7 @@
2620
3033
 
2621
3034
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2622
3035
 
2623
-
3036
+
2624
3037
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2625
3038
 
2626
3039
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
@@ -2628,6 +3041,12 @@
2628
3041
 
2629
3042
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2630
3043
 
3044
+ </xsl:attribute-set><xsl:attribute-set name="add-style">
3045
+ <xsl:attribute name="color">red</xsl:attribute>
3046
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3047
+ </xsl:attribute-set><xsl:attribute-set name="del-style">
3048
+ <xsl:attribute name="color">red</xsl:attribute>
3049
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2631
3050
  </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2632
3051
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2633
3052
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2673,204 +3092,238 @@
2673
3092
  <xsl:call-template name="add-zero-spaces-java"/>
2674
3093
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2675
3094
 
2676
- <xsl:variable name="simple-table">
2677
- <xsl:call-template name="getSimpleTable"/>
2678
- </xsl:variable>
3095
+ <xsl:variable name="table">
2679
3096
 
2680
-
2681
-
2682
-
2683
-
2684
- <!-- <xsl:if test="$namespace = 'bipm'">
2685
- <fo:block>&#xA0;</fo:block>
2686
- </xsl:if> -->
2687
-
2688
- <!-- $namespace = 'iso' or -->
2689
-
2690
-
3097
+ <xsl:variable name="simple-table">
3098
+ <xsl:call-template name="getSimpleTable"/>
3099
+ </xsl:variable>
2691
3100
 
2692
3101
 
2693
-
2694
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2695
-
2696
- <!-- <xsl:variable name="cols-count">
2697
- <xsl:choose>
2698
- <xsl:when test="*[local-name()='thead']">
2699
- <xsl:call-template name="calculate-columns-numbers">
2700
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2701
- </xsl:call-template>
2702
- </xsl:when>
2703
- <xsl:otherwise>
2704
- <xsl:call-template name="calculate-columns-numbers">
2705
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2706
- </xsl:call-template>
2707
- </xsl:otherwise>
2708
- </xsl:choose>
2709
- </xsl:variable> -->
2710
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2711
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2712
-
2713
-
2714
-
2715
- <xsl:variable name="colwidths">
2716
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2717
- <xsl:call-template name="calculate-column-widths">
2718
- <xsl:with-param name="cols-count" select="$cols-count"/>
2719
- <xsl:with-param name="table" select="$simple-table"/>
2720
- </xsl:call-template>
2721
- </xsl:if>
2722
- </xsl:variable>
2723
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2724
-
2725
- <!-- <xsl:variable name="colwidths2">
2726
- <xsl:call-template name="calculate-column-widths">
2727
- <xsl:with-param name="cols-count" select="$cols-count"/>
2728
- </xsl:call-template>
2729
- </xsl:variable> -->
2730
-
2731
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2732
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
2733
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2734
-
2735
- <xsl:variable name="margin-left">
2736
- <xsl:choose>
2737
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2738
- <xsl:otherwise>0</xsl:otherwise>
2739
- </xsl:choose>
2740
- </xsl:variable>
2741
-
2742
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2743
3102
 
2744
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2745
3103
 
2746
3104
 
2747
-
2748
-
2749
-
3105
+ <!-- <xsl:if test="$namespace = 'bipm'">
3106
+ <fo:block>&#xA0;</fo:block>
3107
+ </xsl:if> -->
2750
3108
 
3109
+ <!-- $namespace = 'iso' or -->
2751
3110
 
2752
-
3111
+
2753
3112
 
3113
+
2754
3114
 
2755
- <xsl:attribute name="margin-top">12pt</xsl:attribute>
2756
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2757
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2758
- <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3115
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2759
3116
 
3117
+ <!-- <xsl:variable name="cols-count">
3118
+ <xsl:choose>
3119
+ <xsl:when test="*[local-name()='thead']">
3120
+ <xsl:call-template name="calculate-columns-numbers">
3121
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
3122
+ </xsl:call-template>
3123
+ </xsl:when>
3124
+ <xsl:otherwise>
3125
+ <xsl:call-template name="calculate-columns-numbers">
3126
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
3127
+ </xsl:call-template>
3128
+ </xsl:otherwise>
3129
+ </xsl:choose>
3130
+ </xsl:variable> -->
3131
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3132
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2760
3133
 
2761
3134
 
2762
3135
 
3136
+ <xsl:variable name="colwidths">
3137
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3138
+ <xsl:call-template name="calculate-column-widths">
3139
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3140
+ <xsl:with-param name="table" select="$simple-table"/>
3141
+ </xsl:call-template>
3142
+ </xsl:if>
3143
+ </xsl:variable>
3144
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2763
3145
 
3146
+ <!-- <xsl:variable name="colwidths2">
3147
+ <xsl:call-template name="calculate-column-widths">
3148
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3149
+ </xsl:call-template>
3150
+ </xsl:variable> -->
2764
3151
 
2765
- <xsl:variable name="table_attributes">
2766
- <attribute name="table-layout">fixed</attribute>
2767
- <attribute name="width">
3152
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
3153
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
3154
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
3155
+
3156
+ <xsl:variable name="margin-left">
3157
+ <xsl:choose>
3158
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
3159
+ <xsl:otherwise>0</xsl:otherwise>
3160
+ </xsl:choose>
3161
+ </xsl:variable>
3162
+
3163
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3164
+
3165
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3166
+
3167
+
3168
+
3169
+
3170
+
3171
+
3172
+
3173
+
3174
+
3175
+
3176
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
3177
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3178
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3179
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
3180
+
3181
+
3182
+
3183
+
3184
+
3185
+ <xsl:variable name="table_width">
3186
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3187
+ 100%
3188
+
3189
+
3190
+ </xsl:variable>
3191
+
3192
+ <xsl:variable name="table_attributes">
3193
+ <attribute name="table-layout">fixed</attribute>
3194
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
3195
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
3196
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3197
+
3198
+ <attribute name="border">1.5pt solid black</attribute>
3199
+ <xsl:if test="*[local-name()='thead']">
3200
+ <attribute name="border-top">1pt solid black</attribute>
3201
+ </xsl:if>
3202
+
3203
+
3204
+
3205
+
3206
+ <attribute name="margin-left">0mm</attribute>
3207
+ <attribute name="margin-right">0mm</attribute>
3208
+
3209
+
3210
+
3211
+
3212
+
3213
+
3214
+
3215
+ </xsl:variable>
3216
+
3217
+
3218
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
3219
+
3220
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
3221
+ <xsl:attribute name="{@name}">
3222
+ <xsl:value-of select="."/>
3223
+ </xsl:attribute>
3224
+ </xsl:for-each>
3225
+
3226
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
3227
+ <xsl:if test="$isNoteOrFnExist = 'true'">
3228
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3229
+ </xsl:if>
3230
+
3231
+ <xsl:choose>
3232
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3233
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3234
+ <fo:table-column column-width="{@width}"/>
3235
+ </xsl:for-each>
3236
+ </xsl:when>
3237
+ <xsl:otherwise>
3238
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3239
+ <xsl:choose>
3240
+ <xsl:when test=". = 1 or . = 0">
3241
+ <fo:table-column column-width="proportional-column-width(2)"/>
3242
+ </xsl:when>
3243
+ <xsl:otherwise>
3244
+ <fo:table-column column-width="proportional-column-width({.})"/>
3245
+ </xsl:otherwise>
3246
+ </xsl:choose>
3247
+ </xsl:for-each>
3248
+ </xsl:otherwise>
3249
+ </xsl:choose>
3250
+
2768
3251
  <xsl:choose>
2769
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2770
- <xsl:otherwise>100%</xsl:otherwise>
3252
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3253
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3254
+ </xsl:when>
3255
+ <xsl:otherwise>
3256
+ <xsl:apply-templates/>
3257
+ </xsl:otherwise>
2771
3258
  </xsl:choose>
2772
- </attribute>
2773
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2774
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2775
-
2776
- <attribute name="border">1.5pt solid black</attribute>
2777
- <xsl:if test="*[local-name()='thead']">
2778
- <attribute name="border-top">1pt solid black</attribute>
2779
- </xsl:if>
2780
-
3259
+
3260
+ </fo:table>
2781
3261
 
3262
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3263
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3264
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3265
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3266
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3267
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3268
+ </xsl:call-template>
3269
+ </xsl:for-each>
2782
3270
 
3271
+ <!-- insert footer as table -->
3272
+ <!-- <fo:table>
3273
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
3274
+ <xsl:attribute name="{@name}">
3275
+ <xsl:value-of select="."/>
3276
+ </xsl:attribute>
3277
+ </xsl:for-each>
3278
+
3279
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3280
+ <xsl:choose>
3281
+ <xsl:when test=". = 1 or . = 0">
3282
+ <fo:table-column column-width="proportional-column-width(2)"/>
3283
+ </xsl:when>
3284
+ <xsl:otherwise>
3285
+ <fo:table-column column-width="proportional-column-width({.})"/>
3286
+ </xsl:otherwise>
3287
+ </xsl:choose>
3288
+ </xsl:for-each>
3289
+ </fo:table>-->
2783
3290
 
2784
- <attribute name="margin-left">0mm</attribute>
2785
- <attribute name="margin-right">0mm</attribute>
2786
3291
 
2787
-
2788
-
2789
-
2790
3292
 
2791
-
2792
3293
 
2793
- </xsl:variable>
2794
-
2795
-
2796
- <fo:table id="{@id}" table-omit-footer-at-break="true">
2797
3294
 
2798
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2799
- <xsl:attribute name="{@name}">
2800
- <xsl:value-of select="."/>
2801
- </xsl:attribute>
2802
- </xsl:for-each>
3295
+ </fo:block-container>
3296
+ </xsl:variable>
3297
+
3298
+
3299
+
3300
+ <xsl:choose>
3301
+ <xsl:when test="@width">
3302
+
3303
+ <!-- centered table when table name is centered (see table-name-style) -->
2803
3304
 
2804
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2805
- <xsl:if test="$isNoteOrFnExist = 'true'">
2806
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2807
- </xsl:if>
3305
+ <fo:table table-layout="fixed" width="100%">
3306
+ <fo:table-column column-width="proportional-column-width(1)"/>
3307
+ <fo:table-column column-width="{@width}"/>
3308
+ <fo:table-column column-width="proportional-column-width(1)"/>
3309
+ <fo:table-body>
3310
+ <fo:table-row>
3311
+ <fo:table-cell column-number="2">
3312
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
3313
+ </fo:table-cell>
3314
+ </fo:table-row>
3315
+ </fo:table-body>
3316
+ </fo:table>
2808
3317
 
2809
- <xsl:choose>
2810
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2811
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2812
- <fo:table-column column-width="{@width}"/>
2813
- </xsl:for-each>
2814
- </xsl:when>
2815
- <xsl:otherwise>
2816
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2817
- <xsl:choose>
2818
- <xsl:when test=". = 1 or . = 0">
2819
- <fo:table-column column-width="proportional-column-width(2)"/>
2820
- </xsl:when>
2821
- <xsl:otherwise>
2822
- <fo:table-column column-width="proportional-column-width({.})"/>
2823
- </xsl:otherwise>
2824
- </xsl:choose>
2825
- </xsl:for-each>
2826
- </xsl:otherwise>
2827
- </xsl:choose>
2828
3318
 
2829
- <xsl:choose>
2830
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2831
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2832
- </xsl:when>
2833
- <xsl:otherwise>
2834
- <xsl:apply-templates/>
2835
- </xsl:otherwise>
2836
- </xsl:choose>
2837
3319
 
2838
- </fo:table>
2839
-
2840
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2841
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2842
- <xsl:call-template name="insertTableFooterInSeparateTable">
2843
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
2844
- <xsl:with-param name="colwidths" select="$colwidths"/>
2845
- <xsl:with-param name="colgroup" select="$colgroup"/>
2846
- </xsl:call-template>
2847
- </xsl:for-each>
2848
-
2849
- <!-- insert footer as table -->
2850
- <!-- <fo:table>
2851
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2852
- <xsl:attribute name="{@name}">
2853
- <xsl:value-of select="."/>
2854
- </xsl:attribute>
2855
- </xsl:for-each>
2856
3320
 
2857
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2858
- <xsl:choose>
2859
- <xsl:when test=". = 1 or . = 0">
2860
- <fo:table-column column-width="proportional-column-width(2)"/>
2861
- </xsl:when>
2862
- <xsl:otherwise>
2863
- <fo:table-column column-width="proportional-column-width({.})"/>
2864
- </xsl:otherwise>
2865
- </xsl:choose>
2866
- </xsl:for-each>
2867
- </fo:table>-->
2868
-
2869
-
2870
-
2871
-
2872
-
2873
- </fo:block-container>
3321
+ </xsl:when>
3322
+ <xsl:otherwise>
3323
+ <xsl:copy-of select="$table"/>
3324
+ </xsl:otherwise>
3325
+ </xsl:choose>
3326
+
2874
3327
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2875
3328
  <xsl:if test="normalize-space() != ''">
2876
3329
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -3000,7 +3453,15 @@
3000
3453
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3001
3454
  <xsl:value-of select="@target"/>
3002
3455
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3003
- <xsl:variable name="math_text" select="normalize-space(.)"/>
3456
+ <xsl:variable name="mathml">
3457
+ <xsl:for-each select="*">
3458
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3459
+ <xsl:copy-of select="."/>
3460
+ </xsl:if>
3461
+ </xsl:for-each>
3462
+ </xsl:variable>
3463
+
3464
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3004
3465
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3005
3466
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3006
3467
  <xsl:param name="cols-count"/>
@@ -3777,7 +4238,7 @@
3777
4238
  <xsl:with-param name="table" select="$html-table"/>
3778
4239
  </xsl:call-template>
3779
4240
  </xsl:variable>
3780
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4241
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3781
4242
  <xsl:variable name="maxlength_dt">
3782
4243
  <xsl:call-template name="getMaxLength_dt"/>
3783
4244
  </xsl:variable>
@@ -3806,13 +4267,22 @@
3806
4267
  </xsl:when>
3807
4268
  <xsl:otherwise>
3808
4269
  <xsl:choose>
4270
+ <!-- to set width check most wide chars like `W` -->
3809
4271
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3810
- <fo:table-column column-width="5%"/>
3811
- <fo:table-column column-width="95%"/>
4272
+ <fo:table-column column-width="7%"/>
4273
+ <fo:table-column column-width="93%"/>
4274
+ </xsl:when>
4275
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
4276
+ <fo:table-column column-width="15%"/>
4277
+ <fo:table-column column-width="85%"/>
3812
4278
  </xsl:when>
3813
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3814
- <fo:table-column column-width="10%"/>
3815
- <fo:table-column column-width="90%"/>
4279
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
4280
+ <fo:table-column column-width="20%"/>
4281
+ <fo:table-column column-width="80%"/>
4282
+ </xsl:when>
4283
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
4284
+ <fo:table-column column-width="25%"/>
4285
+ <fo:table-column column-width="75%"/>
3816
4286
  </xsl:when>
3817
4287
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3818
4288
  <fo:table-column column-width="60%"/>
@@ -4028,8 +4498,16 @@
4028
4498
  <fo:inline text-decoration="underline">
4029
4499
  <xsl:apply-templates/>
4030
4500
  </fo:inline>
4501
+ </xsl:template><xsl:template match="*[local-name()='add']">
4502
+ <fo:inline xsl:use-attribute-sets="add-style">
4503
+ <xsl:apply-templates/>
4504
+ </fo:inline>
4031
4505
  </xsl:template><xsl:template match="*[local-name()='del']">
4032
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4506
+ <fo:inline xsl:use-attribute-sets="del-style">
4507
+ <xsl:apply-templates/>
4508
+ </fo:inline>
4509
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4510
+ <fo:inline background-color="yellow">
4033
4511
  <xsl:apply-templates/>
4034
4512
  </fo:inline>
4035
4513
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -4121,6 +4599,10 @@
4121
4599
  <xsl:param name="text" select="."/>
4122
4600
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4123
4601
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4602
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
4603
+ <xsl:param name="text" select="."/>
4604
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4605
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4124
4606
  </xsl:template><xsl:template name="add-zero-spaces">
4125
4607
  <xsl:param name="text" select="."/>
4126
4608
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -4368,6 +4850,7 @@
4368
4850
  <xsl:apply-templates select="." mode="mathml"/>
4369
4851
  </xsl:variable>
4370
4852
  <fo:instream-foreign-object fox:alt-text="Math">
4853
+
4371
4854
  <!-- <xsl:copy-of select="."/> -->
4372
4855
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4373
4856
  </fo:instream-foreign-object>
@@ -4381,7 +4864,12 @@
4381
4864
  <!-- replace start and end spaces to non-break space -->
4382
4865
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4383
4866
  </xsl:copy>
4384
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4867
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
4868
+ <xsl:copy>
4869
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
4870
+ </xsl:copy>
4871
+ <mathml:mspace width="0.5ex"/>
4872
+ </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">
4385
4873
  <xsl:variable name="target">
4386
4874
  <xsl:choose>
4387
4875
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4402,7 +4890,10 @@
4402
4890
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4403
4891
  <xsl:choose>
4404
4892
  <xsl:when test="normalize-space(.) = ''">
4405
- <xsl:value-of select="$target"/>
4893
+ <!-- <xsl:value-of select="$target"/> -->
4894
+ <xsl:call-template name="add-zero-spaces-link-java">
4895
+ <xsl:with-param name="text" select="$target"/>
4896
+ </xsl:call-template>
4406
4897
  </xsl:when>
4407
4898
  <xsl:otherwise>
4408
4899
  <xsl:apply-templates/>
@@ -4412,8 +4903,6 @@
4412
4903
  </xsl:otherwise>
4413
4904
  </xsl:choose>
4414
4905
  </fo:inline>
4415
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4416
- <fo:inline id="{@id}"/>
4417
4906
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4418
4907
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4419
4908
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4622,27 +5111,43 @@
4622
5111
  <fo:block id="{@id}">
4623
5112
  <xsl:apply-templates/>
4624
5113
  </fo:block>
5114
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4625
5115
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4626
5116
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4627
5117
  <xsl:apply-templates/>
4628
5118
  </fo:block>
4629
5119
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4630
- <fo:block xsl:use-attribute-sets="image-style">
4631
-
4632
-
4633
- <xsl:variable name="src">
4634
- <xsl:choose>
4635
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4636
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4637
- </xsl:when>
4638
- <xsl:otherwise>
4639
- <xsl:value-of select="@src"/>
4640
- </xsl:otherwise>
4641
- </xsl:choose>
4642
- </xsl:variable>
4643
-
4644
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4645
- </fo:block>
5120
+ <xsl:choose>
5121
+ <xsl:when test="ancestor::*[local-name() = 'title']">
5122
+ <fo:inline padding-left="1mm" padding-right="1mm">
5123
+ <xsl:variable name="src">
5124
+ <xsl:call-template name="image_src"/>
5125
+ </xsl:variable>
5126
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
5127
+ </fo:inline>
5128
+ </xsl:when>
5129
+ <xsl:otherwise>
5130
+ <fo:block xsl:use-attribute-sets="image-style">
5131
+
5132
+ <xsl:variable name="src">
5133
+ <xsl:call-template name="image_src"/>
5134
+ </xsl:variable>
5135
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5136
+ </fo:block>
5137
+ </xsl:otherwise>
5138
+ </xsl:choose>
5139
+ </xsl:template><xsl:template name="image_src">
5140
+ <xsl:choose>
5141
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5142
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5143
+ </xsl:when>
5144
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5145
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5146
+ </xsl:when>
5147
+ <xsl:otherwise>
5148
+ <xsl:value-of select="@src"/>
5149
+ </xsl:otherwise>
5150
+ </xsl:choose>
4646
5151
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
4647
5152
  <xsl:apply-templates mode="contents"/>
4648
5153
  <xsl:text> </xsl:text>
@@ -4875,6 +5380,8 @@
4875
5380
  <xsl:copy>
4876
5381
  <xsl:apply-templates mode="contents_item"/>
4877
5382
  </xsl:copy>
5383
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
5384
+ <xsl:copy-of select="."/>
4878
5385
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4879
5386
  <xsl:text> </xsl:text>
4880
5387
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -5159,8 +5666,8 @@
5159
5666
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5160
5667
 
5161
5668
  <xsl:variable name="element">
5162
- block
5163
-
5669
+
5670
+ inline
5164
5671
  <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5165
5672
  </xsl:variable>
5166
5673
 
@@ -5203,9 +5710,15 @@
5203
5710
  </xsl:choose>
5204
5711
 
5205
5712
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5206
-
5713
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5207
5714
  <xsl:variable name="element">
5208
- block
5715
+
5716
+
5717
+ <xsl:choose>
5718
+ <xsl:when test="$num = 1">inline</xsl:when>
5719
+ <xsl:otherwise>block</xsl:otherwise>
5720
+ </xsl:choose>
5721
+
5209
5722
 
5210
5723
  </xsl:variable>
5211
5724
  <xsl:choose>
@@ -5281,11 +5794,13 @@
5281
5794
  </xsl:if>
5282
5795
  </xsl:if>
5283
5796
 
5797
+
5284
5798
  <fo:block-container margin-left="0mm">
5285
5799
 
5286
5800
  <fo:block xsl:use-attribute-sets="quote-style">
5287
5801
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
5288
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5802
+
5803
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5289
5804
  </fo:block>
5290
5805
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5291
5806
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -5308,29 +5823,47 @@
5308
5823
  <xsl:text>— </xsl:text>
5309
5824
  <xsl:apply-templates/>
5310
5825
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5311
- <fo:inline xsl:use-attribute-sets="eref-style">
5312
- <xsl:if test="@type = 'footnote'">
5313
-
5314
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5315
- <xsl:attribute name="font-size">80%</xsl:attribute>
5316
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5317
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5318
-
5319
-
5320
- </xsl:if>
5321
-
5322
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5323
-
5324
- <xsl:if test="@type = 'inline'">
5325
-
5326
-
5327
-
5328
- </xsl:if>
5329
-
5330
-
5331
- <xsl:apply-templates/>
5332
- </fo:basic-link>
5333
- </fo:inline>
5826
+
5827
+ <xsl:variable name="bibitemid">
5828
+ <xsl:choose>
5829
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5830
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5831
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5832
+ </xsl:choose>
5833
+ </xsl:variable>
5834
+
5835
+ <xsl:choose>
5836
+ <xsl:when test="normalize-space($bibitemid) != ''">
5837
+ <fo:inline xsl:use-attribute-sets="eref-style">
5838
+ <xsl:if test="@type = 'footnote'">
5839
+
5840
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5841
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5842
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5843
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5844
+
5845
+
5846
+ </xsl:if>
5847
+
5848
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5849
+ <xsl:if test="normalize-space(@citeas) = ''">
5850
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5851
+ </xsl:if>
5852
+ <xsl:if test="@type = 'inline'">
5853
+
5854
+
5855
+
5856
+ </xsl:if>
5857
+
5858
+ <xsl:apply-templates/>
5859
+ </fo:basic-link>
5860
+
5861
+ </fo:inline>
5862
+ </xsl:when>
5863
+ <xsl:otherwise>
5864
+ <fo:inline><xsl:apply-templates/></fo:inline>
5865
+ </xsl:otherwise>
5866
+ </xsl:choose>
5334
5867
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5335
5868
  <!-- zero-space char -->
5336
5869
  <xsl:variable name="depth">
@@ -5513,6 +6046,153 @@
5513
6046
  </fo:block>
5514
6047
  </xsl:otherwise>
5515
6048
  </xsl:choose>
6049
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
6050
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
6051
+ <bookmark><xsl:value-of select="@id"/></bookmark>
6052
+ </xsl:for-each>
6053
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
6054
+ <xsl:copy>
6055
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
6056
+ </xsl:copy>
6057
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
6058
+ <xsl:variable name="id">
6059
+ <xsl:call-template name="generateIndexXrefId"/>
6060
+ </xsl:variable>
6061
+ <xsl:copy> <!-- add id to xref -->
6062
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
6063
+ <xsl:attribute name="id">
6064
+ <xsl:value-of select="$id"/>
6065
+ </xsl:attribute>
6066
+ <xsl:apply-templates mode="index_add_id"/>
6067
+ </xsl:copy>
6068
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6069
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6070
+ <xsl:if test="@to">
6071
+ <xsl:value-of select="$dash"/>
6072
+ <xsl:copy>
6073
+ <xsl:copy-of select="@*"/>
6074
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
6075
+ <xsl:attribute name="id">
6076
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
6077
+ </xsl:attribute>
6078
+ <xsl:apply-templates mode="index_add_id"/>
6079
+ </xsl:copy>
6080
+ </xsl:if>
6081
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
6082
+ <xsl:copy>
6083
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
6084
+ </xsl:copy>
6085
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
6086
+ <xsl:copy>
6087
+ <xsl:apply-templates select="@*" mode="index_update"/>
6088
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
6089
+ </xsl:copy>
6090
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
6091
+ <xsl:param name="element"/>
6092
+ <xsl:param name="remove" select="'false'"/>
6093
+ <xsl:param name="target"/>
6094
+ <!-- <node></node> -->
6095
+ <xsl:choose>
6096
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6097
+ <!-- skip text (i.e. remove it) and process next element -->
6098
+ <!-- [removed_<xsl:value-of select="."/>] -->
6099
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6100
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
6101
+ </xsl:apply-templates>
6102
+ </xsl:when>
6103
+ <xsl:when test="self::text()">
6104
+ <xsl:value-of select="."/>
6105
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6106
+ </xsl:when>
6107
+ <xsl:when test="self::* and local-name(.) = 'xref'">
6108
+ <xsl:variable name="id" select="@id"/>
6109
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
6110
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
6111
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
6112
+
6113
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
6114
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
6115
+
6116
+ <xsl:choose>
6117
+ <!-- 2nd pass -->
6118
+ <!-- if page is equal to page for next and page is not the end of range -->
6119
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
6120
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
6121
+ <!-- [removed_xref] -->
6122
+
6123
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6124
+ <xsl:with-param name="remove">true</xsl:with-param>
6125
+ <xsl:with-param name="target">
6126
+ <xsl:choose>
6127
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
6128
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
6129
+ </xsl:choose>
6130
+ </xsl:with-param>
6131
+ </xsl:apply-templates>
6132
+ </xsl:when>
6133
+
6134
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
6135
+ <!-- remove xref -->
6136
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6137
+ <xsl:with-param name="remove">true</xsl:with-param>
6138
+ </xsl:apply-templates>
6139
+ </xsl:when>
6140
+
6141
+ <xsl:otherwise>
6142
+ <xsl:apply-templates select="." mode="xref_copy">
6143
+ <xsl:with-param name="target" select="$target"/>
6144
+ </xsl:apply-templates>
6145
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6146
+ </xsl:otherwise>
6147
+ </xsl:choose>
6148
+ </xsl:when>
6149
+ <xsl:when test="self::* and local-name(.) = 'ul'">
6150
+ <!-- ul -->
6151
+ <xsl:apply-templates select="." mode="index_update"/>
6152
+ </xsl:when>
6153
+ <xsl:otherwise>
6154
+ <xsl:apply-templates select="." mode="xref_copy">
6155
+ <xsl:with-param name="target" select="$target"/>
6156
+ </xsl:apply-templates>
6157
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6158
+ </xsl:otherwise>
6159
+ </xsl:choose>
6160
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
6161
+ <xsl:param name="target"/>
6162
+ <xsl:copy>
6163
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
6164
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
6165
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
6166
+ </xsl:if>
6167
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
6168
+ </xsl:copy>
6169
+ </xsl:template><xsl:template name="generateIndexXrefId">
6170
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6171
+
6172
+ <xsl:variable name="docid">
6173
+ <xsl:call-template name="getDocumentId"/>
6174
+ </xsl:variable>
6175
+ <xsl:variable name="item_number">
6176
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
6177
+ </xsl:variable>
6178
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6179
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6180
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6181
+ <xsl:apply-templates/>
6182
+ <fo:block>
6183
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6184
+ <fo:block> </fo:block>
6185
+ </xsl:if>
6186
+ </fo:block>
6187
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6188
+ <xsl:apply-templates/>
6189
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6190
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6191
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6192
+ <xsl:apply-templates/>
6193
+ </fo:block>
6194
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6195
+ <fo:inline id="{@id}" font-size="1pt"/>
5516
6196
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5517
6197
  <!-- <row>
5518
6198
  <date>05-07-2013</date>
@@ -5700,7 +6380,7 @@
5700
6380
  <xsl:param name="charDelim" select="', '"/>
5701
6381
  <xsl:choose>
5702
6382
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
5703
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
6383
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5704
6384
  <xsl:sort data-type="text" order="ascending"/>
5705
6385
  <xsl:call-template name="insertKeyword">
5706
6386
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -5709,7 +6389,7 @@
5709
6389
  </xsl:for-each>
5710
6390
  </xsl:when>
5711
6391
  <xsl:otherwise>
5712
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
6392
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5713
6393
  <xsl:call-template name="insertKeyword">
5714
6394
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
5715
6395
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -5726,65 +6406,71 @@
5726
6406
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5727
6407
  </xsl:choose>
5728
6408
  </xsl:template><xsl:template name="addPDFUAmeta">
5729
- <fo:declarations>
5730
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5731
- <pdf:dictionary type="normal" key="ViewerPreferences">
5732
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5733
- </pdf:dictionary>
5734
- </pdf:catalog>
5735
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5736
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5737
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5738
- <!-- Dublin Core properties go here -->
5739
- <dc:title>
5740
- <xsl:variable name="title">
6409
+ <xsl:variable name="lang">
6410
+ <xsl:call-template name="getLang"/>
6411
+ </xsl:variable>
6412
+ <pdf:catalog>
6413
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6414
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6415
+ </pdf:dictionary>
6416
+ </pdf:catalog>
6417
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6418
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6419
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6420
+ <!-- Dublin Core properties go here -->
6421
+ <dc:title>
6422
+ <xsl:variable name="title">
6423
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6424
+
6425
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5741
6426
 
5742
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
5743
6427
 
5744
6428
 
5745
6429
 
5746
6430
 
5747
6431
 
5748
- </xsl:variable>
5749
- <xsl:choose>
5750
- <xsl:when test="normalize-space($title) != ''">
5751
- <xsl:value-of select="$title"/>
5752
- </xsl:when>
5753
- <xsl:otherwise>
5754
- <xsl:text> </xsl:text>
5755
- </xsl:otherwise>
5756
- </xsl:choose>
5757
- </dc:title>
5758
- <dc:creator>
6432
+ </xsl:for-each>
6433
+ </xsl:variable>
6434
+ <xsl:choose>
6435
+ <xsl:when test="normalize-space($title) != ''">
6436
+ <xsl:value-of select="$title"/>
6437
+ </xsl:when>
6438
+ <xsl:otherwise>
6439
+ <xsl:text> </xsl:text>
6440
+ </xsl:otherwise>
6441
+ </xsl:choose>
6442
+ </dc:title>
6443
+ <dc:creator>
6444
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5759
6445
 
5760
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
6446
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6447
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6448
+ <xsl:if test="position() != last()">; </xsl:if>
6449
+ </xsl:for-each>
5761
6450
 
5762
6451
 
5763
6452
 
5764
- </dc:creator>
5765
- <dc:description>
5766
- <xsl:variable name="abstract">
5767
-
5768
- <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
5769
-
5770
-
5771
-
5772
-
5773
-
5774
- </xsl:variable>
5775
- <xsl:value-of select="normalize-space($abstract)"/>
5776
- </dc:description>
5777
- <pdf:Keywords>
5778
- <xsl:call-template name="insertKeywords"/>
5779
- </pdf:Keywords>
5780
- </rdf:Description>
5781
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5782
- <!-- XMP properties go here -->
5783
- <xmp:CreatorTool/>
5784
- </rdf:Description>
5785
- </rdf:RDF>
5786
- </x:xmpmeta>
5787
- </fo:declarations>
6453
+ </xsl:for-each>
6454
+ </dc:creator>
6455
+ <dc:description>
6456
+ <xsl:variable name="abstract">
6457
+
6458
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6459
+
6460
+
6461
+ </xsl:variable>
6462
+ <xsl:value-of select="normalize-space($abstract)"/>
6463
+ </dc:description>
6464
+ <pdf:Keywords>
6465
+ <xsl:call-template name="insertKeywords"/>
6466
+ </pdf:Keywords>
6467
+ </rdf:Description>
6468
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6469
+ <!-- XMP properties go here -->
6470
+ <xmp:CreatorTool/>
6471
+ </rdf:Description>
6472
+ </rdf:RDF>
6473
+ </x:xmpmeta>
5788
6474
  </xsl:template><xsl:template name="getId">
5789
6475
  <xsl:choose>
5790
6476
  <xsl:when test="../@id">