metanorma-iec 2.0.2 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,17 +2,12 @@
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
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 -->
7
- <xsl:variable name="images" select="document($svg_images)"/>
8
- <xsl:param name="basepath"/>
5
+ <xsl:param name="additionalXMLs" select="''"/> <!-- iec-rice.fr.xml -->
9
6
 
10
7
  <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
11
8
 
12
9
 
13
-
14
- <xsl:param name="additionalXMLs" select="''"/> <!-- iec-rice.fr.xml -->
15
-
10
+
16
11
  <xsl:variable name="additionalXMLsArray">
17
12
  <xsl:call-template name="split">
18
13
  <xsl:with-param name="pText" select="normalize-space($additionalXMLs)"/>
@@ -23,14 +18,8 @@
23
18
 
24
19
  <xsl:variable name="debug">false</xsl:variable>
25
20
 
26
- <xsl:variable name="marginLeftRight1" select="25"/>
27
- <xsl:variable name="marginLeftRight2" select="25"/>
28
- <xsl:variable name="marginTop" select="31"/>
29
- <xsl:variable name="marginBottom" select="15"/>
30
-
31
21
  <xsl:variable name="copyrightText" select="concat('© ', //iec:iec-standard/iec:bibdata/iec:copyright/iec:owner/iec:organization/iec:abbreviation, ':', //iec:iec-standard/iec:bibdata/iec:copyright/iec:from)"/>
32
- <!-- <xsl:variable name="lang-1st-letter" select="concat('(', translate(substring(iec:iec-standard/iec:bibdata/iec:language,1,1),$lower, $upper), ')')"/> -->
33
- <xsl:variable name="lang-1st-letter" select="''"/>
22
+
34
23
  <xsl:variable name="ISOname" select="//iec:iec-standard/iec:bibdata/iec:docidentifier[@type='iso' or @type='ISO']"/>
35
24
 
36
25
  <xsl:variable name="part" select="//iec:iec-standard/iec:bibdata/iec:ext/iec:structuredidentifier/iec:project-number/@part"/>
@@ -85,7 +74,7 @@
85
74
  <item level="1" id="Foreword" display="true">Foreword</item>
86
75
  <item id="term-script" display="false">3.2</item>
87
76
  -->
88
- <xsl:variable name="contents">
77
+ <xsl:variable name="contents_">
89
78
 
90
79
  <xsl:for-each select="//iec:iec-standard">
91
80
  <xsl:variable name="lang" select="*[local-name()='bibdata']/*[local-name()='language'][@current = 'true']"/>
@@ -102,63 +91,23 @@
102
91
  </xsl:for-each>
103
92
  </xsl:for-each>
104
93
 
105
-
106
- <!-- <xsl:variable name="docid">
107
- <xsl:call-template name="getDocumentId"/>
108
- </xsl:variable>
109
- <doc id="{$docid}" lang="{$lang}">
110
- <xsl:call-template name="generateContents"/>
111
- </doc>
112
-
113
- <xsl:for-each select="xalan:nodeset($additionalXMLsArray)/*">
114
- <xsl:for-each select="document(.)">
115
- <xsl:variable name="lang">
116
- <xsl:call-template name="getLang"/>
117
- </xsl:variable>
118
- <xsl:variable name="document">
119
- <xsl:apply-templates mode="change_id">
120
- <xsl:with-param name="lang" select="$lang"/>
121
- </xsl:apply-templates>
122
- </xsl:variable>
123
- <xsl:for-each select="xalan:nodeset($document)">
124
- <xsl:variable name="docid">
125
- <xsl:call-template name="getDocumentId"/>
126
- </xsl:variable>
127
- <doc id="{$docid}" lang="{$lang}">
128
- <xsl:call-template name="generateContents"/>
129
- </doc>
130
- </xsl:for-each>
131
- </xsl:for-each>
132
- </xsl:for-each> -->
133
-
134
-
135
94
  </xsl:variable>
95
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
136
96
 
137
97
  <xsl:template name="generateContents">
138
98
  <contents>
139
99
  <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
140
100
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
141
101
  <xsl:apply-templates select="//iec:indexsect" mode="contents"/>
142
- <xsl:for-each select="//*[local-name() = 'figure'][@id and *[local-name() = 'name']]">
143
- <figure id="{@id}">
144
- <title><xsl:value-of select="*[local-name() = 'name']/text()"/></title>
145
- </figure>
146
- </xsl:for-each>
147
- <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name']]">
148
- <table id="{@id}">
149
- <title><xsl:value-of select="*[local-name() = 'name']/text()"/></title>
150
- </table>
151
- </xsl:for-each>
102
+ <xsl:call-template name="processTablesFigures_Contents">
103
+ <xsl:with-param name="always">true</xsl:with-param>
104
+ </xsl:call-template>
152
105
  </contents>
153
106
  </xsl:template>
154
107
 
155
108
  <xsl:variable name="color_blue">rgb(0, 90, 162)</xsl:variable>
156
109
  <xsl:variable name="color_gray">rgb(157, 158, 160)</xsl:variable>
157
110
 
158
- <xsl:variable name="lang">
159
- <xsl:call-template name="getLang"/>
160
- </xsl:variable>
161
-
162
111
  <xsl:variable name="isIEV" select="normalize-space((//iec:iec-standard/iec:bibdata/iec:title[@language = 'en' and @type = 'title-main'] = 'International Electrotechnical Vocabulary') and 1 = 1)"/>
163
112
 
164
113
  <xsl:template match="/">
@@ -349,143 +298,19 @@
349
298
 
350
299
  <xsl:apply-templates select="(//iec:iec-standard)[1]/iec:boilerplate/iec:feedback-statement"/> <!-- //iec:clause[not(@id) or @id != 'boilerplate-cenelec-attention'] -->
351
300
  <fo:block span="all" border-bottom="0.5pt solid black"/>
301
+ <!-- About the IEC
302
+ The International Electrotechnical Commission (IEC) is the leading global organization that prepares and publishes
303
+ International Standards for all electrical, electronic and related technologies.
304
+ About IEC publications
305
+ The technical content of IEC publications is kept under constant review by the IEC. Please make sure that you have the
306
+ latest edition, a corrigenda or an amendment might have been published.
307
+ ...
308
+ -->
352
309
  <xsl:if test="(//iec:iec-standard)[2]/iec:boilerplate/iec:feedback-statement">
353
310
  <xsl:apply-templates select="(//iec:iec-standard)[2]/iec:boilerplate/iec:feedback-statement"/>
354
311
  <fo:block span="all"/>
355
312
  </xsl:if>
356
- <!-- <fo:block span="all">
357
- <fo:block-container margin-top="6pt">
358
- <fo:block-container text-align="justify" margin-left="0mm" margin-right="0mm">
359
-
360
- <fo:block font-weight="bold">About the IEC</fo:block>
361
- <fo:block margin-bottom="6pt">The International Electrotechnical Commission (IEC) is the leading global organization that prepares and publishes
362
- International Standards for all electrical, electronic and related technologies.</fo:block>
363
-
364
- <fo:block font-weight="bold">About IEC publications</fo:block>
365
- <fo:block margin-bottom="6pt">The technical content of IEC publications is kept under constant review by the IEC. Please make sure that you have the
366
- latest edition, a corrigenda or an amendment might have been published.</fo:block>
367
-
368
- <fo:table table-layout="fixed" width="100%" margin-bottom="12pt">
369
- <fo:table-column column-width="82mm"/>
370
- <fo:table-column column-width="78mm"/>
371
- <fo:table-body>
372
- <fo:table-row border-bottom="0.5pt solid black">
373
- <fo:table-cell padding-right="5mm">
374
- <fo:block font-weight="bold">IEC Catalogue - <fo:inline color="blue">webstore.iec.ch/catalogue</fo:inline></fo:block>
375
- <fo:block margin-bottom="6pt">
376
- <xsl:text>The stand-alone application for consulting the entire
377
- bibliographical information on IEC International Standards,
378
- Technical Specifications, Technical Reports and other
379
- documents. Available for PC, Mac OS, Android Tablets and
380
- iPad.</xsl:text>
381
- </fo:block>
382
- <fo:block font-weight="bold">IEC publications search - <fo:inline color="blue">www.iec.ch/searchpub</fo:inline></fo:block>
383
- <fo:block margin-bottom="6pt">
384
- <xsl:text>The advanced search enables to find IEC publications by a
385
- variety of criteria (reference number, text, technical
386
- committee,…). It also gives information on projects, replaced
387
- and withdrawn publications.</xsl:text>
388
- </fo:block>
389
- <fo:block font-weight="bold">IEC Just Published - <fo:inline color="blue">webstore.iec.ch/justpublished</fo:inline></fo:block>
390
- <fo:block margin-bottom="6pt">
391
- <xsl:text>Stay up to date on all new IEC publications. Just Published
392
- details all new publications released. Available online and
393
- also once a month by email.</xsl:text>
394
- </fo:block>
395
- </fo:table-cell>
396
- <fo:table-cell>
397
- <fo:block font-weight="bold">Electropedia - <fo:inline color="blue">www.electropedia.org</fo:inline></fo:block>
398
- <fo:block margin-bottom="6pt">
399
- <xsl:text>The world's leading online dictionary of electronic and
400
- electrical terms containing more than 30 000 terms and
401
- definitions in English and French, with equivalent terms in 14
402
- additional languages. Also known as the International
403
- Electrotechnical Vocabulary (IEV) online.</xsl:text>
404
- </fo:block>
405
- <fo:block font-weight="bold">IEC Glossary - <fo:inline color="blue">std.iec.ch/glossary</fo:inline></fo:block>
406
- <fo:block margin-bottom="6pt">
407
- <xsl:text>More than 55 000 electrotechnical terminology entries in
408
- English and French extracted from the Terms and Definitions
409
- clause of IEC publications issued since 2002. Some entries
410
- have been collected from earlier publications of IEC TC 37,
411
- 77, 86 and CISPR.</xsl:text>
412
- </fo:block>
413
- <fo:block font-weight="bold">IEC Customer Service Centre - <fo:inline color="blue">webstore.iec.ch/csc</fo:inline></fo:block>
414
- <fo:block margin-bottom="6pt">
415
- <xsl:text>If you wish to give us your feedback on this publication or
416
- need further assistance, please contact the Customer Service
417
- Centre: </xsl:text><fo:inline color="blue">csc@iec.ch</fo:inline>.
418
- </fo:block>
419
- </fo:table-cell>
420
- </fo:table-row>
421
- </fo:table-body>
422
- </fo:table>
423
-
424
- <fo:block font-weight="bold">A propos de l'IEC</fo:block>
425
- <fo:block margin-bottom="6pt">La Commission Electrotechnique Internationale (IEC) est la première organisation mondiale qui élabore et publie des
426
- Normes internationales pour tout ce qui a trait à l'électricité, à l'électronique et aux technologies apparentées.</fo:block>
427
-
428
- <fo:block font-weight="bold">A propos des publications IEC</fo:block>
429
- <fo:block margin-bottom="6pt">Le contenu technique des publications IEC est constamment revu. Veuillez vous assurer que vous possédez l’édition la
430
- plus récente, un corrigendum ou amendement peut avoir été publié.</fo:block>
431
-
432
- <fo:table table-layout="fixed" width="100%">
433
- <fo:table-column column-width="82mm"/>
434
- <fo:table-column column-width="78mm"/>
435
- <fo:table-body>
436
- <fo:table-row>
437
- <fo:table-cell padding-right="5mm">
438
- <fo:block font-weight="bold">Catalogue IEC - <fo:inline color="blue">webstore.iec.ch/catalogue</fo:inline></fo:block>
439
- <fo:block margin-bottom="6pt">
440
- <xsl:text>Application autonome pour consulter tous les renseignements
441
- bibliographiques sur les Normes internationales,
442
- Spécifications techniques, Rapports techniques et autres
443
- documents de l'IEC. Disponible pour PC, Mac OS, tablettes
444
- Android et iPad.</xsl:text>
445
- </fo:block>
446
- <fo:block font-weight="bold">Recherche de publications IEC - <fo:inline color="blue">www.iec.ch/searchpub</fo:inline></fo:block>
447
- <fo:block margin-bottom="6pt">
448
- <xsl:text>La recherche avancée permet de trouver des publications IEC
449
- en utilisant différents critères (numéro de référence, texte,
450
- comité d’études,…). Elle donne aussi des informations sur les
451
- projets et les publications remplacées ou retirées.</xsl:text>
452
- </fo:block>
453
- <fo:block font-weight="bold">IEC Just Published - <fo:inline color="blue">webstore.iec.ch/justpublished</fo:inline></fo:block>
454
- <fo:block margin-bottom="6pt">
455
- <xsl:text>Restez informé sur les nouvelles publications IEC. Just
456
- Published détaille les nouvelles publications parues.
457
- Disponible en ligne et aussi une fois par mois par email.</xsl:text>
458
- </fo:block>
459
- </fo:table-cell>
460
- <fo:table-cell>
461
- <fo:block font-weight="bold">Electropedia - <fo:inline color="blue">www.electropedia.org</fo:inline></fo:block>
462
- <fo:block margin-bottom="6pt">
463
- <xsl:text>Le premier dictionnaire en ligne de termes électroniques et
464
- électriques. Il contient plus de 30 000 termes et définitions en
465
- anglais et en français, ainsi que les termes équivalents dans
466
- 14 langues additionnelles. Egalement appelé Vocabulaire
467
- Electrotechnique International (IEV) en ligne.</xsl:text>
468
- </fo:block>
469
- <fo:block font-weight="bold">Glossaire IEC - <fo:inline color="blue">std.iec.ch/glossary</fo:inline></fo:block>
470
- <fo:block margin-bottom="6pt">
471
- <xsl:text>Plus de 55 000 entrées terminologiques électrotechniques, en
472
- anglais et en français, extraites des articles Termes et
473
- Définitions des publications IEC parues depuis 2002. Plus
474
- certaines entrées antérieures extraites des publications des
475
- CE 37, 77, 86 et CISPR de l'IEC.</xsl:text>
476
- </fo:block>
477
- <fo:block font-weight="bold">Service Clients - <fo:inline color="blue">webstore.iec.ch/csc</fo:inline></fo:block>
478
- <fo:block margin-bottom="6pt">
479
- <xsl:text>Si vous désirez nous donner des commentaires sur cette
480
- publication ou si vous avez des questions contactez-nous: </xsl:text><fo:inline color="blue">csc@iec.ch</fo:inline>.
481
- </fo:block>
482
- </fo:table-cell>
483
- </fo:table-row>
484
- </fo:table-body>
485
- </fo:table>
486
- </fo:block-container>
487
- </fo:block-container>
488
- </fo:block> -->
313
+
489
314
  </fo:flow>
490
315
  </fo:page-sequence>
491
316
  </xsl:if>
@@ -513,6 +338,7 @@
513
338
  <xsl:call-template name="getLocalizedString">
