metanorma-iso 1.5.6 → 1.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +9 -1
  3. data/.github/workflows/ubuntu.yml +8 -0
  4. data/.github/workflows/windows.yml +7 -0
  5. data/lib/asciidoctor/iso/basicdoc.rng +4 -11
  6. data/lib/asciidoctor/iso/boilerplate-fr.xml +40 -0
  7. data/lib/asciidoctor/iso/boilerplate.xml +1 -0
  8. data/lib/asciidoctor/iso/cleanup.rb +5 -0
  9. data/lib/asciidoctor/iso/front.rb +9 -15
  10. data/lib/asciidoctor/iso/isodoc.rng +14 -50
  11. data/lib/asciidoctor/iso/isostandard.rng +8 -1
  12. data/lib/isodoc/iso/html/header.html +8 -16
  13. data/lib/isodoc/iso/html/style-human.css +5 -1
  14. data/lib/isodoc/iso/html/style-iso.css +5 -1
  15. data/lib/isodoc/iso/i18n-en.yaml +3 -0
  16. data/lib/isodoc/iso/i18n-fr.yaml +3 -0
  17. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  18. data/lib/isodoc/iso/iso.amendment.xsl +543 -94
  19. data/lib/isodoc/iso/iso.international-standard.xsl +543 -94
  20. data/lib/isodoc/iso/isosts_convert.rb +31 -0
  21. data/lib/isodoc/iso/metadata.rb +19 -19
  22. data/lib/metanorma-iso.rb +1 -0
  23. data/lib/metanorma/iso/processor.rb +1 -1
  24. data/lib/metanorma/iso/version.rb +1 -1
  25. data/metanorma-iso.gemspec +1 -1
  26. data/spec/asciidoctor-iso/amd_spec.rb +7 -7
  27. data/spec/asciidoctor-iso/base_spec.rb +144 -18
  28. data/spec/asciidoctor-iso/validate_spec.rb +35 -15
  29. data/spec/assets/xref_error.adoc +7 -0
  30. data/spec/isodoc/amd_spec.rb +191 -17
  31. data/spec/isodoc/blocks_spec.rb +1 -1
  32. data/spec/isodoc/i18n_spec.rb +13 -13
  33. data/spec/isodoc/inline_spec.rb +2 -2
  34. data/spec/isodoc/iso_spec.rb +2 -2
  35. data/spec/isodoc/metadata_spec.rb +170 -19
  36. data/spec/isodoc/postproc_spec.rb +3 -3
  37. data/spec/isodoc/ref_spec.rb +3 -3
  38. data/spec/isodoc/section_spec.rb +2 -2
  39. data/spec/isodoc/table_spec.rb +1 -1
  40. data/spec/isodoc/terms_spec.rb +1 -1
  41. data/spec/isodoc/xref_spec.rb +11 -11
  42. data/spec/metanorma/processor_spec.rb +1 -1
  43. data/spec/spec_helper.rb +22 -2
  44. metadata +7 -4
@@ -8,3 +8,6 @@ term_def_boilerplate: |
8
8
  <li> <p>IEC Electropedia: available at
9
9
  <link target="http://www.electropedia.org"/>
10
10
  </p> </li> </ul>
11
+ all_rights_reserved: All rights reserved
12
+ reference_number: Reference Number
13
+ price_based_on: Price based on % pages
@@ -8,3 +8,6 @@ term_def_boilerplate: |
8
8
  <li> <p>IEC Electropedia: disponible à l'adresse
9
9
  <link target="http://www.electropedia.org"/>
10
10
  </p> </li> </ul>
11
+ all_rights_reserved: Tous droits réservés
12
+ reference_number: Numéro de référence
13
+ price_based_on: Prix basé sur % pages
@@ -6,3 +6,7 @@ term_def_boilerplate: |
6
6
  <li> <p>IEC Electropedia:
7
7
  位于<link target="http://www.electropedia.org"/>
8
8
  </p> </li> </ul>
9
+ all_rights_reserved: 版权所有
10
+ reference_number: 参考编号
11
+ price_based_on: 价格基于%页
12
+
@@ -295,6 +295,10 @@
295
295
 
296
296
  <xsl:call-template name="addPDFUAmeta"/>
297
297
 
298
+ <xsl:call-template name="addBookmarks">
299
+ <xsl:with-param name="contents" select="$contents"/>
300
+ </xsl:call-template>
301
+
298
302
  <!-- cover page -->
299
303
  <xsl:choose>
300
304
  <xsl:when test="$stage-abbreviation != ''">
@@ -398,7 +402,15 @@
398
402
  <fo:flow flow-name="xsl-region-body">
399
403
  <fo:block-container>
400
404
  <fo:block margin-top="-1mm" font-size="20pt" text-align="right">
401
- <xsl:value-of select="$stage-fullname-uppercased"/>
405
+ <xsl:value-of select="$stage-fullname-uppercased"/>
406
+ <!-- <xsl:if test="$doctype = 'amendment'">
407
+ <xsl:variable name="title-amendment">
408
+ <xsl:call-template name="getTitle">
409
+ <xsl:with-param name="name" select="'title-amendment'"/>
410
+ </xsl:call-template>
411
+ </xsl:variable>
412
+ <xsl:text> </xsl:text><xsl:value-of select="$title-amendment"/>
413
+ </xsl:if> -->
402
414
  </fo:block>
403
415
  <fo:block font-size="20pt" font-weight="bold" text-align="right">
404
416
  <xsl:value-of select="$docidentifierISO"/>
@@ -473,16 +485,13 @@
473
485
 
474
486
  <xsl:call-template name="printTitlePartEn"/>
475
487
 
