metanorma-itu 1.2.14 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -12
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +7 -1
  5. data/lib/asciidoctor/itu/biblio.rng +4 -6
  6. data/lib/asciidoctor/itu/cleanup.rb +9 -6
  7. data/lib/asciidoctor/itu/converter.rb +31 -27
  8. data/lib/asciidoctor/itu/front.rb +35 -23
  9. data/lib/asciidoctor/itu/isodoc.rng +327 -2
  10. data/lib/asciidoctor/itu/itu.rng +0 -30
  11. data/lib/isodoc/itu/base_convert.rb +25 -37
  12. data/lib/isodoc/itu/html/_coverpage.css +7 -0
  13. data/lib/isodoc/itu/html/header.html +8 -8
  14. data/lib/isodoc/itu/html/htmlstyle.css +14 -7
  15. data/lib/isodoc/itu/html/htmlstyle.scss +0 -9
  16. data/lib/isodoc/itu/html/itu.css +0 -7
  17. data/lib/isodoc/itu/html/itu.scss +0 -7
  18. data/lib/isodoc/itu/html_convert.rb +0 -1
  19. data/lib/isodoc/itu/i18n-ar.yaml +87 -0
  20. data/lib/isodoc/itu/i18n-de.yaml +88 -0
  21. data/lib/isodoc/itu/i18n-en.yaml +1 -0
  22. data/lib/isodoc/itu/i18n-es.yaml +88 -0
  23. data/lib/isodoc/itu/i18n-fr.yaml +88 -0
  24. data/lib/isodoc/itu/i18n-ru.yaml +88 -0
  25. data/lib/isodoc/itu/i18n-zh-Hans.yaml +81 -0
  26. data/lib/isodoc/itu/i18n.rb +14 -4
  27. data/lib/isodoc/itu/itu.implementers-guide.xsl +962 -392
  28. data/lib/isodoc/itu/itu.in-force.xsl +962 -392
  29. data/lib/isodoc/itu/itu.recommendation-annex.xsl +962 -392
  30. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +962 -392
  31. data/lib/isodoc/itu/itu.recommendation.xsl +962 -392
  32. data/lib/isodoc/itu/itu.resolution.xsl +962 -392
  33. data/lib/isodoc/itu/itu.technical-paper.xsl +962 -392
  34. data/lib/isodoc/itu/itu.technical-report.xsl +962 -392
  35. data/lib/isodoc/itu/metadata.rb +3 -3
  36. data/lib/isodoc/itu/presentation_xml_convert.rb +1 -1
  37. data/lib/isodoc/itu/xref.rb +1 -2
  38. data/lib/metanorma/itu/version.rb +1 -1
  39. data/metanorma-itu.gemspec +6 -6
  40. metadata +38 -33
  41. data/lib/asciidoctor/itu/macros.rb +0 -27
@@ -3,7 +3,9 @@
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
 
@@ -116,10 +118,17 @@
116
118
 
117
119
  <xsl:template match="/">
118
120
  <xsl:call-template name="namespaceCheck"/>
119
- <fo:root font-family="Times New Roman, STIX Two Math" font-size="12pt" xml:lang="{$lang}">
121
+ <fo:root xsl:use-attribute-sets="root-style">
122
+ <xsl:if test="$lang != 'ar'">
123
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
124
+ </xsl:if>
120
125
  <xsl:if test="$doctype = 'resolution'">
121
126
  <xsl:attribute name="font-size">11pt</xsl:attribute>
122
127
  </xsl:if>
128
+ <xsl:call-template name="setWritingMode"/>
129
+ <xsl:if test="$lang = 'ar'">
130
+ <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
131
+ </xsl:if>
123
132
  <fo:layout-master-set>
124
133
 
125
134
 
@@ -187,7 +196,9 @@
187
196
  </fo:page-sequence-master>
188
197
  </fo:layout-master-set>
189
198
 
190
- <xsl:call-template name="addPDFUAmeta"/>
199
+ <fo:declarations>
200
+ <xsl:call-template name="addPDFUAmeta"/>
201
+ </fo:declarations>
191
202
 
192
203
  <xsl:call-template name="addBookmarks">
193
204
  <xsl:with-param name="contents" select="$contents"/>
@@ -318,7 +329,7 @@
318
329
  </xsl:if>
319
330
 
320
331
  <!-- cover page -->
321
- <fo:page-sequence master-reference="cover-page">
332
+ <fo:page-sequence master-reference="cover-page" writing-mode="lr-tb">
322
333
  <xsl:if test="$doctype = 'resolution'">
323
334
  <xsl:attribute name="force-page-count">no-force</xsl:attribute>
324
335
  </xsl:if>
@@ -339,7 +350,7 @@
339
350
  </fo:block-container>
340
351
 
341
352
  <fo:block-container absolute-position="fixed" left="-7mm" top="0" font-size="0">
342
- <fo:block>
353
+ <fo:block text-align="left">
343
354
  <fo:external-graphic src="{concat('data:image/png;base64,', normalize-space($Image-Fond-Rec))}" width="43.6mm" content-height="299.2mm" content-width="scale-to-fit" scaling="uniform" fox:alt-text="Image Cover Page"/>
344
355
  </fo:block>
345
356
  </fo:block-container>
@@ -355,12 +366,15 @@
355
366
  <fo:block> </fo:block>
356
367
  </fo:table-cell>
357
368
  <fo:table-cell number-columns-spanned="3">
358
- <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray"> <!-- margin-top="16pt" letter-spacing="4pt", Helvetica for letter-spacing working -->
359
- <fo:block><xsl:value-of select="$linebreak"/></fo:block>
360
- <xsl:call-template name="addLetterSpacing">
361
- <xsl:with-param name="text" select="/itu:itu-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/>
362
- </xsl:call-template>
363
- </fo:block>
369
+ <fo:block-container>
370
+ <xsl:call-template name="setWritingMode"/>
371
+ <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray"> <!-- margin-top="16pt" letter-spacing="4pt", Helvetica for letter-spacing working -->
372
+ <fo:block><xsl:value-of select="$linebreak"/></fo:block>
373
+ <xsl:call-template name="addLetterSpacing">
374
+ <xsl:with-param name="text" select="/itu:itu-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/>
375
+ </xsl:call-template>
376
+ </fo:block>
377
+ </fo:block-container>
364
378
  </fo:table-cell>
365
379
  </fo:table-row>
366
380
  <fo:table-row>
@@ -368,48 +382,56 @@
368
382
  <fo:block> </fo:block>
369
383
  </fo:table-cell>
370
384
  <fo:table-cell padding-top="2mm" padding-bottom="-1mm">
371
- <fo:block font-family="Arial" font-size="36pt" font-weight="bold" margin-top="6pt" letter-spacing="2pt"> <!-- Helvetica for letter-spacing working -->
372
- <xsl:value-of select="substring-before(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/>
373
- </fo:block>
385
+ <fo:block-container>
386
+ <xsl:call-template name="setWritingMode"/>
387
+ <fo:block font-family="Arial" font-size="36pt" font-weight="bold" margin-top="6pt" letter-spacing="2pt"> <!-- Helvetica for letter-spacing working -->
388
+ <fo:block>
389
+ <xsl:value-of select="substring-before(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/>
390
+ </fo:block>
391
+ </fo:block>
392
+ </fo:block-container>
374
393
  </fo:table-cell>
375
394
  <fo:table-cell padding-top="1mm" number-columns-spanned="2" padding-bottom="-1mm">
376
- <fo:block font-size="30pt" font-weight="bold" text-align="right" margin-top="12pt" padding="0mm">
377
- <xsl:choose>
378
- <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'">
379
- <xsl:value-of select="$doctypeTitle"/>
380
- </xsl:when>
381
- <xsl:when test="$doctype = 'implementers-guide'">
382
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU-Recommendation']"/>
383
- <xsl:text> </xsl:text>
384
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/>
385
- </xsl:when>
386
- <xsl:when test="$doctype = 'resolution'"/>
387
- <xsl:when test="$doctype = 'recommendation-supplement'">
388
- <!-- Series L -->
389
- <xsl:variable name="title-series">
390
- <xsl:call-template name="getLocalizedString">
391
- <xsl:with-param name="key">series</xsl:with-param>
392
- </xsl:call-template>
393
- </xsl:variable>
394
- <xsl:call-template name="capitalize">
395
- <xsl:with-param name="str" select="$title-series"/>
396
- </xsl:call-template>
397
- <xsl:text> </xsl:text>
398
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type='main']/itu:title[@type='abbrev']"/>
399
- <!-- Ex. Supplement 37 -->
400
- <fo:block font-size="18pt">
401
- <xsl:call-template name="getLocalizedString">
402
- <xsl:with-param name="key">doctype_dict.recommendation-supplement</xsl:with-param>
395
+ <fo:block-container>
396
+ <xsl:call-template name="setWritingMode"/>
397
+ <fo:block font-size="30pt" font-weight="bold" text-align="right" margin-top="12pt" padding="0mm">
398
+ <xsl:choose>
399
+ <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'">
400
+ <xsl:value-of select="$doctypeTitle"/>
401
+ </xsl:when>
402
+ <xsl:when test="$doctype = 'implementers-guide'">
403
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU-Recommendation']"/>
404
+ <xsl:text> </xsl:text>
405
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/>
406
+ </xsl:when>
407
+ <xsl:when test="$doctype = 'resolution'"/>
408
+ <xsl:when test="$doctype = 'recommendation-supplement'">
409
+ <!-- Series L -->
410
+ <xsl:variable name="title-series">
411
+ <xsl:call-template name="getLocalizedString">
412
+ <xsl:with-param name="key">series</xsl:with-param>
413
+ </xsl:call-template>
414
+ </xsl:variable>
415
+ <xsl:call-template name="capitalize">
416
+ <xsl:with-param name="str" select="$title-series"/>
403
417
  </xsl:call-template>