514
339
  <xsl:with-param name="key">IEC</xsl:with-param>
515
340
  <xsl:with-param name="lang"><xsl:value-of select="$lang_second"/></xsl:with-param>
341
+ <xsl:with-param name="returnEmptyIfNotFound">true</xsl:with-param>
516
342
  </xsl:call-template>
517
343
  </xsl:variable>
518
344
 
@@ -520,7 +346,7 @@
520
346
  <fo:block font-size="9pt" line-height="150%" margin-top="8pt">
521
347
  <fo:block-container width="40mm">
522
348
  <fo:block>
523
- <!-- <xsl:value-of select="'COMMISSION ELECTROTECHNIQUE INTERNATIONALE'"/> -->
349
+ <!-- 'COMMISSION ELECTROTECHNIQUE INTERNATIONALE' -->
524
350
  <xsl:value-of select="$IEC_lang_second"/>
525
351
  </fo:block>
526
352
  </fo:block-container>
@@ -547,9 +373,7 @@
547
373
  </xsl:variable>
548
374
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($price_code))"/>
549
375
  </fo:block>
550
- <!-- <xsl:if test="$lang != 'fr'">
551
- <fo:block>CODE PRIX</fo:block>
552
- </xsl:if> -->
376
+
553
377
  <fo:block>
554
378
  <xsl:variable name="price_code">
555
379
  <xsl:call-template name="getLocalizedString">
@@ -578,7 +402,7 @@
578
402
  <fo:inline keep-together.within-line="always"><fo:leader leader-pattern="space"/>
579
403
  <xsl:text> </xsl:text>
580
404
  <xsl:if test="//iec:iec-standard/iec:bibdata/iec:docidentifier[@type='ISBN']">
581
- <!-- <xsl:text>Example: ISBN 978-2-8322-1532-6</xsl:text> -->
405
+ <!-- Example: ISBN 978-2-8322-1532-6 -->
582
406
  <xsl:value-of select="//iec:iec-standard/iec:bibdata/iec:docidentifier[@type='ISBN']"/>
583
407
  </xsl:if>
584
408
  </fo:inline>
@@ -614,22 +438,6 @@
614
438
 
615
439
  <xsl:apply-templates select="(//iec:iec-standard)[1]/iec:boilerplate/iec:copyright-statement/iec:clause/iec:p[not(@id)]"/>
616
440
 
617
- <!-- <fo:inline font-weight="bold">
618
- <xsl:call-template name="addLetterSpacing">
619
- <xsl:with-param name="text">
620
- <xsl:for-each select="(//iec:iec-standard)[1]/iec:bibdata/iec:copyright">
621
- <xsl:text>Copyright © </xsl:text><xsl:value-of select="iec:from"/><xsl:text> </xsl:text><xsl:value-of select="iec:owner/iec:organization/iec:name"/><xsl:text>, </xsl:text><xsl:value-of select="iec:owner/iec:organization/iec:abbreviation"/>
622
- </xsl:for-each>
623
- </xsl:with-param>
624
- </xsl:call-template>
625
- </fo:inline>
626
- <fo:inline>
627
- <xsl:call-template name="addLetterSpacing">
628
- <xsl:with-param name="text">
629
- <xsl:text>. All rights reserved. It is permitted to download this electronic file, to make a copy and to print out the content for the sole purpose of preparing National Committee positions. You may not copy or "mirror" the file or printed version of the document, or any part of it, for any other purpose without permission in writing from IEC.</xsl:text>
630
- </xsl:with-param>
631
- </xsl:call-template>
632
- </fo:inline> -->
633
441
  </fo:block>
634
442
  </fo:block-container>
635
443
  </fo:static-content>
@@ -647,19 +455,10 @@
647
455
  </fo:inline>
648
456
  </fo:block>
649
457
  <fo:block font-size="10pt" text-align="right" margin-top="-2mm" margin-bottom="8pt">
458
+ <!-- Examples: 'FINAL DRAFT INTERNATIONAL STANDARD (FDIS)', 'COMMITTEE DRAFT FOR VOTE (CDV)' -->
650
459
  <xsl:call-template name="addLetterSpacing">
651
460
  <xsl:with-param name="text" select="concat($stage-fullname-uppercased, ' (', $stage-abbreviation ,')')"/>
652
461
  </xsl:call-template>
653
- <!-- <xsl:if test="$stage-abbreviation = 'FDIS'">
654
- <xsl:call-template name="addLetterSpacing">
655
- <xsl:with-param name="text" select="'FINAL DRAFT INTERNATIONAL STANDARD (FDIS)'"/>
656
- </xsl:call-template>
657
- </xsl:if>
658
- <xsl:if test="$stage-abbreviation = 'CDV'">
659
- <xsl:call-template name="addLetterSpacing">
660
- <xsl:with-param name="text" select="'COMMITTEE DRAFT FOR VOTE (CDV)'"/>
661
- </xsl:call-template>
662
- </xsl:if> -->
663
462
  <xsl:text> </xsl:text>
664
463
  </fo:block>
665
464
  <fo:block-container margin-left="57mm">
@@ -937,24 +736,6 @@
937
736
 
938
737
  <xsl:apply-templates select="(//iec:iec-standard)[1]/iec:boilerplate/iec:feedback-statement/iec:clause[@id = 'boilerplate-cenelec-attention']"/>
939
738
 
940
- <!-- <fo:block font-size="8pt" margin-bottom="10pt" text-align="justify">
941
- <xsl:if test="$stage-abbreviation = 'FDIS'">
942
- <xsl:call-template name="addLetterSpacing">
943
- <xsl:with-param name="text" select="'The attention of IEC National Committees, members of CENELEC, is drawn to the fact that this Final Draft International Standard (FDIS) is submitted for parallel voting.'"/>
944
- </xsl:call-template>
945
- </xsl:if>
946
- <xsl:if test="$stage-abbreviation = 'CDV'">
947
- <xsl:call-template name="addLetterSpacing">
948
- <xsl:with-param name="text" select="'The attention of IEC National Committees, members of CENELEC, is drawn to the fact that this Committee Draft for Vote (CDV) is submitted for parallel voting.'"/>
949
- </xsl:call-template>
950
- </xsl:if>
951
- </fo:block>
952
- <fo:block font-size="8pt" margin-bottom="10pt">
953
- <xsl:call-template name="addLetterSpacing">
954
- <xsl:with-param name="text" select="'The CENELEC members are invited to vote through the CENELEC online voting system.'"/>
955
- </xsl:call-template>
956
- </fo:block> -->
957
-
958
739
  </fo:table-cell>
959
740
  <fo:table-cell border="1.5pt solid {$border-color}" padding="1.5mm" padding-bottom="0mm">
960
741
  <fo:block font-size="6.5pt" margin-bottom="6pt">
@@ -982,45 +763,6 @@
982
763
  <fo:block>
983
764
  <xsl:apply-templates select="(//iec:iec-standard)[1]/iec:boilerplate/iec:license-statement" mode="cover-page-internal"/>
984
765
  </fo:block>
985
- <!-- <xsl:if test="$stage-abbreviation = 'FDIS'">
986
- <fo:block margin-bottom="6pt">
987
- <xsl:call-template name="addLetterSpacing">
988
- <xsl:with-param name="text">This document is a draft distributed for approval. It may not be referred to as an International Standard until published as such.</xsl:with-param>
989
- </xsl:call-template>
990
- </fo:block>
991
- <fo:block margin-bottom="6pt">
992
- <xsl:call-template name="addLetterSpacing">
993
- <xsl:with-param name="text">In addition to their evaluation as being acceptable for industrial, technological, commercial and user purposes, Final Draft International Standards may on occasion have to be considered in the light of their potential to become standards to which reference may be made in national regulations.</xsl:with-param>
994
- </xsl:call-template>
995
- </fo:block>
996
- <fo:block>
997
- <xsl:call-template name="addLetterSpacing">
998
- <xsl:with-param name="text"> Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</xsl:with-param>
999
- </xsl:call-template>
1000
- </fo:block>
1001
- </xsl:if>
1002
- <xsl:if test="$stage-abbreviation = 'NWIP' or
1003
- $stage-abbreviation = 'PWI' or
1004
- $stage-abbreviation = 'NP' or
1005
- $stage-abbreviation = 'AWI' or
1006
- $stage-abbreviation = 'WD' or
1007
- $stage-abbreviation = 'CD' or
1008
- $stage-abbreviation = 'CDV' or
1009
- $stage-abbreviation = 'CD-TSTR' or
1010
- $stage-abbreviation = 'DTS' or
1011
- $stage-abbreviation = 'DTR' or
1012
- $stage-abbreviation = 'DPAS'">
1013
- <fo:block margin-bottom="6pt">
1014
- <xsl:call-template name="addLetterSpacing">
1015
- <xsl:with-param name="text">This document is still under study and subject to change. It should not be used for reference purposes.</xsl:with-param>
1016
- </xsl:call-template>
1017
- </fo:block>
1018
- <fo:block margin-bottom="6pt">
1019
- <xsl:call-template name="addLetterSpacing">
1020
- <xsl:with-param name="text">Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</xsl:with-param>
1021
- </xsl:call-template>
1022
- </fo:block>
1023
- </xsl:if> -->
1024
766
  </fo:block-container>
1025
767
 
1026
768
  <fo:block-container background-color="rgb(219, 229, 241)" margin-top="4mm" padding="2mm" padding-top="1mm" border="1.5pt solid white">
@@ -1060,24 +802,6 @@
1060
802
  <xsl:apply-templates select="(//iec:iec-standard)[1]/iec:bibdata/iec:ext/iec:tc-sc-officers-note"/>
1061
803
  </fo:block-container>
1062
804
 
1063
- <!-- <xsl:if test="$stage-abbreviation = 'FDIS'">
1064
- <fo:block-container font-size="9pt" border="1.5 solid" border-color="rgb(221, 213, 213)" height="13mm" padding="1mm" margin-top="3mm">
1065
- <fo:block margin-bottom="6pt">
1066
- <xsl:call-template name="addLetterSpacing">
1067
- <xsl:with-param name="text">
1068
- <xsl:text>Chicago (USA) on April 9th</xsl:text>
1069
- </xsl:with-param>
1070
- </xsl:call-template>
1071
- </fo:block>
1072
- <fo:block>
1073
- <xsl:call-template name="addLetterSpacing">
1074
- <xsl:with-param name="text">
1075
- <xsl:text>This document is also of interest for ISO/ TC114/ WG1 Requirements for Watch batteries</xsl:text>
1076
- </xsl:with-param>
1077
- </xsl:call-template>
1078
- </fo:block>
1079
- </fo:block-container>
1080
- </xsl:if> -->
1081
805
 
1082
806
  </fo:flow>
1083
807
  </fo:page-sequence>
@@ -1086,7 +810,7 @@
1086
810
  <xsl:if test="$debug = 'true'">
1087
811
  <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
1088
812
  DEBUG
1089
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
813
+ contents=<xsl:copy-of select="$contents"/>
1090
814
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
1091
815
  </xsl:if>
1092
816
 
@@ -1115,7 +839,7 @@
1115
839
  <fo:flow flow-name="xsl-region-body">
1116
840
 
1117
841
  <xsl:call-template name="insertTOCpages">
1118
- <xsl:with-param name="contents" select="xalan:nodeset($contents)/doc[@id = $docid]"/>
842
+ <xsl:with-param name="contents" select="$contents/doc[@id = $docid]"/>
1119
843
  </xsl:call-template>
1120
844
 
1121
845
  <xsl:call-template name="insertPrefacepages">
@@ -1133,76 +857,7 @@
1133
857
  </xsl:for-each>
1134
858
  </xsl:for-each>
1135
859
 
1136
-
1137
-
1138
- <!-- <fo:page-sequence master-reference="document" format="1" initial-page-number="2" force-page-count="no-force">
1139
- <xsl:call-template name="insertHeaderFooter"/>
1140
- <fo:flow flow-name="xsl-region-body">
1141
-
1142
- <xsl:variable name="docid">
1143
- <xsl:call-template name="getDocumentId"/>
1144
- </xsl:variable>
1145
-
1146
-
1147
- <xsl:call-template name="insertTOCpages">
1148
- <xsl:with-param name="contents" select="xalan:nodeset($contents)/doc[@id = $docid]"/>
1149
- </xsl:call-template>
1150
-
1151
- <xsl:call-template name="insertPrefacepages"/>
1152
-
1153
- </fo:flow>
1154
- </fo:page-sequence>
1155
-
1156
-
1157
- <xsl:call-template name="insertBodypages"/>
1158
- -->
1159
-
1160
-
1161
- <!-- Test=<xsl:copy-of select="$additionalDocs"/> Test -->
1162
- <!-- <xsl:for-each select="xalan:nodeset($additionalXMLsArray)/*">
1163
-
1164
- <xsl:for-each select="document(.)">
1165
- <xsl:variable name="lang">
1166
- <xsl:call-template name="getLang"/>
1167
- </xsl:variable>
1168
- <xsl:variable name="document">
1169
- <xsl:apply-templates mode="change_id">
1170
- <xsl:with-param name="lang" select="$lang"/>
1171
- </xsl:apply-templates>
1172
- </xsl:variable>
1173
-
1174
-
1175
- <xsl:for-each select="xalan:nodeset($document)">
1176
-
1177
- <fo:page-sequence master-reference="document" force-page-count="no-force">
1178
- <xsl:call-template name="insertHeaderFooter"/>
1179
- <fo:flow flow-name="xsl-region-body">
1180
-
1181
- <xsl:variable name="docid">
1182
- <xsl:call-template name="getDocumentId"/>
1183
- </xsl:variable>
1184
-
1185
- <xsl:call-template name="insertTOCpages">
1186
- <xsl:with-param name="contents" select="xalan:nodeset($contents)/doc[@id = $docid]"/>
1187
- </xsl:call-template>
1188
-
1189
- <xsl:call-template name="insertPrefacepages">
1190
- <xsl:with-param name="lang" select="$lang"/>
1191
- </xsl:call-template>
1192
-
1193
- </fo:flow>
1194
- </fo:page-sequence>
1195
-
1196
- <xsl:call-template name="insertBodypages">
1197
- <xsl:with-param name="lang" select="$lang"/>
1198
- </xsl:call-template>
1199
-
1200
-
1201
- </xsl:for-each>
1202
- </xsl:for-each>
1203
- </xsl:for-each> -->
1204
-
1205
-
860
+
1206
861
 
1207
862
 
1208
863
  <xsl:if test="$stage &gt;= 60">
@@ -1399,10 +1054,8 @@
1399
1054
  </xsl:call-template>
1400
1055
  </xsl:variable>
1401
1056
 
1402
- <!-- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($localized_part),'#',$part)"/> -->
1403
1057
  <xsl:value-of select="concat($localized_part ,' ',$part, ': ')"/>
1404
- <!-- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1405
- <xsl:text>: </xsl:text> -->
1058
+
1406
1059
  </xsl:if>