476
- <!-- <xsl:if test="normalize-space($title-part) != ''">
477
- <xsl:if test="$part != ''">
478
- <xsl:text> — </xsl:text>
479
- <fo:block font-weight="normal" margin-top="6pt">
480
- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
481
- <xsl:text>:</xsl:text>
482
- </fo:block>
483
- </xsl:if>
484
- <xsl:value-of select="$title-part"/>
485
- </xsl:if> -->
488
+ <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-amd']"/>
489
+ <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
490
+ <fo:block margin-top="12pt">
491
+ <xsl:call-template name="printAmendmentTitle"/>
492
+ </fo:block>
493
+ </xsl:if>
494
+
486
495
  </fo:block>
487
496
 
488
497
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
@@ -497,6 +506,15 @@
497
506
 
498
507
  <xsl:call-template name="printTitlePartFr"/>
499
508
 
509
+ <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-amd']"/>
510
+ <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
511
+ <fo:block margin-top="6pt">
512
+ <xsl:call-template name="printAmendmentTitle">
513
+ <xsl:with-param name="lang" select="'fr'"/>
514
+ </xsl:call-template>
515
+ </fo:block>
516
+ </xsl:if>
517
+
500
518
  </fo:block>
501
519
  </fo:block>
502
520
  <fo:block margin-top="10mm">
@@ -541,7 +559,14 @@
541
559
  </fo:table-cell>
542
560
  <fo:table-cell>
543
561
  <fo:block text-align="left">
544
- <xsl:value-of select="$doctype_uppercased"/>
562
+ <xsl:choose>
563
+ <xsl:when test="$doctype = 'amendment'">
564
+ <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(translate(/iso:iso-standard/iso:bibdata/iso:ext/iso:updates-document-type,'-',' ')))"/>
565
+ </xsl:when>
566
+ <xsl:otherwise>
567
+ <xsl:value-of select="$doctype_uppercased"/>
568
+ </xsl:otherwise>
569
+ </xsl:choose>
545
570
  </fo:block>
546
571
  </fo:table-cell>
547
572
  <fo:table-cell>
@@ -553,24 +578,50 @@
553
578
  <fo:table-row height="42mm">
554
579
  <fo:table-cell number-columns-spanned="3" font-size="10pt" line-height="1.2">
555
580
  <fo:block text-align="right">
556
- <xsl:if test="$stage-abbreviation = 'PRF' or $stage-abbreviation = 'IS' or $stage-abbreviation = 'published'">
581
+ <xsl:if test="$stage-abbreviation = 'PRF' or $stage-abbreviation = 'IS' or $stage-abbreviation = 'D' or $stage-abbreviation = 'published'">
557
582
  <xsl:call-template name="printEdition"/>
558
583
  </xsl:if>
559
584
  <xsl:choose>
560
585
  <xsl:when test="$stage-abbreviation = 'IS' and /iso:iso-standard/iso:bibdata/iso:date[@type = 'published']">
561
586
  <xsl:value-of select="$linebreak"/>
562
587
  <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'published']"/>
563
- </xsl:when>
588
+ </xsl:when>
589
+ <xsl:when test="($stage-abbreviation = 'IS' or $stage-abbreviation = 'D') and /iso:iso-standard/iso:bibdata/iso:date[@type = 'created']">
590
+ <xsl:value-of select="$linebreak"/>
591
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'created']"/>
592
+ </xsl:when>
564
593
  <xsl:when test="$stage-abbreviation = 'IS' or $stage-abbreviation = 'published'">
565
594
  <xsl:value-of select="$linebreak"/>
566
595
  <xsl:value-of select="substring(/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date,1, 7)"/>
567
596
  </xsl:when>
568
597
  </xsl:choose>
569
- <!-- <xsl:value-of select="$linebreak"/>
570
- <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date"/> -->
598
+ </fo:block>
599
+ <!-- <xsl:value-of select="$linebreak"/>
600
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:version/iso:revision-date"/> -->
601
+ <xsl:if test="$doctype = 'amendment'">
602
+ <fo:block text-align="right" margin-right="0.5mm">
603
+ <fo:block font-weight="bold" margin-top="4pt">
604
+ <xsl:variable name="title-amendment">
605
+ <xsl:call-template name="getTitle">
606
+ <xsl:with-param name="name" select="'title-amendment'"/>
607
+ </xsl:call-template>
608
+ </xsl:variable>
609
+ <xsl:value-of select="$title-amendment"/><xsl:text> </xsl:text>
610
+ <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
611
+ <xsl:if test="normalize-space($amendment-number) != ''">
612
+ <xsl:value-of select="$amendment-number"/><xsl:text> </xsl:text>
613
+ </xsl:if>
614
+ </fo:block>
615
+ <fo:block>
616
+ <xsl:if test="/iso:iso-standard/iso:bibdata/iso:date[@type = 'updated']">
617
+ <xsl:value-of select="/iso:iso-standard/iso:bibdata/iso:date[@type = 'updated']"/>
618
+ </xsl:if>
619
+ </fo:block>
571
620
  </fo:block>
621
+ </xsl:if>
572
622
  </fo:table-cell>
573
623
  </fo:table-row>
624
+
574
625
  </fo:table-body>
575
626
  </fo:table>
576
627
 
@@ -639,6 +690,12 @@
639
690
  </xsl:if>
640
691
  <xsl:value-of select="$title-part"/>
641
692
  </xsl:if> -->
693
+ <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-amd']"/>
694
+ <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
695
+ <fo:block margin-right="-5mm" margin-top="12pt">
696
+ <xsl:call-template name="printAmendmentTitle"/>
697
+ </fo:block>
698
+ </xsl:if>
642
699
  </fo:block>
643
700
 
644
701
  <fo:block font-size="9pt"><xsl:value-of select="$linebreak"/></fo:block>
@@ -653,6 +710,15 @@
653
710
 