404
418
  <xsl:text> </xsl:text>
405
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docnumber"/>
406
- </fo:block>
407
- </xsl:when>
408
- <xsl:otherwise>
409
- <xsl:value-of select="substring-after(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/>
410
- </xsl:otherwise>
411
- </xsl:choose>
412
- </fo:block>
419
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type='main']/itu:title[@type='abbrev']"/>
420
+ <!-- Ex. Supplement 37 -->
421
+ <fo:block font-size="18pt">
422
+ <xsl:call-template name="getLocalizedString">
423
+ <xsl:with-param name="key">doctype_dict.recommendation-supplement</xsl:with-param>
424
+ </xsl:call-template>
425
+ <xsl:text> </xsl:text>
426
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docnumber"/>
427
+ </fo:block>
428
+ </xsl:when>
429
+ <xsl:otherwise>
430
+ <xsl:value-of select="substring-after(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/>
431
+ </xsl:otherwise>
432
+ </xsl:choose>
433
+ </fo:block>
434
+ </fo:block-container>
413
435
  </fo:table-cell>
414
436
  </fo:table-row>
415
437
  <fo:table-row height="17.2mm">
@@ -417,36 +439,48 @@
417
439
  <fo:block> </fo:block>
418
440
  </fo:table-cell>
419
441
  <fo:table-cell font-size="10pt" number-columns-spanned="2" padding-top="1mm">
420
- <fo:block>
421
- <xsl:text>TELECOMMUNICATION</xsl:text>
422
- </fo:block>
423
- <fo:block>
424
- <xsl:text>STANDARDIZATION SECTOR</xsl:text>
425
- </fo:block>
426
- <fo:block>
427
- <xsl:text>OF ITU</xsl:text>
428
- </fo:block>
442
+ <fo:block-container>
443
+ <xsl:call-template name="setWritingMode"/>
444
+ <fo:block>
445
+ <xsl:text>TELECOMMUNICATION</xsl:text>
446
+ </fo:block>
447
+ <fo:block>
448
+ <xsl:text>STANDARDIZATION SECTOR</xsl:text>
449
+ </fo:block>
450
+ <fo:block>
451
+ <xsl:text>OF ITU</xsl:text>
452
+ </fo:block>
453
+ </fo:block-container>
429
454
  </fo:table-cell>
430
455
  <fo:table-cell text-align="right">
431
456
  <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
432
- <fo:block font-size="18pt" font-weight="bold">
433
- <xsl:variable name="title-annex">
434
- <xsl:call-template name="getTitle">
435
- <xsl:with-param name="name" select="'title-annex'"/>
436
- </xsl:call-template>
437
- </xsl:variable>
438
- <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
439
- </fo:block>
457
+ <fo:block-container>
458
+ <xsl:call-template name="setWritingMode"/>
459
+ <fo:block font-size="18pt" font-weight="bold">
460
+ <xsl:variable name="title-annex">
461
+ <xsl:call-template name="getTitle">
462
+ <xsl:with-param name="name" select="'title-annex'"/>
463
+ </xsl:call-template>
464
+ </xsl:variable>
465
+ <xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
466
+ </fo:block>
467
+ </fo:block-container>
440
468
  </xsl:if>
441
469
  <xsl:if test="$isAmendment != ''">
442
- <fo:block font-size="18pt" font-weight="bold">
443
- <xsl:value-of select="$isAmendment"/>
444
- </fo:block>
470
+ <fo:block-container>
471
+ <xsl:call-template name="setWritingMode"/>
472
+ <fo:block font-size="18pt" font-weight="bold">
473
+ <xsl:value-of select="$isAmendment"/>
474
+ </fo:block>
475
+ </fo:block-container>
445
476
  </xsl:if>
446
477
  <xsl:if test="$isCorrigendum != ''">
447
- <fo:block font-size="18pt" font-weight="bold">
448
- <xsl:value-of select="$isCorrigendum"/>
449
- </fo:block>
478
+ <fo:block-container>
479
+ <xsl:call-template name="setWritingMode"/>
480
+ <fo:block font-size="18pt" font-weight="bold">
481
+ <xsl:value-of select="$isCorrigendum"/>
482
+ </fo:block>
483
+ </fo:block-container>
450
484
  </xsl:if>
451
485
  <fo:block font-size="14pt">
452
486
  <xsl:choose>
@@ -471,79 +505,81 @@
471
505
  <fo:block> </fo:block>
472
506
  </fo:table-cell>
473
507
  <fo:table-cell font-size="16pt" number-columns-spanned="3" border-bottom="0.5mm solid black" padding-right="2mm" display-align="after">
474
- <fo:block padding-bottom="7mm">
475
- <xsl:if test="$doctype = 'resolution'">
476
- <fo:block><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting"/></fo:block>
477
- <fo:block>
478
- <xsl:variable name="meeting-place" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-place"/>
479
- <xsl:variable name="meeting-date_from" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:from"/>
480
- <xsl:variable name="meeting-date_from_year" select="substring($meeting-date_from, 1, 4)"/>
481
- <xsl:variable name="meeting-date_to" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:to"/>
482
- <xsl:variable name="meeting-date_to_year" select="substring($meeting-date_to, 1, 4)"/>
483
-
484
- <xsl:variable name="date_format">
485
- <xsl:choose>
486
- <xsl:when test="$meeting-date_from_year = $meeting-date_to_year">ddMM</xsl:when>
487
- <xsl:otherwise>ddMMyyyy</xsl:otherwise>
488
- </xsl:choose>
489
- </xsl:variable>
490
- <xsl:variable name="meeting-date_from_str">
491
- <xsl:call-template name="convertDateLocalized">
492
- <xsl:with-param name="date" select="$meeting-date_from"/>
493
- <xsl:with-param name="format" select="$date_format"/>
494
- </xsl:call-template>
495
- </xsl:variable>
508
+ <fo:block-container>
509
+ <xsl:call-template name="setWritingMode"/>
510
+ <fo:block padding-bottom="7mm">
511
+ <xsl:if test="$doctype = 'resolution'">
512
+ <fo:block><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting"/></fo:block>
513
+ <fo:block>
514
+ <xsl:variable name="meeting-place" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-place"/>
515
+ <xsl:variable name="meeting-date_from" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:from"/>
516
+ <xsl:variable name="meeting-date_from_year" select="substring($meeting-date_from, 1, 4)"/>
517
+ <xsl:variable name="meeting-date_to" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:meeting-date/itu:to"/>
518
+ <xsl:variable name="meeting-date_to_year" select="substring($meeting-date_to, 1, 4)"/>
519
+
520
+ <xsl:variable name="date_format">
521
+ <xsl:choose>
522
+ <xsl:when test="$meeting-date_from_year = $meeting-date_to_year">ddMM</xsl:when>
523
+ <xsl:otherwise>ddMMyyyy</xsl:otherwise>
524
+ </xsl:choose>
525
+ </xsl:variable>
526
+ <xsl:variable name="meeting-date_from_str">
527
+ <xsl:call-template name="convertDateLocalized">
528
+ <xsl:with-param name="date" select="$meeting-date_from"/>
529
+ <xsl:with-param name="format" select="$date_format"/>
530
+ </xsl:call-template>
531
+ </xsl:variable>
496
532
 
497
- <xsl:variable name="meeting-date_to_str">
498
- <xsl:call-template name="convertDateLocalized">
499
- <xsl:with-param name="date" select="$meeting-date_to"/>
500
- <xsl:with-param name="format" select="'ddMMyyyy'"/>
501
- </xsl:call-template>
502
- </xsl:variable>
503
-
504
- <xsl:value-of select="$meeting-place"/>
505
- <xsl:if test="$meeting-place != '' and (normalize-space($meeting-date_from_str) != '' or normalize-space($meeting-date_to_str != ''))">
506
- <xsl:text>, </xsl:text>
507
- <xsl:value-of select="$meeting-date_from_str"/>
508
- <xsl:if test="normalize-space($meeting-date_from_str) != '' and normalize-space($meeting-date_to_str) != ''">
509
- <xsl:text> – </xsl:text>
510
- </xsl:if>
511
- <xsl:value-of select="$meeting-date_to_str"/>
512
- </xsl:if>
513
- </fo:block>
514
- </xsl:if>
515
- <fo:block text-transform="uppercase">
516
- <xsl:variable name="series_title" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']/itu:title[@type = 'full'])"/>
517
- <xsl:if test="$series_title != ''">
518
- <xsl:variable name="title">
519
- <xsl:if test="$doctype != 'resolution'">
520
- <!-- <xsl:text>Series </xsl:text> -->
521
- <xsl:call-template name="getLocalizedString">
522
- <xsl:with-param name="key">series</xsl:with-param>
533
+ <xsl:variable name="meeting-date_to_str">
534
+ <xsl:call-template name="convertDateLocalized">
535
+ <xsl:with-param name="date" select="$meeting-date_to"/>
536
+ <xsl:with-param name="format" select="'ddMMyyyy'"/>
523
537
  </xsl:call-template>
524
- <xsl:text> </xsl:text>
538
+ </xsl:variable>
539
+
540
+ <xsl:value-of select="$meeting-place"/>
541
+ <xsl:if test="$meeting-place != '' and (normalize-space($meeting-date_from_str) != '' or normalize-space($meeting-date_to_str != ''))">
542
+ <xsl:text>, </xsl:text>
543
+ <xsl:value-of select="$meeting-date_from_str"/>
544
+ <xsl:if test="normalize-space($meeting-date_from_str) != '' and normalize-space($meeting-date_to_str) != ''">
545
+ <xsl:text> – </xsl:text>
546
+ </xsl:if>
547
+ <xsl:value-of select="$meeting-date_to_str"/>
525
548
  </xsl:if>