1407
1060
  <xsl:value-of select="$title-part"/>
1408
1061
  </xsl:if>
@@ -1428,11 +1081,12 @@
1428
1081
  <xsl:call-template name="getLocalizedString">
1429
1082
  <xsl:with-param name="key">locality.part</xsl:with-param>
1430
1083
  <xsl:with-param name="lang"><xsl:value-of select="$lang_second"/></xsl:with-param>
1084
+ <xsl:with-param name="returnEmptyIfNotFound">true</xsl:with-param>
1431
1085
  </xsl:call-template>
1432
1086
  </xsl:variable>
1433
1087
 
1434
1088
  <xsl:choose>
1435
- <xsl:when test="normalize-space($locality_part_lang_second)">
1089
+ <xsl:when test="normalize-space($locality_part_lang_second) != ''">
1436
1090
  <xsl:variable name="localized_part">
1437
1091
  <xsl:value-of select="$locality_part_lang_second"/>
1438
1092
  </xsl:variable>
@@ -1443,10 +1097,6 @@
1443
1097
  </xsl:otherwise>
1444
1098
  </xsl:choose>
1445
1099
 
1446
- <!-- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($localized_part),'#',$part)"/> -->
1447
-
1448
- <!-- <xsl:text>Part </xsl:text><xsl:value-of select="$part"/>
1449
- <xsl:text>: </xsl:text> -->
1450
1100
  </xsl:if>
1451
1101
  <xsl:value-of select="$part-second"/>
1452
1102
  </xsl:if>
@@ -1489,91 +1139,83 @@
1489
1139
  <xsl:if test="@type = 'references'">
1490
1140
  <xsl:attribute name="space-before">5pt</xsl:attribute>
1491
1141
  </xsl:if>
1492
- <!-- <xsl:if test="@level &gt;= 2 and @section != ''">
1493
- <xsl:attribute name="margin-left">5mm</xsl:attribute>
1494
- </xsl:if> -->
1495
1142
 
1496
- <!-- <xsl:choose>
1497
- <xsl:when test="@section != '' and not(@display-section = 'false')"> -->
1498
- <fo:list-block>
1499
- <xsl:attribute name="margin-left">
1500
- <xsl:choose>
1501
- <xsl:when test="title/@variant-title = 'true'">0mm</xsl:when>
1502
- <xsl:when test="@level = 2">8mm</xsl:when>
1503
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 23"/>mm</xsl:when>
1504
- <xsl:otherwise>0mm</xsl:otherwise>
1505
- </xsl:choose>
1506
- </xsl:attribute>
1507
- <xsl:attribute name="provisional-distance-between-starts">
1508
- <xsl:choose>
1509
- <xsl:when test="@section = ''">0mm</xsl:when>
1510
- <xsl:when test="@level = 1">8mm</xsl:when>
1511
- <xsl:when test="@level = 2">15mm</xsl:when>
1512
- <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 19"/>mm</xsl:when>
1513
- <xsl:otherwise>0mm</xsl:otherwise>
1514
- </xsl:choose>
1515
- </xsl:attribute>
1516
- <fo:list-item>
1517
- <fo:list-item-label end-indent="label-end()">
1518
- <fo:block>
1519
- <xsl:value-of select="@section"/>
1520
- </fo:block>
1521
- </fo:list-item-label>
1522
- <fo:list-item-body start-indent="body-start()">
1523
- <fo:block text-align-last="justify">
1524
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1525
- <xsl:variable name="title">
1526
- <xsl:apply-templates select="title"/>
1527
- </xsl:variable>
1528
- <xsl:call-template name="addLetterSpacing">
1529
- <xsl:with-param name="text" select="$title"/>
1530
- </xsl:call-template>
1531
- <xsl:text> </xsl:text>
1532
- <fo:inline keep-together.within-line="always">
1533
- <fo:leader leader-pattern="dots"/>
1534
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1535
- </fo:inline>
1536
- </fo:basic-link>
1537
- </fo:block>
1538
- </fo:list-item-body>
1539
- </fo:list-item>
1540
- </fo:list-block>
1143
+ <fo:list-block>
1144
+ <xsl:attribute name="margin-left">
1145
+ <xsl:choose>
1146
+ <xsl:when test="title/@variant-title = 'true'">0mm</xsl:when>
1147
+ <xsl:when test="@level = 2">8mm</xsl:when>
1148
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 23"/>mm</xsl:when>
1149
+ <xsl:otherwise>0mm</xsl:otherwise>
1150
+ </xsl:choose>
1151
+ </xsl:attribute>
1152
+ <xsl:attribute name="provisional-distance-between-starts">
1153
+ <xsl:choose>
1154
+ <xsl:when test="@section = ''">0mm</xsl:when>
1155
+ <xsl:when test="@level = 1">8mm</xsl:when>
1156
+ <xsl:when test="@level = 2">15mm</xsl:when>
1157
+ <xsl:when test="@level &gt;= 3"><xsl:value-of select="(@level - 2) * 19"/>mm</xsl:when>
1158
+ <xsl:otherwise>0mm</xsl:otherwise>
1159
+ </xsl:choose>
1160
+ </xsl:attribute>
1161
+ <fo:list-item>
1162
+ <fo:list-item-label end-indent="label-end()">
1163
+ <fo:block>
1164
+ <xsl:value-of select="@section"/>
1165
+ </fo:block>
1166
+ </fo:list-item-label>
1167
+ <fo:list-item-body start-indent="body-start()">
1168
+ <fo:block text-align-last="justify">
1169
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
1170
+ <xsl:variable name="title">
1171
+ <xsl:apply-templates select="title"/>
1172
+ </xsl:variable>
1173
+ <xsl:call-template name="addLetterSpacing">
1174
+ <xsl:with-param name="text" select="$title"/>
1175
+ </xsl:call-template>
1176
+ <xsl:text> </xsl:text>
1177
+ <fo:inline keep-together.within-line="always">
1178
+ <fo:leader leader-pattern="dots"/>
1179
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
1180
+ </fo:inline>
1181
+ </fo:basic-link>
1182
+ </fo:block>
1183
+ </fo:list-item-body>
1184
+ </fo:list-item>
1185
+ </fo:list-block>
1541
1186
  </fo:block>
1542
1187
  </xsl:for-each>
1543
1188
 
1544
- <xsl:if test="//iec:figure[@id and iec:name]">
1545
- <fo:block margin-bottom="5pt"> </fo:block>
1546
- <xsl:for-each select="//iec:figure[@id and iec:name]">
1547
- <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm" role="TOCI">
1548
- <fo:basic-link internal-destination="{@id}" fox:alt-text="Figure {@id}">
1549
- <xsl:apply-templates select="iec:name" mode="contents"/>
1550
- <fo:inline keep-together.within-line="always">
1551
- <fo:leader leader-pattern="dots"/>
1552
- <fo:page-number-citation ref-id="{@id}"/>
1553
- </fo:inline>
1554
- </fo:basic-link>
1555
- </fo:block>
1189
+ <xsl:if test="$contents//figures/figure">
1190
+ <fo:block margin-bottom="5pt"> </fo:block>
1191
+ <xsl:for-each select="$contents//figures/figure">
1192
+ <xsl:call-template name="insertListOf_Item"/>
1556
1193
  </xsl:for-each>
1557
1194
  </xsl:if>
1558
1195
 
1559
- <xsl:if test="//iec:table[@id and iec:name]">
1560
- <fo:block margin-bottom="5pt"> </fo:block>
1561
- <xsl:for-each select="//iec:table[@id and iec:name]">
1562
- <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm" role="TOCI">
1563
- <fo:basic-link internal-destination="{@id}" fox:alt-text="Table {@id}">
1564
- <xsl:apply-templates select="iec:name" mode="contents"/>
1565
- <fo:inline keep-together.within-line="always">
1566
- <fo:leader leader-pattern="dots"/>
1567
- <fo:page-number-citation ref-id="{@id}"/>
1568
- </fo:inline>
1569
- </fo:basic-link>
1570
- </fo:block>
1196
+ <xsl:if test="$contents//tables/table">
1197
+ <fo:block margin-bottom="5pt"> </fo:block>
1198
+ <xsl:for-each select="$contents//tables/table">
1199
+ <xsl:call-template name="insertListOf_Item"/>
1571
1200
  </xsl:for-each>
1572
1201
  </xsl:if>
1202
+
1573
1203
  </fo:block>
1574
1204
  </fo:block-container>
1575
1205
  </xsl:template>
1576
1206
 
1207
+ <xsl:template name="insertListOf_Item">
1208
+ <fo:block text-align-last="justify" margin-bottom="5pt" margin-left="8mm" text-indent="-8mm" role="TOCI">
1209
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{local-name()} {@id}">
1210
+ <xsl:apply-templates select="." mode="contents"/>
1211
+ <fo:inline keep-together.within-line="always">
1212
+ <fo:leader leader-pattern="dots"/>
1213
+ <fo:page-number-citation ref-id="{@id}"/>
1214
+ </fo:inline>
1215
+ </fo:basic-link>
1216
+ </fo:block>
1217
+ </xsl:template>
1218
+
1577
1219
  <xsl:template name="insertPrefacepages">
1578
1220
  <xsl:param name="lang" select="$lang"/>
1579
1221
  <fo:block break-after="page"/>
@@ -1633,9 +1275,7 @@
1633
1275
  <fo:flow flow-name="xsl-region-body">
1634
1276
 
1635
1277
  <fo:block-container font-size="12pt" text-align="center" margin-bottom="36pt">
1636
- <!-- <fo:block><xsl:value-of select="$organization"/></fo:block>
1637
- <fo:block>____________</fo:block>
1638
- <fo:block>&#xa0;</fo:block> -->
1278
+
1639
1279
  <fo:block font-weight="bold" role="H1">
1640
1280
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(/iec:iec-standard/iec:bibdata/iec:title[@language = $lang and @type = 'title-intro']))"/>
1641
1281
  <xsl:text> — </xsl:text>
@@ -1790,9 +1430,6 @@
1790
1430
  </xsl:if>
1791
1431
  <title>
1792
1432
  <xsl:choose>
1793
- <!-- <xsl:when test="$type = 'foreword' or $type = 'introduction'">
1794
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($title))"/>
1795
- </xsl:when> -->
1796
1433
  <xsl:when test="normalize-space($variant_title) != ''">
1797
1434
  <xsl:attribute name="variant-title">true</xsl:attribute>
1798
1435
  <xsl:apply-templates select="xalan:nodeset($variant_title)" mode="contents_item"/>
@@ -1897,14 +1534,7 @@
1897
1534
  <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
1898
1535
  </fo:block>
1899
1536
  </xsl:template>
1900
-
1901
- <!-- <xsl:template match="iec:iec-standard/iec:preface/iec:introduction" priority="3">
1902
- <fo:block break-after="page"/>
1903
- <fo:block id="{@id}">
1904
- <xsl:apply-templates />
1905
- </fo:block>
1906
- </xsl:template> -->
1907
-
1537
+
1908
1538
 
1909
1539
  <xsl:template match="iec:annex//iec:clause" priority="2">
1910
1540
  <fo:block id="{@id}" margin-top="5pt" margin-bottom="10pt" text-align="justify">
@@ -1917,24 +1547,6 @@
1917
1547
  <xsl:apply-templates/>
1918
1548
  </fo:block>
1919
1549
  </xsl:template>
1920
- <!-- <xsl:template match="iec:clause//iec:clause[not(iec:title)]">
1921
- <xsl:param name="sectionNum"/>
1922
- <xsl:variable name="section">
1923
- <xsl:call-template name="getSection">
1924
- <xsl:with-param name="sectionNum" select="$sectionNum"/>
1925
- </xsl:call-template>
1926
- </xsl:variable>
1927
-
1928
- <fo:block margin-top="5pt" margin-bottom="5pt" font-weight="bold" keep-with-next="always">
1929
- <xsl:value-of select="$section"/>
1930
- </fo:block>
1931
- <fo:block margin-bottom="10pt">
1932
- <xsl:apply-templates>
1933
- <xsl:with-param name="sectionNum" select="$sectionNum"/>
1934
- </xsl:apply-templates>
1935
- </fo:block>
1936
-
1937
- </xsl:template> -->
1938
1550
 
1939
1551
  <!-- ====== -->
1940
1552
  <!-- title -->
@@ -1947,7 +1559,6 @@
1947
1559
  </xsl:template>
1948
1560
  <xsl:template match="iec:introduction/iec:title/text()">
1949
1561
  <xsl:call-template name="addLetterSpacing">
1950
- <!-- <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(.))"/> -->
1951
1562
  <xsl:with-param name="text" select="."/>
1952
1563
  </xsl:call-template>
1953
1564
  </xsl:template>
@@ -1999,8 +1610,7 @@
1999
1610
  <xsl:choose>
2000
1611
  <xsl:when test="$level = 2 and ancestor::iec:annex">22pt</xsl:when>
2001
1612
  <xsl:when test="$level &gt;= 2 and ancestor::iec:annex">5pt</xsl:when>
2002
- <!-- <xsl:when test="$level &gt;= 4">5pt</xsl:when> -->
2003
- <xsl:when test="$level = '' or $level = 1">18pt</xsl:when><!-- 13.5pt -->
1613
+ <xsl:when test="$level = '' or $level = 1">18pt</xsl:when>
2004
1614
  <xsl:otherwise>10pt</xsl:otherwise>
2005
1615
  </xsl:choose>
2006
1616
  </xsl:attribute>
@@ -2033,15 +1643,14 @@
2033
1643
  <xsl:otherwise>fo:block</xsl:otherwise>
2034
1644
  </xsl:choose>
2035
1645
  </xsl:variable>
2036
- <!-- inline=<xsl:value-of select="$inline"/> -->
1646
+
2037
1647
  <xsl:choose>
2038
1648
  <xsl:when test="$element-name = 'fo:block'">
2039
1649
  <xsl:element name="{$element-name}">
2040
1650
  <xsl:attribute name="text-align">
2041
1651
  <xsl:choose>
2042
- <!-- <xsl:when test="ancestor::iec:preface">justify</xsl:when> -->
2043
1652
  <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
2044
- <xsl:otherwise>justify</xsl:otherwise><!-- left -->
1653
+ <xsl:otherwise>justify</xsl:otherwise>
2045
1654
  </xsl:choose>
2046
1655
  </xsl:attribute>
2047
1656
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
@@ -2064,10 +1673,7 @@
2064
1673
  <xsl:if test="ancestor::iec:dl">
2065
1674
  <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
2066
1675
  </xsl:if>
2067
- <!-- Key -->
2068
- <!-- <xsl:if test="ancestor::iec:dl and ancestor::iec:figure">
2069
- <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
2070
- </xsl:if> -->
1676
+
2071
1677
  <xsl:apply-templates select="@language"/>
2072
1678
  <xsl:apply-templates/>
2073
1679
  </xsl:element>