654
711
  <xsl:call-template name="printTitlePartFr"/>
655
712
 
713
+ <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'fr' and @type = 'title-amd']"/>
714
+ <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
715
+ <fo:block margin-right="-5mm" margin-top="6pt">
716
+ <xsl:call-template name="printAmendmentTitle">
717
+ <xsl:with-param name="lang" select="'fr'"/>
718
+ </xsl:call-template>
719
+ </fo:block>
720
+ </xsl:if>
721
+
656
722
  </fo:block>
657
723
  </fo:block>
658
724
  </fo:block-container>
@@ -966,7 +1032,7 @@
966
1032
  </xsl:if>
967
1033
 
968
1034
  <xsl:variable name="margin-left">12</xsl:variable>
969
- <xsl:for-each select="xalan:nodeset($contents)//item"><!-- [@display = 'true'][not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
1035
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
970
1036
 
971
1037
  <fo:block>
972
1038
  <xsl:if test="@level = 1">
@@ -996,9 +1062,9 @@
996
1062
  </fo:list-item-label>
997
1063
  <fo:list-item-body start-indent="body-start()">
998
1064
  <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
999
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
1065
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1000
1066
 
1001
- <xsl:apply-templates/>
1067
+ <xsl:apply-templates select="title"/>
1002
1068
 
1003
1069
  <fo:inline keep-together.within-line="always">
1004
1070
  <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
@@ -1067,19 +1133,8 @@
1067
1133
 
1068
1134
  <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = 'en' and @type = 'title-amd']"/>
1069
1135
  <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
1070
- <fo:block font-weight="normal" margin-top="12pt" line-height="1.1">
1071
- <xsl:variable name="title-amendment">
1072
- <xsl:call-template name="getTitle">
1073
- <xsl:with-param name="name" select="'title-amendment'"/>
1074
- </xsl:call-template>
1075
- </xsl:variable>
1076
- <xsl:value-of select="$title-amendment"/>
1077
- <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
1078
- <xsl:if test="normalize-space($amendment-number) != ''">
1079
- <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
1080
- </xsl:if>
1081
- <xsl:text>: </xsl:text>
1082
- <xsl:value-of select="$title-amd"/>
1136
+ <fo:block margin-top="12pt">
1137
+ <xsl:call-template name="printAmendmentTitle"/>
1083
1138
  </fo:block>
1084
1139
  </xsl:if>
1085
1140
 
@@ -1174,6 +1229,27 @@
1174
1229
  <xsl:apply-templates/>
1175
1230
  </xsl:template>
1176
1231
 
1232
+ <xsl:template name="printAmendmentTitle">
1233
+ <xsl:param name="lang" select="'en'"/>
1234
+ <xsl:variable name="title-amd" select="/iso:iso-standard/iso:bibdata/iso:title[@language = $lang and @type = 'title-amd']"/>
1235
+ <xsl:if test="$doctype = 'amendment' and normalize-space($title-amd) != ''">
1236
+ <fo:block font-weight="normal" line-height="1.1">
1237
+ <xsl:variable name="title-amendment">
1238
+ <xsl:call-template name="getTitle">
1239
+ <xsl:with-param name="name" select="'title-amendment'"/>
1240
+ </xsl:call-template>
1241
+ </xsl:variable>
1242
+ <xsl:value-of select="$title-amendment"/>
1243
+ <xsl:variable name="amendment-number" select="/iso:iso-standard/iso:bibdata/iso:ext/iso:structuredidentifier/iso:project-number/@amendment"/>
1244
+ <xsl:if test="normalize-space($amendment-number) != ''">
1245
+ <xsl:text> </xsl:text><xsl:value-of select="$amendment-number"/>
1246
+ </xsl:if>
1247
+ <xsl:text>: </xsl:text>
1248
+ <xsl:value-of select="$title-amd"/>
1249
+ </fo:block>
1250
+ </xsl:if>
1251
+ </xsl:template>
1252
+
1177
1253
  <!-- ============================= -->
1178
1254
  <!-- CONTENTS -->
1179
1255
  <!-- ============================= -->
@@ -1198,9 +1274,7 @@
1198
1274
  </xsl:variable>
1199
1275
 
1200
1276
  <xsl:variable name="display">
1201
- <xsl:choose>
1202
- <xsl:when test="ancestor-or-self::iso:bibitem">false</xsl:when>
1203
- <xsl:when test="ancestor-or-self::iso:term">false</xsl:when>
1277
+ <xsl:choose>
1204
1278
  <xsl:when test="ancestor-or-self::iso:annex and $level &gt;= 2">false</xsl:when>
1205
1279
  <xsl:when test="$section = '' and $type = 'clause'">false</xsl:when>
1206
1280
  <xsl:when test="$level &lt;= 3">true</xsl:when>
@@ -1208,8 +1282,16 @@
1208
1282
  </xsl:choose>
1209
1283
  </xsl:variable>
1210
1284
 
1285
+ <xsl:variable name="skip">
1286
+ <xsl:choose>
1287
+ <xsl:when test="ancestor-or-self::iso:bibitem">true</xsl:when>
1288
+ <xsl:when test="ancestor-or-self::iso:term">true</xsl:when>
1289
+ <xsl:otherwise>false</xsl:otherwise>
1290
+ </xsl:choose>
1291
+ </xsl:variable>
1292
+
1211
1293
 
1212
- <xsl:if test="$display = 'true'">
1294
+ <xsl:if test="$skip = 'false'">
1213
1295
 
1214
1296
  <xsl:variable name="title">
1215
1297
  <xsl:call-template name="getName"/>
@@ -1220,12 +1302,13 @@
1220
1302
  <xsl:if test="ancestor-or-self::iso:annex">annex</xsl:if>