526
- <xsl:value-of select="$series_title"/>
527
- </xsl:variable>
528
- <xsl:value-of select="$title"/>
549
+ </fo:block>
529
550
  </xsl:if>
530
- </fo:block>
531
- <xsl:choose>
532
- <xsl:when test="$doctype = 'recommendation-supplement'"/>
533
- <xsl:otherwise>
534
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
535
- <fo:block margin-top="6pt">
536
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
537
- <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
538
- <xsl:text> — </xsl:text>
539
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
551
+ <fo:block text-transform="uppercase">
552
+ <xsl:variable name="series_title" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']/itu:title[@type = 'full'])"/>
553
+ <xsl:if test="$series_title != ''">
554
+ <xsl:variable name="title">
555
+ <xsl:if test="$doctype != 'resolution'">
556
+ <!-- <xsl:text>Series </xsl:text> -->
557
+ <xsl:call-template name="getLocalizedString">
558
+ <xsl:with-param name="key">series</xsl:with-param>
559
+ </xsl:call-template>
560
+ <xsl:text> </xsl:text>
540
561
  </xsl:if>
541
- </fo:block>
562
+ <xsl:value-of select="$series_title"/>
563
+ </xsl:variable>
564
+ <xsl:value-of select="$title"/>
542
565
  </xsl:if>
543
- </xsl:otherwise>
544
- </xsl:choose>
545
-
546
- </fo:block>
566
+ </fo:block>
567
+ <xsl:choose>
568
+ <xsl:when test="$doctype = 'recommendation-supplement'"/>
569
+ <xsl:otherwise>
570
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
571
+ <fo:block margin-top="6pt">
572
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
573
+ <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
574
+ <xsl:text> — </xsl:text>
575
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
576
+ </xsl:if>
577
+ </fo:block>
578
+ </xsl:if>
579
+ </xsl:otherwise>
580
+ </xsl:choose>
581
+ </fo:block>
582
+ </fo:block-container>
547
583
  </fo:table-cell>
548
584
  </fo:table-row>
549
585
  <fo:table-row height="40mm">
@@ -551,49 +587,52 @@
551
587
  <fo:block> </fo:block>
552
588
  </fo:table-cell>
553
589
  <fo:table-cell font-size="18pt" number-columns-spanned="3">
554
- <fo:block padding-right="2mm" margin-top="6pt">
555
- <xsl:if test="not(/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']) and $isAmendment = '' and $isCorrigendum = ''">
556
- <xsl:attribute name="font-weight">bold</xsl:attribute>
557
- </xsl:if>
558
- <xsl:if test="($doctype = 'technical-report' or $doctype = 'technical-paper') and /itu:itu-standard/itu:bibdata/itu:docnumber">
559
- <fo:block font-weight="bold">
560
- <xsl:value-of select="$xSTR-ACRONYM"/>
561
- </fo:block>
562
- </xsl:if>
563
- <xsl:if test="$doctype = 'implementers-guide'">
564
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/>
565
- <xsl:text> for </xsl:text>
566
- </xsl:if>
567
- <xsl:if test="$doctype = 'resolution'">
568
- <!-- Resolution 1 -->
569
- <xsl:value-of select="$doctypeTitle"/><xsl:text> </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
570
- <xsl:text> – </xsl:text>
571
- </xsl:if>
572
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'main' and @language = 'en']"/>
573
- </fo:block>
574
- <xsl:for-each select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']">
575
- <fo:block font-weight="bold">
576
- <xsl:value-of select="."/>
577
- </fo:block>
578
- </xsl:for-each>
579
- <xsl:if test="$isAmendment != ''">
580
- <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold">
581
- <xsl:value-of select="$isAmendment"/>
582
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']">
583
- <xsl:text>: </xsl:text>
584
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']"/>
590
+ <fo:block-container>
591
+ <xsl:call-template name="setWritingMode"/>
592
+ <fo:block padding-right="2mm" margin-top="6pt">
593
+ <xsl:if test="not(/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']) and $isAmendment = '' and $isCorrigendum = ''">
594
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
585
595
  </xsl:if>
586
- </fo:block>
587
- </xsl:if>
588
- <xsl:if test="$isCorrigendum != ''">
589
- <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold">
590
- <xsl:value-of select="$isCorrigendum"/>
591
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']">
592
- <xsl:text>: </xsl:text>
593
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']"/>
596
+ <xsl:if test="($doctype = 'technical-report' or $doctype = 'technical-paper') and /itu:itu-standard/itu:bibdata/itu:docnumber">
597
+ <fo:block font-weight="bold">
598
+ <xsl:value-of select="$xSTR-ACRONYM"/>
599
+ </fo:block>
594
600
  </xsl:if>
601
+ <xsl:if test="$doctype = 'implementers-guide'">
602
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/>
603
+ <xsl:text> for </xsl:text>
604
+ </xsl:if>
605
+ <xsl:if test="$doctype = 'resolution'">
606
+ <!-- Resolution 1 -->
607
+ <xsl:value-of select="$doctypeTitle"/><xsl:text> </xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
608
+ <xsl:text> – </xsl:text>
609
+ </xsl:if>
610
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'main' and @language = 'en']"/>
595
611
  </fo:block>
596
- </xsl:if>
612
+ <xsl:for-each select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'annex' and @language = 'en']">
613
+ <fo:block font-weight="bold">
614
+ <xsl:value-of select="."/>
615
+ </fo:block>
616
+ </xsl:for-each>
617
+ <xsl:if test="$isAmendment != ''">
618
+ <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold">
619
+ <xsl:value-of select="$isAmendment"/>
620
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']">
621
+ <xsl:text>: </xsl:text>
622
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'amendment']"/>
623
+ </xsl:if>
624
+ </fo:block>
625
+ </xsl:if>
626
+ <xsl:if test="$isCorrigendum != ''">
627
+ <fo:block padding-right="2mm" margin-top="6pt" font-weight="bold">
628
+ <xsl:value-of select="$isCorrigendum"/>
629
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']">
630
+ <xsl:text>: </xsl:text>
631
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'corrigendum']"/>
632
+ </xsl:if>
633
+ </fo:block>
634
+ </xsl:if>
635
+ </fo:block-container>
597
636
  </fo:table-cell>
598
637
  </fo:table-row>
599
638
  <fo:table-row height="40mm">
@@ -601,17 +640,20 @@
601
640
  <fo:block> </fo:block>
602
641
  </fo:table-cell>
603
642
  <fo:table-cell number-columns-spanned="3">
604
- <xsl:choose>
605
- <xsl:when test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']">
606
- <xsl:attribute name="border">0.7mm solid black</xsl:attribute>
607
- <fo:block padding-top="3mm" margin-left="1mm" margin-right="1mm">
608
- <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']" mode="caution"/>
609
- </fo:block>
610
- </xsl:when>
611
- <xsl:otherwise>
612
- <fo:block> </fo:block>
613
- </xsl:otherwise>
614
- </xsl:choose>
643
+ <fo:block-container>
644
+ <xsl:call-template name="setWritingMode"/>
645
+ <xsl:choose>
646
+ <xsl:when test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']">
647
+ <xsl:attribute name="border">0.7mm solid black</xsl:attribute>
648
+ <fo:block padding-top="3mm" margin-left="1mm" margin-right="1mm">
649
+ <xsl:apply-templates select="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']" mode="caution"/>
650
+ </fo:block>
651
+ </xsl:when>
652
+ <xsl:otherwise>
653
+ <fo:block> </fo:block>
654
+ </xsl:otherwise>
655
+ </xsl:choose>
656
+ </fo:block-container>
615
657
  </fo:table-cell>
616
658
  </fo:table-row>
617
659
  <fo:table-row height="25mm">
@@ -619,55 +661,58 @@
619
661
  <fo:block> </fo:block>
620
662
  </fo:table-cell>
621
663
  <fo:table-cell number-columns-spanned="3">
622
- <fo:block font-size="16pt" margin-top="3pt">
623
- <xsl:if test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']">
624
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
625
- <xsl:if test="$doctype = 'recommendation-supplement'">
626
- <xsl:attribute name="margin-top">12pt</xsl:attribute>
627
- </xsl:if>
628
- </xsl:if>
629
-
630
- <xsl:choose>
631
- <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'">
632
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage">
633
- <xsl:call-template name="capitalizeWords">
634
- <xsl:with-param name="str" select="/itu:itu-standard/itu:bibdata/itu:status/itu:stage"/>
635
- </xsl:call-template>
636
- <xsl:text> </xsl:text>
664
+ <fo:block-container>
665
+ <xsl:call-template name="setWritingMode"/>
666
+ <fo:block font-size="16pt" margin-top="3pt">
667
+ <xsl:if test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']">
668
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
669
+ <xsl:if test="$doctype = 'recommendation-supplement'">
670
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
637
671
  </xsl:if>