@@ -2077,18 +1683,6 @@
2077
1683
  </xsl:otherwise>
2078
1684
  </xsl:choose>
2079
1685
 
2080
-
2081
- <!-- <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
2082
- <fo:block margin-bottom="10pt">
2083
- <xsl:if test="ancestor::iec:annex">
2084
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2085
- </xsl:if>
2086
- <xsl:value-of select="$linebreak"/>
2087
- </fo:block>
2088
- </xsl:if> -->
2089
- <!-- <xsl:if test="$inline = 'true'">
2090
- <fo:block>&#xA0;</fo:block>
2091
- </xsl:if> -->
2092
1686
  </xsl:template>
2093
1687
 
2094
1688
 
@@ -2105,63 +1699,6 @@
2105
1699
  </xsl:template>
2106
1700
 
2107
1701
 
2108
-
2109
- <xsl:template match="iec:ul | iec:ol" mode="ul_ol">
2110
- <fo:list-block provisional-distance-between-starts="6mm" margin-bottom="12pt">
2111
- <xsl:if test="ancestor::iec:ul or ancestor::iec:ol">
2112
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
2113
- </xsl:if>
2114
- <!-- <xsl:if test="local-name() = 'ul'">
2115
- <xsl:attribute name="margin-left">6mm</xsl:attribute>
2116
- </xsl:if> -->
2117
- <xsl:if test="ancestor::iec:legal-statement">
2118
- <xsl:attribute name="provisional-distance-between-starts">5mm</xsl:attribute>
2119
- </xsl:if>
2120
- <xsl:apply-templates/>
2121
- </fo:list-block>
2122
- </xsl:template>
2123
-
2124
- <xsl:template match="iec:li">
2125
- <fo:list-item>
2126
- <fo:list-item-label end-indent="label-end()">
2127
- <fo:block>
2128
- <xsl:choose>
2129
- <xsl:when test="local-name(..) = 'ul'">
2130
- <xsl:call-template name="setULLabel"/>
2131
- </xsl:when>
2132
- <xsl:otherwise> <!-- for ordered lists -->
2133
- <xsl:choose>
2134
- <xsl:when test="../@type = 'arabic'">
2135
- <xsl:number format="1)"/>
2136
- </xsl:when>
2137
- <xsl:when test="../@type = 'alphabet'">
2138
- <xsl:number format="a)" lang="en"/>
2139
- </xsl:when>
2140
- <xsl:when test="../@type = 'alphabet_upper'">
2141
- <xsl:number format="A." lang="en"/>
2142
- </xsl:when>
2143
- <xsl:when test="../@type = 'roman'">
2144
- <xsl:number format="i)" lang="en"/>
2145
- </xsl:when>
2146
- <xsl:when test="../@type = 'roman_upper'">
2147
- <xsl:number format="I." lang="en"/>
2148
- </xsl:when>
2149
- <xsl:otherwise>
2150
- <xsl:number format="a)" lang="en"/>
2151
- </xsl:otherwise>
2152
- </xsl:choose>
2153
- </xsl:otherwise>
2154
- </xsl:choose>
2155
- </fo:block>
2156
- </fo:list-item-label>
2157
- <fo:list-item-body start-indent="body-start()">
2158
- <fo:block>
2159
- <xsl:apply-templates/>
2160
- </fo:block>
2161
- </fo:list-item-body>
2162
- </fo:list-item>
2163
- </xsl:template>
2164
-
2165
1702
  <xsl:template match="iec:li/iec:p" priority="2">
2166
1703
  <fo:block margin-bottom="6pt">
2167
1704
  <xsl:if test="ancestor::iec:ul">
@@ -2175,26 +1712,6 @@
2175
1712
  </xsl:template>
2176
1713
 
2177
1714
 
2178
- <xsl:template match="iec:preferred">
2179
- <xsl:variable name="levelTerm">
2180
- <xsl:call-template name="getLevelTermName"/>
2181
- </xsl:variable>
2182
- <fo:block line-height="1.1" space-before="14pt" role="H{$levelTerm}">
2183
- <xsl:if test="preceding-sibling::*[1][self::iec:preferred]">
2184
- <xsl:attribute name="space-before">1pt</xsl:attribute>
2185
- </xsl:if>
2186
- <xsl:if test="parent::iec:term and not(preceding-sibling::iec:preferred)"> <!-- if first preffered in term, then display term's name -->
2187
- <fo:block font-weight="bold" keep-with-next="always">
2188
- <xsl:apply-templates select="ancestor::iec:term[1]/iec:name"/>
2189
- </fo:block>
2190
- </xsl:if>
2191
- <fo:block font-weight="bold" keep-with-next="always">
2192
- <xsl:call-template name="setStyle_preferred"/>
2193
- <xsl:apply-templates/>
2194
- </fo:block>
2195
- </fo:block>
2196
- </xsl:template>
2197
-
2198
1715
 
2199
1716
  <xsl:template match="iec:admonition//iec:p//text()">
2200
1717
  <xsl:call-template name="addLetterSpacing">
@@ -2202,32 +1719,7 @@
2202
1719
  </xsl:call-template>
2203
1720
  </xsl:template>
2204
1721
 
2205
-
2206
-
2207
-
2208
- <xsl:template match="iec:formula/iec:stem">
2209
- <fo:block margin-top="6pt" margin-bottom="12pt">
2210
- <fo:table table-layout="fixed" width="100%">
2211
- <fo:table-column column-width="95%"/>
2212
- <fo:table-column column-width="5%"/>
2213
- <fo:table-body>
2214
- <fo:table-row>
2215
- <fo:table-cell display-align="center">
2216
- <fo:block text-align="center">
2217
- <xsl:apply-templates/>
2218
- </fo:block>
2219
- </fo:table-cell>
2220
- <fo:table-cell display-align="center">
2221
- <fo:block text-align="right" margin-right="-10mm">
2222
- <xsl:apply-templates select="../iec:name" mode="formula_number"/>
2223
- </fo:block>
2224
- </fo:table-cell>
2225
- </fo:table-row>
2226
- </fo:table-body>
2227
- </fo:table>
2228
- </fo:block>
2229
- </xsl:template>
2230
-
1722
+
2231
1723
  <!-- =================== -->
2232
1724
  <!-- Index processing -->
2233
1725
  <!-- =================== -->
@@ -2247,29 +1739,11 @@
2247
1739
  </fo:flow>
2248
1740
  </fo:page-sequence>
2249
1741
  </xsl:template>
2250
-
2251
- <xsl:template match="iec:indexsect/iec:title" priority="4">
2252
- <fo:block font-size="12pt" font-weight="bold" margin-bottom="84pt" role="H1">
2253
- <!-- Index -->
2254
- <xsl:apply-templates/>
2255
- </fo:block>
2256
- </xsl:template>
2257
1742
 
2258
1743
  <xsl:template match="iec:indexsect/iec:title/text()" priority="4">
2259
1744
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(.))"/>
2260
1745
  </xsl:template>
2261
1746
 
2262
- <xsl:template match="iec:indexsect/iec:clause/iec:title" priority="4">
2263
- <!-- Letter A, B, C, ... -->
2264
- <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
2265
- <xsl:apply-templates/>
2266
- </fo:block>
2267
- </xsl:template>
2268
-
2269
- <xsl:template match="iec:indexsect//iec:li/text()">
2270
- <!-- to split by '_' and other chars -->
2271
- <xsl:call-template name="add-zero-spaces-java"/>
2272
- </xsl:template>
2273
1747
 
2274
1748
  <xsl:template match="iec:xref[@pagenumber = 'true']" priority="2">
2275
1749
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
@@ -2448,11 +1922,21 @@
2448
1922
  </xsl:copy>
2449
1923
  </xsl:template> -->
2450
1924
 
2451
- <xsl:variable name="pageWidth_">
1925
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:key name="bibitems" match="*[local-name() = 'bibitem']" use="@id"/><xsl:key name="bibitems_hidden" match="*[local-name() = 'bibitem'][@hidden='true'] | *[local-name() = 'references'][@hidden='true']//*[local-name() = 'bibitem']" use="@id"/><xsl:variable name="lang">
1926
+ <xsl:call-template name="getLang"/>
1927
+ </xsl:variable><xsl:variable name="pageWidth_">
2452
1928
  210
2453
1929
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
2454
1930
  297
2455
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
1931
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
1932
+ 25
1933
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
1934
+ 25
1935
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
1936
+ 31
1937
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
1938
+ 15
1939
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
2456
1940
 
2457
1941
  <title-edition lang="en">
2458
1942
 
@@ -2464,6 +1948,10 @@
2464
1948
  <xsl:text>Édition </xsl:text>
2465
1949
  </title-edition>
2466
1950
 
1951
+ <title-edition lang="ru">
1952
+ <xsl:text>Издание </xsl:text>
1953
+ </title-edition>
1954
+
2467
1955
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
2468
1956
  <title-toc lang="en">
2469
1957
 
@@ -2478,7 +1966,7 @@
2478
1966
  <xsl:text>Contents</xsl:text>
2479
1967
 
2480
1968
  </title-toc>
2481
-
1969
+
2482
1970
  <title-descriptors lang="en">Descriptors</title-descriptors>
2483
1971
 
2484
1972
  <title-part lang="en">
@@ -2494,7 +1982,13 @@
2494
1982
  <xsl:text>Partie #: </xsl:text>
2495
1983
 
2496
1984
 
2497
- </title-part>
1985
+ </title-part>
1986
+ <title-part lang="ru">
1987
+
1988
+
1989
+ <xsl:text>Часть #: </xsl:text>
1990
+
1991
+ </title-part>
2498
1992
  <title-part lang="zh">第 # 部分:</title-part>
2499
1993
 
2500
1994
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -2510,13 +2004,38 @@
2510
2004
 
2511
2005
  <title-summary lang="en">Summary</title-summary>
2512
2006
 
2007
+ <title-continued lang="ru">(продолжение)</title-continued>
2513
2008
  <title-continued lang="en">(continued)</title-continued>
2514
2009
  <title-continued lang="fr">(continué)</title-continued>
2515
2010
 
2516
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
2011
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
2012
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
2013
+ <xsl:value-of select="$toc_table_title"/>
2014
+ <xsl:if test="normalize-space($toc_table_title) = ''">
2015
+ <xsl:call-template name="getTitle">
2016
+ <xsl:with-param name="name" select="'title-list-tables'"/>
2017
+ </xsl:call-template>
2018
+ </xsl:if>
2019
+ </xsl:variable><xsl:variable name="title-list-figures">
2020
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
2021
+ <xsl:value-of select="$toc_figure_title"/>
2022
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
2023
+ <xsl:call-template name="getTitle">
2024
+ <xsl:with-param name="name" select="'title-list-figures'"/>
2025
+ </xsl:call-template>
2026
+ </xsl:if>
2027
+ </xsl:variable><xsl:variable name="title-list-recommendations">
2028
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
2029
+ <xsl:value-of select="$toc_requirement_title"/>
2030
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
2031
+ <xsl:call-template name="getTitle">
2032
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
2033
+ </xsl:call-template>
2034
+ </xsl:if>
2035
+ </xsl:variable><xsl:variable name="bibdata">
2517
2036
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
2518
2037
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
2519
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2038
+ </xsl:variable><xsl:variable name="linebreak">&#8232;</xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:variable name="non_breaking_hyphen">‑</xsl:variable><xsl:variable name="thin_space"> </xsl:variable><xsl:variable name="zero_width_space">​</xsl:variable><xsl:variable name="en_dash">–</xsl:variable><xsl:template name="getTitle">
2520
2039
  <xsl:param name="name"/>
2521
2040
  <xsl:param name="lang"/>
2522
2041
  <xsl:variable name="lang_">
@@ -2539,7 +2058,7 @@
2539
2058
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
2540
2059
  </xsl:otherwise>
2541
2060
  </xsl:choose>
2542
- </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">
2061
+ </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:attribute-set name="root-style">
2543
2062
 
2544
2063
 
2545
2064
 
@@ -2706,11 +2225,12 @@
2706
2225
 
2707
2226
 
2708
2227
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
2709
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
2710
2228
 
2711
2229
 
2712
2230
 
2713
2231
 
2232
+
2233
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2714
2234
  <xsl:attribute name="padding-right">9mm</xsl:attribute>
2715
2235
 
2716
2236
 
@@ -3106,24 +2626,22 @@
3106
2626
 
3107
2627
 
3108
2628
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
3109
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
2629
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
2630
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
3110
2631
 
3111
2632
 
3112
2633
 
3113
2634
 
3114
2635
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
3115
2636
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
3116
- <xsl:attribute name="margin-left">12mm</xsl:attribute>
3117
- <xsl:attribute name="margin-right">12mm</xsl:attribute>
3118
2637
 
3119
2638
 
3120
2639
 
3121
2640
 
3122
2641
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2642
+ <xsl:attribute name="text-align">right</xsl:attribute>
3123
2643
 
3124
-
3125
2644
 
3126
- <xsl:attribute name="text-align">right</xsl:attribute>
3127
2645
  <xsl:attribute name="margin-top">15pt</xsl:attribute>
3128
2646
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
3129
2647
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
@@ -3149,6 +2667,9 @@
3149
2667
 
3150
2668
  </xsl:attribute-set><xsl:attribute-set name="term-style">
3151
2669
 
2670
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
2671
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2672
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3152
2673
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
3153
2674
 
3154
2675
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -3179,6 +2700,35 @@
3179
2700
 
3180
2701
 
3181
2702
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
2703
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2704
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2705
+
2706
+
2707
+
2708
+
2709
+
2710
+
2711
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
2712
+ <xsl:attribute name="text-align">center</xsl:attribute>
2713
+
2714
+
2715
+
2716
+
2717
+
2718
+
2719
+
2720
+
2721
+
2722
+
2723
+
2724
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
2725
+ <xsl:attribute name="text-align">right</xsl:attribute>
2726
+
2727
+
2728
+ <xsl:attribute name="margin-right">-10mm</xsl:attribute>
2729
+
2730
+
2731
+
3182
2732
 
3183
2733
  </xsl:attribute-set><xsl:attribute-set name="image-style">
3184
2734
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -3214,6 +2764,21 @@
3214
2764
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
3215
2765
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
3216
2766
 
2767
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
2768
+
2769
+
2770
+ <xsl:attribute name="line-height">1.1</xsl:attribute>
2771
+ <xsl:attribute name="space-before">14pt</xsl:attribute>
2772
+
2773
+
2774
+
2775
+
2776
+
2777
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
2778
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2779
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2780
+
2781
+
3217
2782
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
3218
2783
 
3219
2784
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -3236,13 +2801,19 @@
3236
2801
  </xsl:attribute-set><xsl:variable name="color-added-text">
3237
2802
  <xsl:text>rgb(0, 255, 0)</xsl:text>
3238
2803
  </xsl:variable><xsl:attribute-set name="add-style">