1221
1303
  </xsl:variable>
1222
1304
 
1223
- <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}">
1224
- <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
1305
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
1306
+ <title>
1307
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
1308
+ </title>
1309
+ <xsl:apply-templates mode="contents"/>
1225
1310
  </item>
1226
- <xsl:apply-templates mode="contents"/>
1227
- </xsl:if>
1228
-
1311
+ </xsl:if>
1229
1312
  </xsl:template>
1230
1313
 
1231
1314
 
@@ -1987,6 +2070,12 @@
1987
2070
 
1988
2071
  </title-edition>
1989
2072
 
2073
+ <title-edition lang="fr">
2074
+
2075
+ <xsl:text>Édition </xsl:text>
2076
+
2077
+ </title-edition>
2078
+
1990
2079
 
1991
2080
  <title-toc lang="en">
1992
2081
 
@@ -1995,7 +2084,12 @@
1995
2084
 
1996
2085
 
1997
2086
  </title-toc>
1998
- <title-toc lang="fr">Sommaire</title-toc>
2087
+ <title-toc lang="fr">
2088
+
2089
+ <xsl:text>Sommaire</xsl:text>
2090
+
2091
+
2092
+ </title-toc>
1999
2093
 
2000
2094
  <title-toc lang="zh">Contents</title-toc>
2001
2095
 
@@ -2087,10 +2181,19 @@
2087
2181
 
2088
2182
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2089
2183
  <xsl:param name="name"/>
2090
- <xsl:variable name="lang">
2091
- <xsl:call-template name="getLang"/>
2184
+ <xsl:param name="lang"/>
2185
+ <xsl:variable name="lang_">
2186
+ <xsl:choose>
2187
+ <xsl:when test="$lang != ''">
2188
+ <xsl:value-of select="$lang"/>
2189
+ </xsl:when>
2190
+ <xsl:otherwise>
2191
+ <xsl:call-template name="getLang"/>
2192
+ </xsl:otherwise>
2193
+ </xsl:choose>
2092
2194
  </xsl:variable>
2093
- <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $lang]"/>
2195
+ <xsl:variable name="language" select="normalize-space($lang_)"/>
2196
+ <xsl:variable name="title_" select="$titles/*[local-name() = $name][@lang = $language]"/>
2094
2197
  <xsl:choose>
2095
2198
  <xsl:when test="normalize-space($title_) != ''">
2096
2199
  <xsl:value-of select="$title_"/>
@@ -2099,7 +2202,9 @@
2099
2202
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2100
2203
  </xsl:otherwise>
2101
2204
  </xsl:choose>
2102
- </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="link-style">
2205
+ </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">
2206
+
2207
+ </xsl:attribute-set><xsl:attribute-set name="link-style">
2103
2208
 
2104
2209
  <xsl:attribute name="color">blue</xsl:attribute>
2105
2210
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
@@ -2241,6 +2346,7 @@
2241
2346
 
2242
2347
 
2243
2348
 
2349
+
2244
2350
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2245
2351
 
2246
2352
  <xsl:attribute name="font-size">12pt</xsl:attribute>
@@ -2289,6 +2395,7 @@
2289
2395
 
2290
2396
 
2291
2397
 
2398
+
2292
2399
  </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
2293
2400
 
2294
2401
 
@@ -2490,6 +2597,8 @@
2490
2597
 
2491
2598
 
2492
2599
 
2600
+
2601
+
2493
2602
  <!-- $namespace = 'iso' or -->
2494
2603
 
2495
2604
 
@@ -2523,6 +2632,7 @@
2523
2632
  <xsl:with-param name="table" select="$simple-table"/>
2524
2633
  </xsl:call-template>
2525
2634
  </xsl:variable>
2635
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2526
2636
 
2527
2637
  <!-- <xsl:variable name="colwidths2">
2528
2638
  <xsl:call-template name="calculate-column-widths">
@@ -2543,11 +2653,16 @@
2543
2653
 
2544
2654
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2545
2655
 
2656
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2546
2657
 
2547
2658
 
2659
+
2660
+
2661
+
2548
2662
 
2549
2663
 
2550
-
2664
+
2665
+
2551
2666
 
2552
2667
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2553
2668
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2556,30 +2671,47 @@
2556
2671
 
2557
2672
 
2558
2673
 
2559
- <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
2674
+
2675
+
2676
+
2677
+ <xsl:variable name="table_attributes">
2678
+ <attribute name="table-layout">fixed</attribute>
2679
+ <attribute name="width">100%</attribute>
2680
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2681
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2560
2682
 
2561
- <xsl:attribute name="border">1.5pt solid black</xsl:attribute>
2683
+ <attribute name="border">1.5pt solid black</attribute>
2562
2684
  <xsl:if test="*[local-name()='thead']">
2563
- <xsl:attribute name="border-top">1pt solid black</xsl:attribute>
2685
+ <attribute name="border-top">1pt solid black</attribute>
2564
2686
  </xsl:if>
2565
2687
 
2566
2688
 
2567
2689
 
2568
2690
 
2569
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2570
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2571
-
2572
-
2573
-
2574
-
2575
-
2576
-
2577
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2691
+ <attribute name="margin-left">0mm</attribute>
2692
+ <attribute name="margin-right">0mm</attribute>
2578
2693
 
2694
+
2695
+
2696
+
2579
2697
 
2698
+
2580
2699
 
2700
+ </xsl:variable>
2701
+
2702
+
2703
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
2581
2704
 
2705
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2706
+ <xsl:attribute name="{@name}">
2707
+ <xsl:value-of select="."/>
2708
+ </xsl:attribute>
2709
+ </xsl:for-each>
2582
2710
 
2711
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2712
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2713
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2714
+ </xsl:if>
2583
2715
 