638
- <xsl:value-of select="$doctypeTitle"/>
639
- <xsl:text>  </xsl:text>
640
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU']"/>
641
- </xsl:when>
642
- <xsl:when test="$doctype = 'implementers-guide'"/>
643
- <xsl:when test="$doctype = 'resolution'"/>
644
- <xsl:when test="$doctype = 'recommendation-supplement'">
645
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage = 'draft'">Draft </xsl:if>
646
- <xsl:text>ITU-</xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:editorialgroup/itu:bureau"/><xsl:text> </xsl:text>
647
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement']"/>
648
- </xsl:when>
649
- <xsl:otherwise>
650
- <xsl:value-of select="$doctypeTitle"/>
651
- <xsl:text>  </xsl:text>
652
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation">
653
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"/>
654
- <xsl:text>-</xsl:text>
655
- </xsl:if>
656
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:bureau"/>
657
- <xsl:text>  </xsl:text>
658
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
659
- </xsl:otherwise>
660
- </xsl:choose>
661
-
662
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
663
- <xsl:variable name="title-annex">
664
- <xsl:call-template name="getTitle">
665
- <xsl:with-param name="name" select="'title-annex'"/>
666
- </xsl:call-template>
667
- </xsl:variable>
668
- <xsl:text> — </xsl:text><xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
669
- </xsl:if>
670
- </fo:block>
672
+ </xsl:if>
673
+
674
+ <xsl:choose>
675
+ <xsl:when test="$doctype = 'technical-report' or $doctype = 'technical-paper'">
676
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage">
677
+ <xsl:call-template name="capitalizeWords">
678
+ <xsl:with-param name="str" select="/itu:itu-standard/itu:bibdata/itu:status/itu:stage"/>
679
+ </xsl:call-template>
680
+ <xsl:text> </xsl:text>
681
+ </xsl:if>
682
+ <xsl:value-of select="$doctypeTitle"/>
683
+ <xsl:text>  </xsl:text>
684
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type='ITU']"/>
685
+ </xsl:when>
686
+ <xsl:when test="$doctype = 'implementers-guide'"/>
687
+ <xsl:when test="$doctype = 'resolution'"/>
688
+ <xsl:when test="$doctype = 'recommendation-supplement'">
689
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage = 'draft'">Draft </xsl:if>
690
+ <xsl:text>ITU-</xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:editorialgroup/itu:bureau"/><xsl:text> </xsl:text>
691
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement']"/>
692
+ </xsl:when>
693
+ <xsl:otherwise>
694
+ <xsl:value-of select="$doctypeTitle"/>
695
+ <xsl:text>  </xsl:text>
696
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation">
697
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:contributor/itu:organization/itu:abbreviation"/>
698
+ <xsl:text>-</xsl:text>
699
+ </xsl:if>
700
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:bureau"/>
701
+ <xsl:text>  </xsl:text>
702
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
703
+ </xsl:otherwise>
704
+ </xsl:choose>
705
+
706
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid">
707
+ <xsl:variable name="title-annex">
708
+ <xsl:call-template name="getTitle">
709
+ <xsl:with-param name="name" select="'title-annex'"/>
710
+ </xsl:call-template>
711
+ </xsl:variable>
712
+ <xsl:text> — </xsl:text><xsl:value-of select="$title-annex"/><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:annexid"/>
713
+ </xsl:if>
714
+ </fo:block>
715
+ </fo:block-container>
671
716
  </fo:table-cell>
672
717
  </fo:table-row>
673
718
  </fo:table-body>
@@ -750,7 +795,7 @@
750
795
  <xsl:with-param name="key">table_of_contents</xsl:with-param>
751
796
  </xsl:call-template>
752
797
  </fo:block>
753
- <fo:block margin-top="6pt" text-align="right" font-weight="bold">
798
+ <fo:block margin-top="6pt" text-align="end" font-weight="bold">
754
799
  <xsl:call-template name="getLocalizedString">
755
800
  <xsl:with-param name="key">Page.sg</xsl:with-param>
756
801
  </xsl:call-template>
@@ -821,7 +866,7 @@
821
866
  <fo:block space-before="36pt" text-align="center" font-weight="bold" keep-with-next="always">
822
867
  <xsl:value-of select="$title-list-tables"/>
823
868
  </fo:block>
824
- <fo:block margin-top="6pt" text-align="right" font-weight="bold" keep-with-next="always">
869
+ <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always">
825
870
  <xsl:call-template name="getLocalizedString">
826
871
  <xsl:with-param name="key">Page.sg</xsl:with-param>
827
872
  </xsl:call-template>
@@ -853,7 +898,7 @@
853
898
  <fo:block space-before="36pt" text-align="center" font-weight="bold" keep-with-next="always">
854
899
  <xsl:value-of select="$title-list-figures"/>
855
900
  </fo:block>
856
- <fo:block margin-top="6pt" text-align="right" font-weight="bold" keep-with-next="always">
901
+ <fo:block margin-top="6pt" text-align="end" font-weight="bold" keep-with-next="always">
857
902
  <xsl:call-template name="getLocalizedString">
858
903
  <xsl:with-param name="key">Page.sg</xsl:with-param>
859
904
  </xsl:call-template>
@@ -1152,12 +1197,19 @@
1152
1197
  <xsl:attribute name="text-align">
1153
1198
  <xsl:choose>
1154
1199
  <xsl:when test="@class='supertitle'">center</xsl:when>
1155
- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
1200
+ <!-- <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when> -->
1201
+ <xsl:when test="@align"><xsl:call-template name="setAlignment"/></xsl:when>
1156
1202
  <xsl:when test="ancestor::*[1][local-name() = 'td']/@align">
1157
- <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/>
1203
+ <!-- <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/> -->
1204
+ <xsl:call-template name="setAlignment">
1205
+ <xsl:with-param name="align" select="ancestor::*[1][local-name() = 'td']/@align"/>
1206
+ </xsl:call-template>
1158
1207
  </xsl:when>
1159
1208
  <xsl:when test="ancestor::*[1][local-name() = 'th']/@align">
1160
- <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/>
1209
+ <!-- <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/> -->
1210
+ <xsl:call-template name="setAlignment">
1211
+ <xsl:with-param name="align" select="ancestor::*[1][local-name() = 'th']/@align"/>
1212
+ </xsl:call-template>
1161
1213
  </xsl:when>
1162
1214
  <xsl:otherwise>justify</xsl:otherwise>
1163
1215
  </xsl:choose>
@@ -1371,6 +1423,7 @@
1371
1423
  <xsl:variable name="text-align">
1372
1424
  <xsl:choose>
1373
1425
  <xsl:when test="$level = 1 and $doctype = 'resolution'">center</xsl:when>
1426
+ <xsl:when test="$lang = 'ar'">start</xsl:when>
1374
1427
  <xsl:otherwise>left</xsl:otherwise>
1375
1428
  </xsl:choose>
1376
1429
  </xsl:variable>
@@ -1581,6 +1634,7 @@
1581
1634
  <xsl:variable name="element-name">
1582
1635
  <xsl:choose>
1583
1636
  <xsl:when test="ancestor::itu:dd">fo:inline</xsl:when>
1637
+ <xsl:when test="ancestor::itu:title">fo:inline</xsl:when>
1584
1638
  <xsl:when test="normalize-space(ancestor::itu:p[1]//text()[not(parent::itu:tt)]) != ''">fo:inline</xsl:when>
1585
1639
  <xsl:otherwise>fo:block</xsl:otherwise>
1586
1640
  </xsl:choose>
@@ -1588,9 +1642,12 @@
1588
1642
  <xsl:element name="{$element-name}">
1589
1643
  <xsl:attribute name="font-family">Courier</xsl:attribute>
1590
1644
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1591
- <xsl:if test="local-name(..) != 'dt' and not(ancestor::itu:dd)">
1645
+ <xsl:if test="local-name(..) != 'dt' and not(ancestor::itu:dd) and not(ancestor::itu:title)">
1592
1646
  <xsl:attribute name="text-align">center</xsl:attribute>
1593
1647
  </xsl:if>
1648
+ <xsl:if test="ancestor::itu:title">
1649
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
1650
+ </xsl:if>
1594
1651
  <xsl:apply-templates/>
1595
1652
  </xsl:element>
1596
1653
  </xsl:template>
@@ -1657,19 +1714,25 @@
1657
1714
  </fo:list-item-label>
1658
1715
  <fo:list-item-body start-indent="body-start()">
1659
1716
  <fo:block-container>
1717
+ <xsl:variable name="attribute-margin">
1718
+ <xsl:choose>
1719
+ <xsl:when test="$lang = 'ar'">margin-right</xsl:when>
1720
+ <xsl:otherwise>margin-left</xsl:otherwise>
1721
+ </xsl:choose>
1722
+ </xsl:variable>
1660
1723
  <xsl:if test="../preceding-sibling::*[1][local-name() = 'title']">
1661
- <xsl:attribute name="margin-left">18mm</xsl:attribute>
1724
+ <xsl:attribute name="{$attribute-margin}">18mm</xsl:attribute>
1662
1725
  </xsl:if>
1663
1726
  <xsl:if test="local-name(..) = 'ul'">
1664
- <xsl:attribute name="margin-left">7mm</xsl:attribute><!-- 15mm -->
1727
+ <xsl:attribute name="{$attribute-margin}">7mm</xsl:attribute><!-- 15mm -->
1665
1728
  <xsl:if test="ancestor::itu:table">
1666
- <xsl:attribute name="margin-left">4.5mm</xsl:attribute>
1729
+ <xsl:attribute name="{$attribute-margin}">4.5mm</xsl:attribute>
1667
1730
  </xsl:if>
1668
1731
  <!-- <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1">
1669
1732
  <xsl:attribute name="margin-left">7mm</xsl:attribute>
1670
1733
  </xsl:if> -->
1671
1734
  </xsl:if>
1672
- <fo:block-container margin-left="0mm">
1735
+ <fo:block-container margin-left="0mm" margin-right="0mm">
1673
1736
  <fo:block>
1674
1737
  <xsl:apply-templates/>
1675
1738
  <xsl:apply-templates select=".//itu:note" mode="process"/>
@@ -1748,19 +1811,7 @@
1748
1811
  <xsl:template match="itu:formula" mode="process">
1749
1812
  <xsl:call-template name="formula"/>
1750
1813
  </xsl:template>
1751
-
1752
- <xsl:template match="mathml:math" priority="2">
1753
- <fo:inline font-family="STIX Two Math" font-size="11pt">
1754
- <xsl:variable name="mathml">
1755
- <xsl:apply-templates select="." mode="mathml"/>
1756
- </xsl:variable>
1757
- <fo:instream-foreign-object fox:alt-text="Math">
1758
- <!-- <xsl:copy-of select="."/> -->
1759
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
1760
- </fo:instream-foreign-object>
1761
- </fo:inline>
1762
- </xsl:template>
1763
-
1814
+
1764
1815
 
