metanorma-iso 1.7.1 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) 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 +18 -16
  6. data/lib/asciidoctor/iso/biblio.rng +4 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +28 -24
  8. data/lib/asciidoctor/iso/front.rb +26 -16
  9. data/lib/asciidoctor/iso/front_id.rb +30 -25
  10. data/lib/asciidoctor/iso/isodoc.rng +172 -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 +22 -109
  14. data/lib/asciidoctor/iso/validate_image.rb +97 -0
  15. data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
  16. data/lib/asciidoctor/iso/validate_section.rb +39 -20
  17. data/lib/asciidoctor/iso/validate_style.rb +36 -24
  18. data/lib/asciidoctor/iso/validate_title.rb +23 -17
  19. data/lib/isodoc/iso/base_convert.rb +19 -2
  20. data/lib/isodoc/iso/html/style-human.css +7 -0
  21. data/lib/isodoc/iso/html/style-iso.css +7 -0
  22. data/lib/isodoc/iso/html_convert.rb +0 -1
  23. data/lib/isodoc/iso/i18n-en.yaml +4 -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 +1092 -208
  28. data/lib/isodoc/iso/iso.international-standard.xsl +1092 -208
  29. data/lib/isodoc/iso/presentation_xml_convert.rb +45 -37
  30. data/lib/isodoc/iso/word_convert.rb +0 -1
  31. data/lib/isodoc/iso/xref.rb +15 -7
  32. data/lib/metanorma/iso/processor.rb +1 -0
  33. data/lib/metanorma/iso/version.rb +1 -1
  34. data/metanorma-iso.gemspec +8 -8
  35. data/spec/asciidoctor/amd_spec.rb +696 -0
  36. data/spec/asciidoctor/base_spec.rb +733 -0
  37. data/spec/asciidoctor/blocks_spec.rb +527 -0
  38. data/spec/asciidoctor/cleanup_spec.rb +1134 -0
  39. data/spec/asciidoctor/inline_spec.rb +195 -0
  40. data/spec/asciidoctor/lists_spec.rb +197 -0
  41. data/spec/asciidoctor/refs_spec.rb +375 -0
  42. data/spec/asciidoctor/section_spec.rb +393 -0
  43. data/spec/asciidoctor/table_spec.rb +329 -0
  44. data/spec/asciidoctor/validate_spec.rb +1627 -0
  45. data/spec/isodoc/amd_spec.rb +967 -946
  46. data/spec/isodoc/blocks_spec.rb +530 -507
  47. data/spec/isodoc/i18n_spec.rb +953 -911
  48. data/spec/isodoc/inline_spec.rb +355 -293
  49. data/spec/isodoc/iso_spec.rb +338 -314
  50. data/spec/isodoc/metadata_spec.rb +392 -382
  51. data/spec/isodoc/postproc_spec.rb +836 -657
  52. data/spec/isodoc/ref_spec.rb +374 -331
  53. data/spec/isodoc/section_spec.rb +821 -519
  54. data/spec/isodoc/table_spec.rb +472 -411
  55. data/spec/isodoc/terms_spec.rb +209 -185
  56. data/spec/isodoc/xref_spec.rb +1370 -1236
  57. data/spec/metanorma/processor_spec.rb +28 -26
  58. data/spec/spec_helper.rb +178 -193
  59. metadata +65 -66
  60. data/.rubocop.ribose.yml +0 -66
  61. data/lib/isodoc/iso/html/scripts.html +0 -178
  62. data/spec/asciidoctor-iso/amd_spec.rb +0 -694
  63. data/spec/asciidoctor-iso/base_spec.rb +0 -713
  64. data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
  65. data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
  66. data/spec/asciidoctor-iso/inline_spec.rb +0 -170
  67. data/spec/asciidoctor-iso/lists_spec.rb +0 -190
  68. data/spec/asciidoctor-iso/refs_spec.rb +0 -317
  69. data/spec/asciidoctor-iso/section_spec.rb +0 -362
  70. data/spec/asciidoctor-iso/table_spec.rb +0 -313
  71. data/spec/asciidoctor-iso/validate_spec.rb +0 -1621
  72. 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"/>
@@ -900,22 +948,24 @@
900
948
  /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup/@type, ' ',
901
949
  /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup/@number)"/>
902
950
  -->
903
- <!-- ISO/TC 34/SC 4/WG 3 -->
904
- <fo:block margin-bottom="12pt">
905
- <xsl:text>ISO</xsl:text>
906
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[@number]">
907
- <xsl:text>/TC </xsl:text><xsl:value-of select="@number"/>
908
- </xsl:for-each>
909
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[@number]">
910
- <xsl:text>/SC </xsl:text>
911
- <xsl:value-of select="@number"/>
912
- </xsl:for-each>
913
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[@number]">
914
- <xsl:text>/WG </xsl:text>
915
- <xsl:value-of select="@number"/>
916
- </xsl:for-each>
917
- </fo:block>
918
-
951
+
952
+ <xsl:if test="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[normalize-space(@number) != ''] or /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[normalize-space(@number) != ''] or /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[normalize-space(@number) != '']">
953
+ <!-- ISO/TC 34/SC 4/WG 3 -->
954
+ <fo:block margin-bottom="12pt">
955
+ <xsl:text>ISO</xsl:text>
956
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[normalize-space(@number) != '']">
957
+ <xsl:text>/TC </xsl:text><xsl:value-of select="@number"/>
958
+ </xsl:for-each>
959
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[normalize-space(@number) != '']">
960
+ <xsl:text>/SC </xsl:text>
961
+ <xsl:value-of select="@number"/>
962
+ </xsl:for-each>
963
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[normalize-space(@number) != '']">
964
+ <xsl:text>/WG </xsl:text>
965
+ <xsl:value-of select="@number"/>
966
+ </xsl:for-each>
967
+ </fo:block>
968
+ </xsl:if>
919
969
  <!-- Secretariat: AFNOR -->
920
970
 
921
971
  <fo:block margin-bottom="100pt">
@@ -977,7 +1027,15 @@
977
1027
  <fo:block font-size="11pt" margin-bottom="8pt"><xsl:value-of select="$linebreak"/></fo:block>
978
1028
  <fo:block-container font-size="40pt" text-align="center" margin-bottom="12pt" border="0.5pt solid black">
979
1029
  <xsl:variable name="stage-title" select="substring-after(substring-before($docidentifierISO, ' '), '/')"/>
980
- <fo:block padding-top="2mm"><xsl:value-of select="$stage-title"/><xsl:text> stage</xsl:text></fo:block>
1030
+ <xsl:choose>
1031
+ <xsl:when test="normalize-space($stage-title) != ''">
1032
+ <fo:block padding-top="2mm"><xsl:value-of select="$stage-title"/><xsl:text> stage</xsl:text></fo:block>
1033
+ </xsl:when>
1034
+ <xsl:otherwise>
1035
+ <xsl:attribute name="border">0pt solid white</xsl:attribute>
1036
+ <fo:block> </fo:block>
1037
+ </xsl:otherwise>
1038
+ </xsl:choose>
981
1039
  </fo:block-container>
982
1040
  <fo:block><xsl:value-of select="$linebreak"/></fo:block>
983
1041
 
@@ -1182,6 +1240,10 @@
1182
1240
  </fo:flow>
1183
1241
  </fo:page-sequence>
1184
1242
 
1243
+
1244
+ <!-- Index -->
1245
+ <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1246
+
1185
1247
  <xsl:if test="$isPublished = 'true'">