2584
2716
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2585
2717
  <xsl:choose>
@@ -2603,6 +2735,33 @@
2603
2735
 
2604
2736
  </fo:table>
2605
2737
 
2738
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2739
+ <xsl:call-template name="insertTableFooterInSeparateTable">
2740
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
2741
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2742
+ </xsl:call-template>
2743
+ </xsl:for-each>
2744
+
2745
+ <!-- insert footer as table -->
2746
+ <!-- <fo:table>
2747
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2748
+ <xsl:attribute name="{@name}">
2749
+ <xsl:value-of select="."/>
2750
+ </xsl:attribute>
2751
+ </xsl:for-each>
2752
+
2753
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2754
+ <xsl:choose>
2755
+ <xsl:when test=". = 1 or . = 0">
2756
+ <fo:table-column column-width="proportional-column-width(2)"/>
2757
+ </xsl:when>
2758
+ <xsl:otherwise>
2759
+ <fo:table-column column-width="proportional-column-width({.})"/>
2760
+ </xsl:otherwise>
2761
+ </xsl:choose>
2762
+ </xsl:for-each>
2763
+ </fo:table>-->
2764
+
2606
2765
 
2607
2766
 
2608
2767
 
@@ -2669,6 +2828,13 @@
2669
2828
  <xsl:for-each select="xalan:nodeset($table)//tr">
2670
2829
  <xsl:variable name="td_text">
2671
2830
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2831
+
2832
+ <!-- <xsl:if test="$namespace = 'bipm'">
2833
+ <xsl:for-each select="*[local-name()='td'][$curr-col]//*[local-name()='math']">
2834
+ <word><xsl:value-of select="normalize-space(.)"/></word>
2835
+ </xsl:for-each>
2836
+ </xsl:if> -->
2837
+
2672
2838
  </xsl:variable>
2673
2839
  <xsl:variable name="words">
2674
2840
  <xsl:variable name="string_with_added_zerospaces">
@@ -2728,6 +2894,9 @@
2728
2894
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2729
2895
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2730
2896
  <xsl:value-of select="@target"/>
2897
+ </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2898
+ <xsl:variable name="math_text" select="normalize-space(.)"/>
2899
+ <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2731
2900
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2732
2901
  <xsl:param name="cols-count"/>
2733
2902
  <!-- font-weight="bold" -->
@@ -2736,7 +2905,7 @@
2736
2905
  <xsl:call-template name="table-header-title">
2737
2906
  <xsl:with-param name="cols-count" select="$cols-count"/>
2738
2907
  </xsl:call-template>
2739
-
2908
+
2740
2909
  <xsl:apply-templates/>
2741
2910
  </fo:table-header>
2742
2911
  </xsl:template><xsl:template name="table-header-title">
@@ -2761,6 +2930,13 @@
2761
2930
  </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2762
2931
  <xsl:apply-templates/>
2763
2932
  </xsl:template><xsl:template name="insertTableFooter">
2933
+ <xsl:param name="cols-count"/>
2934
+ <xsl:if test="../*[local-name()='tfoot']">
2935
+ <fo:table-footer>
2936
+ <xsl:apply-templates select="../*[local-name()='tfoot']" mode="process"/>
2937
+ </fo:table-footer>
2938
+ </xsl:if>
2939
+ </xsl:template><xsl:template name="insertTableFooter2">
2764
2940
  <xsl:param name="cols-count"/>
2765
2941
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2766
2942
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
@@ -2784,11 +2960,29 @@
2784
2960
  <!-- fn will be processed inside 'note' processing -->
2785
2961
 
2786
2962
 
2963
+
2964
+
2965
+
2966
+
2787
2967
  <!-- except gb -->
2788
2968
 
2789
2969
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
2790
2970
 
2791
2971
 
2972
+ <!-- show Note under table in preface (ex. abstract) sections -->
2973
+ <!-- empty, because notes show at page side in main sections -->
2974
+ <!-- <xsl:if test="$namespace = 'bipm'">
2975
+ <xsl:choose>
2976
+ <xsl:when test="ancestor::*[local-name()='preface']">
2977
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
2978
+ </xsl:when>
2979
+ <xsl:otherwise>
2980
+ <fo:block/>
2981
+ </xsl:otherwise>
2982
+ </xsl:choose>
2983
+ </xsl:if> -->
2984
+
2985
+
2792
2986
  <!-- horizontal row separator -->
2793
2987
 
2794
2988
 
@@ -2802,6 +2996,90 @@
2802
2996
  </fo:table-footer>
2803
2997
 
2804
2998
  </xsl:if>