1765
1816
  <xsl:template match="itu:references[@normative='true']">
1766
1817
  <fo:block id="{@id}">
@@ -1785,10 +1836,10 @@
1785
1836
  <fo:table-column column-width="90%"/>
1786
1837
  <fo:table-body>
1787
1838
  <fo:table-row>
1788
- <fo:table-cell text-align="left" padding-bottom="8mm">
1839
+ <fo:table-cell text-align="start" padding-bottom="8mm">
1789
1840
  <fo:block><fo:page-number/></fo:block>
1790
1841
  </fo:table-cell>
1791
- <fo:table-cell font-weight="bold" text-align="left" padding-bottom="8mm">
1842
+ <fo:table-cell font-weight="bold" text-align="start" padding-bottom="8mm">
1792
1843
  <fo:block><xsl:value-of select="$footer-text"/></fo:block>
1793
1844
  </fo:table-cell>
1794
1845
  </fo:table-row>
@@ -1803,10 +1854,10 @@
1803
1854
  <fo:table-column column-width="10%"/>
1804
1855
  <fo:table-body>
1805
1856
  <fo:table-row>
1806
- <fo:table-cell font-weight="bold" text-align="right" padding-bottom="8mm">
1857
+ <fo:table-cell font-weight="bold" text-align="end" padding-bottom="8mm">
1807
1858
  <fo:block><xsl:value-of select="$footer-text"/></fo:block>
1808
1859
  </fo:table-cell>
1809
- <fo:table-cell text-align="right" padding-bottom="8mm" padding-right="2mm">
1860
+ <fo:table-cell text-align="end" padding-bottom="8mm" padding-right="2mm">
1810
1861
  <fo:block><fo:page-number/></fo:block>
1811
1862
  </fo:table-cell>
1812
1863
  </fo:table-row>
@@ -1835,7 +1886,7 @@
1835
1886
  <xsl:variable name="year" select="substring($date, 1, 4)"/>
1836
1887
  <xsl:variable name="month" select="substring($date, 6, 2)"/>
1837
1888
  <xsl:if test="$month != '' and $year != ''">
1838
- <xsl:text>(</xsl:text><xsl:value-of select="$month"/>/<xsl:value-of select="$year"/><xsl:text>)</xsl:text>
1889
+ <xsl:value-of select="$LRM"/><xsl:text>(</xsl:text><xsl:value-of select="$month"/>/<xsl:value-of select="$year"/><xsl:text>)</xsl:text><xsl:value-of select="$LRM"/>
1839
1890
  </xsl:if>
1840
1891
  </xsl:template>
1841
1892
 
@@ -2033,6 +2084,10 @@
2033
2084
  </xsl:choose>
2034
2085
  </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">
2035
2086
 
2087
+
2088
+ <xsl:attribute name="font-family">Times New Roman, STIX Two Math</xsl:attribute>
2089
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
2090
+
2036
2091
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2037
2092
 
2038
2093
 
@@ -2129,6 +2184,7 @@
2129
2184
 
2130
2185
 
2131
2186
 
2187
+
2132
2188
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2133
2189
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2134
2190
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -2346,13 +2402,33 @@
2346
2402
 
2347
2403
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2348
2404
 
2349
-
2405
+
2350
2406
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2351
2407
 
2352
2408
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
2353
2409
 
2354
2410
 
2355
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2411
+ </xsl:attribute-set><xsl:variable name="color-added-text">
2412
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
2413
+ </xsl:variable><xsl:attribute-set name="add-style">
2414
+ <xsl:attribute name="color">red</xsl:attribute>
2415
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2416
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2417
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2418
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2419
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2420
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
2421
+ <xsl:text>red</xsl:text>
2422
+ </xsl:variable><xsl:attribute-set name="del-style">
2423
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
2424
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2425
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
2426
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2427
+
2428
+
2429
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
2430
+
2431
+ </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">
2356
2432
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2357
2433
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2358
2434
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2397,18 +2473,19 @@
2397
2473
  <xsl:call-template name="add-zero-spaces-java"/>
2398
2474
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2399
2475
 
2476
+ <xsl:variable name="table-preamble">
2477
+
2478
+ <fo:block space-before="18pt"> </fo:block>
2479
+
2480
+
2481
+ </xsl:variable>
2482
+
2400
2483
  <xsl:variable name="table">
2401
2484
 
2402
2485
  <xsl:variable name="simple-table">
2403
2486
  <xsl:call-template name="getSimpleTable"/>
2404
2487
  </xsl:variable>
2405
2488
 
2406
-
2407
- <fo:block space-before="18pt"> </fo:block>
2408
-
2409
-
2410
-
2411
-
2412
2489
  <!-- <xsl:if test="$namespace = 'bipm'">
2413
2490
  <fo:block>&#xA0;</fo:block>
2414
2491
  </xsl:if> -->
@@ -2423,7 +2500,7 @@
2423
2500
 
2424
2501
 
2425
2502
 
2426
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2503
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2427
2504
 
2428
2505
  <!-- <xsl:variable name="cols-count">
2429
2506
  <xsl:choose>
@@ -2442,8 +2519,6 @@
2442
2519
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2443
2520
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2444
2521
 
2445
-
2446
-
2447
2522
  <xsl:variable name="colwidths">
2448
2523
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2449
2524
  <xsl:call-template name="calculate-column-widths">
@@ -2471,6 +2546,7 @@
2471
2546
  </xsl:choose>
2472
2547
  </xsl:variable>
2473
2548
 
2549
+
2474
2550
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2475
2551
 
2476
2552
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -2509,6 +2585,7 @@
2509
2585
 
2510
2586
 
2511
2587
 
2588
+
2512
2589
  <attribute name="margin-left">0mm</attribute>
2513
2590
  <attribute name="margin-right">0mm</attribute>
2514
2591
 
@@ -2602,7 +2679,8 @@
2602
2679
  </fo:block-container>
2603
2680
  </xsl:variable>
2604
2681
 
2605
-
2682
+ <xsl:variable name="isAdded" select="@added"/>
2683
+ <xsl:variable name="isDeleted" select="@deleted"/>
2606
2684
 
2607
2685
  <xsl:choose>
2608
2686
  <xsl:when test="@width">
@@ -2616,7 +2694,14 @@
2616
2694
  <fo:table-body>
2617
2695
  <fo:table-row>
2618
2696
  <fo:table-cell column-number="2">
2619
- <fo:block><xsl:copy-of select="$table"/></fo:block>
2697
+ <xsl:copy-of select="$table-preamble"/>
2698
+ <fo:block>
2699
+ <xsl:call-template name="setTrackChangesStyles">
2700
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2701
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2702
+ </xsl:call-template>
2703
+ <xsl:copy-of select="$table"/>
2704
+ </fo:block>
2620
2705
  </fo:table-cell>
2621
2706
  </fo:table-row>
2622
2707
  </fo:table-body>
@@ -2627,7 +2712,22 @@
2627
2712
 
2628
2713
  </xsl:when>
2629
2714
  <xsl:otherwise>
2630
- <xsl:copy-of select="$table"/>
2715
+ <xsl:choose>
2716
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
2717
+ <xsl:copy-of select="$table-preamble"/>
2718
+ <fo:block>
2719
+ <xsl:call-template name="setTrackChangesStyles">
2720
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2721
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2722
+ </xsl:call-template>
2723
+ <xsl:copy-of select="$table"/>
2724
+ </fo:block>
2725
+ </xsl:when>
2726
+ <xsl:otherwise>
2727
+ <xsl:copy-of select="$table-preamble"/>
2728
+ <xsl:copy-of select="$table"/>
2729
+ </xsl:otherwise>
2730
+ </xsl:choose>
2631
2731
  </xsl:otherwise>
2632
2732
  </xsl:choose>
2633
2733
 
@@ -2688,7 +2788,7 @@
2688
2788
  </xsl:for-each>
2689
2789
  </xsl:when>
2690
2790
  <xsl:otherwise>
2691
- <xsl:for-each select="xalan:nodeset($table)//tr">
2791
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
2692
2792
  <xsl:variable name="td_text">
2693
2793
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2694
2794
 
@@ -2758,7 +2858,15 @@
2758
2858
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2759
2859
  <xsl:value-of select="@target"/>
2760
2860
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2761
- <xsl:variable name="math_text" select="normalize-space(.)"/>
2861
+ <xsl:variable name="mathml">
2862
+ <xsl:for-each select="*">
2863
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2864
+ <xsl:copy-of select="."/>
2865
+ </xsl:if>
2866
+ </xsl:for-each>
2867
+ </xsl:variable>
2868
+
2869
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2762
2870
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2763
2871
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2764
2872
  <xsl:param name="cols-count"/>
@@ -3028,7 +3136,8 @@
3028
3136
  <xsl:attribute name="text-align">
3029
3137
  <xsl:choose>
3030
3138
  <xsl:when test="@align">
3031
- <xsl:value-of select="@align"/>
3139
+ <xsl:call-template name="setAlignment"/>
3140
+ <!-- <xsl:value-of select="@align"/> -->
3032
3141
  </xsl:when>
3033
3142
  <xsl:otherwise>center</xsl:otherwise>
3034
3143
  </xsl:choose>
@@ -3048,6 +3157,9 @@
3048
3157
 
3049
3158
 
3050
3159
 
3160
+ <xsl:if test="$lang = 'ar'">
3161
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3162
+ </xsl:if>
3051
3163
  <xsl:if test="@colspan">
3052
3164
  <xsl:attribute name="number-columns-spanned">