1186
1248
  <fo:page-sequence master-reference="last-page" force-page-count="no-force">
1187
1249
  <xsl:call-template name="insertHeaderEven"/>
@@ -1314,7 +1376,10 @@
1314
1376
  </xsl:variable>
1315
1377
 
1316
1378
  <xsl:variable name="type">
1317
- <xsl:value-of select="local-name()"/>
1379
+ <xsl:choose>
1380
+ <xsl:when test="local-name() = 'indexsect'">index</xsl:when>
1381
+ <xsl:otherwise><xsl:value-of select="local-name()"/></xsl:otherwise>
1382
+ </xsl:choose>
1318
1383
  </xsl:variable>
1319
1384
 
1320
1385
  <xsl:variable name="display">
@@ -1347,10 +1412,15 @@
1347
1412
  </xsl:variable>
1348
1413
 
1349
1414
  <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
1415
+ <xsl:if test="$type = 'index'">
1416
+ <xsl:attribute name="level">1</xsl:attribute>
1417
+ </xsl:if>
1350
1418
  <title>
1351
1419
  <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
1352
1420
  </title>
1353
- <xsl:apply-templates mode="contents"/>
1421
+ <xsl:if test="$type != 'index'">
1422
+ <xsl:apply-templates mode="contents"/>
1423
+ </xsl:if>
1354
1424
  </item>
1355
1425
  </xsl:if>
1356
1426
  </xsl:template>
@@ -1588,6 +1658,15 @@
1588
1658
  </xsl:choose>
1589
1659
  </xsl:attribute>
1590
1660
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1661
+ <xsl:if test="@id">
1662
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1663
+ </xsl:if>
1664
+ <!-- bookmarks only in paragraph -->
1665
+ <xsl:if test="count(iso:bookmark) != 0 and count(*) = count(iso:bookmark) and normalize-space() = ''">
1666
+ <xsl:attribute name="font-size">0</xsl:attribute>
1667
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1668
+ <xsl:attribute name="line-height">0</xsl:attribute>
1669
+ </xsl:if>
1591
1670
  <xsl:apply-templates/>
1592
1671
  </xsl:element>
1593
1672
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
@@ -1737,7 +1816,7 @@
1737
1816
  </xsl:for-each>
1738
1817
  </xsl:template>
1739
1818
 
1740
- <xsl:template match="iso:ul//iso:note | iso:ol//iso:note" priority="2"/>
1819
+ <xsl:template match="iso:ul/iso:note | iso:ol/iso:note | iso:ul/iso:li/iso:note | iso:ol/iso:li/iso:note" priority="2"/>
1741
1820
 
1742
1821
  <xsl:template match="iso:li">
1743
1822
  <fo:list-item id="{@id}">
@@ -1749,7 +1828,10 @@
1749
1828
  <fo:list-item-body start-indent="body-start()">
1750
1829
  <fo:block>
1751
1830
  <xsl:apply-templates/>
1752
- <xsl:apply-templates select=".//iso:note" mode="process"/>
1831
+ <!-- <xsl:apply-templates select=".//iso:note" mode="process"/> -->
1832
+ <xsl:for-each select="./iso:note">
1833
+ <xsl:call-template name="note"/>
1834
+ </xsl:for-each>
1753
1835
  </fo:block>
1754
1836
  </fo:list-item-body>
1755
1837
  </fo:list-item>
@@ -1759,6 +1841,10 @@
1759
1841
  <xsl:call-template name="note"/>
1760
1842
  </xsl:template>
1761
1843
 
1844
+ <xsl:template match="*" mode="process">
1845
+ <xsl:apply-templates select="."/>
1846
+ </xsl:template>
1847
+
1762
1848
  <xsl:template match="iso:preferred">
1763
1849
  <fo:block line-height="1.1">
1764
1850
  <fo:block font-weight="bold" keep-with-next="always">
@@ -1840,20 +1926,6 @@
1840
1926
  </xsl:template>
1841
1927
 
1842
1928
 
1843
- <xsl:template match="mathml:math" priority="2">
1844
- <fo:inline font-family="Cambria Math">
1845
- <xsl:variable name="mathml">
1846
- <xsl:apply-templates select="." mode="mathml"/>
1847
- </xsl:variable>
1848
- <fo:instream-foreign-object fox:alt-text="Math">
1849
- <!-- <xsl:copy-of select="."/> -->
1850
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
1851
- </fo:instream-foreign-object>
1852
- </fo:inline>
1853
- </xsl:template>
1854
-
1855
-
1856
-
1857
1929
  <xsl:template match="iso:admonition">
1858
1930
  <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
1859
1931
  <xsl:variable name="type">
@@ -1891,7 +1963,348 @@
1891
1963
  </fo:block>
1892
1964
  </xsl:template>
1893
1965
 