2999
+ </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
3000
+ <xsl:param name="table_attributes"/>
3001
+ <xsl:param name="colwidths"/>
3002
+
3003
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3004
+
3005
+ <xsl:if test="$isNoteOrFnExist = 'true'">
3006
+
3007
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
3008
+
3009
+ <fo:table keep-with-previous="always">
3010
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
3011
+ <xsl:choose>
3012
+ <xsl:when test="@name = 'border-top'">
3013
+ <xsl:attribute name="{@name}">0pt solid black</xsl:attribute>
3014
+ </xsl:when>
3015
+ <xsl:when test="@name = 'border'">
3016
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
3017
+ <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
3018
+ </xsl:when>
3019
+ <xsl:otherwise>
3020
+ <xsl:attribute name="{@name}"><xsl:value-of select="."/></xsl:attribute>
3021
+ </xsl:otherwise>
3022
+ </xsl:choose>
3023
+ </xsl:for-each>
3024
+
3025
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3026
+ <xsl:choose>
3027
+ <xsl:when test=". = 1 or . = 0">
3028
+ <fo:table-column column-width="proportional-column-width(2)"/>
3029
+ </xsl:when>
3030
+ <xsl:otherwise>
3031
+ <fo:table-column column-width="proportional-column-width({.})"/>
3032
+ </xsl:otherwise>
3033
+ </xsl:choose>
3034
+ </xsl:for-each>
3035
+
3036
+ <fo:table-body>
3037
+ <fo:table-row>
3038
+ <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
3039
+
3040
+ <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
3041
+
3042
+
3043
+
3044
+ <!-- fn will be processed inside 'note' processing -->
3045
+
3046
+
3047
+
3048
+
3049
+
3050
+
3051
+
3052
+ <!-- except gb -->
3053
+
3054
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3055
+
3056
+
3057
+ <!-- <xsl:if test="$namespace = 'bipm'">
3058
+ <xsl:choose>
3059
+ <xsl:when test="ancestor::*[local-name()='preface']">
3060
+ show Note under table in preface (ex. abstract) sections
3061
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
3062
+ </xsl:when>
3063
+ <xsl:otherwise>
3064
+ empty, because notes show at page side in main sections
3065
+ <fo:block/>
3066
+ </xsl:otherwise>
3067
+ </xsl:choose>
3068
+ </xsl:if> -->
3069
+
3070
+
3071
+ <!-- horizontal row separator -->
3072
+
3073
+
3074
+ <!-- fn processing -->
3075
+ <xsl:call-template name="fn_display"/>
3076
+
3077
+ </fo:table-cell>
3078
+ </fo:table-row>
3079
+ </fo:table-body>
3080
+
3081
+ </fo:table>
3082
+ </xsl:if>
2805
3083
  </xsl:template><xsl:template match="*[local-name()='tbody']">
2806
3084
 
2807
3085
  <xsl:variable name="cols-count">
@@ -2904,8 +3182,11 @@
2904
3182
 
2905
3183
  </xsl:if>
2906
3184
 
2907
-
2908
-
3185
+
3186
+
3187
+ <!-- <xsl:if test="$namespace = 'bipm'">
3188
+ <xsl:attribute name="height">8mm</xsl:attribute>
3189
+ </xsl:if> -->
2909
3190
 
2910
3191
  <xsl:apply-templates/>
2911
3192
  </fo:table-row>
@@ -2931,6 +3212,7 @@
2931
3212
 
2932
3213
 
2933
3214
 
3215
+
2934
3216
  <xsl:if test="@colspan">
2935
3217
  <xsl:attribute name="number-columns-spanned">
2936
3218
  <xsl:value-of select="@colspan"/>
@@ -2976,7 +3258,8 @@
2976
3258
  <xsl:attribute name="border">solid black 0</xsl:attribute>
2977
3259
  </xsl:if>
2978
3260
 
2979
-
3261
+
3262
+
2980
3263
 
2981
3264
 
2982
3265
 
@@ -3009,14 +3292,17 @@
3009
3292
 
3010
3293
 
3011
3294
 
3295
+
3296
+
3012
3297
  <fo:inline padding-right="2mm">
3013
3298
 
3014
3299
 
3015
3300
 
3016
-
3301
+
3017
3302
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3018
3303
 
3019
3304
  </fo:inline>
3305
+
3020
3306
  <xsl:apply-templates mode="process"/>
3021
3307
  </fo:block>
3022
3308
 
@@ -3043,6 +3329,7 @@
3043
3329
 
3044
3330
 
3045
3331
 
3332
+
3046
3333
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
3047
3334
 
3048
3335
 
@@ -3052,12 +3339,15 @@
3052
3339
 
3053
3340
 
3054
3341
 
3342
+
3055
3343
  <xsl:value-of select="@reference"/>
3056
3344
 
3345
+
3057
3346
  </fo:inline>
3058
3347
  <fo:inline>
3059
3348
 
3060
- <xsl:apply-templates/>
3349
+ <!-- <xsl:apply-templates /> -->
3350
+ <xsl:copy-of select="./node()"/>
3061
3351
  </fo:inline>
3062
3352
  </fo:block>
3063
3353
  </xsl:if>
@@ -3094,7 +3384,20 @@
3094
3384
  <xsl:variable name="following_dl_colwidths">
3095
3385
  <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
3096
3386
  <xsl:variable name="html-table">
3097
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3387
+ <xsl:variable name="doc_ns">
3388
+
3389
+ </xsl:variable>
3390
+ <xsl:variable name="ns">
3391
+ <xsl:choose>
3392
+ <xsl:when test="normalize-space($doc_ns) != ''">
3393
+ <xsl:value-of select="normalize-space($doc_ns)"/>
3394
+ </xsl:when>
3395
+ <xsl:otherwise>
3396
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
3397
+ </xsl:otherwise>
3398
+ </xsl:choose>
3399
+ </xsl:variable>
3400
+ <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3098
3401
  <xsl:element name="{$ns}:table">
3099
3402
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3100
3403
  <tbody>
@@ -3159,7 +3462,8 @@
3159
3462
  <xsl:attribute name="margin-bottom">0</xsl:attribute>
3160
3463
  </xsl:if>
3161
3464
 
3162
- <xsl:apply-templates/>
3465
+ <!-- <xsl:apply-templates /> -->
3466
+ <xsl:copy-of select="./node()"/>
3163
3467
  </fo:block>
3164
3468
  </fo:table-cell>
3165
3469
  </fo:table-row>
@@ -3184,9 +3488,12 @@
3184
3488
 
3185
3489
 
3186
3490
 
3491
+
3187
3492
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3188
3493
 
3494
+
3189
3495
  <xsl:value-of select="@reference"/>
3496
+
3190
3497
  </fo:basic-link>
3191
3498
  </fo:inline>
3192
3499
  </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
@@ -3298,7 +3605,20 @@
3298
3605
  </xsl:choose>