3053
3165
  <xsl:value-of select="@colspan"/>
@@ -3079,11 +3191,16 @@
3079
3191
  <xsl:attribute name="text-align">
3080
3192
  <xsl:choose>
3081
3193
  <xsl:when test="@align">
3082
- <xsl:value-of select="@align"/>
3194
+ <xsl:call-template name="setAlignment"/>
3195
+ <!-- <xsl:value-of select="@align"/> -->
3083
3196
  </xsl:when>
3084
3197
  <xsl:otherwise>left</xsl:otherwise>
3085
3198
  </xsl:choose>
3086
3199
  </xsl:attribute>
3200
+ <xsl:if test="$lang = 'ar'">
3201
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3202
+ </xsl:if>
3203
+
3087
3204
 
3088
3205
 
3089
3206
  <xsl:if test="ancestor::*[local-name()='preface']">
@@ -3100,6 +3217,9 @@
3100
3217
 
3101
3218
 
3102
3219
 
3220
+ <xsl:if test=".//*[local-name() = 'table']">
3221
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3222
+ </xsl:if>
3103
3223
  <xsl:if test="@colspan">
3104
3224
  <xsl:attribute name="number-columns-spanned">
3105
3225
  <xsl:value-of select="@colspan"/>
@@ -3243,13 +3363,13 @@
3243
3363
  </xsl:choose>
3244
3364
  </xsl:variable>
3245
3365
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3246
- <xsl:element name="{$ns}:table">
3366
+ <!-- <xsl:element name="{$ns}:table"> -->
3247
3367
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3248
3368
  <tbody>
3249
3369
  <xsl:apply-templates mode="dl"/>
3250
3370
  </tbody>
3251
3371
  </xsl:for-each>
3252
- </xsl:element>
3372
+ <!-- </xsl:element> -->
3253
3373
  </xsl:variable>
3254
3374
 
3255
3375
  <xsl:call-template name="calculate-column-widths">
@@ -3343,6 +3463,8 @@
3343
3463
  <xsl:apply-templates/>
3344
3464
  </fo:inline>
3345
3465
  </xsl:template><xsl:template match="*[local-name()='dl']">
3466
+ <xsl:variable name="isAdded" select="@added"/>
3467
+ <xsl:variable name="isDeleted" select="@deleted"/>
3346
3468
  <fo:block-container>
3347
3469
 
3348
3470
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -3359,6 +3481,12 @@
3359
3481
  </xsl:attribute>
3360
3482
 
3361
3483
  </xsl:if>
3484
+
3485
+ <xsl:call-template name="setTrackChangesStyles">
3486
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3487
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3488
+ </xsl:call-template>
3489
+
3362
3490
  <fo:block-container>
3363
3491
 
3364
3492
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -3475,11 +3603,11 @@
3475
3603
  </xsl:choose>
3476
3604
  </xsl:variable>
3477
3605
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3478
- <xsl:element name="{$ns}:table">
3606
+ <!-- <xsl:element name="{$ns}:table"> -->
3479
3607
  <tbody>
3480
3608
  <xsl:apply-templates mode="dl"/>
3481
3609
  </tbody>
3482
- </xsl:element>
3610
+ <!-- </xsl:element> -->
3483
3611
  </xsl:variable>
3484
3612
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
3485
3613
  <xsl:variable name="colwidths">
@@ -3756,8 +3884,78 @@
3756
3884
  <fo:inline text-decoration="underline">
3757
3885
  <xsl:apply-templates/>
3758
3886
  </fo:inline>
3887
+ </xsl:template><xsl:template match="*[local-name()='add']">
3888
+ <xsl:choose>
3889
+ <xsl:when test="@amendment">
3890
+ <fo:inline>
3891
+ <xsl:call-template name="insertTag">
3892
+ <xsl:with-param name="kind">A</xsl:with-param>
3893
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3894
+ </xsl:call-template>
3895
+ <xsl:apply-templates/>
3896
+ <xsl:call-template name="insertTag">
3897
+ <xsl:with-param name="type">closing</xsl:with-param>
3898
+ <xsl:with-param name="kind">A</xsl:with-param>
3899
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3900
+ </xsl:call-template>
3901
+ </fo:inline>
3902
+ </xsl:when>
3903
+ <xsl:when test="@corrigenda">
3904
+ <fo:inline>
3905
+ <xsl:call-template name="insertTag">
3906
+ <xsl:with-param name="kind">C</xsl:with-param>
3907
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3908
+ </xsl:call-template>
3909
+ <xsl:apply-templates/>
3910
+ <xsl:call-template name="insertTag">
3911
+ <xsl:with-param name="type">closing</xsl:with-param>
3912
+ <xsl:with-param name="kind">C</xsl:with-param>
3913
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3914
+ </xsl:call-template>
3915
+ </fo:inline>
3916
+ </xsl:when>
3917
+ <xsl:otherwise>
3918
+ <fo:inline xsl:use-attribute-sets="add-style">
3919
+ <xsl:apply-templates/>
3920
+ </fo:inline>
3921
+ </xsl:otherwise>
3922
+ </xsl:choose>
3923
+
3924
+ </xsl:template><xsl:template name="insertTag">
3925
+ <xsl:param name="type"/>
3926
+ <xsl:param name="kind"/>
3927
+ <xsl:param name="value"/>
3928
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3929
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3930
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3931
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3932
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3933
+ <xsl:attribute name="height">5mm</xsl:attribute>
3934
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3935
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3936
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3937
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3938
+ <g>
3939
+ <xsl:if test="$type = 'closing'">
3940
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3941
+ </xsl:if>
3942
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3943
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3944
+ </g>
3945
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3946
+ <xsl:if test="$type = 'closing'">
3947
+ <xsl:attribute name="x">25</xsl:attribute>
3948
+ </xsl:if>
3949
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3950
+ </text>
3951
+ </svg>
3952
+ </fo:instream-foreign-object>
3759
3953
  </xsl:template><xsl:template match="*[local-name()='del']">
3760
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3954
+ <fo:inline xsl:use-attribute-sets="del-style">
3955
+ <xsl:apply-templates/>
3956
+ </fo:inline>
3957
+ </xsl:template><xsl:template match="*[local-name()='hi']">
3958
+ <fo:inline background-color="yellow">
3761
3959
  <xsl:apply-templates/>
3762
3960
  </fo:inline>
3763
3961
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -4094,12 +4292,23 @@
4094
4292
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4095
4293
  <xsl:value-of select="substring($str, 2)"/>
4096
4294
  </xsl:template><xsl:template match="mathml:math">
4097
- <fo:inline font-family="STIX Two Math"> <!-- -->
4295
+ <xsl:variable name="isAdded" select="@added"/>
4296
+ <xsl:variable name="isDeleted" select="@deleted"/>
4297
+
4298
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4299
+
4300
+
4301
+ <xsl:call-template name="setTrackChangesStyles">
4302
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4303
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4304
+ </xsl:call-template>
4098
4305
 
4099
4306
  <xsl:variable name="mathml">
4100
4307
  <xsl:apply-templates select="." mode="mathml"/>
4101
4308
  </xsl:variable>
4102
4309
  <fo:instream-foreign-object fox:alt-text="Math">
4310
+
4311
+
4103
4312
  <!-- <xsl:copy-of select="."/> -->
4104
4313
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4105
4314
  </fo:instream-foreign-object>
@@ -4118,7 +4327,7 @@
4118
4327
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4119
4328
  </xsl:copy>
4120
4329
  <mathml:mspace width="0.5ex"/>
4121
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4330
+ </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">
4122
4331
  <xsl:variable name="target">
4123
4332
  <xsl:choose>
4124
4333
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4152,8 +4361,6 @@
4152
4361
  </xsl:otherwise>
4153
4362
  </xsl:choose>
4154
4363
  </fo:inline>
4155
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4156
- <fo:inline id="{@id}"/>
4157
4364
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4158
4365
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4159
4366
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4353,8 +4560,15 @@
4353
4560
  </fo:inline>
4354
4561
  </xsl:if>
4355
4562
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4563
+ <xsl:variable name="isAdded" select="@added"/>
4564
+ <xsl:variable name="isDeleted" select="@deleted"/>
4356
4565
  <fo:block-container id="{@id}">
4357
4566
 
4567
+ <xsl:call-template name="setTrackChangesStyles">
4568
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4569
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4570
+ </xsl:call-template>
4571
+
4358
4572
  <fo:block>
4359
4573
  <xsl:apply-templates/>
4360
4574
  </fo:block>
@@ -4368,27 +4582,113 @@
4368
4582
  <fo:block id="{@id}">
4369
4583
  <xsl:apply-templates/>
4370
4584
  </fo:block>
4585
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4371
4586
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4372
4587
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4373
4588
  <xsl:apply-templates/>
4374
4589
  </fo:block>