1966
+ <!-- =================== -->
1967
+ <!-- SVG images processing -->
1968
+ <!-- =================== -->
1969
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/>
1970
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
1971
+ <xsl:param name="name"/>
1972
+
1973
+ <xsl:variable name="svg_content">
1974
+ <xsl:apply-templates select="." mode="svg_update"/>
1975
+ </xsl:variable>
1976
+
1977
+ <xsl:variable name="alt-text">
1978
+ <xsl:choose>
1979
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
1980
+ <xsl:value-of select="../*[local-name() = 'name']"/>
1981
+ </xsl:when>
1982
+ <xsl:when test="normalize-space($name) != ''">
1983
+ <xsl:value-of select="$name"/>
1984
+ </xsl:when>
1985
+ <xsl:otherwise>Figure</xsl:otherwise>
1986
+ </xsl:choose>
1987
+ </xsl:variable>
1988
+
1989
+ <xsl:choose>
1990
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
1991
+ <fo:block>
1992
+ <xsl:variable name="width" select="@width"/>
1993
+ <xsl:variable name="height" select="@height"/>
1994
+
1995
+ <xsl:variable name="scale_x">
1996
+ <xsl:choose>
1997
+ <xsl:when test="$width &gt; $width_effective_px">
1998
+ <xsl:value-of select="$width_effective_px div $width"/>
1999
+ </xsl:when>
2000
+ <xsl:otherwise>1</xsl:otherwise>
2001
+ </xsl:choose>
2002
+ </xsl:variable>
2003
+
2004
+ <xsl:variable name="scale_y">
2005
+ <xsl:choose>
2006
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
2007
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
2008
+ </xsl:when>
2009
+ <xsl:otherwise>1</xsl:otherwise>
2010
+ </xsl:choose>
2011
+ </xsl:variable>
2012
+
2013
+ <xsl:variable name="scale">
2014
+ <xsl:choose>
2015
+ <xsl:when test="$scale_y != 1">
2016
+ <xsl:value-of select="$scale_x * $scale_y"/>
2017
+ </xsl:when>
2018
+ <xsl:otherwise>
2019
+ <xsl:value-of select="$scale_x"/>
2020
+ </xsl:otherwise>
2021
+ </xsl:choose>
2022
+ </xsl:variable>
2023
+
2024
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
2025
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
2026
+
2027
+ <fo:table table-layout="fixed" width="100%">
2028
+ <fo:table-column column-width="proportional-column-width(1)"/>
2029
+ <fo:table-column column-width="{$width_scale}px"/>
2030
+ <fo:table-column column-width="proportional-column-width(1)"/>
2031
+ <fo:table-body>
2032
+ <fo:table-row>
2033
+ <fo:table-cell column-number="2">
2034
+ <fo:block>
2035
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
2036
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
2037
+ <fo:block line-height="0" font-size="0">
2038
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
2039
+ <xsl:call-template name="bookmark"/>
2040
+ </xsl:for-each>
2041
+ </fo:block>
2042
+ </xsl:if>
2043
+ <fo:block text-depth="0" line-height="0" font-size="0">
2044
+
2045
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2046
+ <xsl:attribute name="width">100%</xsl:attribute>
2047
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2048
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2049
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2050
+
2051
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
2052
+ </fo:instream-foreign-object>
2053
+ </fo:block>
2054
+
2055
+ <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">
2056
+ <xsl:with-param name="scale" select="$scale"/>
2057
+ </xsl:apply-templates>
2058
+ </fo:block-container>
2059
+ </fo:block>
2060
+ </fo:table-cell>
2061
+ </fo:table-row>
2062
+ </fo:table-body>
2063
+ </fo:table>
2064
+ </fo:block>
2065
+
2066
+ </xsl:when>
2067
+ <xsl:otherwise>
2068
+ <fo:block xsl:use-attribute-sets="image-style">
2069
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2070
+ <xsl:attribute name="width">100%</xsl:attribute>
2071
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2072
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2073
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
2074
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
2075
+ <!-- effective height / width = 1.48, 1.4 - with title -->
2076
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
2077
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
2078
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
2079
+ </xsl:if>
2080
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2081
+ <xsl:copy-of select="$svg_content"/>
2082
+ </fo:instream-foreign-object>
2083
+ </fo:block>
2084
+ </xsl:otherwise>
2085
+ </xsl:choose>
2086
+ </xsl:template>
2087
+
2088
+ <xsl:template match="@*|node()" mode="svg_update">
2089
+ <xsl:copy>
2090
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
2091
+ </xsl:copy>
2092
+ </xsl:template>
2093
+
2094
+ <xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
2095
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
2096
+ <xsl:value-of select="."/>
2097
+ </xsl:attribute>
2098
+ </xsl:template>
2099
+
2100
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
2101
+ <xsl:variable name="svg_content" select="document(@src)"/>
2102
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
2103
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
2104
+ <xsl:call-template name="image_svg">
2105
+ <xsl:with-param name="name" select="$name"/>
2106
+ </xsl:call-template>
2107
+ </xsl:for-each>
2108
+ </xsl:template>
2109
+
2110
+ <xsl:template match="@*|node()" mode="svg_remove_a">
2111
+ <xsl:copy>
2112
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
2113
+ </xsl:copy>
2114
+ </xsl:template>
2115
+
2116
+ <xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
2117
+ <xsl:apply-templates mode="svg_remove_a"/>
2118
+ </xsl:template>
2119
+
2120
+ <xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
2121
+ <xsl:param name="scale"/>
2122
+ <xsl:variable name="dest">
2123
+ <xsl:choose>
2124
+ <xsl:when test="starts-with(@href, '#')">
2125
+ <xsl:value-of select="substring-after(@href, '#')"/>
2126
+ </xsl:when>
2127
+ <xsl:otherwise>
2128
+ <xsl:value-of select="@href"/>
2129
+ </xsl:otherwise>
2130
+ </xsl:choose>
2131
+ </xsl:variable>
2132
+ <xsl:for-each select="./*[local-name() = 'rect']">
2133
+ <xsl:call-template name="insertSVGMapLink">
2134
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
2135
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
2136
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
2137
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
2138
+ <xsl:with-param name="dest" select="$dest"/>
2139
+ </xsl:call-template>
2140
+ </xsl:for-each>
2141
+
2142
+ <xsl:for-each select="./*[local-name() = 'polygon']">
2143
+ <xsl:variable name="points">
2144
+ <xsl:call-template name="split">
2145
+ <xsl:with-param name="pText" select="@points"/>
2146
+ </xsl:call-template>
2147
+ </xsl:variable>
2148
+ <xsl:variable name="x_coords">
2149
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
2150
+ <xsl:sort select="." data-type="number"/>
2151
+ <x><xsl:value-of select="."/></x>
2152
+ </xsl:for-each>
2153
+ </xsl:variable>
2154
+ <xsl:variable name="y_coords">
2155
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
2156
+ <xsl:sort select="." data-type="number"/>
2157
+ <y><xsl:value-of select="."/></y>
2158
+ </xsl:for-each>
2159
+ </xsl:variable>
2160
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
2161
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
2162
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
2163
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
2164
+ <xsl:call-template name="insertSVGMapLink">
2165
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
2166
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
2167
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
2168
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
2169
+ <xsl:with-param name="dest" select="$dest"/>
2170
+ </xsl:call-template>
2171
+ </xsl:for-each>
2172
+
2173
+ <xsl:for-each select="./*[local-name() = 'circle']">
2174
+ <xsl:call-template name="insertSVGMapLink">
2175
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
2176
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
2177
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
2178
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
2179
+ <xsl:with-param name="dest" select="$dest"/>
2180
+ </xsl:call-template>
2181
+ </xsl:for-each>
2182
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
2183
+ <xsl:call-template name="insertSVGMapLink">
2184
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
2185
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
2186
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
2187
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
2188
+ <xsl:with-param name="dest" select="$dest"/>
2189
+ </xsl:call-template>
2190
+ </xsl:for-each>
2191
+ </xsl:template>
2192
+
2193
+ <xsl:template name="insertSVGMapLink">
2194
+ <xsl:param name="left"/>
2195
+ <xsl:param name="top"/>
2196
+ <xsl:param name="width"/>
2197
+ <xsl:param name="height"/>
2198
+ <xsl:param name="dest"/>
2199
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
2200
+ <fo:block font-size="1pt">
2201
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
2202
+ <fo:inline-container inline-progression-dimension="100%">
2203
+ <fo:block-container height="{$height - 1}px" width="100%">
2204
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
2205
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
2206
+ </xsl:if> -->
2207
+ <fo:block> </fo:block></fo:block-container>
2208
+ </fo:inline-container>
2209
+ </fo:basic-link>
2210
+ </fo:block>
2211
+ </fo:block-container>
2212
+ </xsl:template>
2213
+
2214
+ <!-- =================== -->
2215
+ <!-- End SVG images processing -->
2216
+ <!-- =================== -->
2217
+
2218
+ <!-- For express listings PDF attachments -->
2219
+ <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid, '.exp')]" priority="2">
2220
+ <fo:inline xsl:use-attribute-sets="eref-style">
2221
+ <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
2222
+ <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
2223
+ <xsl:if test="normalize-space(@citeas) = ''">
2224
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
2225
+ </xsl:if>
2226
+ <xsl:apply-templates/>
2227
+ </fo:basic-link>
2228
+ </fo:inline>
2229
+ </xsl:template>
2230
+
1894
2231
 