3299
3606
  <!-- create virtual html table for dl/[dt and dd] -->
3300
3607
  <xsl:variable name="html-table">
3301
- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
3608
+ <xsl:variable name="doc_ns">
3609
+
3610
+ </xsl:variable>
3611
+ <xsl:variable name="ns">
3612
+ <xsl:choose>
3613
+ <xsl:when test="normalize-space($doc_ns) != ''">
3614
+ <xsl:value-of select="normalize-space($doc_ns)"/>
3615
+ </xsl:when>
3616
+ <xsl:otherwise>
3617
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
3618
+ </xsl:otherwise>
3619
+ </xsl:choose>
3620
+ </xsl:variable>
3621
+ <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3302
3622
  <xsl:element name="{$ns}:table">
3303
3623
  <tbody>
3304
3624
  <xsl:apply-templates mode="dl"/>
@@ -3444,6 +3764,7 @@
3444
3764
 
3445
3765
 
3446
3766
 
3767
+
3447
3768
  <xsl:apply-templates/>
3448
3769
  <!-- <xsl:if test="$namespace = 'gb'">
3449
3770
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -3510,18 +3831,18 @@
3510
3831
  </xsl:template><xsl:template match="*[local-name()='tt']">
3511
3832
  <fo:inline xsl:use-attribute-sets="tt-style">
3512
3833
  <xsl:variable name="_font-size">
3513
-
3514
-
3515
-
3834
+
3835
+
3836
+
3516
3837
 
3517
3838
 
3518
3839
  10
3519
3840
 
3520
3841
 
3521
3842
 
3522
-
3523
3843
 
3524
-
3844
+
3845
+
3525
3846
 
3526
3847
 
3527
3848
  </xsl:variable>
@@ -3859,7 +4180,7 @@
3859
4180
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3860
4181
  <xsl:value-of select="substring($str, 2)"/>
3861
4182
  </xsl:template><xsl:template match="mathml:math">
3862
- <fo:inline font-family="STIX2Math">
4183
+ <fo:inline font-family="STIX Two Math"> <!-- -->
3863
4184
  <xsl:variable name="mathml">
3864
4185
  <xsl:apply-templates select="." mode="mathml"/>
3865
4186
  </xsl:variable>
@@ -3953,7 +4274,7 @@
3953
4274
  <xsl:apply-templates/>
3954
4275
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3955
4276
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3956
-
4277
+
3957
4278
  <xsl:apply-templates/>
3958
4279
  </fo:basic-link>
3959
4280
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -4006,6 +4327,8 @@
4006
4327
 
4007
4328
 
4008
4329
 
4330
+
4331
+
4009
4332
  <fo:inline xsl:use-attribute-sets="note-name-style">
4010
4333
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4011
4334
  </fo:inline>
@@ -4131,15 +4454,109 @@
4131
4454
 
4132
4455
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4133
4456
  </fo:block>
4134
- </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">
4457
+ </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">
4135
4458
  <xsl:apply-templates mode="contents"/>
4136
4459
  <xsl:text> </xsl:text>
4137
- </xsl:template><xsl:template match="text()" mode="contents">
4460
+ </xsl:template><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="bookmarks">
4461
+ <xsl:apply-templates mode="bookmarks"/>
4462
+ <xsl:text> </xsl:text>
4463
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
4138
4464
  <xsl:value-of select="."/>
4139
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
4465
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
4466
+ <xsl:value-of select="."/>
4467
+ </xsl:template><xsl:template match="node()" mode="contents">
4468
+ <xsl:apply-templates mode="contents"/>
4469
+ </xsl:template><xsl:template match="node()" mode="bookmarks">
4470
+ <xsl:apply-templates mode="bookmarks"/>
4471
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
4472
+ <xsl:apply-templates select="."/>
4473
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4474
+ <xsl:apply-templates mode="bookmarks"/>
4475
+ </xsl:template><xsl:template name="addBookmarks">
4476
+ <xsl:param name="contents"/>
4477
+ <xsl:if test="xalan:nodeset($contents)//item">
4478
+ <fo:bookmark-tree>
4479
+ <xsl:choose>
4480
+ <xsl:when test="xalan:nodeset($contents)/doc">
4481
+ <xsl:choose>
4482
+ <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
4483
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
4484
+ <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4485
+ <fo:bookmark-title>
4486
+ <xsl:variable name="bookmark-title_">
4487
+ <xsl:call-template name="getLangVersion">
4488
+ <xsl:with-param name="lang" select="@lang"/>
4489
+ </xsl:call-template>
4490
+ </xsl:variable>
4491
+ <xsl:choose>
4492
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
4493
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
4494
+ </xsl:when>
4495
+ <xsl:otherwise>
4496
+ <xsl:choose>
4497
+ <xsl:when test="@lang = 'en'">English</xsl:when>
4498
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
4499
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
4500
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
4501
+ </xsl:choose>
4502
+ </xsl:otherwise>
4503
+ </xsl:choose>
4504
+ </fo:bookmark-title>
4505
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
4506
+ </fo:bookmark>
4507
+
4508
+ </xsl:for-each>
4509
+ </xsl:when>
4510
+ <xsl:otherwise>
4511
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
4512
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
4513
+ </xsl:for-each>
4514
+ </xsl:otherwise>
4515
+ </xsl:choose>
4516
+ </xsl:when>
4517
+ <xsl:otherwise>
4518
+ <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
4519
+ </xsl:otherwise>
4520
+ </xsl:choose>
4521
+
4522
+
4523
+
4524
+
4525
+
4526
+
4527
+
4528
+
4529
+ </fo:bookmark-tree>
4530
+ </xsl:if>
4531
+ </xsl:template><xsl:template name="getLangVersion">
4532
+ <xsl:param name="lang"/>
4533
+ <xsl:choose>
4534
+ <xsl:when test="$lang = 'en'">
4535
+
4536
+
4537
+ </xsl:when>
4538
+ <xsl:when test="$lang = 'fr'">
4539
+
4540
+
4541
+ </xsl:when>
4542
+ <xsl:when test="$lang = 'de'">Deutsche</xsl:when>
4543
+ <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
4544
+ </xsl:choose>
4545
+ </xsl:template><xsl:template match="item" mode="bookmark">
4546
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
4547
+ <fo:bookmark-title>
4548
+ <xsl:if test="@section != ''">
4549
+ <xsl:value-of select="@section"/>
4550
+ <xsl:text> </xsl:text>
4551
+ </xsl:if>
4552
+ <xsl:value-of select="normalize-space(title)"/>
4553
+ </fo:bookmark-title>
4554
+ <xsl:apply-templates mode="bookmark"/>
4555
+ </fo:bookmark>
4556
+ </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
4140
4557
  <xsl:if test="normalize-space() != ''">