4375
4590
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4376
- <fo:block xsl:use-attribute-sets="image-style">
4377
-
4378
-
4379
- <xsl:variable name="src">
4380
- <xsl:choose>
4381
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4382
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4383
- </xsl:when>
4384
- <xsl:otherwise>
4385
- <xsl:value-of select="@src"/>
4386
- </xsl:otherwise>
4387
- </xsl:choose>
4388
- </xsl:variable>
4389
-
4390
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4391
- </fo:block>
4591
+ <xsl:variable name="isAdded" select="../@added"/>
4592
+ <xsl:variable name="isDeleted" select="../@deleted"/>
4593
+ <xsl:choose>
4594
+ <xsl:when test="ancestor::*[local-name() = 'title']">
4595
+ <fo:inline padding-left="1mm" padding-right="1mm">
4596
+ <xsl:variable name="src">
4597
+ <xsl:call-template name="image_src"/>
4598
+ </xsl:variable>
4599
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
4600
+ </fo:inline>
4601
+ </xsl:when>
4602
+ <xsl:otherwise>
4603
+ <fo:block xsl:use-attribute-sets="image-style">
4604
+
4605
+ <xsl:variable name="src">
4606
+ <xsl:call-template name="image_src"/>
4607
+ </xsl:variable>
4608
+
4609
+ <xsl:choose>
4610
+ <xsl:when test="$isDeleted = 'true'">
4611
+ <!-- enclose in svg -->
4612
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
4613
+ <xsl:attribute name="width">100%</xsl:attribute>
4614
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4615
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4616
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4617
+
4618
+
4619
+ <xsl:apply-templates select="." mode="cross_image"/>
4620
+
4621
+ </fo:instream-foreign-object>
4622
+ </xsl:when>
4623
+ <xsl:otherwise>
4624
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4625
+ </xsl:otherwise>
4626
+ </xsl:choose>
4627
+
4628
+ </fo:block>
4629
+ </xsl:otherwise>
4630
+ </xsl:choose>
4631
+ </xsl:template><xsl:template name="image_src">
4632
+ <xsl:choose>
4633
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4634
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4635
+ </xsl:when>
4636
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4637
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4638
+ </xsl:when>
4639
+ <xsl:otherwise>
4640
+ <xsl:value-of select="@src"/>
4641
+ </xsl:otherwise>
4642
+ </xsl:choose>
4643
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
4644
+ <xsl:choose>
4645
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4646
+ <xsl:variable name="src">
4647
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4648
+ </xsl:variable>
4649
+ <xsl:variable name="width" select="document($src)/@width"/>
4650
+ <xsl:variable name="height" select="document($src)/@height"/>
4651
+ <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">
4652
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4653
+ </svg>
4654
+ </xsl:when>
4655
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4656
+ <xsl:variable name="src">
4657
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4658
+ </xsl:variable>
4659
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
4660
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
4661
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4662
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4663
+ <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">
4664
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
4665
+ </svg>
4666
+ </xsl:when>
4667
+ <xsl:otherwise>
4668
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
4669
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
4670
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
4671
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
4672
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
4673
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
4674
+ <!-- width=<xsl:value-of select="$width"/> -->
4675
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
4676
+ <!-- height=<xsl:value-of select="$height"/> -->
4677
+ <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">
4678
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
4679
+ <xsl:call-template name="svg_cross">
4680
+ <xsl:with-param name="width" select="$width"/>
4681
+ <xsl:with-param name="height" select="$height"/>
4682
+ </xsl:call-template>
4683
+ </svg>
4684
+ </xsl:otherwise>
4685
+ </xsl:choose>
4686
+
4687
+ </xsl:template><xsl:template name="svg_cross">
4688
+ <xsl:param name="width"/>
4689
+ <xsl:param name="height"/>
4690
+ <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; "/>
4691
+ <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; "/>
4392
4692
  </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">
4393
4693
  <xsl:apply-templates mode="contents"/>
4394
4694
  <xsl:text> </xsl:text>
@@ -4931,6 +5231,7 @@
4931
5231
  <xsl:variable name="element">
4932
5232
  block
4933
5233
 
5234
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4934
5235
  </xsl:variable>
4935
5236
  <xsl:choose>
4936
5237
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4938,7 +5239,7 @@
4938
5239
  <xsl:apply-templates/>
4939
5240
  </fo:inline>
4940
5241
  </xsl:when>
4941
- <xsl:when test="normalize-space($element) = 'block'">
5242
+ <xsl:when test="contains(normalize-space($element), 'block')">
4942
5243
  <fo:block xsl:use-attribute-sets="example-name-style">
4943
5244
  <xsl:apply-templates/>
4944
5245
  </fo:block>
@@ -4951,10 +5252,11 @@
4951
5252
  </xsl:choose>
4952
5253
 
4953
5254
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4954
-
5255
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4955
5256
  <xsl:variable name="element">
4956
5257
  block
4957
5258
 
5259
+
4958
5260
  </xsl:variable>
4959
5261
  <xsl:choose>
4960
5262
  <xsl:when test="normalize-space($element) = 'block'">
@@ -5045,29 +5347,47 @@
5045
5347
  <xsl:text>— </xsl:text>
5046
5348
  <xsl:apply-templates/>
5047
5349
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5048
- <fo:inline xsl:use-attribute-sets="eref-style">
5049
- <xsl:if test="@type = 'footnote'">
5050
-
5051
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5052
- <xsl:attribute name="font-size">80%</xsl:attribute>
5053
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5054
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5055
-
5056
-
5057
- </xsl:if>
5058
-
5059
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5060
-
5061
- <xsl:if test="@type = 'inline'">
5062
-
5063
-
5064
-
5065
- </xsl:if>
5066
-
5067
-
5068
- <xsl:apply-templates/>
5069
- </fo:basic-link>
5070
- </fo:inline>
5350
+
5351
+ <xsl:variable name="bibitemid">
5352
+ <xsl:choose>
5353
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5354
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5355
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5356
+ </xsl:choose>
5357
+ </xsl:variable>
5358
+
5359
+ <xsl:choose>
5360
+ <xsl:when test="normalize-space($bibitemid) != ''">
5361
+ <fo:inline xsl:use-attribute-sets="eref-style">
5362
+ <xsl:if test="@type = 'footnote'">
5363
+
5364
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5365
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5366
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5367
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5368
+
5369
+
5370
+ </xsl:if>
5371
+
5372
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5373
+ <xsl:if test="normalize-space(@citeas) = ''">
5374
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5375
+ </xsl:if>
5376
+ <xsl:if test="@type = 'inline'">
5377
+
5378
+
5379
+
5380
+ </xsl:if>
5381
+
5382
+ <xsl:apply-templates/>
5383
+ </fo:basic-link>
5384
+
5385
+ </fo:inline>
5386
+ </xsl:when>
5387
+ <xsl:otherwise>
5388
+ <fo:inline><xsl:apply-templates/></fo:inline>
5389
+ </xsl:otherwise>
5390
+ </xsl:choose>
5071
5391
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5072
5392
  <!-- zero-space char -->
5073
5393
  <xsl:variable name="depth">
@@ -5128,7 +5448,8 @@
5128
5448
  </fo:inline>
5129
5449
  </xsl:when>
5130
5450
  <xsl:otherwise>
5131
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
5451
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
5452
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5132
5453
  </xsl:otherwise>
5133
5454
  </xsl:choose>
5134
5455
 
@@ -5259,6 +5580,153 @@
5259
5580
  </fo:block>
5260
5581
  </xsl:otherwise>
5261
5582
  </xsl:choose>
5583
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5584
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5585
+ <bookmark><xsl:value-of select="@id"/></bookmark>
5586
+ </xsl:for-each>
5587
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
5588
+ <xsl:copy>
5589
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
5590
+ </xsl:copy>
5591
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
5592
+ <xsl:variable name="id">
5593
+ <xsl:call-template name="generateIndexXrefId"/>
5594
+ </xsl:variable>
5595
+ <xsl:copy> <!-- add id to xref -->
5596
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
5597
+ <xsl:attribute name="id">
5598
+ <xsl:value-of select="$id"/>
5599
+ </xsl:attribute>
5600
+ <xsl:apply-templates mode="index_add_id"/>
5601
+ </xsl:copy>
5602
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5603
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5604
+ <xsl:if test="@to">
5605
+ <xsl:value-of select="$dash"/>
5606
+ <xsl:copy>
5607
+ <xsl:copy-of select="@*"/>
5608
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
5609
+ <xsl:attribute name="id">
5610
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
5611
+ </xsl:attribute>
5612
+ <xsl:apply-templates mode="index_add_id"/>
5613
+ </xsl:copy>
5614
+ </xsl:if>
5615
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
5616
+ <xsl:copy>
5617
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
5618
+ </xsl:copy>
5619
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
5620
+ <xsl:copy>
5621
+ <xsl:apply-templates select="@*" mode="index_update"/>
5622
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
5623
+ </xsl:copy>
5624
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
5625
+ <xsl:param name="element"/>
5626
+ <xsl:param name="remove" select="'false'"/>
5627
+ <xsl:param name="target"/>
5628
+ <!-- <node></node> -->
5629
+ <xsl:choose>
5630
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
5631
+ <!-- skip text (i.e. remove it) and process next element -->
5632
+ <!-- [removed_<xsl:value-of select="."/>] -->
5633
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5634
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
5635
+ </xsl:apply-templates>
5636
+ </xsl:when>
5637
+ <xsl:when test="self::text()">
5638
+ <xsl:value-of select="."/>
5639
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5640
+ </xsl:when>
5641
+ <xsl:when test="self::* and local-name(.) = 'xref'">
5642
+ <xsl:variable name="id" select="@id"/>
5643
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
5644
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
5645
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
5646
+
5647
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
5648
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
5649
+
5650
+ <xsl:choose>
5651
+ <!-- 2nd pass -->
5652
+ <!-- if page is equal to page for next and page is not the end of range -->
5653
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
5654
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
5655
+ <!-- [removed_xref] -->
5656
+
5657
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5658
+ <xsl:with-param name="remove">true</xsl:with-param>
5659
+ <xsl:with-param name="target">
5660
+ <xsl:choose>
5661
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
5662
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
5663
+ </xsl:choose>
5664
+ </xsl:with-param>
5665
+ </xsl:apply-templates>
5666
+ </xsl:when>
5667
+
5668
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
5669
+ <!-- remove xref -->
5670
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5671
+ <xsl:with-param name="remove">true</xsl:with-param>
5672
+ </xsl:apply-templates>
5673
+ </xsl:when>
5674
+
5675
+ <xsl:otherwise>
5676
+ <xsl:apply-templates select="." mode="xref_copy">
5677
+ <xsl:with-param name="target" select="$target"/>
5678
+ </xsl:apply-templates>
5679
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5680
+ </xsl:otherwise>
5681
+ </xsl:choose>
5682
+ </xsl:when>
5683
+ <xsl:when test="self::* and local-name(.) = 'ul'">
5684
+ <!-- ul -->
5685
+ <xsl:apply-templates select="." mode="index_update"/>
5686
+ </xsl:when>
5687
+ <xsl:otherwise>
5688
+ <xsl:apply-templates select="." mode="xref_copy">
5689
+ <xsl:with-param name="target" select="$target"/>
5690
+ </xsl:apply-templates>
5691
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5692
+ </xsl:otherwise>
5693
+ </xsl:choose>
5694
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
5695
+ <xsl:param name="target"/>
5696
+ <xsl:copy>
5697
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
5698
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
5699
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
5700
+ </xsl:if>
5701
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
5702
+ </xsl:copy>
5703
+ </xsl:template><xsl:template name="generateIndexXrefId">
5704
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5705
+
5706
+ <xsl:variable name="docid">
5707
+ <xsl:call-template name="getDocumentId"/>
5708
+ </xsl:variable>
5709
+ <xsl:variable name="item_number">
5710
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
5711
+ </xsl:variable>
5712
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
5713
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
5714
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
5715
+ <xsl:apply-templates/>
5716
+ <fo:block>
5717
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
5718
+ <fo:block> </fo:block>
5719
+ </xsl:if>
5720
+ </fo:block>
5721
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
5722
+ <xsl:apply-templates/>
5723
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5724
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5725
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5726
+ <xsl:apply-templates/>
5727
+ </fo:block>
5728
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
5729
+ <fo:inline id="{@id}" font-size="1pt"/>
5262
5730
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5263
5731
  <!-- <row>