2232
+ <!-- =================== -->
2233
+ <!-- Index processing -->
2234
+ <!-- =================== -->
2235
+
2236
+ <xsl:template match="iso:indexsect"/>
2237
+ <xsl:template match="iso:indexsect" mode="index">
2238
+
2239
+ <fo:page-sequence master-reference="index" force-page-count="no-force">
2240
+ <xsl:variable name="header-title">
2241
+ <xsl:choose>
2242
+ <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2243
+ <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
2244
+ </xsl:when>
2245
+ <xsl:otherwise>
2246
+ <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2247
+ </xsl:otherwise>
2248
+ </xsl:choose>
2249
+ </xsl:variable>
2250
+ <xsl:call-template name="insertHeaderFooter">
2251
+ <xsl:with-param name="header-title" select="$header-title"/>
2252
+ </xsl:call-template>
2253
+
2254
+ <fo:flow flow-name="xsl-region-body">
2255
+ <fo:block id="{@id}" span="all">
2256
+ <xsl:apply-templates select="iso:title"/>
2257
+ </fo:block>
2258
+ <fo:block>
2259
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
2260
+ </fo:block>
2261
+ </fo:flow>
2262
+ </fo:page-sequence>
2263
+ </xsl:template>
2264
+
2265
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:title" priority="4"> -->
2266
+ <xsl:template match="iso:indexsect/iso:title" priority="4">
2267
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt">
2268
+ <!-- Index -->
2269
+ <xsl:apply-templates/>
2270
+ </fo:block>
2271
+ </xsl:template>
2272
+
2273
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:clause/iso:title" priority="4"> -->
2274
+ <xsl:template match="iso:indexsect/iso:clause/iso:title" priority="4">
2275
+ <!-- Letter A, B, C, ... -->
2276
+ <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
2277
+ <xsl:apply-templates/>
2278
+ </fo:block>
2279
+ </xsl:template>
2280
+
2281
+ <xsl:template match="iso:indexsect//iso:li/text()">
2282
+ <!-- to split by '_' and other chars -->
2283
+ <xsl:call-template name="add-zero-spaces-java"/>
2284
+ </xsl:template>
2285
+
2286
+ <xsl:template match="iso:xref" priority="2">
2287
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2288
+ <xsl:choose>
2289
+ <xsl:when test="@pagenumber='true'">
2290
+ <fo:inline>
2291
+ <xsl:if test="@id">
2292
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2293
+ </xsl:if>
2294
+ <fo:page-number-citation ref-id="{@target}"/>
2295
+ </fo:inline>
2296
+ </xsl:when>
2297
+ <xsl:otherwise>
2298
+ <xsl:apply-templates/>
2299
+ </xsl:otherwise>
2300
+ </xsl:choose>
2301
+ </fo:basic-link>
2302
+ </xsl:template>
2303
+
2304
+ <!-- =================== -->
2305
+ <!-- End of Index processing -->
2306
+ <!-- =================== -->
2307
+
1895
2308
 
1896
2309
  <xsl:template name="insertHeaderFooter">
1897
2310
  <xsl:param name="font-weight" select="'bold'"/>
@@ -2285,6 +2698,7 @@
2285
2698
  </xsl:choose>
2286
2699
  </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
2287
2700
 
2701
+
2288
2702
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2289
2703
 
2290
2704
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -2367,6 +2781,7 @@
2367
2781
 
2368
2782
 
2369
2783
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2784
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2370
2785
 
2371
2786
 
2372
2787
 
@@ -2393,6 +2808,9 @@
2393
2808
 
2394
2809
 
2395
2810
 
2811
+ <xsl:attribute name="text-align">justify</xsl:attribute>
2812
+
2813
+
2396
2814
 
2397
2815
 
2398
2816
 
@@ -2620,7 +3038,7 @@
2620
3038
 
2621
3039
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2622
3040
 
2623
-
3041
+
2624
3042
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2625
3043
 
2626
3044
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
@@ -2628,7 +3046,27 @@
2628
3046
 
2629
3047
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2630
3048
 
2631
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
3049
+ </xsl:attribute-set><xsl:variable name="color-added-text">
3050
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
3051
+ </xsl:variable><xsl:attribute-set name="add-style">
3052
+ <xsl:attribute name="color">red</xsl:attribute>
3053
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3054
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
3055
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
3056
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
3057
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
3058
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
3059
+ <xsl:text>red</xsl:text>
3060
+ </xsl:variable><xsl:attribute-set name="del-style">
3061
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
3062
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
3063
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
3064
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
3065
+
3066
+ <xsl:attribute name="font-family">Cambria Math</xsl:attribute>
3067
+
3068
+
3069
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
2632
3070
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2633
3071
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2634
3072
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2673,16 +3111,17 @@
2673
3111
  <xsl:call-template name="add-zero-spaces-java"/>
2674
3112
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2675
3113
 
3114
+ <xsl:variable name="table-preamble">
3115
+
3116
+
3117
+ </xsl:variable>
3118
+
2676
3119
  <xsl:variable name="table">
2677
3120
 
2678
3121
  <xsl:variable name="simple-table">
2679
3122
  <xsl:call-template name="getSimpleTable"/>
2680
3123
  </xsl:variable>
2681
3124
 
2682
-
2683
-
2684
-
2685
-
2686
3125
  <!-- <xsl:if test="$namespace = 'bipm'">
2687
3126
  <fo:block>&#xA0;</fo:block>
2688
3127
  </xsl:if> -->
@@ -2693,7 +3132,7 @@
2693
3132
 
2694
3133
 
2695
3134
 
2696
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3135
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2697
3136
 
2698
3137
  <!-- <xsl:variable name="cols-count">
2699
3138
  <xsl:choose>
@@ -2712,8 +3151,6 @@
2712
3151
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2713
3152
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2714
3153
 
2715
-
2716
-
2717
3154
  <xsl:variable name="colwidths">
2718
3155
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2719
3156
  <xsl:call-template name="calculate-column-widths">
@@ -2741,6 +3178,7 @@
2741
3178
  </xsl:choose>
2742
3179
  </xsl:variable>
2743
3180
 
3181
+
2744
3182
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2745
3183
 
2746
3184
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -2782,6 +3220,12 @@
2782
3220
  </xsl:if>
2783
3221
 
2784
3222
 
3223
+ <xsl:if test="ancestor::*[local-name() = 'table']">
3224
+ <!-- for internal table in table cell -->
3225
+ <attribute name="border">0.5pt solid black</attribute>
3226
+ </xsl:if>
3227
+
3228
+
2785
3229
 
2786
3230
 
2787
3231
  <attribute name="margin-left">0mm</attribute>
@@ -2876,7 +3320,8 @@
2876
3320
  </fo:block-container>
2877
3321
  </xsl:variable>
2878
3322
 
2879
-
3323
+ <xsl:variable name="isAdded" select="@added"/>
3324
+ <xsl:variable name="isDeleted" select="@deleted"/>
2880
3325
 
2881
3326
  <xsl:choose>
2882
3327
  <xsl:when test="@width">
@@ -2890,7 +3335,14 @@
2890
3335
  <fo:table-body>
2891
3336
  <fo:table-row>
2892
3337
  <fo:table-cell column-number="2">
2893
- <fo:block><xsl:copy-of select="$table"/></fo:block>
3338
+ <xsl:copy-of select="$table-preamble"/>
3339
+ <fo:block>
3340
+ <xsl:call-template name="setTrackChangesStyles">
3341
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3342
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3343
+ </xsl:call-template>
3344
+ <xsl:copy-of select="$table"/>
3345
+ </fo:block>
2894
3346
  </fo:table-cell>
2895
3347
  </fo:table-row>
2896
3348
  </fo:table-body>
@@ -2901,7 +3353,22 @@
2901
3353
 
2902
3354
  </xsl:when>
2903
3355
  <xsl:otherwise>