4141
4558
  <fo:block xsl:use-attribute-sets="figure-name-style">
4142
-
4559
+
4143
4560
  <xsl:apply-templates/>
4144
4561
  </fo:block>
4145
4562
  </xsl:if>
@@ -4194,7 +4611,7 @@
4194
4611
  <xsl:apply-templates/>
4195
4612
  </xsl:otherwise>
4196
4613
  </xsl:choose>
4197
- </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
4614
+ </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
4198
4615
  <xsl:text> </xsl:text>
4199
4616
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
4200
4617
  <xsl:copy>
@@ -4776,6 +5193,7 @@
4776
5193
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4777
5194
  <fo:block>
4778
5195
  <xsl:call-template name="setId"/>
5196
+
4779
5197
  <xsl:apply-templates/>
4780
5198
  </fo:block>
4781
5199
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -4801,20 +5219,30 @@
4801
5219
  <!-- 0xA0 to space replacement -->
4802
5220
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
4803
5221
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
4804
- <fo:block-container margin-left="0mm">
4805
- <xsl:if test="parent::*[local-name() = 'note']">
4806
- <xsl:attribute name="margin-left">
4807
- <xsl:choose>
4808
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
4809
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
4810
- </xsl:choose>
4811
- </xsl:attribute>
4812
-
4813
- </xsl:if>
4814
- <fo:block-container margin-left="0mm">
4815
- <xsl:apply-templates select="." mode="ul_ol"/>
4816
- </fo:block-container>
4817
- </fo:block-container>
5222
+ <xsl:choose>
5223
+ <xsl:when test="parent::*[local-name() = 'note']">
5224
+ <fo:block-container>
5225
+ <xsl:attribute name="margin-left">
5226
+ <xsl:choose>
5227
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
5228
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
5229
+ </xsl:choose>
5230
+ </xsl:attribute>
5231
+
5232
+
5233
+ <fo:block-container margin-left="0mm">
5234
+ <fo:block>
5235
+ <xsl:apply-templates select="." mode="ul_ol"/>
5236
+ </fo:block>
5237
+ </fo:block-container>
5238
+ </fo:block-container>
5239
+ </xsl:when>
5240
+ <xsl:otherwise>
5241
+ <fo:block>
5242
+ <xsl:apply-templates select="." mode="ul_ol"/>
5243
+ </fo:block>
5244
+ </xsl:otherwise>
5245
+ </xsl:choose>
4818
5246
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4819
5247
  <!-- <row>
4820
5248
  <date>05-07-2013</date>
@@ -4987,6 +5415,7 @@
4987
5415
 
4988
5416
 
4989
5417
 
5418
+
4990
5419
 
4991
5420
  </xsl:variable>
4992
5421
  <xsl:choose>
@@ -5003,6 +5432,7 @@
5003
5432
  <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
5004
5433
 
5005
5434
 
5435
+
5006
5436
  </dc:creator>
5007
5437
  <dc:description>
5008
5438
  <xsl:variable name="abstract">
@@ -5012,6 +5442,7 @@
5012
5442
 
5013
5443
 
5014
5444
 
5445
+
5015
5446
  </xsl:variable>
5016
5447
  <xsl:value-of select="normalize-space($abstract)"/>
5017
5448
  </dc:description>
@@ -5112,6 +5543,7 @@
5112
5543
 
5113
5544
 
5114
5545
 
5546
+
5115
5547
  </xsl:variable>
5116
5548
  <xsl:if test="$documentNS != $XSLNS">
5117
5549
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -5137,4 +5569,21 @@
5137
5569
  </xsl:otherwise>
5138
5570
  </xsl:choose>
5139
5571
  </xsl:attribute>
5572
+ </xsl:template><xsl:template name="add-letter-spacing">
5573
+ <xsl:param name="text"/>
5574
+ <xsl:param name="letter-spacing" select="'0.15'"/>
5575
+ <xsl:if test="string-length($text) &gt; 0">
5576
+ <xsl:variable name="char" select="substring($text, 1, 1)"/>
5577
+ <fo:inline padding-right="{$letter-spacing}mm">
5578
+ <xsl:if test="$char = '®'">
5579
+ <xsl:attribute name="font-size">58%</xsl:attribute>
5580
+ <xsl:attribute name="baseline-shift">30%</xsl:attribute>
5581
+ </xsl:if>
5582
+ <xsl:value-of select="$char"/>
5583
+ </fo:inline>
5584
+ <xsl:call-template name="add-letter-spacing">
5585
+ <xsl:with-param name="text" select="substring($text, 2)"/>
5586
+ <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
5587
+ </xsl:call-template>
5588
+ </xsl:if>
5140
5589
  </xsl:template></xsl:stylesheet>