5264
5732
  <date>05-07-2013</date>
@@ -5356,6 +5824,70 @@
5356
5824
  <xsl:value-of select="substring(.,1,1)"/>
5357
5825
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5358
5826
  <fo:inline><xsl:apply-templates/></fo:inline>
5827
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
5828
+ <fo:block>
5829
+ <xsl:apply-templates/>
5830
+ </fo:block>
5831
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
5832
+ <fo:inline><xsl:apply-templates/></fo:inline>
5833
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
5834
+ <fo:inline>
5835
+ <xsl:call-template name="text_input"/>
5836
+ </fo:inline>
5837
+ </xsl:template><xsl:template name="text_input">
5838
+ <xsl:variable name="count">
5839
+ <xsl:choose>
5840
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
5841
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
5842
+ <xsl:otherwise>10</xsl:otherwise>
5843
+ </xsl:choose>
5844
+ </xsl:variable>
5845
+ <xsl:call-template name="repeat">
5846
+ <xsl:with-param name="char" select="'_'"/>
5847
+ <xsl:with-param name="count" select="$count"/>
5848
+ </xsl:call-template>
5849
+ <xsl:text> </xsl:text>
5850
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
5851
+ <xsl:variable name="caption">
5852
+ <xsl:choose>
5853
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
5854
+ <xsl:otherwise>BUTTON</xsl:otherwise>
5855
+ </xsl:choose>
5856
+ </xsl:variable>
5857
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
5858
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
5859
+ <fo:inline padding-right="1mm">
5860
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5861
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5862
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5863
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5864
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5865
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5866
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
5867
+ </svg>
5868
+ </fo:instream-foreign-object>
5869
+ </fo:inline>
5870
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
5871
+ <fo:inline padding-right="1mm">
5872
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
5873
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
5874
+ <xsl:attribute name="content-width">100%</xsl:attribute>
5875
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5876
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5877
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
5878
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
5879
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
5880
+ </svg>
5881
+ </fo:instream-foreign-object>
5882
+ </fo:inline>
5883
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
5884
+ <fo:inline>
5885
+ <xsl:call-template name="text_input"/>
5886
+ </fo:inline>
5887
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
5888
+ <fo:block-container border="1pt solid black" width="50%">
5889
+ <fo:block> </fo:block>
5890
+ </fo:block-container>
5359
5891
  </xsl:template><xsl:template name="convertDate">
5360
5892
  <xsl:param name="date"/>
5361
5893
  <xsl:param name="format" select="'short'"/>
@@ -5475,70 +6007,68 @@
5475
6007
  <xsl:variable name="lang">
5476
6008
  <xsl:call-template name="getLang"/>
5477
6009
  </xsl:variable>
5478
- <fo:declarations>
5479
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5480
- <pdf:dictionary type="normal" key="ViewerPreferences">
5481
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5482
- </pdf:dictionary>
5483
- </pdf:catalog>
5484
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5485
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5486
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5487
- <!-- Dublin Core properties go here -->
5488
- <dc:title>
5489
- <xsl:variable name="title">
5490
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5491
-
5492
-
5493
-
5494
-
5495
-
5496
-
5497
- <xsl:value-of select="*[local-name() = 'title'][@type='main']"/>
5498
-
5499
- </xsl:for-each>
5500
- </xsl:variable>
5501
- <xsl:choose>
5502
- <xsl:when test="normalize-space($title) != ''">
5503
- <xsl:value-of select="$title"/>
5504
- </xsl:when>
5505
- <xsl:otherwise>
5506
- <xsl:text> </xsl:text>
5507
- </xsl:otherwise>
5508
- </xsl:choose>
5509
- </dc:title>
5510
- <dc:creator>
6010
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6011
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6012
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6013
+ </pdf:dictionary>
6014
+ </pdf:catalog>
6015
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6016
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6017
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6018
+ <!-- Dublin Core properties go here -->
6019
+ <dc:title>
6020
+ <xsl:variable name="title">
5511
6021
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5512
6022
 
5513
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5514
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
5515
- <xsl:if test="position() != last()">; </xsl:if>
5516
- </xsl:for-each>
5517
6023
 
5518
6024
 
5519
6025
 
5520
- </xsl:for-each>
5521
- </dc:creator>
5522
- <dc:description>
5523
- <xsl:variable name="abstract">
5524
6026
 
5525
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5526
6027
 
5527
-
5528
- </xsl:variable>
5529
- <xsl:value-of select="normalize-space($abstract)"/>
5530
- </dc:description>
5531
- <pdf:Keywords>
5532
- <xsl:call-template name="insertKeywords"/>
5533
- </pdf:Keywords>
5534
- </rdf:Description>
5535
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5536
- <!-- XMP properties go here -->
5537
- <xmp:CreatorTool/>
5538
- </rdf:Description>
5539
- </rdf:RDF>
5540
- </x:xmpmeta>
5541
- </fo:declarations>
6028
+ <xsl:value-of select="*[local-name() = 'title'][@type='main']"/>
6029
+
6030
+ </xsl:for-each>
6031
+ </xsl:variable>
6032
+ <xsl:choose>
6033
+ <xsl:when test="normalize-space($title) != ''">
6034
+ <xsl:value-of select="$title"/>
6035
+ </xsl:when>
6036
+ <xsl:otherwise>
6037
+ <xsl:text> </xsl:text>
6038
+ </xsl:otherwise>
6039
+ </xsl:choose>
6040
+ </dc:title>
6041
+ <dc:creator>
6042
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6043
+
6044
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6045
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6046
+ <xsl:if test="position() != last()">; </xsl:if>
6047
+ </xsl:for-each>
6048
+
6049
+
6050
+
6051
+ </xsl:for-each>
6052
+ </dc:creator>
6053
+ <dc:description>
6054
+ <xsl:variable name="abstract">
6055
+
6056
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6057
+
6058
+
6059
+ </xsl:variable>
6060
+ <xsl:value-of select="normalize-space($abstract)"/>
6061
+ </dc:description>
6062
+ <pdf:Keywords>
6063
+ <xsl:call-template name="insertKeywords"/>
6064
+ </pdf:Keywords>
6065
+ </rdf:Description>
6066
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6067
+ <!-- XMP properties go here -->
6068
+ <xmp:CreatorTool/>
6069
+ </rdf:Description>
6070
+ </rdf:RDF>
6071
+ </x:xmpmeta>
5542
6072
  </xsl:template><xsl:template name="getId">
5543
6073
  <xsl:choose>
5544
6074
  <xsl:when test="../@id">
@@ -5702,4 +6232,44 @@
5702
6232
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5703
6233
  </xsl:choose>
5704
6234
 
6235
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6236
+ <xsl:param name="isAdded"/>
6237
+ <xsl:param name="isDeleted"/>
6238
+ <xsl:choose>
6239
+ <xsl:when test="local-name() = 'math'">
6240
+ <xsl:if test="$isAdded = 'true'">
6241
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6242
+ </xsl:if>
6243
+ <xsl:if test="$isDeleted = 'true'">
6244
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6245
+ </xsl:if>
6246
+ </xsl:when>
6247
+ <xsl:otherwise>
6248
+ <xsl:if test="$isAdded = 'true'">
6249
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6250
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6251
+ </xsl:if>
6252
+ <xsl:if test="$isDeleted = 'true'">
6253
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6254
+ <xsl:if test="local-name() = 'table'">
6255
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6256
+ </xsl:if>
6257
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6258
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6259
+ </xsl:if>
6260
+ </xsl:otherwise>
6261
+ </xsl:choose>
6262
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6263
+ <xsl:if test="$lang = 'ar'">
6264
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6265
+ </xsl:if>
6266
+ </xsl:template><xsl:template name="setAlignment">
6267
+ <xsl:param name="align" select="normalize-space(@align)"/>
6268
+ <xsl:choose>
6269
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6270
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6271
+ <xsl:when test="$align != ''">
6272
+ <xsl:value-of select="$align"/>
6273
+ </xsl:when>
6274
+ </xsl:choose>
5705
6275
  </xsl:template></xsl:stylesheet>