2904
- <xsl:copy-of select="$table"/>
3356
+ <xsl:choose>
3357
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
3358
+ <xsl:copy-of select="$table-preamble"/>
3359
+ <fo:block>
3360
+ <xsl:call-template name="setTrackChangesStyles">
3361
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3362
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3363
+ </xsl:call-template>
3364
+ <xsl:copy-of select="$table"/>
3365
+ </fo:block>
3366
+ </xsl:when>
3367
+ <xsl:otherwise>
3368
+ <xsl:copy-of select="$table-preamble"/>
3369
+ <xsl:copy-of select="$table"/>
3370
+ </xsl:otherwise>
3371
+ </xsl:choose>
2905
3372
  </xsl:otherwise>
2906
3373
  </xsl:choose>
2907
3374
 
@@ -2964,7 +3431,7 @@
2964
3431
  </xsl:for-each>
2965
3432
  </xsl:when>
2966
3433
  <xsl:otherwise>
2967
- <xsl:for-each select="xalan:nodeset($table)//tr">
3434
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
2968
3435
  <xsl:variable name="td_text">
2969
3436
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2970
3437
 
@@ -3034,7 +3501,15 @@
3034
3501
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3035
3502
  <xsl:value-of select="@target"/>
3036
3503
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3037
- <xsl:variable name="math_text" select="normalize-space(.)"/>
3504
+ <xsl:variable name="mathml">
3505
+ <xsl:for-each select="*">
3506
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3507
+ <xsl:copy-of select="."/>
3508
+ </xsl:if>
3509
+ </xsl:for-each>
3510
+ </xsl:variable>
3511
+
3512
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3038
3513
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3039
3514
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3040
3515
  <xsl:param name="cols-count"/>
@@ -3354,7 +3829,8 @@
3354
3829
  <xsl:attribute name="text-align">
3355
3830
  <xsl:choose>
3356
3831
  <xsl:when test="@align">
3357
- <xsl:value-of select="@align"/>
3832
+ <xsl:call-template name="setAlignment"/>
3833
+ <!-- <xsl:value-of select="@align"/> -->
3358
3834
  </xsl:when>
3359
3835
  <xsl:otherwise>center</xsl:otherwise>
3360
3836
  </xsl:choose>
@@ -3372,6 +3848,9 @@
3372
3848
 
3373
3849
 
3374
3850
 
3851
+ <xsl:if test="$lang = 'ar'">
3852
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3853
+ </xsl:if>
3375
3854
  <xsl:if test="@colspan">
3376
3855
  <xsl:attribute name="number-columns-spanned">
3377
3856
  <xsl:value-of select="@colspan"/>
@@ -3403,11 +3882,15 @@
3403
3882
  <xsl:attribute name="text-align">
3404
3883
  <xsl:choose>
3405
3884
  <xsl:when test="@align">
3406
- <xsl:value-of select="@align"/>
3885
+ <xsl:call-template name="setAlignment"/>
3886
+ <!-- <xsl:value-of select="@align"/> -->
3407
3887
  </xsl:when>
3408
3888
  <xsl:otherwise>left</xsl:otherwise>
3409
3889
  </xsl:choose>
3410
3890
  </xsl:attribute>
3891
+ <xsl:if test="$lang = 'ar'">
3892
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3893
+ </xsl:if>
3411
3894
  <!-- and ancestor::*[local-name() = 'thead'] -->
3412
3895
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3413
3896
 
@@ -3425,6 +3908,9 @@
3425
3908
 
3426
3909
 
3427
3910
 
3911
+ <xsl:if test=".//*[local-name() = 'table']">
3912
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3913
+ </xsl:if>
3428
3914
  <xsl:if test="@colspan">
3429
3915
  <xsl:attribute name="number-columns-spanned">
3430
3916
  <xsl:value-of select="@colspan"/>
@@ -3558,13 +4044,13 @@
3558
4044
  </xsl:choose>
3559
4045
  </xsl:variable>
3560
4046
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3561
- <xsl:element name="{$ns}:table">
4047
+ <!-- <xsl:element name="{$ns}:table"> -->
3562
4048
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3563
4049
  <tbody>
3564
4050
  <xsl:apply-templates mode="dl"/>
3565
4051
  </tbody>
3566
4052
  </xsl:for-each>
3567
- </xsl:element>
4053
+ <!-- </xsl:element> -->
3568
4054
  </xsl:variable>
3569
4055
 
3570
4056
  <xsl:call-template name="calculate-column-widths">
@@ -3661,6 +4147,8 @@
3661
4147
  <xsl:apply-templates/>
3662
4148
  </fo:inline>
3663
4149
  </xsl:template><xsl:template match="*[local-name()='dl']">
4150
+ <xsl:variable name="isAdded" select="@added"/>
4151
+ <xsl:variable name="isDeleted" select="@deleted"/>
3664
4152
  <fo:block-container>
3665
4153
 
3666
4154
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -3677,6 +4165,12 @@
3677
4165
  </xsl:attribute>
3678
4166
 
3679
4167
  </xsl:if>
4168
+
4169
+ <xsl:call-template name="setTrackChangesStyles">
4170
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4171
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4172
+ </xsl:call-template>
4173
+
3680
4174
  <fo:block-container>
3681
4175
 
3682
4176
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -3798,11 +4292,11 @@
3798
4292
  </xsl:choose>
3799
4293
  </xsl:variable>
3800
4294
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3801
- <xsl:element name="{$ns}:table">
4295
+ <!-- <xsl:element name="{$ns}:table"> -->
3802
4296
  <tbody>
3803
4297
  <xsl:apply-templates mode="dl"/>
3804
4298
  </tbody>
3805
- </xsl:element>
4299
+ <!-- </xsl:element> -->
3806
4300
  </xsl:variable>
3807
4301
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
3808
4302
  <xsl:variable name="colwidths">
@@ -4071,8 +4565,78 @@
4071
4565
  <fo:inline text-decoration="underline">
4072
4566
  <xsl:apply-templates/>
4073
4567
  </fo:inline>
4568
+ </xsl:template><xsl:template match="*[local-name()='add']">
4569
+ <xsl:choose>
4570
+ <xsl:when test="@amendment">
4571
+ <fo:inline>
4572
+ <xsl:call-template name="insertTag">
4573
+ <xsl:with-param name="kind">A</xsl:with-param>
4574
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4575
+ </xsl:call-template>
4576
+ <xsl:apply-templates/>
4577
+ <xsl:call-template name="insertTag">
4578
+ <xsl:with-param name="type">closing</xsl:with-param>
4579
+ <xsl:with-param name="kind">A</xsl:with-param>
4580
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4581
+ </xsl:call-template>
4582
+ </fo:inline>
4583
+ </xsl:when>
4584
+ <xsl:when test="@corrigenda">
4585
+ <fo:inline>
4586
+ <xsl:call-template name="insertTag">
4587
+ <xsl:with-param name="kind">C</xsl:with-param>
4588
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4589
+ </xsl:call-template>
4590
+ <xsl:apply-templates/>
4591
+ <xsl:call-template name="insertTag">
4592
+ <xsl:with-param name="type">closing</xsl:with-param>
4593
+ <xsl:with-param name="kind">C</xsl:with-param>
4594
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4595
+ </xsl:call-template>
4596
+ </fo:inline>
4597
+ </xsl:when>
4598
+ <xsl:otherwise>
4599
+ <fo:inline xsl:use-attribute-sets="add-style">
4600
+ <xsl:apply-templates/>
4601
+ </fo:inline>
4602
+ </xsl:otherwise>
4603
+ </xsl:choose>
4604
+
4605
+ </xsl:template><xsl:template name="insertTag">
4606
+ <xsl:param name="type"/>
4607
+ <xsl:param name="kind"/>
4608
+ <xsl:param name="value"/>
4609
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4610
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4611
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4612
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4613
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4614
+ <xsl:attribute name="height">5mm</xsl:attribute>
4615
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4616
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4617
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4618
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4619
+ <g>
4620
+ <xsl:if test="$type = 'closing'">
4621
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4622
+ </xsl:if>
4623
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4624
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4625
+ </g>
4626
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4627
+ <xsl:if test="$type = 'closing'">
4628
+ <xsl:attribute name="x">25</xsl:attribute>
4629
+ </xsl:if>
4630
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4631
+ </text>
4632
+ </svg>
4633
+ </fo:instream-foreign-object>
4074
4634
  </xsl:template><xsl:template match="*[local-name()='del']">