3239
- <xsl:attribute name="color">red</xsl:attribute>
3240
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
3241
- <!-- <xsl:attribute name="color">black</xsl:attribute>
3242
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
3243
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
3244
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
3245
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
2804
+
2805
+ <xsl:attribute name="color">red</xsl:attribute>
2806
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2807
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2808
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2809
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2810
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2811
+
2812
+ </xsl:attribute-set><xsl:variable name="add-style">
2813
+ <add-style xsl:use-attribute-sets="add-style"/>
2814
+ </xsl:variable><xsl:template name="append_add-style">
2815
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
2816
+ </xsl:template><xsl:variable name="color-deleted-text">
3246
2817
  <xsl:text>red</xsl:text>
3247
2818
  </xsl:variable><xsl:attribute-set name="del-style">
3248
2819
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -3253,6 +2824,36 @@
3253
2824
 
3254
2825
  </xsl:attribute-set><xsl:attribute-set name="list-style">
3255
2826
 
2827
+
2828
+
2829
+
2830
+
2831
+ <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
2832
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2833
+
2834
+
2835
+
2836
+
2837
+
2838
+
2839
+
2840
+
2841
+
2842
+
2843
+
2844
+
2845
+
2846
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2847
+
2848
+
2849
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
2850
+
2851
+
2852
+
2853
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
2854
+
2855
+
2856
+
3256
2857
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
3257
2858
  <xsl:attribute name="line-height">135%</xsl:attribute>
3258
2859
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -3535,15 +3136,156 @@
3535
3136
 
3536
3137
 
3537
3138
 
3139
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
3140
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3141
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
3142
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3143
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
3144
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3145
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
3146
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3147
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
3148
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3149
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
3150
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3151
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
3152
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
3153
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
3154
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
3155
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
3156
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
3157
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
3158
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
3159
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
3160
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
3161
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
3162
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3163
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
3164
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3165
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
3166
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3167
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
3168
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3169
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
3170
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3171
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
3172
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3173
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
3174
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3175
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
3176
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3177
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
3178
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3179
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
3180
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3181
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
3182
+ <xsl:attribute name="color">#032f62</xsl:attribute>
3183
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
3184
+ <xsl:attribute name="color">#032f62</xsl:attribute>
3185
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
3186
+ <xsl:attribute name="color">#032f62</xsl:attribute>
3187
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
3188
+ <xsl:attribute name="color">#e36209</xsl:attribute>
3189
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
3190
+ <xsl:attribute name="color">#e36209</xsl:attribute>
3191
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
3192
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
3193
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
3194
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
3195
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
3196
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
3197
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
3198
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3199
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
3200
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3201
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
3202
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3203
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
3204
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3205
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
3206
+ <xsl:attribute name="color">#24292e</xsl:attribute>
3207
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
3208
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
3209
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3210
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
3211
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
3212
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
3213
+ <xsl:attribute name="color">#24292e</xsl:attribute>
3214
+ <xsl:attribute name="font-style">italic</xsl:attribute>
3215
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
3216
+ <xsl:attribute name="color">#24292e</xsl:attribute>
3217
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3218
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
3219
+ <xsl:attribute name="color">#22863a</xsl:attribute>
3220
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
3221
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
3222
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
3223
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
3224
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
3225
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
3226
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
3227
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
3228
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
3229
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
3230
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
3231
+ <xsl:attribute name="role">H1</xsl:attribute>
3232
+
3233
+
3234
+
3235
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
3236
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3237
+ <xsl:attribute name="margin-bottom">84pt</xsl:attribute>
3238
+
3239
+
3240
+
3241
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
3242
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
3243
+
3244
+
3245
+
3246
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
3247
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
3248
+ <xsl:attribute name="margin-bottom">3pt</xsl:attribute>
3249
+
3250
+
3251
+
3538
3252
  </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:variable name="ace_tag">ace-tag_</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
3253
+ <xsl:variable name="nodes_preface_">
3254
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
3255
+ <node id="{@id}"/>
3256
+ </xsl:for-each>
3257
+ </xsl:variable>
3258
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
3259
+
3539
3260
  <xsl:for-each select="/*/*[local-name()='preface']/*">
3540
3261
  <xsl:sort select="@displayorder" data-type="number"/>
3262
+
3263
+ <!-- process Section's title -->
3264
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
3265
+ <xsl:if test="$preceding-sibling_id != ''">
3266
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
3267
+ </xsl:if>
3268
+
3541
3269
  <xsl:apply-templates select="." mode="contents"/>
3542
3270
  </xsl:for-each>
3543
3271
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
3544
3272
 
3273
+ <xsl:variable name="nodes_sections_">
3274
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
3275
+ <node id="{@id}"/>
3276
+ </xsl:for-each>
3277
+ </xsl:variable>
3278
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
3279
+
3545
3280
  <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
3546
3281
  <xsl:sort select="@displayorder" data-type="number"/>
3282
+
3283
+ <!-- process Section's title -->
3284
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
3285
+ <xsl:if test="$preceding-sibling_id != ''">
3286
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
3287
+ </xsl:if>
3288
+
3547
3289
  <xsl:apply-templates select="." mode="contents"/>
3548
3290
  </xsl:for-each>
3549
3291
 
@@ -3556,6 +3298,30 @@
3556
3298
  <xsl:sort select="@displayorder" data-type="number"/>
3557
3299
  <xsl:apply-templates select="." mode="contents"/>
3558
3300
  </xsl:for-each>
3301
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
3302
+ <xsl:param name="always"/>
3303
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3304
+ <xsl:call-template name="processTables_Contents"/>
3305
+ </xsl:if>
3306
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3307
+ <xsl:call-template name="processFigures_Contents"/>
3308
+ </xsl:if>
3309
+ </xsl:template><xsl:template name="processTables_Contents">
3310
+ <tables>
3311
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
3312
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
3313
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3314
+ </table>
3315
+ </xsl:for-each>
3316
+ </tables>
3317
+ </xsl:template><xsl:template name="processFigures_Contents">
3318
+ <figures>
3319
+ <xsl:for-each select="//*[local-name() = 'figure'][@id and *[local-name() = 'name'] and not(@unnumbered = 'true') and normalize-space(@id) != ''] | //*[@id and starts-with(*[local-name() = 'name'], 'Figure ') and normalize-space(@id) != '']">
3320
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
3321
+ <xsl:copy-of select="*[local-name() = 'name']"/>
3322
+ </figure>
3323
+ </xsl:for-each>
3324
+ </figures>
3559
3325
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3560
3326
  <xsl:for-each select="/*/*[local-name()='preface']/*">
3561
3327
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -3621,9 +3387,12 @@
3621
3387
 
3622
3388
 
3623
3389
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
3390
+ <xsl:param name="margin"/>
3624
3391
 
3625
3392
  <!-- process in the template 'paragraph' -->
3626
- <xsl:call-template name="paragraph"/>
3393
+ <xsl:call-template name="paragraph">
3394
+ <xsl:with-param name="margin" select="$margin"/>
3395
+ </xsl:call-template>
3627
3396
 
3628
3397
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
3629
3398
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -3639,6 +3408,7 @@
3639
3408
  </fo:block>
3640
3409
 
3641
3410
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
3411
+ <xsl:param name="margin"/>
3642
3412
 
3643
3413
  <fo:block xsl:use-attribute-sets="feedback-statement-p-style">
3644
3414
  <xsl:apply-templates/>
@@ -3681,7 +3451,7 @@
3681
3451
  </xsl:call-template>
3682
3452
  </xsl:if>
3683
3453
  </xsl:variable>
3684
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3454
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
3685
3455
 
3686
3456
 
3687
3457
  <xsl:variable name="margin-side">
@@ -3951,7 +3721,7 @@
3951
3721
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
3952
3722
  <!-- 2009 thinspace -->
3953
3723
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
3954
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
3724
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
3955
3725
  </xsl:call-template>
3956
3726
  </xsl:variable>
3957
3727
  <xsl:variable name="max_length">
@@ -3992,8 +3762,7 @@
3992
3762
  </xsl:call-template>
3993
3763
  </xsl:if>
3994
3764
  </xsl:template><xsl:template match="text()" mode="td_text">
3995
- <xsl:variable name="zero-space">​</xsl:variable>
3996
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3765
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3997
3766
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3998
3767
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3999
3768
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -4357,37 +4126,7 @@
4357
4126
 
4358
4127
  <!-- list of footnotes to calculate actual footnotes number -->
4359
4128
  <xsl:variable name="p_fn_">
4360
- <xsl:choose>
4361
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
4362
- <fn gen_id="{generate-id(.)}">
4363
- <xsl:copy-of select="@*"/>
4364
- <xsl:copy-of select="node()"/>
4365
- </fn>
4366
- </xsl:when>
4367
- <xsl:otherwise>
4368
- <!-- itetation for:
4369
- footnotes in bibdata/title
4370
- footnotes in bibliography
4371
- footnotes in document's body (except table's head/body/foot and figure text)
4372
- -->
4373
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
4374
- <fn gen_id="{generate-id(.)}">
4375
- <xsl:copy-of select="@*"/>
4376
- <xsl:copy-of select="node()"/>
4377
- </fn>
4378
- </xsl:for-each>
4379
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
4380
- <xsl:sort select="@displayorder" data-type="number"/>
4381
- <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4382
- <!-- copy unique fn -->
4383
- <fn gen_id="{generate-id(.)}">
4384
- <xsl:copy-of select="@*"/>
4385
- <xsl:copy-of select="node()"/>
4386
- </fn>
4387
- </xsl:for-each>
4388
- </xsl:for-each>
4389
- </xsl:otherwise>
4390
- </xsl:choose>
4129
+ <xsl:call-template name="get_fn_list"/>
4391
4130
  </xsl:variable>
4392
4131
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
4393
4132
 
@@ -4448,6 +4187,38 @@
4448
4187
  <xsl:copy-of select="$footnote_inline"/>
4449
4188
  </xsl:otherwise>
4450
4189
  </xsl:choose>