4075
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4635
+ <fo:inline xsl:use-attribute-sets="del-style">
4636
+ <xsl:apply-templates/>
4637
+ </fo:inline>
4638
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4639
+ <fo:inline background-color="yellow">
4076
4640
  <xsl:apply-templates/>
4077
4641
  </fo:inline>
4078
4642
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -4409,12 +4973,30 @@
4409
4973
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4410
4974
  <xsl:value-of select="substring($str, 2)"/>
4411
4975
  </xsl:template><xsl:template match="mathml:math">
4412
- <fo:inline font-family="STIX Two Math"> <!-- -->
4976
+ <xsl:variable name="isAdded" select="@added"/>
4977
+ <xsl:variable name="isDeleted" select="@deleted"/>
4978
+
4979
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4980
+
4981
+
4982
+ <xsl:call-template name="setTrackChangesStyles">
4983
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4984
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4985
+ </xsl:call-template>
4413
4986
 
4414
4987
  <xsl:variable name="mathml">
4415
4988
  <xsl:apply-templates select="." mode="mathml"/>
4416
4989
  </xsl:variable>
4417
4990
  <fo:instream-foreign-object fox:alt-text="Math">
4991
+
4992
+
4993
+ <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
4994
+ <xsl:attribute name="width">95%</xsl:attribute>
4995
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4996
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4997
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4998
+ </xsl:if>
4999
+
4418
5000
  <!-- <xsl:copy-of select="."/> -->
4419
5001
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4420
5002
  </fo:instream-foreign-object>
@@ -4433,7 +5015,7 @@
4433
5015
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4434
5016
  </xsl:copy>
4435
5017
  <mathml:mspace width="0.5ex"/>
4436
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
5018
+ </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">
4437
5019
  <xsl:variable name="target">
4438
5020
  <xsl:choose>
4439
5021
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4467,8 +5049,6 @@
4467
5049
  </xsl:otherwise>
4468
5050
  </xsl:choose>
4469
5051
  </fo:inline>
4470
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4471
- <fo:inline id="{@id}"/>
4472
5052
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4473
5053
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4474
5054
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4662,8 +5242,15 @@
4662
5242
  </fo:inline>
4663
5243
  </xsl:if>
4664
5244
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
5245
+ <xsl:variable name="isAdded" select="@added"/>
5246
+ <xsl:variable name="isDeleted" select="@deleted"/>
4665
5247
  <fo:block-container id="{@id}">
4666
5248
 
5249
+ <xsl:call-template name="setTrackChangesStyles">
5250
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5251
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5252
+ </xsl:call-template>
5253
+
4667
5254
  <fo:block>
4668
5255
  <xsl:apply-templates/>
4669
5256
  </fo:block>
@@ -4677,27 +5264,113 @@
4677
5264
  <fo:block id="{@id}">
4678
5265
  <xsl:apply-templates/>
4679
5266
  </fo:block>
5267
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4680
5268
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4681
5269
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4682
5270
  <xsl:apply-templates/>
4683
5271
  </fo:block>
4684
5272
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4685
- <fo:block xsl:use-attribute-sets="image-style">
4686
-
4687
-
4688
- <xsl:variable name="src">
4689
- <xsl:choose>
4690
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4691
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4692
- </xsl:when>
4693
- <xsl:otherwise>
4694
- <xsl:value-of select="@src"/>
4695
- </xsl:otherwise>
4696
- </xsl:choose>
4697
- </xsl:variable>
4698
-
4699
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4700
- </fo:block>
5273
+ <xsl:variable name="isAdded" select="../@added"/>
5274
+ <xsl:variable name="isDeleted" select="../@deleted"/>
5275
+ <xsl:choose>
5276
+ <xsl:when test="ancestor::*[local-name() = 'title']">
5277
+ <fo:inline padding-left="1mm" padding-right="1mm">
5278
+ <xsl:variable name="src">
5279
+ <xsl:call-template name="image_src"/>
5280
+ </xsl:variable>
5281
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
5282
+ </fo:inline>
5283
+ </xsl:when>
5284
+ <xsl:otherwise>
5285
+ <fo:block xsl:use-attribute-sets="image-style">
5286
+
5287
+ <xsl:variable name="src">
5288
+ <xsl:call-template name="image_src"/>
5289
+ </xsl:variable>
5290
+
5291
+ <xsl:choose>
5292
+ <xsl:when test="$isDeleted = 'true'">
5293
+ <!-- enclose in svg -->
5294
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
5295
+ <xsl:attribute name="width">100%</xsl:attribute>
5296
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5297
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5298
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5299
+
5300
+
5301
+ <xsl:apply-templates select="." mode="cross_image"/>
5302
+
5303
+ </fo:instream-foreign-object>
5304
+ </xsl:when>
5305
+ <xsl:otherwise>
5306
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5307
+ </xsl:otherwise>
5308
+ </xsl:choose>
5309
+
5310
+ </fo:block>
5311
+ </xsl:otherwise>
5312
+ </xsl:choose>
5313
+ </xsl:template><xsl:template name="image_src">
5314
+ <xsl:choose>
5315
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5316
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5317
+ </xsl:when>
5318
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5319
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5320
+ </xsl:when>
5321
+ <xsl:otherwise>
5322
+ <xsl:value-of select="@src"/>
5323
+ </xsl:otherwise>
5324
+ </xsl:choose>
5325
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
5326
+ <xsl:choose>
5327
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5328
+ <xsl:variable name="src">
5329
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5330
+ </xsl:variable>
5331
+ <xsl:variable name="width" select="document($src)/@width"/>
5332
+ <xsl:variable name="height" select="document($src)/@height"/>
5333
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5334
+ <image xlink:href="{$src}" style="overflow:visible;"/>
5335
+ </svg>
5336
+ </xsl:when>
5337
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5338
+ <xsl:variable name="src">
5339
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5340
+ </xsl:variable>
5341
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
5342
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
5343
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5344
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5345
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5346
+ <image xlink:href="{$src}" style="overflow:visible;"/>
5347
+ </svg>
5348
+ </xsl:when>
5349
+ <xsl:otherwise>
5350
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
5351
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
5352
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
5353
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
5354
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
5355
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5356
+ <!-- width=<xsl:value-of select="$width"/> -->
5357
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5358
+ <!-- height=<xsl:value-of select="$height"/> -->
5359
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5360
+ <image xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
5361
+ <xsl:call-template name="svg_cross">
5362
+ <xsl:with-param name="width" select="$width"/>
5363
+ <xsl:with-param name="height" select="$height"/>
5364
+ </xsl:call-template>
5365
+ </svg>
5366
+ </xsl:otherwise>
5367
+ </xsl:choose>
5368
+
5369
+ </xsl:template><xsl:template name="svg_cross">
5370
+ <xsl:param name="width"/>
5371
+ <xsl:param name="height"/>
5372
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
5373
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
4701
5374
  </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">
4702
5375
  <xsl:apply-templates mode="contents"/>
4703
5376
  <xsl:text> </xsl:text>
@@ -5216,8 +5889,8 @@
5216
5889
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5217
5890
 
5218
5891
  <xsl:variable name="element">
5219
- block
5220
-
5892
+
5893
+ inline
5221
5894
  <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5222
5895
  </xsl:variable>
5223
5896
 
@@ -5240,6 +5913,7 @@
5240
5913
  <xsl:variable name="element">
5241
5914
 
5242
5915
  inline
5916
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5243
5917
  </xsl:variable>
5244
5918
  <xsl:choose>
5245
5919
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5247,7 +5921,7 @@
5247
5921
  <xsl:apply-templates/>
5248
5922
  </fo:inline>
5249
5923
  </xsl:when>
5250
- <xsl:when test="normalize-space($element) = 'block'">
5924
+ <xsl:when test="contains(normalize-space($element), 'block')">
5251
5925
  <fo:block xsl:use-attribute-sets="example-name-style">
5252
5926
  <xsl:apply-templates/>
5253
5927
  </fo:block>
@@ -5260,9 +5934,15 @@
5260
5934
  </xsl:choose>
5261
5935
 
5262
5936
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5263
-
5937
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5264
5938
  <xsl:variable name="element">
5265
- block
5939
+
5940
+
5941
+ <xsl:choose>
5942
+ <xsl:when test="$num = 1">inline</xsl:when>
5943
+ <xsl:otherwise>block</xsl:otherwise>
5944
+ </xsl:choose>
5945
+
5266
5946
 
5267
5947
  </xsl:variable>
5268
5948
  <xsl:choose>
@@ -5367,29 +6047,47 @@
5367
6047
  <xsl:text>— </xsl:text>
5368
6048
  <xsl:apply-templates/>
5369
6049
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5370
- <fo:inline xsl:use-attribute-sets="eref-style">
5371
- <xsl:if test="@type = 'footnote'">
5372
-
5373
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5374
- <xsl:attribute name="font-size">80%</xsl:attribute>
5375
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5376
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5377
-
5378
-
5379
- </xsl:if>
5380
-
5381
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5382
-
5383
- <xsl:if test="@type = 'inline'">
5384
-
5385
-
5386
-
5387
- </xsl:if>
5388
-
5389
-
5390
- <xsl:apply-templates/>
5391
- </fo:basic-link>
5392
- </fo:inline>
6050
+
6051
+ <xsl:variable name="bibitemid">
6052
+ <xsl:choose>
6053
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
6054
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6055
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
6056
+ </xsl:choose>
6057
+ </xsl:variable>
6058
+
6059
+ <xsl:choose>
6060
+ <xsl:when test="normalize-space($bibitemid) != ''">
6061
+ <fo:inline xsl:use-attribute-sets="eref-style">
6062
+ <xsl:if test="@type = 'footnote'">
6063
+
6064
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6065
+ <xsl:attribute name="font-size">80%</xsl:attribute>
6066
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
6067
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
6068
+
6069
+
6070
+ </xsl:if>
6071
+
6072
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6073
+ <xsl:if test="normalize-space(@citeas) = ''">
6074
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
6075
+ </xsl:if>
6076
+ <xsl:if test="@type = 'inline'">
6077
+
6078
+
6079
+
6080
+ </xsl:if>
6081
+
6082
+ <xsl:apply-templates/>
6083
+ </fo:basic-link>
6084
+
6085
+ </fo:inline>
6086
+ </xsl:when>
6087
+ <xsl:otherwise>
6088
+ <fo:inline><xsl:apply-templates/></fo:inline>
6089
+ </xsl:otherwise>
6090
+ </xsl:choose>
5393
6091
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5394
6092
  <!-- zero-space char -->
5395
6093
  <xsl:variable name="depth">
@@ -5447,7 +6145,8 @@
5447
6145
  </fo:inline>
5448
6146
  </xsl:when>
5449
6147
  <xsl:otherwise>
5450
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
6148
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
6149
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5451
6150
  </xsl:otherwise>
5452
6151
  </xsl:choose>
5453
6152
 
@@ -5572,6 +6271,153 @@
5572
6271
  </fo:block>
5573
6272
  </xsl:otherwise>
5574
6273
  </xsl:choose>
6274
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
6275
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
6276
+ <bookmark><xsl:value-of select="@id"/></bookmark>
6277
+ </xsl:for-each>
6278
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
6279
+ <xsl:copy>
6280
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
6281
+ </xsl:copy>
6282
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
6283
+ <xsl:variable name="id">
6284
+ <xsl:call-template name="generateIndexXrefId"/>
6285
+ </xsl:variable>
6286
+ <xsl:copy> <!-- add id to xref -->
6287
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
6288
+ <xsl:attribute name="id">
6289
+ <xsl:value-of select="$id"/>
6290
+ </xsl:attribute>
6291
+ <xsl:apply-templates mode="index_add_id"/>
6292
+ </xsl:copy>
6293
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6294
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6295
+ <xsl:if test="@to">
6296
+ <xsl:value-of select="$dash"/>
6297
+ <xsl:copy>
6298
+ <xsl:copy-of select="@*"/>
6299
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
6300
+ <xsl:attribute name="id">
6301
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
6302
+ </xsl:attribute>
6303
+ <xsl:apply-templates mode="index_add_id"/>
6304
+ </xsl:copy>
6305
+ </xsl:if>
6306
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
6307
+ <xsl:copy>
6308
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
6309
+ </xsl:copy>
6310
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
6311
+ <xsl:copy>
6312
+ <xsl:apply-templates select="@*" mode="index_update"/>
6313
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
6314
+ </xsl:copy>
6315
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
6316
+ <xsl:param name="element"/>
6317
+ <xsl:param name="remove" select="'false'"/>
6318
+ <xsl:param name="target"/>
6319
+ <!-- <node></node> -->
6320
+ <xsl:choose>
6321
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6322
+ <!-- skip text (i.e. remove it) and process next element -->
6323
+ <!-- [removed_<xsl:value-of select="."/>] -->
6324
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6325
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
6326
+ </xsl:apply-templates>
6327
+ </xsl:when>
6328
+ <xsl:when test="self::text()">
6329
+ <xsl:value-of select="."/>
6330
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6331
+ </xsl:when>
6332
+ <xsl:when test="self::* and local-name(.) = 'xref'">
6333
+ <xsl:variable name="id" select="@id"/>
6334
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
6335
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
6336
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
6337
+
6338
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
6339
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
6340
+
6341
+ <xsl:choose>
6342
+ <!-- 2nd pass -->
6343
+ <!-- if page is equal to page for next and page is not the end of range -->
6344
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
6345
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
6346
+ <!-- [removed_xref] -->
6347
+
6348
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6349
+ <xsl:with-param name="remove">true</xsl:with-param>
6350
+ <xsl:with-param name="target">
6351
+ <xsl:choose>
6352
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
6353
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
6354
+ </xsl:choose>
6355
+ </xsl:with-param>
6356
+ </xsl:apply-templates>
6357
+ </xsl:when>
6358
+
6359
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
6360
+ <!-- remove xref -->
6361
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6362
+ <xsl:with-param name="remove">true</xsl:with-param>
6363
+ </xsl:apply-templates>
6364
+ </xsl:when>
6365
+
6366
+ <xsl:otherwise>
6367
+ <xsl:apply-templates select="." mode="xref_copy">
6368
+ <xsl:with-param name="target" select="$target"/>
6369
+ </xsl:apply-templates>
6370
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6371
+ </xsl:otherwise>
6372
+ </xsl:choose>
6373
+ </xsl:when>
6374
+ <xsl:when test="self::* and local-name(.) = 'ul'">
6375
+ <!-- ul -->
6376
+ <xsl:apply-templates select="." mode="index_update"/>
6377
+ </xsl:when>
6378
+ <xsl:otherwise>
6379
+ <xsl:apply-templates select="." mode="xref_copy">
6380
+ <xsl:with-param name="target" select="$target"/>
6381
+ </xsl:apply-templates>
6382
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6383
+ </xsl:otherwise>
6384
+ </xsl:choose>
6385
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
6386
+ <xsl:param name="target"/>
6387
+ <xsl:copy>
6388
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
6389
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
6390
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
6391
+ </xsl:if>
6392
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
6393
+ </xsl:copy>
6394
+ </xsl:template><xsl:template name="generateIndexXrefId">
6395
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6396
+
6397
+ <xsl:variable name="docid">
6398
+ <xsl:call-template name="getDocumentId"/>
6399
+ </xsl:variable>
6400
+ <xsl:variable name="item_number">
6401
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
6402
+ </xsl:variable>
6403
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6404
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6405
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6406
+ <xsl:apply-templates/>
6407
+ <fo:block>
6408
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6409
+ <fo:block> </fo:block>
6410
+ </xsl:if>
6411
+ </fo:block>
6412
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6413
+ <xsl:apply-templates/>
6414
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6415
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6416
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6417
+ <xsl:apply-templates/>
6418
+ </fo:block>
6419
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6420
+ <fo:inline id="{@id}" font-size="1pt"/>
5575
6421
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5576
6422
  <!-- <row>