4190
+ </xsl:template><xsl:template name="get_fn_list">
4191
+ <xsl:choose>
4192
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
4193
+ <fn gen_id="{generate-id(.)}">
4194
+ <xsl:copy-of select="@*"/>
4195
+ <xsl:copy-of select="node()"/>
4196
+ </fn>
4197
+ </xsl:when>
4198
+ <xsl:otherwise>
4199
+ <!-- itetation for:
4200
+ footnotes in bibdata/title
4201
+ footnotes in bibliography
4202
+ footnotes in document's body (except table's head/body/foot and figure text)
4203
+ -->
4204
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
4205
+ <fn gen_id="{generate-id(.)}">
4206
+ <xsl:copy-of select="@*"/>
4207
+ <xsl:copy-of select="node()"/>
4208
+ </fn>
4209
+ </xsl:for-each>
4210
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='preface']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='sections']/* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='annex'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*">
4211
+ <xsl:sort select="@displayorder" data-type="number"/>
4212
+ <xsl:for-each select=".//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] | .//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
4213
+ <!-- copy unique fn -->
4214
+ <fn gen_id="{generate-id(.)}">
4215
+ <xsl:copy-of select="@*"/>
4216
+ <xsl:copy-of select="node()"/>
4217
+ </fn>
4218
+ </xsl:for-each>
4219
+ </xsl:for-each>
4220
+ </xsl:otherwise>
4221
+ </xsl:choose>
4451
4222
  </xsl:template><xsl:template name="table_fn_display">
4452
4223
  <xsl:variable name="references">
4453
4224
 
@@ -4624,7 +4395,7 @@
4624
4395
  </fo:inline>
4625
4396
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
4626
4397
  <fo:inline><xsl:value-of select="."/></fo:inline>
4627
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
4398
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
4628
4399
  <fo:inline>
4629
4400
  <xsl:apply-templates/>
4630
4401
  </fo:inline>
@@ -5003,20 +4774,44 @@
5003
4774
  <fo:inline text-decoration="underline">
5004
4775
  <xsl:apply-templates/>
5005
4776
  </fo:inline>
5006
- </xsl:template><xsl:template match="*[local-name()='add']">
4777
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
5007
4778
  <xsl:param name="skip">true</xsl:param>
4779
+ <xsl:param name="block">false</xsl:param>
4780
+ <xsl:param name="type"/>
4781
+ <xsl:param name="text-align"/>
5008
4782
  <xsl:choose>
5009
4783
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
5010
4784
  <xsl:choose>
5011
- <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab'])) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
4785
+ <xsl:when test="$skip = 'true' and ((local-name(../..) = 'note' and not(preceding-sibling::node())) or (local-name(..) = 'title' and preceding-sibling::node()[1][local-name() = 'tab']) or local-name(..) = 'formattedref' and not(preceding-sibling::node())) and ../node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]"><!-- start tag displayed in template name="note" and title --></xsl:when>
5012
4786
  <xsl:otherwise>
5013
- <fo:inline>
4787
+ <xsl:variable name="tag">
5014
4788
  <xsl:call-template name="insertTag">
5015
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4789
+ <xsl:with-param name="type">
4790
+ <xsl:choose>
4791
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
4792
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
4793
+ </xsl:choose>
4794
+ </xsl:with-param>
5016
4795
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
5017
4796
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
5018
4797
  </xsl:call-template>
5019
- </fo:inline>
4798
+ </xsl:variable>
4799
+ <xsl:choose>
4800
+ <xsl:when test="$block = 'false'">
4801
+ <fo:inline>
4802
+ <xsl:copy-of select="$tag"/>
4803
+ </fo:inline>
4804
+ </xsl:when>
4805
+ <xsl:otherwise>
4806
+ <fo:block> <!-- for around figures -->
4807
+ <xsl:if test="$text-align != ''">
4808
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
4809
+ </xsl:if>
4810
+ <xsl:copy-of select="$tag"/>
4811
+ </fo:block>
4812
+ </xsl:otherwise>
4813
+ </xsl:choose>
4814
+
5020
4815
  </xsl:otherwise>
5021
4816
  </xsl:choose>
5022
4817
  </xsl:when>
@@ -5375,17 +5170,21 @@
5375
5170
  </xsl:apply-templates>
5376
5171
  </xsl:template><xsl:template name="getLang">
5377
5172
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5378
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5379
5173
  <xsl:variable name="language">
5380
5174
  <xsl:choose>
5381
5175
  <xsl:when test="$language_current != ''">
5382
5176
  <xsl:value-of select="$language_current"/>
5383
5177
  </xsl:when>
5384
- <xsl:when test="$language_current_2 != ''">
5385
- <xsl:value-of select="$language_current_2"/>
5386
- </xsl:when>
5387
5178
  <xsl:otherwise>
5388
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
5179
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
5180
+ <xsl:choose>
5181
+ <xsl:when test="$language_current_2 != ''">
5182
+ <xsl:value-of select="$language_current_2"/>
5183
+ </xsl:when>
5184
+ <xsl:otherwise>
5185
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
5186
+ </xsl:otherwise>
5187
+ </xsl:choose>
5389
5188
  </xsl:otherwise>
5390
5189
  </xsl:choose>
5391
5190
  </xsl:variable>
@@ -5592,6 +5391,9 @@
5592
5391
  </fo:inline>
5593
5392
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
5594
5393
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
5394
+ <xsl:if test="parent::*[local-name() = 'add']">
5395
+ <xsl:call-template name="append_add-style"/>
5396
+ </xsl:if>
5595
5397
  <xsl:apply-templates/>
5596
5398
  </fo:basic-link>
5597
5399
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -5606,8 +5408,8 @@
5606
5408
 
5607
5409
  </xsl:if>
5608
5410
  <fo:block-container margin-left="0mm">
5609
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
5610
- <xsl:apply-templates/>
5411
+ <fo:block id="{@id}">
5412
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
5611
5413
  </fo:block>
5612
5414
  </fo:block-container>
5613
5415
  </fo:block-container>
@@ -5619,10 +5421,43 @@
5619
5421
  <fo:inline>
5620
5422
  <xsl:apply-templates/>
5621
5423
  </fo:inline>
5622
- </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']" mode="formula_number"> <!-- show by demand -->
5424
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
5623
5425
  <xsl:if test="normalize-space() != ''">
5624
5426
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
5625
5427
  </xsl:if>
5428
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
5429
+ <fo:block xsl:use-attribute-sets="formula-style">
5430
+
5431
+
5432
+
5433
+ <fo:table table-layout="fixed" width="100%">
5434
+ <fo:table-column column-width="95%"/>
5435
+ <fo:table-column column-width="5%"/>
5436
+ <fo:table-body>
5437
+ <fo:table-row>
5438
+ <fo:table-cell display-align="center">
5439
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
5440
+
5441
+
5442
+
5443
+ <xsl:apply-templates/>
5444
+ </fo:block>
5445
+ </fo:table-cell>
5446
+ <fo:table-cell display-align="center">
5447
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
5448
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
5449
+ </fo:block>
5450
+ </fo:table-cell>
5451
+ </fo:table-row>
5452
+ </fo:table-body>
5453
+ </fo:table>
5454
+ </fo:block>
5455
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
5456
+ <fo:block xsl:use-attribute-sets="formula-style">
5457
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
5458
+ <xsl:apply-templates/>
5459
+ </fo:block>
5460
+ </fo:block>
5626
5461
  </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
5627
5462
 
5628
5463
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
@@ -5656,6 +5491,13 @@
5656
5491
 
5657
5492
 
5658
5493
 
5494
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5495
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5496
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5497
+ <xsl:call-template name="append_add-style"/>
5498
+ </xsl:if>
5499
+
5500
+
5659
5501
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
5660
5502
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
5661
5503
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -5694,6 +5536,12 @@
5694
5536
 
5695
5537
 
5696
5538
 
5539
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5540
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
5541
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5542
+ <xsl:call-template name="append_add-style"/>
5543
+ </xsl:if>
5544
+
5697
5545
  <xsl:apply-templates select="*[local-name() = 'name']"/>
5698
5546
 
5699
5547
  </fo:inline>
@@ -5745,6 +5593,7 @@
5745
5593
  </fo:block>
5746
5594
  </xsl:template><xsl:template match="*[local-name() = 'term']">
5747
5595
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
5596
+
5748
5597
 
5749
5598
 
5750
5599
 
@@ -6181,7 +6030,11 @@
6181
6030
  <xsl:value-of select="."/>
6182
6031
  </xsl:template><xsl:template match="node()" mode="contents">
6183
6032
  <xsl:apply-templates mode="contents"/>
6184
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
6033
+ </xsl:template><xsl:template match="*[local-name() = 'preface' or local-name() = 'sections']/*[local-name() = 'p'][@type = 'section-title' and not(@displayorder)]" priority="3" mode="contents"/><xsl:template match="*[local-name() = 'p'][@type = 'section-title' and not(@displayorder)]" mode="contents_no_displayorder">
6034
+ <xsl:call-template name="contents_section-title"/>
6035
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
6036
+ <xsl:call-template name="contents_section-title"/>
6037
+ </xsl:template><xsl:template match="*[local-name() = 'clause']/*[local-name() = 'p'][@type = 'section-title' and (@depth != ../*[local-name() = 'title']/@depth or ../*[local-name() = 'title']/@depth = 1)]" priority="3" mode="contents"/><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" name="contents_section-title" mode="contents">
6185
6038
  <xsl:variable name="level">
6186
6039
  <xsl:call-template name="getLevel">
6187
6040
  <xsl:with-param name="depth" select="@depth"/>
@@ -6250,13 +6103,14 @@
6250
6103
  <xsl:apply-templates mode="bookmarks"/>
6251
6104
  </xsl:template><xsl:template name="addBookmarks">
6252
6105
  <xsl:param name="contents"/>
6253
- <xsl:if test="xalan:nodeset($contents)//item">
6106
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6107
+ <xsl:if test="$contents_nodes//item">
6254
6108
  <fo:bookmark-tree>
6255
6109
  <xsl:choose>
6256
- <xsl:when test="xalan:nodeset($contents)/doc">
6110
+ <xsl:when test="$contents_nodes/doc">
6257
6111
  <xsl:choose>
6258
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
6259
- <xsl:for-each select="xalan:nodeset($contents)/doc">
6112
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
6113
+ <xsl:for-each select="$contents_nodes/doc">
6260
6114
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
6261
6115
  <xsl:if test="@bundle = 'true'">
6262
6116
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -6307,7 +6161,7 @@
6307
6161
  </xsl:for-each>
6308
6162
  </xsl:when>
6309
6163
  <xsl:otherwise>
6310
- <xsl:for-each select="xalan:nodeset($contents)/doc">
6164
+ <xsl:for-each select="$contents_nodes/doc">
6311
6165
 
6312
6166
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
6313
6167
 
@@ -6325,25 +6179,36 @@
6325
6179
  </xsl:choose>
6326
6180
  </xsl:when>
6327
6181
  <xsl:otherwise>
6328
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
6182
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
6183
+
6184
+ <xsl:call-template name="insertFigureBookmarks">
6185
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
6186
+ </xsl:call-template>
6187
+
6188
+ <xsl:call-template name="insertTableBookmarks">
6189
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
6190
+ <xsl:with-param name="lang" select="@lang"/>
6191
+ </xsl:call-template>
6192
+
6329
6193
  </xsl:otherwise>
6330
6194
  </xsl:choose>
6331
6195
 
6196
+
6332
6197
 
6333
6198
 
6334
6199
 
6335
6200
 
6336
-
6337
-
6201
+
6338
6202
 
6339
6203
  </fo:bookmark-tree>
6340
6204
  </xsl:if>
6341
6205
  </xsl:template><xsl:template name="insertFigureBookmarks">
6342
6206
  <xsl:param name="contents"/>
6343
- <xsl:if test="xalan:nodeset($contents)/figure">
6344
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
6207
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6208
+ <xsl:if test="$contents_nodes/figure">
6209
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
6345
6210
  <fo:bookmark-title>Figures</fo:bookmark-title>
6346
- <xsl:for-each select="xalan:nodeset($contents)/figure">
6211
+ <xsl:for-each select="$contents_nodes/figure">
6347
6212
  <fo:bookmark internal-destination="{@id}">
6348
6213
  <fo:bookmark-title>
6349
6214
  <xsl:value-of select="normalize-space(title)"/>
@@ -6352,18 +6217,42 @@
6352
6217
  </xsl:for-each>
6353
6218
  </fo:bookmark>
6354
6219
  </xsl:if>
6220
+
6221
+
6222
+ <xsl:if test="$contents_nodes//figures/figure">
6223
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
6224
+
6225
+
6226
+ <xsl:attribute name="internal-destination">
6227
+ <xsl:value-of select="$contents_nodes//figures/figure[1]/@id"/>
6228
+ </xsl:attribute>
6229
+
6230
+
6231
+ <xsl:variable name="bookmark-title">
6232
+ Figures
6233
+ </xsl:variable>
6234
+ <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
6235
+ <xsl:for-each select="$contents_nodes//figures/figure">
6236
+ <fo:bookmark internal-destination="{@id}">
6237
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
6238
+ </fo:bookmark>
6239
+ </xsl:for-each>
6240
+ </fo:bookmark>
6241
+ </xsl:if>
6242
+
6355
6243
  </xsl:template><xsl:template name="insertTableBookmarks">
6356
6244
  <xsl:param name="contents"/>
6357
6245
  <xsl:param name="lang"/>
6358
- <xsl:if test="xalan:nodeset($contents)/table">
6359
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
6246
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
6247
+ <xsl:if test="$contents_nodes/table">
6248
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
6360
6249
  <fo:bookmark-title>
6361
6250
  <xsl:choose>
6362
6251
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
6363
6252
  <xsl:otherwise>Tables</xsl:otherwise>
6364
6253
  </xsl:choose>
6365
6254
  </fo:bookmark-title>
6366
- <xsl:for-each select="xalan:nodeset($contents)/table">
6255
+ <xsl:for-each select="$contents_nodes/table">
6367
6256
  <fo:bookmark internal-destination="{@id}">
6368
6257
  <fo:bookmark-title>
6369
6258
  <xsl:value-of select="normalize-space(title)"/>
@@ -6372,6 +6261,36 @@
6372
6261
  </xsl:for-each>
6373
6262
  </fo:bookmark>
6374
6263
  </xsl:if>
6264
+
6265
+
6266
+ <xsl:if test="$contents_nodes//tables/table">
6267
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
6268
+
6269
+
6270
+ <xsl:attribute name="internal-destination">
6271
+ <xsl:value-of select="$contents_nodes//tables/table[1]/@id"/>
6272
+ </xsl:attribute>
6273
+
6274
+
6275
+ <xsl:variable name="bookmark-title">
6276
+
6277
+ <xsl:choose>
6278
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
6279
+ <xsl:otherwise>Tables</xsl:otherwise>
6280
+ </xsl:choose>
6281
+
6282
+ </xsl:variable>
6283
+
6284
+ <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
6285
+
6286
+ <xsl:for-each select="$contents_nodes//tables/table">
6287
+ <fo:bookmark internal-destination="{@id}">
6288
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
6289
+ </fo:bookmark>
6290
+ </xsl:for-each>
6291
+ </fo:bookmark>
6292
+ </xsl:if>
6293
+
6375
6294
  </xsl:template><xsl:template name="getLangVersion">
6376
6295
  <xsl:param name="lang"/>
6377
6296
  <xsl:param name="doctype" select="''"/>
@@ -6570,12 +6489,140 @@
6570
6489
  </fo:block-container>
6571
6490
  </fo:block-container>
6572
6491
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
6573
- <xsl:variable name="text">
6492
+ <xsl:choose>
6493
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6494
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6495
+ <xsl:choose>
6496
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
6497
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
6498
+ </xsl:when>
6499
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
6500
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6501
+ </xsl:otherwise>
6502
+ </xsl:choose>
6503
+ </xsl:when>
6504
+ <xsl:otherwise>
6505
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6506
+ </xsl:otherwise>
6507
+ </xsl:choose>
6508
+
6509
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
6510
+ <xsl:variable name="text_step1">
6574
6511
  <xsl:call-template name="add-zero-spaces-equal"/>
6575
6512
  </xsl:variable>
6576
- <xsl:call-template name="add-zero-spaces-java">
6577
- <xsl:with-param name="text" select="$text"/>
6578
- </xsl:call-template>
6513
+ <xsl:variable name="text_step2">
6514
+ <xsl:call-template name="add-zero-spaces-java">
6515
+ <xsl:with-param name="text" select="$text_step1"/>
6516
+ </xsl:call-template>
6517
+ </xsl:variable>
6518
+ <xsl:value-of select="$text_step2"/>
6519
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
6520
+ <xsl:apply-templates mode="syntax_highlight"/>
6521
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
6522
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
6523
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
6524
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
6525
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
6526
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
6527
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
6528
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
6529
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
6530
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
6531
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
6532
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
6533
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
6534
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
6535
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
6536
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
6537
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
6538
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
6539
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
6540
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
6541
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
6542
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
6543
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
6544
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
6545
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
6546
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
6547
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
6548
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
6549
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
6550
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
6551
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
6552
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
6553
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
6554
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
6555
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
6556
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
6557
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
6558
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
6559
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
6560
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
6561
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
6562
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
6563
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
6564
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
6565
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
6566
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
6567
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
6568
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
6569
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
6570
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
6571
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
6572
+ <fo:inline>
6573
+ <xsl:variable name="classes_">
6574
+ <xsl:call-template name="split">
6575
+ <xsl:with-param name="pText" select="@class"/>
6576
+ <xsl:with-param name="sep" select="' '"/>
6577
+ </xsl:call-template>
6578
+ <!-- a few classes together (_and_ suffix) -->
6579
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
6580
+ <item>hljs-char_and_escape_</item>
6581
+ </xsl:if>
6582
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
6583
+ <item>hljs-title_and_class_</item>
6584
+ </xsl:if>
6585
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
6586
+ <item>hljs-title_and_class__and_inherited__</item>
6587
+ </xsl:if>
6588
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
6589
+ <item>hljs-title_and_function_</item>
6590
+ </xsl:if>
6591
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
6592
+ <item>hljs-variable_and_language_</item>
6593
+ </xsl:if>
6594
+ <!-- with parent classes (_ suffix) -->
6595
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
6596
+ <item>hljs-meta_hljs-keyword</item>
6597
+ </xsl:if>
6598
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
6599
+ <item>hljs-meta_hljs-string</item>
6600
+ </xsl:if>
6601
+ </xsl:variable>
6602
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
6603
+
6604
+ <xsl:for-each select="$classes/item">
6605
+ <xsl:variable name="class_name" select="."/>
6606
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
6607
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
6608
+ </xsl:for-each>
6609
+ </xsl:for-each>
6610
+
6611
+ <!-- <xsl:variable name="class_name">
6612
+ <xsl:choose>
6613
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
6614
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
6615
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
6616
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
6617
+ </xsl:choose>
6618
+ </xsl:variable>
6619
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
6620
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
6621
+ </xsl:for-each> -->
6622
+
6623
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
6624
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
6625
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6579
6626
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
6580
6627
  <xsl:if test="normalize-space() != ''">
6581
6628
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -6906,6 +6953,8 @@
6906
6953
  </xsl:otherwise>
6907
6954
  </xsl:choose> -->
6908
6955
  </fo:block>
6956
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
6957
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
6909
6958
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
6910
6959
  <xsl:if test="normalize-space() != ''">
6911
6960
  <xsl:value-of select="."/>
@@ -6952,11 +7001,14 @@
6952
7001
 
6953
7002
 
6954
7003
  <fo:block-container margin-left="0mm">
6955
-
6956
- <fo:block xsl:use-attribute-sets="quote-style">
7004
+ <fo:block-container xsl:use-attribute-sets="quote-style">
6957
7005
 
6958
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
6959
- </fo:block>
7006
+ <fo:block-container margin-left="0mm" margin-right="0mm">
7007
+ <fo:block role="BlockQuote">
7008
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
7009
+ </fo:block>
7010
+ </fo:block-container>
7011
+ </fo:block-container>
6960
7012
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
6961
7013
  <fo:block xsl:use-attribute-sets="quote-source-style">
6962
7014
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -6977,26 +7029,11 @@
6977
7029
  </xsl:template><xsl:template match="*[local-name() = 'author']">
6978
7030
  <xsl:text>— </xsl:text>
6979
7031
  <xsl:apply-templates/>
6980
- </xsl:template><xsl:variable name="bibitem_hidden_">
6981
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
6982
- <xsl:copy-of select="."/>
6983
- </xsl:for-each>
6984
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
6985
- <xsl:copy-of select="."/>
6986
- </xsl:for-each>
6987
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
6988
-
6989
- <xsl:variable name="bibitemid">
6990
- <xsl:choose>
6991
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
6992
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
6993
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6994
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
6995
- </xsl:choose>
6996
- </xsl:variable>
6997
-
7032
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
7033
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7034
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
6998
7035
  <xsl:choose>
6999
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
7036
+ <xsl:when test="$external-destination != '' or not(key('bibitems_hidden', $current_bibitemid))"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link (internal to the bibitem or external) -->
7000
7037
  <fo:inline xsl:use-attribute-sets="eref-style">
7001
7038
  <xsl:if test="@type = 'footnote'">
7002
7039
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -7010,8 +7047,8 @@
7010
7047
  <xsl:variable name="text" select="normalize-space()"/>
7011
7048
 
7012
7049
 
7013
-
7014
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7050
+
7051
+ <fo:basic-link fox:alt-text="{@citeas}">
7015
7052
  <xsl:if test="normalize-space(@citeas) = ''">
7016
7053
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
7017
7054
  </xsl:if>
@@ -7021,14 +7058,21 @@
7021
7058
 
7022
7059
  </xsl:if>
7023
7060
 
7024
-
7061
+ <xsl:choose>
7062
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
7063
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
7064
+ </xsl:when>
7065
+ <xsl:otherwise>
7066
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
7067
+ </xsl:otherwise>
7068
+ </xsl:choose>
7025
7069
 
7026
7070
  <xsl:apply-templates/>
7027
7071
  </fo:basic-link>
7028
-
7072
+
7029
7073
  </fo:inline>
7030
7074
  </xsl:when>
7031
- <xsl:otherwise>
7075
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
7032
7076
  <fo:inline><xsl:apply-templates/></fo:inline>
7033
7077
  </xsl:otherwise>
7034
7078
  </xsl:choose>
@@ -7103,6 +7147,35 @@
7103
7147
  <xsl:with-param name="count" select="$count - 1"/>
7104
7148
  </xsl:call-template>
7105
7149
  </xsl:if>
7150
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
7151
+ <xsl:variable name="level">
7152
+ <xsl:call-template name="getLevel"/>
7153
+ </xsl:variable>
7154
+ <xsl:variable name="font-size">
7155
+ inherit
7156
+ </xsl:variable>
7157
+ <xsl:variable name="levelTerm">
7158
+ <xsl:call-template name="getLevelTermName"/>
7159
+ </xsl:variable>
7160
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
7161
+
7162
+
7163
+ <xsl:if test="preceding-sibling::*[1][self::iec:preferred]">
7164
+ <xsl:attribute name="space-before">1pt</xsl:attribute>
7165
+ </xsl:if>
7166
+
7167
+
7168
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
7169
+ <fo:block xsl:use-attribute-sets="term-name-style">
7170
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
7171
+ </fo:block>
7172
+ </xsl:if>
7173
+
7174
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
7175
+ <xsl:call-template name="setStyle_preferred"/>
7176
+ <xsl:apply-templates/>
7177
+ </fo:block>
7178
+ </fo:block>
7106
7179
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
7107
7180
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
7108
7181
  <xsl:text> </xsl:text>
@@ -7186,26 +7259,10 @@
7186
7259
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
7187
7260
  </xsl:template><xsl:variable name="ul_labels_">
7188
7261
 
7189
-
7190
-
7191
-
7192
-
7193
- <label level="1" font-size="10pt">•</label>
7194
- <label level="2" font-size="10pt">—</label><!-- em dash -->
7195
- <label level="3" font-size="75%">o</label> <!-- white circle -->
7196
-
7197
-
7198
-
7199
-
7200
-
7201
-
7202
-
7203
-
7204
-
7205
-
7206
-
7207
-
7208
-
7262
+ <label level="1" font-size="10pt">•</label>
7263
+ <label level="2" font-size="10pt">—</label><!-- em dash -->
7264
+ <label level="3" font-size="75%">o</label> <!-- white circle -->
7265
+
7209
7266
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
7210
7267
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
7211
7268
  <xsl:variable name="list_level">
@@ -7231,6 +7288,91 @@
7231
7288
  </xsl:template><xsl:template match="label" mode="ul_labels">
7232
7289
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
7233
7290
  <xsl:value-of select="."/>
7291
+ </xsl:template><xsl:template name="getListItemFormat">
7292
+ <!-- Example: for BSI <?list-type loweralpha?> -->
7293
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
7294
+ <xsl:choose>
7295
+ <xsl:when test="local-name(..) = 'ul'">
7296
+ <xsl:choose>
7297
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
7298
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
7299
+ </xsl:choose>
7300
+ </xsl:when>
7301
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
7302
+
7303
+ <!-- Example: for BSI <?list-start 2?> -->
7304
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
7305
+
7306
+ <xsl:variable name="start_value">
7307
+ <xsl:choose>
7308
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
7309
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
7310
+ </xsl:when>
7311
+ <xsl:when test="normalize-space(../@start) != ''">
7312
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
7313
+ </xsl:when>
7314
+ <xsl:otherwise>0</xsl:otherwise>
7315
+ </xsl:choose>
7316
+ </xsl:variable>
7317
+
7318
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
7319
+
7320
+ <xsl:variable name="type">
7321
+ <xsl:choose>
7322
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
7323
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
7324
+
7325
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
7326
+
7327
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
7328
+ <xsl:variable name="list_level">
7329
+ <xsl:choose>
7330
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
7331
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
7332
+ </xsl:choose>
7333
+ </xsl:variable>
7334
+
7335
+ <xsl:choose>
7336
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
7337
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
7338
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
7339
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
7340
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
7341
+ <xsl:otherwise> <!-- level 1 -->
7342
+ <xsl:choose>
7343
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
7344
+ <xsl:otherwise>alphabet</xsl:otherwise>
7345
+ </xsl:choose>
7346
+ </xsl:otherwise>
7347
+ </xsl:choose>
7348
+
7349
+ </xsl:otherwise>
7350
+ </xsl:choose>
7351
+ </xsl:variable>
7352
+
7353
+ <xsl:variable name="format">
7354
+ <xsl:choose>
7355
+ <xsl:when test="$type = 'arabic'">
7356
+ 1)
7357
+ </xsl:when>
7358
+ <xsl:when test="$type = 'alphabet'">
7359
+ a)
7360
+ </xsl:when>
7361
+ <xsl:when test="$type = 'alphabet_upper'">
7362
+ A.
7363
+ </xsl:when>
7364
+ <xsl:when test="$type = 'roman'">
7365
+ i)
7366
+ </xsl:when>
7367
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
7368
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
7369
+ </xsl:choose>
7370
+ </xsl:variable>
7371
+
7372
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
7373
+
7374
+ </xsl:otherwise>
7375
+ </xsl:choose>
7234
7376
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
7235
7377
  <xsl:choose>
7236
7378
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -7246,18 +7388,78 @@
7246
7388
 
7247
7389
  <fo:block-container margin-left="0mm">
7248
7390
  <fo:block>
7249
- <xsl:apply-templates select="." mode="ul_ol"/>
7391
+ <xsl:apply-templates select="." mode="list"/>
7250
7392
  </fo:block>
7251
7393
  </fo:block-container>
7252
7394
  </fo:block-container>
7253
7395
  </xsl:when>
7254
7396
  <xsl:otherwise>
7255
7397
  <fo:block>
7256
- <xsl:apply-templates select="." mode="ul_ol"/>
7398
+ <xsl:apply-templates select="." mode="list"/>
7257
7399
  </fo:block>
7258
7400
  </xsl:otherwise>
7259
7401
  </xsl:choose>
7260
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
7402
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
7403
+ <fo:list-block xsl:use-attribute-sets="list-style">
7404
+
7405
+
7406
+
7407
+
7408
+ <xsl:if test="ancestor::iec:ul or ancestor::iec:ol">
7409
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
7410
+ </xsl:if>
7411
+ <xsl:if test="ancestor::iec:legal-statement">
7412
+ <xsl:attribute name="provisional-distance-between-starts">5mm</xsl:attribute>
7413
+ </xsl:if>
7414
+
7415
+
7416
+
7417
+
7418
+
7419
+
7420
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
7421
+ </fo:list-block>
7422
+ <!-- <xsl:for-each select="./iho:note">
7423
+ <xsl:call-template name="note"/>
7424
+ </xsl:for-each> -->
7425
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
7426
+ </xsl:template><xsl:template match="*[local-name()='li']">
7427
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
7428
+ <xsl:copy-of select="@id"/>
7429
+
7430
+
7431
+
7432
+ <fo:list-item-label end-indent="label-end()">
7433
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
7434
+
7435
+
7436
+
7437
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
7438
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
7439
+ <xsl:call-template name="append_add-style"/>
7440
+ </xsl:if>
7441
+
7442
+ <xsl:call-template name="getListItemFormat"/>
7443
+ </fo:block>
7444
+ </fo:list-item-label>
7445
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
7446
+ <fo:block>
7447
+
7448
+
7449
+
7450
+
7451
+
7452
+ <xsl:apply-templates/>
7453
+
7454
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
7455
+
7456
+ <xsl:for-each select="./bsi:note">
7457
+ <xsl:call-template name="note"/>
7458
+ </xsl:for-each> -->
7459
+ </fo:block>
7460
+ </fo:list-item-body>
7461
+ </fo:list-item>
7462
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
7261
7463
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
7262
7464
  <bookmark><xsl:value-of select="@id"/></bookmark>
7263
7465
  </xsl:for-each>
@@ -7279,7 +7481,7 @@
7279
7481
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
7280
7482
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
7281
7483
  <xsl:if test="@to">
7282
- <xsl:value-of select="$dash"/>
7484
+ <xsl:value-of select="$en_dash"/>
7283
7485
  <xsl:copy>
7284
7486
  <xsl:copy-of select="@*"/>
7285
7487
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -7304,7 +7506,7 @@
7304
7506
  <xsl:param name="target"/>
7305
7507
  <!-- <node></node> -->
7306
7508
  <xsl:choose>
7307
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
7509
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
7308
7510
  <!-- skip text (i.e. remove it) and process next element -->
7309
7511
  <!-- [removed_<xsl:value-of select="."/>] -->
7310
7512
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -7388,12 +7590,22 @@
7388
7590
  </xsl:variable>
7389
7591
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
7390
7592
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
7593
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
7594
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
7595
+ <!-- Index -->
7596
+ <xsl:apply-templates/>
7597
+ </fo:block>
7598
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
7599
+ <!-- Letter A, B, C, ... -->
7600
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
7601
+ <xsl:apply-templates/>
7602
+ </fo:block>
7391
7603
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
7392
7604
  <xsl:apply-templates/>
7393
7605
  <fo:block>
7394
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
7395
- <fo:block> </fo:block>
7396
- </xsl:if>
7606
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
7607
+ <fo:block> </fo:block>
7608
+ </xsl:if>
7397
7609
  </fo:block>
7398
7610
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
7399
7611
  <xsl:apply-templates/>
@@ -7403,6 +7615,9 @@
7403
7615
 
7404
7616
  <xsl:apply-templates/>
7405
7617
  </fo:block>
7618
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
7619
+ <!-- to split by '_' and other chars -->
7620
+ <xsl:call-template name="add-zero-spaces-java"/>
7406
7621
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
7407
7622
  <fo:inline id="{@id}" font-size="1pt"/>
7408
7623
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -7598,23 +7813,45 @@
7598
7813
  <xsl:apply-templates/>
7599
7814
  </fo:inline>
7600
7815
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
7816
+
7817
+ <!-- list of footnotes to calculate actual footnotes number -->
7818
+ <xsl:variable name="p_fn_">
7819
+ <xsl:call-template name="get_fn_list"/>
7820
+ </xsl:variable>
7821
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
7822
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
7823
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
7824
+ <!-- fn sequence number in document -->
7825
+ <xsl:variable name="current_fn_number">
7826
+ <xsl:choose>
7827
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
7828
+ <xsl:otherwise>
7829
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
7830
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
7831
+ </xsl:otherwise>
7832
+ </xsl:choose>
7833
+ </xsl:variable>
7601
7834
  <fo:footnote>
7602
7835
  <xsl:variable name="number">
7603
7836
 
7604
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
7837
+ <xsl:value-of select="$current_fn_number"/>
7605
7838
 
7606
7839
  </xsl:variable>
7840
+
7841
+ <xsl:variable name="current_fn_number_text">
7842
+ <xsl:value-of select="$number"/>
7843
+
7844
+ </xsl:variable>
7845
+
7607
7846
  <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
7608
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
7609
- <xsl:value-of select="$number"/>
7610
-
7847
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
7848
+ <xsl:value-of select="$current_fn_number_text"/>
7611
7849
  </fo:basic-link>
7612
7850
  </fo:inline>
7613
7851
  <fo:footnote-body>
7614
7852
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
7615
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7616
- <xsl:value-of select="$number"/>
7617
-
7853
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
7854
+ <xsl:value-of select="$current_fn_number_text"/>
7618
7855
  </fo:inline>
7619
7856
  <xsl:apply-templates/>
7620
7857
  </fo:block>
@@ -7740,7 +7977,7 @@
7740
7977
  </fo:table-body>
7741
7978
  </fo:table>
7742
7979
  </fo:block>
7743
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
7980
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
7744
7981
  <fo:table-row min-height="5mm">
7745
7982
  <xsl:apply-templates/>
7746
7983
  </fo:table-row>
@@ -7856,6 +8093,78 @@
7856
8093
  <!-- processing for admonition/p found in the template for 'p' -->
7857
8094
  <xsl:call-template name="paragraph"/>
7858
8095
 
8096
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
8097
+ <xsl:copy>
8098
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
8099
+ </xsl:copy>
8100
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
8101
+ <xsl:copy>
8102
+ <xsl:copy-of select="@*"/>
8103
+
8104
+ <xsl:variable name="nodes_preface_">
8105
+ <xsl:for-each select="*">
8106
+ <node id="{@id}"/>
8107
+ </xsl:for-each>
8108
+ </xsl:variable>
8109
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
8110
+
8111
+ <xsl:for-each select="*">
8112
+ <xsl:sort select="@displayorder" data-type="number"/>
8113
+
8114
+ <!-- process Section's title -->
8115
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
8116
+ <xsl:if test="$preceding-sibling_id != ''">
8117
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8118
+ </xsl:if>
8119
+
8120
+ <xsl:choose>
8121
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8122
+ <xsl:otherwise>
8123
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8124
+ </xsl:otherwise>
8125
+ </xsl:choose>
8126
+
8127
+ </xsl:for-each>
8128
+ </xsl:copy>
8129
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
8130
+ <xsl:copy>
8131
+ <xsl:copy-of select="@*"/>
8132
+
8133
+ <xsl:variable name="nodes_sections_">
8134
+ <xsl:for-each select="*">
8135
+ <node id="{@id}"/>
8136
+ </xsl:for-each>
8137
+ </xsl:variable>
8138
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
8139
+
8140
+ <!-- move section 'Normative references' inside 'sections' -->
8141
+ <xsl:for-each select="* | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]">
8142
+ <xsl:sort select="@displayorder" data-type="number"/>
8143
+
8144
+ <!-- process Section's title -->
8145
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
8146
+ <xsl:if test="$preceding-sibling_id != ''">
8147
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
8148
+ </xsl:if>
8149
+
8150
+ <xsl:choose>
8151
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
8152
+ <xsl:otherwise>
8153
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8154
+ </xsl:otherwise>
8155
+ </xsl:choose>
8156
+
8157
+ </xsl:for-each>
8158
+ </xsl:copy>
8159
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
8160
+ <xsl:copy>
8161
+ <xsl:copy-of select="@*"/>
8162
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
8163
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
8164
+ <xsl:sort select="@displayorder" data-type="number"/>
8165
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
8166
+ </xsl:for-each>
8167
+ </xsl:copy>
7859
8168
  </xsl:template><xsl:template name="convertDate">
7860
8169
  <xsl:param name="date"/>
7861
8170
  <xsl:param name="format" select="'short'"/>
@@ -7969,9 +8278,6 @@
7969
8278
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
7970
8279
  </xsl:choose>
7971
8280
  </xsl:template><xsl:template name="addPDFUAmeta">
7972
- <xsl:variable name="lang">
7973
- <xsl:call-template name="getLang"/>
7974
- </xsl:variable>
7975
8281
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
7976
8282
  <pdf:dictionary type="normal" key="ViewerPreferences">
7977
8283
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -8199,10 +8505,12 @@
8199
8505
  <xsl:param name="key"/>
8200
8506
  <xsl:param name="formatted">false</xsl:param>
8201
8507
  <xsl:param name="lang"/>
8508
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
8202
8509
 
8203
8510
  <xsl:variable name="curr_lang">
8204
8511
  <xsl:choose>
8205
8512
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
8513
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
8206
8514
  <xsl:otherwise>
8207
8515
  <xsl:call-template name="getLang"/>
8208
8516
  </xsl:otherwise>
@@ -8237,6 +8545,7 @@
8237
8545
  </xsl:otherwise>
8238
8546
  </xsl:choose>
8239
8547
  </xsl:when>
8548
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
8240
8549
  <xsl:otherwise>
8241
8550
  <xsl:variable name="key_">
8242
8551
  <xsl:call-template name="capitalize">
@@ -8306,53 +8615,153 @@
8306
8615
  <xsl:param name="first"/>
8307
8616
  <xsl:if test="$number != ''">
8308
8617
  <xsl:variable name="words">
8309
- <words>
8310
- <word cardinal="1">One-</word>
8311
- <word ordinal="1">First </word>
8312
- <word cardinal="2">Two-</word>
8313
- <word ordinal="2">Second </word>
8314
- <word cardinal="3">Three-</word>
8315
- <word ordinal="3">Third </word>
8316
- <word cardinal="4">Four-</word>
8317
- <word ordinal="4">Fourth </word>
8318
- <word cardinal="5">Five-</word>
8319
- <word ordinal="5">Fifth </word>
8320
- <word cardinal="6">Six-</word>
8321
- <word ordinal="6">Sixth </word>
8322
- <word cardinal="7">Seven-</word>
8323
- <word ordinal="7">Seventh </word>
8324
- <word cardinal="8">Eight-</word>
8325
- <word ordinal="8">Eighth </word>
8326
- <word cardinal="9">Nine-</word>
8327
- <word ordinal="9">Ninth </word>
8328
- <word ordinal="10">Tenth </word>
8329
- <word ordinal="11">Eleventh </word>
8330
- <word ordinal="12">Twelfth </word>
8331
- <word ordinal="13">Thirteenth </word>
8332
- <word ordinal="14">Fourteenth </word>
8333
- <word ordinal="15">Fifteenth </word>
8334
- <word ordinal="16">Sixteenth </word>
8335
- <word ordinal="17">Seventeenth </word>
8336
- <word ordinal="18">Eighteenth </word>
8337
- <word ordinal="19">Nineteenth </word>
8338
- <word cardinal="20">Twenty-</word>
8339
- <word ordinal="20">Twentieth </word>
8340
- <word cardinal="30">Thirty-</word>
8341
- <word ordinal="30">Thirtieth </word>
8342
- <word cardinal="40">Forty-</word>
8343
- <word ordinal="40">Fortieth </word>
8344
- <word cardinal="50">Fifty-</word>
8345
- <word ordinal="50">Fiftieth </word>
8346
- <word cardinal="60">Sixty-</word>
8347
- <word ordinal="60">Sixtieth </word>
8348
- <word cardinal="70">Seventy-</word>
8349
- <word ordinal="70">Seventieth </word>
8350
- <word cardinal="80">Eighty-</word>
8351
- <word ordinal="80">Eightieth </word>
8352
- <word cardinal="90">Ninety-</word>
8353
- <word ordinal="90">Ninetieth </word>
8354
- <word cardinal="100">Hundred-</word>
8355
- <word ordinal="100">Hundredth </word>
8618
+ <words>
8619
+ <xsl:choose>
8620
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
8621
+ <word cardinal="1">Une-</word>
8622
+ <word ordinal="1">Première </word>
8623
+ <word cardinal="2">Deux-</word>
8624
+ <word ordinal="2">Seconde </word>
8625
+ <word cardinal="3">Trois-</word>
8626
+ <word ordinal="3">Tierce </word>
8627
+ <word cardinal="4">Quatre-</word>
8628
+ <word ordinal="4">Quatrième </word>
8629
+ <word cardinal="5">Cinq-</word>
8630
+ <word ordinal="5">Cinquième </word>
8631
+ <word cardinal="6">Six-</word>
8632
+ <word ordinal="6">Sixième </word>
8633
+ <word cardinal="7">Sept-</word>
8634
+ <word ordinal="7">Septième </word>
8635
+ <word cardinal="8">Huit-</word>
8636
+ <word ordinal="8">Huitième </word>
8637
+ <word cardinal="9">Neuf-</word>
8638
+ <word ordinal="9">Neuvième </word>
8639
+ <word ordinal="10">Dixième </word>
8640
+ <word ordinal="11">Onzième </word>
8641
+ <word ordinal="12">Douzième </word>
8642
+ <word ordinal="13">Treizième </word>
8643
+ <word ordinal="14">Quatorzième </word>
8644
+ <word ordinal="15">Quinzième </word>
8645
+ <word ordinal="16">Seizième </word>
8646
+ <word ordinal="17">Dix-septième </word>
8647
+ <word ordinal="18">Dix-huitième </word>
8648
+ <word ordinal="19">Dix-neuvième </word>
8649
+ <word cardinal="20">Vingt-</word>
8650
+ <word ordinal="20">Vingtième </word>
8651
+ <word cardinal="30">Trente-</word>
8652
+ <word ordinal="30">Trentième </word>
8653
+ <word cardinal="40">Quarante-</word>
8654
+ <word ordinal="40">Quarantième </word>
8655
+ <word cardinal="50">Cinquante-</word>
8656
+ <word ordinal="50">Cinquantième </word>
8657
+ <word cardinal="60">Soixante-</word>
8658
+ <word ordinal="60">Soixantième </word>
8659
+ <word cardinal="70">Septante-</word>
8660
+ <word ordinal="70">Septantième </word>
8661
+ <word cardinal="80">Huitante-</word>
8662
+ <word ordinal="80">Huitantième </word>
8663
+ <word cardinal="90">Nonante-</word>
8664
+ <word ordinal="90">Nonantième </word>
8665
+ <word cardinal="100">Cent-</word>
8666
+ <word ordinal="100">Centième </word>
8667
+ </xsl:when>
8668
+ <xsl:when test="$lang = 'ru'">
8669
+ <word cardinal="1">Одна-</word>
8670
+ <word ordinal="1">Первое </word>
8671
+ <word cardinal="2">Две-</word>
8672
+ <word ordinal="2">Второе </word>
8673
+ <word cardinal="3">Три-</word>
8674
+ <word ordinal="3">Третье </word>
8675
+ <word cardinal="4">Четыре-</word>
8676
+ <word ordinal="4">Четвертое </word>
8677
+ <word cardinal="5">Пять-</word>
8678
+ <word ordinal="5">Пятое </word>
8679
+ <word cardinal="6">Шесть-</word>
8680
+ <word ordinal="6">Шестое </word>
8681
+ <word cardinal="7">Семь-</word>
8682
+ <word ordinal="7">Седьмое </word>
8683
+ <word cardinal="8">Восемь-</word>
8684
+ <word ordinal="8">Восьмое </word>
8685
+ <word cardinal="9">Девять-</word>
8686
+ <word ordinal="9">Девятое </word>
8687
+ <word ordinal="10">Десятое </word>
8688
+ <word ordinal="11">Одиннадцатое </word>
8689
+ <word ordinal="12">Двенадцатое </word>
8690
+ <word ordinal="13">Тринадцатое </word>
8691
+ <word ordinal="14">Четырнадцатое </word>
8692
+ <word ordinal="15">Пятнадцатое </word>
8693
+ <word ordinal="16">Шестнадцатое </word>
8694
+ <word ordinal="17">Семнадцатое </word>
8695
+ <word ordinal="18">Восемнадцатое </word>
8696
+ <word ordinal="19">Девятнадцатое </word>
8697
+ <word cardinal="20">Двадцать-</word>
8698
+ <word ordinal="20">Двадцатое </word>
8699
+ <word cardinal="30">Тридцать-</word>
8700
+ <word ordinal="30">Тридцатое </word>
8701
+ <word cardinal="40">Сорок-</word>
8702
+ <word ordinal="40">Сороковое </word>
8703
+ <word cardinal="50">Пятьдесят-</word>
8704
+ <word ordinal="50">Пятидесятое </word>
8705
+ <word cardinal="60">Шестьдесят-</word>
8706
+ <word ordinal="60">Шестидесятое </word>
8707
+ <word cardinal="70">Семьдесят-</word>
8708
+ <word ordinal="70">Семидесятое </word>
8709
+ <word cardinal="80">Восемьдесят-</word>
8710
+ <word ordinal="80">Восьмидесятое </word>
8711
+ <word cardinal="90">Девяносто-</word>
8712
+ <word ordinal="90">Девяностое </word>
8713
+ <word cardinal="100">Сто-</word>
8714
+ <word ordinal="100">Сотое </word>
8715
+ </xsl:when>
8716
+ <xsl:otherwise> <!-- default english -->
8717
+ <word cardinal="1">One-</word>
8718
+ <word ordinal="1">First </word>
8719
+ <word cardinal="2">Two-</word>
8720
+ <word ordinal="2">Second </word>
8721
+ <word cardinal="3">Three-</word>
8722
+ <word ordinal="3">Third </word>
8723
+ <word cardinal="4">Four-</word>
8724
+ <word ordinal="4">Fourth </word>
8725
+ <word cardinal="5">Five-</word>
8726
+ <word ordinal="5">Fifth </word>
8727
+ <word cardinal="6">Six-</word>
8728
+ <word ordinal="6">Sixth </word>
8729
+ <word cardinal="7">Seven-</word>
8730
+ <word ordinal="7">Seventh </word>
8731
+ <word cardinal="8">Eight-</word>
8732
+ <word ordinal="8">Eighth </word>
8733
+ <word cardinal="9">Nine-</word>
8734
+ <word ordinal="9">Ninth </word>
8735
+ <word ordinal="10">Tenth </word>
8736
+ <word ordinal="11">Eleventh </word>
8737
+ <word ordinal="12">Twelfth </word>
8738
+ <word ordinal="13">Thirteenth </word>
8739
+ <word ordinal="14">Fourteenth </word>
8740
+ <word ordinal="15">Fifteenth </word>
8741
+ <word ordinal="16">Sixteenth </word>
8742
+ <word ordinal="17">Seventeenth </word>
8743
+ <word ordinal="18">Eighteenth </word>
8744
+ <word ordinal="19">Nineteenth </word>
8745
+ <word cardinal="20">Twenty-</word>
8746
+ <word ordinal="20">Twentieth </word>
8747
+ <word cardinal="30">Thirty-</word>
8748
+ <word ordinal="30">Thirtieth </word>
8749
+ <word cardinal="40">Forty-</word>
8750
+ <word ordinal="40">Fortieth </word>
8751
+ <word cardinal="50">Fifty-</word>
8752
+ <word ordinal="50">Fiftieth </word>
8753
+ <word cardinal="60">Sixty-</word>
8754
+ <word ordinal="60">Sixtieth </word>
8755
+ <word cardinal="70">Seventy-</word>
8756
+ <word ordinal="70">Seventieth </word>
8757
+ <word cardinal="80">Eighty-</word>
8758
+ <word ordinal="80">Eightieth </word>
8759
+ <word cardinal="90">Ninety-</word>
8760
+ <word ordinal="90">Ninetieth </word>
8761
+ <word cardinal="100">Hundred-</word>
8762
+ <word ordinal="100">Hundredth </word>
8763
+ </xsl:otherwise>
8764
+ </xsl:choose>
8356
8765
  </words>
8357
8766
  </xsl:variable>
8358
8767
 
@@ -8426,4 +8835,18 @@
8426
8835
  <xsl:otherwise>_</xsl:otherwise>
8427
8836
  </xsl:choose>
8428
8837
  </xsl:attribute>
8838
+ </xsl:template><xsl:template name="substring-after-last">
8839
+ <xsl:param name="value"/>
8840
+ <xsl:param name="delimiter"/>
8841
+ <xsl:choose>
8842
+ <xsl:when test="contains($value, $delimiter)">
8843
+ <xsl:call-template name="substring-after-last">
8844
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
8845
+ <xsl:with-param name="delimiter" select="$delimiter"/>
8846
+ </xsl:call-template>
8847
+ </xsl:when>
8848
+ <xsl:otherwise>
8849
+ <xsl:value-of select="$value"/>
8850
+ </xsl:otherwise>
8851
+ </xsl:choose>
8429
8852
  </xsl:template></xsl:stylesheet>