5577
6423
  <date>05-07-2013</date>
@@ -5788,70 +6634,68 @@
5788
6634
  <xsl:variable name="lang">
5789
6635
  <xsl:call-template name="getLang"/>
5790
6636
  </xsl:variable>
5791
- <fo:declarations>
5792
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5793
- <pdf:dictionary type="normal" key="ViewerPreferences">
5794
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5795
- </pdf:dictionary>
5796
- </pdf:catalog>
5797
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5798
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5799
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5800
- <!-- Dublin Core properties go here -->
5801
- <dc:title>
5802
- <xsl:variable name="title">
5803
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5804
-
5805
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5806
-
5807
-
5808
-
5809
-
5810
-
5811
-
5812
- </xsl:for-each>
5813
- </xsl:variable>
5814
- <xsl:choose>
5815
- <xsl:when test="normalize-space($title) != ''">
5816
- <xsl:value-of select="$title"/>
5817
- </xsl:when>
5818
- <xsl:otherwise>
5819
- <xsl:text> </xsl:text>
5820
- </xsl:otherwise>
5821
- </xsl:choose>
5822
- </dc:title>
5823
- <dc:creator>
6637
+ <pdf:catalog>
6638
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6639
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6640
+ </pdf:dictionary>
6641
+ </pdf:catalog>
6642
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6643
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6644
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6645
+ <!-- Dublin Core properties go here -->
6646
+ <dc:title>
6647
+ <xsl:variable name="title">
5824
6648
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5825
6649
 
5826
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5827
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
5828
- <xsl:if test="position() != last()">; </xsl:if>
5829
- </xsl:for-each>
6650
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5830
6651
 
5831
6652
 
5832
6653
 
5833
- </xsl:for-each>
5834
- </dc:creator>
5835
- <dc:description>
5836
- <xsl:variable name="abstract">
5837
6654
 
5838
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5839
6655
 
5840
-
5841
- </xsl:variable>
5842
- <xsl:value-of select="normalize-space($abstract)"/>
5843
- </dc:description>
5844
- <pdf:Keywords>
5845
- <xsl:call-template name="insertKeywords"/>
5846
- </pdf:Keywords>
5847
- </rdf:Description>
5848
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5849
- <!-- XMP properties go here -->
5850
- <xmp:CreatorTool/>
5851
- </rdf:Description>
5852
- </rdf:RDF>
5853
- </x:xmpmeta>
5854
- </fo:declarations>
6656
+
6657
+ </xsl:for-each>
6658
+ </xsl:variable>
6659
+ <xsl:choose>
6660
+ <xsl:when test="normalize-space($title) != ''">
6661
+ <xsl:value-of select="$title"/>
6662
+ </xsl:when>
6663
+ <xsl:otherwise>
6664
+ <xsl:text> </xsl:text>
6665
+ </xsl:otherwise>
6666
+ </xsl:choose>
6667
+ </dc:title>
6668
+ <dc:creator>
6669
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6670
+
6671
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6672
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6673
+ <xsl:if test="position() != last()">; </xsl:if>
6674
+ </xsl:for-each>
6675
+
6676
+
6677
+
6678
+ </xsl:for-each>
6679
+ </dc:creator>
6680
+ <dc:description>
6681
+ <xsl:variable name="abstract">
6682
+
6683
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6684
+
6685
+
6686
+ </xsl:variable>
6687
+ <xsl:value-of select="normalize-space($abstract)"/>
6688
+ </dc:description>
6689
+ <pdf:Keywords>
6690
+ <xsl:call-template name="insertKeywords"/>
6691
+ </pdf:Keywords>
6692
+ </rdf:Description>
6693
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6694
+ <!-- XMP properties go here -->
6695
+ <xmp:CreatorTool/>
6696
+ </rdf:Description>
6697
+ </rdf:RDF>
6698
+ </x:xmpmeta>
5855
6699
  </xsl:template><xsl:template name="getId">
5856
6700
  <xsl:choose>
5857
6701
  <xsl:when test="../@id">
@@ -6015,4 +6859,44 @@
6015
6859
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6016
6860
  </xsl:choose>
6017
6861
 
6862
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6863
+ <xsl:param name="isAdded"/>
6864
+ <xsl:param name="isDeleted"/>
6865
+ <xsl:choose>
6866
+ <xsl:when test="local-name() = 'math'">
6867
+ <xsl:if test="$isAdded = 'true'">
6868
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6869
+ </xsl:if>
6870
+ <xsl:if test="$isDeleted = 'true'">
6871
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6872
+ </xsl:if>
6873
+ </xsl:when>
6874
+ <xsl:otherwise>
6875
+ <xsl:if test="$isAdded = 'true'">
6876
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6877
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6878
+ </xsl:if>
6879
+ <xsl:if test="$isDeleted = 'true'">
6880
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6881
+ <xsl:if test="local-name() = 'table'">
6882
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6883
+ </xsl:if>
6884
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6885
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6886
+ </xsl:if>
6887
+ </xsl:otherwise>
6888
+ </xsl:choose>
6889
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6890
+ <xsl:if test="$lang = 'ar'">
6891
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6892
+ </xsl:if>
6893
+ </xsl:template><xsl:template name="setAlignment">
6894
+ <xsl:param name="align" select="normalize-space(@align)"/>
6895
+ <xsl:choose>
6896
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6897
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6898
+ <xsl:when test="$align != ''">
6899
+ <xsl:value-of select="$align"/>
6900
+ </xsl:when>
6901
+ </xsl:choose>
6018
6902
  </xsl:template></xsl:stylesheet>