metanorma-mpfa 0.8.2 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,22 +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"/>
9
-
10
5
  <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
6
 
12
7
 
13
8
 
14
9
  <xsl:variable name="debug">false</xsl:variable>
15
-
16
- <xsl:variable name="marginLeftRight1" select="19"/>
17
- <xsl:variable name="marginLeftRight2" select="19"/>
18
- <xsl:variable name="marginTop" select="16.5"/>
19
- <xsl:variable name="marginBottom" select="10"/>
20
-
10
+
21
11
  <xsl:variable name="copyrightHolder">Ribose Group Inc.</xsl:variable>
22
12
 
23
13
  <xsl:variable name="copyright">
@@ -42,7 +32,7 @@
42
32
  <item level="1" id="Foreword" display="true">Foreword</item>
43
33
  <item id="term-script" display="false">3.2</item>
44
34
  -->
45
- <xsl:variable name="contents">
35
+ <xsl:variable name="contents_">
46
36
  <contents>
47
37
  <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/*[not(local-name() = 'terms')]" mode="contents"/>
48
38
  <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:preface/mpfd:terms" mode="contents"/>
@@ -51,14 +41,12 @@
51
41
 
52
42
  <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:annex" mode="contents"/>
53
43
 
54
- <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:bibliography" mode="contents"/>
44
+ <xsl:apply-templates select="/mpfd:mpfd-standard/mpfd:bibliography" mode="contents"/>
55
45
 
46
+ <xsl:call-template name="processTablesFigures_Contents"/>
56
47
  </contents>
57
48
  </xsl:variable>
58
-
59
- <xsl:variable name="lang">
60
- <xsl:call-template name="getLang"/>
61
- </xsl:variable>
49
+ <xsl:variable name="contents" select="xalan:nodeset($contents_)"/>
62
50
 
63
51
  <xsl:template match="/">
64
52
  <xsl:call-template name="namespaceCheck"/>
@@ -172,7 +160,7 @@
172
160
  <xsl:if test="$debug = 'true'">
173
161
  <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
174
162
  DEBUG
175
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
163
+ contents=<xsl:copy-of select="$contents"/>
176
164
  <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
177
165
  </xsl:if>
178
166
  <!-- Table of content -->
@@ -184,7 +172,7 @@
184
172
  </xsl:variable>
185
173
  <fo:block font-size="14pt" margin-bottom="15.5pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block>
186
174
  <fo:block line-height="115%" role="TOC">
187
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']">
175
+ <xsl:for-each select="$contents//item[@display = 'true']">
188
176
  <fo:block role="TOCI">
189
177
  <xsl:if test="@level = 1">
190
178
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
@@ -204,21 +192,43 @@
204
192
  </xsl:if>
205
193
  </fo:block>
206
194
  </fo:list-item-label>
207
- <fo:list-item-body start-indent="body-start()">
208
- <fo:block text-align-last="justify">
209
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
210
- <xsl:apply-templates select="title"/>
211
- <fo:inline keep-together.within-line="always">
212
- <fo:leader leader-pattern="dots"/>
213
- <fo:page-number-citation ref-id="{@id}"/>
214
- </fo:inline>
215
- </fo:basic-link>
216
- </fo:block>
217
- </fo:list-item-body>
195
+ <fo:list-item-body start-indent="body-start()">
196
+ <fo:block text-align-last="justify">
197
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
198
+ <xsl:apply-templates select="title"/>
199
+ <fo:inline keep-together.within-line="always">
200
+ <fo:leader leader-pattern="dots"/>
201
+ <fo:page-number-citation ref-id="{@id}"/>
202
+ </fo:inline>
203
+ </fo:basic-link>
204
+ </fo:block>
205
+ </fo:list-item-body>
218
206
  </fo:list-item>
219
207
  </fo:list-block>
220
208
  </fo:block>
221
209
  </xsl:for-each>
210
+
211
+
212
+ <!-- List of Tables -->
213
+ <xsl:if test="$contents//tables/table">
214
+ <xsl:call-template name="insertListOf_Title">
215
+ <xsl:with-param name="title" select="$title-list-tables"/>
216
+ </xsl:call-template>
217
+ <xsl:for-each select="$contents//tables/table">
218
+ <xsl:call-template name="insertListOf_Item"/>
219
+ </xsl:for-each>
220
+ </xsl:if>
221
+
222
+ <!-- List of Figures -->
223
+ <xsl:if test="$contents//figures/figure">
224
+ <xsl:call-template name="insertListOf_Title">
225
+ <xsl:with-param name="title" select="$title-list-figures"/>
226
+ </xsl:call-template>
227
+ <xsl:for-each select="$contents//figures/figure">
228
+ <xsl:call-template name="insertListOf_Item"/>
229
+ </xsl:for-each>
230
+ </xsl:if>
231
+
222
232
  </fo:block>
223
233
  </fo:block-container>
224
234
  <xsl:if test="/mpfd:mpfd-standard/mpfd:preface/*">
@@ -259,6 +269,28 @@
259
269
  </fo:root>
260
270
  </xsl:template>
261
271
 
272
+ <xsl:template name="insertListOf_Title">
273
+ <xsl:param name="title"/>
274
+ <fo:block margin-top="6pt" keep-with-next="always">
275
+ <xsl:value-of select="$title"/>
276
+ </fo:block>
277
+ </xsl:template>
278
+
279
+ <xsl:template name="insertListOf_Item">
280
+ <fo:block role="TOCI" text-align-last="justify">
281
+ <fo:basic-link internal-destination="{@id}">
282
+ <xsl:call-template name="setAltText">
283
+ <xsl:with-param name="value" select="@alt-text"/>
284
+ </xsl:call-template>
285
+ <xsl:apply-templates select="." mode="contents"/>
286
+ <fo:inline keep-together.within-line="always">
287
+ <fo:leader leader-pattern="dots"/>
288
+ <fo:page-number-citation ref-id="{@id}"/>
289
+ </fo:inline>
290
+ </fo:basic-link>
291
+ </fo:block>
292
+ </xsl:template>
293
+
262
294
  <xsl:template match="node()">
263
295
  <xsl:apply-templates/>
264
296
  </xsl:template>
@@ -324,31 +356,7 @@
324
356
  <xsl:template match="mpfd:references" mode="contents">
325
357
  <xsl:apply-templates mode="contents"/>
326
358
  </xsl:template>
327
-
328
359
 
329
- <xsl:template name="getListItemFormat">
330
- <xsl:choose>
331
- <xsl:when test="local-name(..) = 'ul'">
332
- <xsl:call-template name="setULLabel"/>
333
- </xsl:when>
334
- <xsl:otherwise> <!-- for ordered lists -->
335
- <xsl:choose>
336
- <xsl:when test="../@type = 'arabic'">
337
- <xsl:number format="a)" lang="en"/>
338
- </xsl:when>
339
- <xsl:when test="../@type = 'roman'">
340
- <xsl:number format="1)"/>
341
- </xsl:when>
342
- <xsl:when test="../@type = 'alphabet'">
343
- <xsl:number format="a)" lang="en"/>
344
- </xsl:when>
345
- <xsl:otherwise>
346
- <xsl:number format="a)" lang="en"/>
347
- </xsl:otherwise>
348
- </xsl:choose>
349
- </xsl:otherwise>
350
- </xsl:choose>
351
- </xsl:template>
352
360
 
353
361
  <!-- ============================= -->
354
362
  <!-- ============================= -->
@@ -457,7 +465,7 @@
457
465
  </xsl:template>
458
466
 
459
467
 
460
- <xsl:template match="mpfd:ul | mpfd:ol" mode="ul_ol">
468
+ <xsl:template match="mpfd:ul | mpfd:ol" mode="list" priority="2">
461
469
  <fo:block-container margin-left="0mm">
462
470
  <xsl:variable name="margin-left">
463
471
  <xsl:variable name="countAncestorLists" select="count(ancestor::mpfd:ul) + count(ancestor::mpfd:ol)"/>
@@ -468,35 +476,13 @@
468
476
  </xsl:attribute>
469
477
 
470
478
  <fo:block-container margin-left="0mm">
471
- <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="6mm">
472
- <xsl:if test="local-name() = 'ol'">
473
- <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute>
474
- </xsl:if>
475
- <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
476
- </fo:list-block>
477
- <xsl:for-each select="./mpfd:note//mpfd:p">
478
- <xsl:call-template name="note"/>
479
- </xsl:for-each>
479
+ <xsl:call-template name="list"/>
480
480
  </fo:block-container>
481
481
  </fo:block-container>
482
482
  </xsl:template>
483
483
 
484
- <xsl:template match="mpfd:li">
485
- <fo:list-item id="{@id}">
486
- <fo:list-item-label end-indent="label-end()">
487
- <fo:block>
488
- <xsl:call-template name="getListItemFormat"/>
489
- </fo:block>
490
- </fo:list-item-label>
491
- <fo:list-item-body start-indent="body-start()">
492
- <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
493
- <xsl:apply-templates select=".//mpfd:note"/>
494
- </fo:list-item-body>
495
- </fo:list-item>
496
- </xsl:template>
497
-
498
484
 
499
- <xsl:template match="mpfd:preferred">
485
+ <xsl:template match="mpfd:preferred" priority="2">
500
486
  <fo:inline font-weight="bold">
501
487
  <xsl:call-template name="setStyle_preferred"/>
502
488
  <xsl:apply-templates/>
@@ -515,12 +501,12 @@
515
501
  </xsl:template>
516
502
 
517
503
 
518
- <xsl:template match="mpfd:formula/mpfd:stem">
504
+ <xsl:template match="mpfd:formula/mpfd:stem" priority="2">
519
505
  <fo:block margin-top="14pt" margin-bottom="14pt" text-align-last="justify">
520
506
  <fo:inline padding-left="5mm"><xsl:apply-templates/></fo:inline>
521
507
  <fo:inline keep-together.within-line="always">
522
508
  <fo:leader leader-pattern="space"/>
523
- <xsl:apply-templates select="../mpfd:name" mode="formula_number"/>
509
+ <xsl:apply-templates select="../mpfd:name"/>
524
510
  </fo:inline>
525
511
  </fo:block>
526
512
  </xsl:template>
@@ -584,11 +570,21 @@
584
570
  </xsl:template>
585
571
 
586
572
 
587
- <xsl:variable name="pageWidth_">
573
+ <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">
574
+ <xsl:call-template name="getLang"/>
575
+ </xsl:variable><xsl:variable name="pageWidth_">
588
576
  210
589
577
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
590
578
  297
591
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
579
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
580
+ 19
581
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
582
+ 19
583
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
584
+ 16.5
585
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
586
+ 10
587
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
592
588
 
593
589
  <title-edition lang="en">
594
590
 
@@ -600,6 +596,10 @@
600
596
  <xsl:text>Édition </xsl:text>
601
597
  </title-edition>
602
598
 
599
+ <title-edition lang="ru">
600
+ <xsl:text>Издание </xsl:text>
601
+ </title-edition>
602
+
603
603
  <!-- These titles of Table of contents renders different than determined in localized-strings -->
604
604
  <title-toc lang="en">
605
605
 
@@ -616,7 +616,7 @@
616
616
  <xsl:text>Contents</xsl:text>
617
617
 
618
618
  </title-toc>
619
-
619
+
620
620
  <title-descriptors lang="en">Descriptors</title-descriptors>
621
621
 
622
622
  <title-part lang="en">
@@ -628,7 +628,11 @@
628
628
 
629
629
 
630
630
 
631
- </title-part>
631
+ </title-part>
632
+ <title-part lang="ru">
633
+
634
+
635
+ </title-part>
632
636
  <title-part lang="zh">第 # 部分:</title-part>
633
637
 
634
638
  <title-subpart lang="en">Sub-part #</title-subpart>
@@ -644,13 +648,38 @@
644
648
 
645
649
  <title-summary lang="en">Summary</title-summary>
646
650
 
651
+ <title-continued lang="ru">(продолжение)</title-continued>
647
652
  <title-continued lang="en">(continued)</title-continued>
648
653
  <title-continued lang="fr">(continué)</title-continued>
649
654
 
650
- </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
655
+ </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="title-list-tables">
656
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
657
+ <xsl:value-of select="$toc_table_title"/>
658
+ <xsl:if test="normalize-space($toc_table_title) = ''">
659
+ <xsl:call-template name="getTitle">
660
+ <xsl:with-param name="name" select="'title-list-tables'"/>
661
+ </xsl:call-template>
662
+ </xsl:if>
663
+ </xsl:variable><xsl:variable name="title-list-figures">
664
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
665
+ <xsl:value-of select="$toc_figure_title"/>
666
+ <xsl:if test="normalize-space($toc_figure_title) = ''">
667
+ <xsl:call-template name="getTitle">
668
+ <xsl:with-param name="name" select="'title-list-figures'"/>
669
+ </xsl:call-template>
670
+ </xsl:if>
671
+ </xsl:variable><xsl:variable name="title-list-recommendations">
672
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
673
+ <xsl:value-of select="$toc_requirement_title"/>
674
+ <xsl:if test="normalize-space($toc_requirement_title) = ''">
675
+ <xsl:call-template name="getTitle">
676
+ <xsl:with-param name="name" select="'title-list-recommendations'"/>
677
+ </xsl:call-template>
678
+ </xsl:if>
679
+ </xsl:variable><xsl:variable name="bibdata">
651
680
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
652
681
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
653
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
682
+ </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">
654
683
  <xsl:param name="name"/>
655
684
  <xsl:param name="lang"/>
656
685
  <xsl:variable name="lang_">
@@ -673,7 +702,7 @@
673
702
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
674
703
  </xsl:otherwise>
675
704
  </xsl:choose>
676
- </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">
705
+ </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">
677
706
 
678
707
 
679
708
 
@@ -830,7 +859,7 @@
830
859
  <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
831
860
 
832
861
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
833
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
862
+
834
863
 
835
864
 
836
865
 
@@ -846,6 +875,7 @@
846
875
 
847
876
 
848
877
 
878
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
849
879
  <xsl:attribute name="font-size">10pt</xsl:attribute>
850
880
  <xsl:attribute name="font-weight">bold</xsl:attribute>
851
881
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1187,7 +1217,8 @@
1187
1217
 
1188
1218
 
1189
1219
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1190
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
1220
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
1221
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
1191
1222
 
1192
1223
 
1193
1224
 
@@ -1196,14 +1227,12 @@
1196
1227
 
1197
1228
 
1198
1229
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1199
- <xsl:attribute name="margin-left">12mm</xsl:attribute>
1200
- <xsl:attribute name="margin-right">12mm</xsl:attribute>
1201
1230
  <xsl:attribute name="text-align">justify</xsl:attribute>
1202
1231
 
1203
1232
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1233
+ <xsl:attribute name="text-align">right</xsl:attribute>
1204
1234
 
1205
1235
 
1206
-
1207
1236
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
1208
1237
 
1209
1238
 
@@ -1222,6 +1251,9 @@
1222
1251
 
1223
1252
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1224
1253
 
1254
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
1255
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1256
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1225
1257
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
1226
1258
 
1227
1259
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -1253,6 +1285,33 @@
1253
1285
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1254
1286
 
1255
1287
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
1288
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
1289
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1290
+
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
1297
+ <xsl:attribute name="text-align">center</xsl:attribute>
1298
+
1299
+
1300
+
1301
+
1302
+
1303
+
1304
+
1305
+
1306
+
1307
+
1308
+
1309
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
1310
+ <xsl:attribute name="text-align">right</xsl:attribute>
1311
+
1312
+
1313
+
1314
+
1256
1315
 
1257
1316
  </xsl:attribute-set><xsl:attribute-set name="image-style">
1258
1317
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1286,6 +1345,18 @@
1286
1345
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1287
1346
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1288
1347
 
1348
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
1349
+
1350
+
1351
+
1352
+
1353
+
1354
+
1355
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
1356
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1357
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1358
+
1359
+
1289
1360
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
1290
1361
 
1291
1362
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -1302,13 +1373,19 @@
1302
1373
  </xsl:attribute-set><xsl:variable name="color-added-text">
1303
1374
  <xsl:text>rgb(0, 255, 0)</xsl:text>
1304
1375
  </xsl:variable><xsl:attribute-set name="add-style">
1305
- <xsl:attribute name="color">red</xsl:attribute>
1306
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
1307
- <!-- <xsl:attribute name="color">black</xsl:attribute>
1308
- <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1309
- <xsl:attribute name="padding-top">1mm</xsl:attribute>
1310
- <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1311
- </xsl:attribute-set><xsl:variable name="color-deleted-text">
1376
+
1377
+ <xsl:attribute name="color">red</xsl:attribute>
1378
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1379
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1380
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1381
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1382
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1383
+
1384
+ </xsl:attribute-set><xsl:variable name="add-style">
1385
+ <add-style xsl:use-attribute-sets="add-style"/>
1386
+ </xsl:variable><xsl:template name="append_add-style">
1387
+ <xsl:copy-of select="xalan:nodeset($add-style)/add-style/@*"/>
1388
+ </xsl:template><xsl:variable name="color-deleted-text">
1312
1389
  <xsl:text>red</xsl:text>
1313
1390
  </xsl:variable><xsl:attribute-set name="del-style">
1314
1391
  <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
@@ -1319,6 +1396,36 @@
1319
1396
 
1320
1397
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1321
1398
 
1399
+
1400
+
1401
+
1402
+
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+ <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
1409
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1410
+
1411
+
1412
+
1413
+
1414
+
1415
+
1416
+
1417
+
1418
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1419
+
1420
+
1421
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
1422
+
1423
+
1424
+
1425
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
1426
+
1427
+
1428
+
1322
1429
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1323
1430
  <xsl:attribute name="line-height">135%</xsl:attribute>
1324
1431
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -1592,15 +1699,148 @@
1592
1699
 
1593
1700
 
1594
1701
 
1702
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
1703
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1704
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
1705
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1706
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
1707
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1708
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
1709
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1710
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
1711
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1712
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
1713
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1714
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
1715
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1716
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
1717
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1718
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
1719
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1720
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
1721
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1722
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
1723
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1724
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
1725
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1726
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
1727
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1728
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
1729
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1730
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
1731
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1732
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
1733
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1734
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
1735
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1736
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
1737
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1738
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
1739
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1740
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
1741
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1742
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
1743
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1744
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
1745
+ <xsl:attribute name="color">#032f62</xsl:attribute>
1746
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
1747
+ <xsl:attribute name="color">#032f62</xsl:attribute>
1748
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
1749
+ <xsl:attribute name="color">#032f62</xsl:attribute>
1750
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
1751
+ <xsl:attribute name="color">#e36209</xsl:attribute>
1752
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
1753
+ <xsl:attribute name="color">#e36209</xsl:attribute>
1754
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
1755
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
1756
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
1757
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
1758
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
1759
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
1760
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
1761
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1762
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
1763
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1764
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
1765
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1766
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
1767
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1768
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
1769
+ <xsl:attribute name="color">#24292e</xsl:attribute>
1770
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
1771
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1772
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1773
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
1774
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
1775
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
1776
+ <xsl:attribute name="color">#24292e</xsl:attribute>
1777
+ <xsl:attribute name="font-style">italic</xsl:attribute>
1778
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
1779
+ <xsl:attribute name="color">#24292e</xsl:attribute>
1780
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1781
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
1782
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1783
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
1784
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
1785
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
1786
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
1787
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
1788
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
1789
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
1790
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
1791
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
1792
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
1793
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
1794
+ <xsl:attribute name="role">H1</xsl:attribute>
1795
+
1796
+
1797
+
1798
+
1799
+
1800
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
1801
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1802
+
1803
+
1804
+
1805
+
1806
+
1595
1807
  </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">
1808
+ <xsl:variable name="nodes_preface_">
1809
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1810
+ <node id="{@id}"/>
1811
+ </xsl:for-each>
1812
+ </xsl:variable>
1813
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
1814
+
1596
1815
  <xsl:for-each select="/*/*[local-name()='preface']/*">
1597
1816
  <xsl:sort select="@displayorder" data-type="number"/>
1817
+
1818
+ <!-- process Section's title -->
1819
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
1820
+ <xsl:if test="$preceding-sibling_id != ''">
1821
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
1822
+ </xsl:if>
1823
+
1598
1824
  <xsl:apply-templates select="." mode="contents"/>
1599
1825
  </xsl:for-each>
1600
1826
  </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1601
1827
 
1828
+ <xsl:variable name="nodes_sections_">
1829
+ <xsl:for-each select="/*/*[local-name()='sections']/*">
1830
+ <node id="{@id}"/>
1831
+ </xsl:for-each>
1832
+ </xsl:variable>
1833
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
1834
+
1602
1835
  <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']]">
1603
1836
  <xsl:sort select="@displayorder" data-type="number"/>
1837
+
1838
+ <!-- process Section's title -->
1839
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
1840
+ <xsl:if test="$preceding-sibling_id != ''">
1841
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="contents_no_displayorder"/>
1842
+ </xsl:if>
1843
+
1604
1844
  <xsl:apply-templates select="." mode="contents"/>
1605
1845
  </xsl:for-each>
1606
1846
 
@@ -1613,6 +1853,30 @@
1613
1853
  <xsl:sort select="@displayorder" data-type="number"/>
1614
1854
  <xsl:apply-templates select="." mode="contents"/>
1615
1855
  </xsl:for-each>
1856
+ </xsl:template><xsl:template name="processTablesFigures_Contents">
1857
+ <xsl:param name="always"/>
1858
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
1859
+ <xsl:call-template name="processTables_Contents"/>
1860
+ </xsl:if>
1861
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
1862
+ <xsl:call-template name="processFigures_Contents"/>
1863
+ </xsl:if>
1864
+ </xsl:template><xsl:template name="processTables_Contents">
1865
+ <tables>
1866
+ <xsl:for-each select="//*[local-name() = 'table'][@id and *[local-name() = 'name'] and normalize-space(@id) != '']">
1867
+ <table id="{@id}" alt-text="{*[local-name() = 'name']}">
1868
+ <xsl:copy-of select="*[local-name() = 'name']"/>
1869
+ </table>
1870
+ </xsl:for-each>
1871
+ </tables>
1872
+ </xsl:template><xsl:template name="processFigures_Contents">
1873
+ <figures>
1874
+ <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) != '']">
1875
+ <figure id="{@id}" alt-text="{*[local-name() = 'name']}">
1876
+ <xsl:copy-of select="*[local-name() = 'name']"/>
1877
+ </figure>
1878
+ </xsl:for-each>
1879
+ </figures>
1616
1880
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1617
1881
  <xsl:for-each select="/*/*[local-name()='preface']/*">
1618
1882
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -1678,9 +1942,12 @@
1678
1942
 
1679
1943
 
1680
1944
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
1945
+ <xsl:param name="margin"/>
1681
1946
 
1682
1947
  <!-- process in the template 'paragraph' -->
1683
- <xsl:call-template name="paragraph"/>
1948
+ <xsl:call-template name="paragraph">
1949
+ <xsl:with-param name="margin" select="$margin"/>
1950
+ </xsl:call-template>
1684
1951
 
1685
1952
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
1686
1953
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -1692,9 +1959,12 @@
1692
1959
  <xsl:call-template name="title"/>
1693
1960
 
1694
1961
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
1962
+ <xsl:param name="margin"/>
1695
1963
 
1696
1964
  <!-- process in the template 'paragraph' -->
1697
- <xsl:call-template name="paragraph"/>
1965
+ <xsl:call-template name="paragraph">
1966
+ <xsl:with-param name="margin" select="$margin"/>
1967
+ </xsl:call-template>
1698
1968
 
1699
1969
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1700
1970
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
@@ -1733,7 +2003,7 @@
1733
2003
  </xsl:call-template>
1734
2004
  </xsl:if>
1735
2005
  </xsl:variable>
1736
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2006
+ <!-- DEBUG colwidths=<xsl:copy-of select="$colwidths"/> -->
1737
2007
 
1738
2008
 
1739
2009
  <xsl:variable name="margin-side">
@@ -1993,7 +2263,7 @@
1993
2263
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
1994
2264
  <!-- 2009 thinspace -->
1995
2265
  <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
1996
- <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '', ' '))"/>
2266
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​­', ' '))"/> <!-- replace zero-width-space and soft-hyphen to space -->
1997
2267
  </xsl:call-template>
1998
2268
  </xsl:variable>
1999
2269
  <xsl:variable name="max_length">
@@ -2034,8 +2304,7 @@
2034
2304
  </xsl:call-template>
2035
2305
  </xsl:if>
2036
2306
  </xsl:template><xsl:template match="text()" mode="td_text">
2037
- <xsl:variable name="zero-space">​</xsl:variable>
2038
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2307
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2039
2308
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2040
2309
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2041
2310
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -2380,37 +2649,7 @@
2380
2649
 
2381
2650
  <!-- list of footnotes to calculate actual footnotes number -->
2382
2651
  <xsl:variable name="p_fn_">
2383
- <xsl:choose>
2384
- <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2385
- <fn gen_id="{generate-id(.)}">
2386
- <xsl:copy-of select="@*"/>
2387
- <xsl:copy-of select="node()"/>
2388
- </fn>
2389
- </xsl:when>
2390
- <xsl:otherwise>
2391
- <!-- itetation for:
2392
- footnotes in bibdata/title
2393
- footnotes in bibliography
2394
- footnotes in document's body (except table's head/body/foot and figure text)
2395
- -->
2396
- <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2397
- <fn gen_id="{generate-id(.)}">
2398
- <xsl:copy-of select="@*"/>
2399
- <xsl:copy-of select="node()"/>
2400
- </fn>
2401
- </xsl:for-each>
2402
- <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']/*">
2403
- <xsl:sort select="@displayorder" data-type="number"/>
2404
- <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])]">
2405
- <!-- copy unique fn -->
2406
- <fn gen_id="{generate-id(.)}">
2407
- <xsl:copy-of select="@*"/>
2408
- <xsl:copy-of select="node()"/>
2409
- </fn>
2410
- </xsl:for-each>
2411
- </xsl:for-each>
2412
- </xsl:otherwise>
2413
- </xsl:choose>
2652
+ <xsl:call-template name="get_fn_list"/>
2414
2653
  </xsl:variable>
2415
2654
  <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
2416
2655
 
@@ -2471,6 +2710,38 @@
2471
2710
  <xsl:copy-of select="$footnote_inline"/>
2472
2711
  </xsl:otherwise>
2473
2712
  </xsl:choose>
2713
+ </xsl:template><xsl:template name="get_fn_list">
2714
+ <xsl:choose>
2715
+ <xsl:when test="@current_fn_number"> <!-- for BSI, footnote reference number calculated already -->
2716
+ <fn gen_id="{generate-id(.)}">
2717
+ <xsl:copy-of select="@*"/>
2718
+ <xsl:copy-of select="node()"/>
2719
+ </fn>
2720
+ </xsl:when>
2721
+ <xsl:otherwise>
2722
+ <!-- itetation for:
2723
+ footnotes in bibdata/title
2724
+ footnotes in bibliography
2725
+ footnotes in document's body (except table's head/body/foot and figure text)
2726
+ -->
2727
+ <xsl:for-each select="ancestor::*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']/*[local-name() = 'note'][@type='title-footnote']">
2728
+ <fn gen_id="{generate-id(.)}">
2729
+ <xsl:copy-of select="@*"/>
2730
+ <xsl:copy-of select="node()"/>
2731
+ </fn>
2732
+ </xsl:for-each>
2733
+ <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']/*">
2734
+ <xsl:sort select="@displayorder" data-type="number"/>
2735
+ <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])]">
2736
+ <!-- copy unique fn -->
2737
+ <fn gen_id="{generate-id(.)}">
2738
+ <xsl:copy-of select="@*"/>
2739
+ <xsl:copy-of select="node()"/>
2740
+ </fn>
2741
+ </xsl:for-each>
2742
+ </xsl:for-each>
2743
+ </xsl:otherwise>
2744
+ </xsl:choose>
2474
2745
  </xsl:template><xsl:template name="table_fn_display">
2475
2746
  <xsl:variable name="references">
2476
2747
 
@@ -2642,7 +2913,7 @@
2642
2913
  </fo:inline>
2643
2914
  </xsl:template><xsl:template match="*[local-name()='fn']/text()[normalize-space() != '']">
2644
2915
  <fo:inline><xsl:value-of select="."/></fo:inline>
2645
- </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
2916
+ </xsl:template><xsl:template match="*[local-name()='fn']//*[local-name()='p']">
2646
2917
  <fo:inline>
2647
2918
  <xsl:apply-templates/>
2648
2919
  </fo:inline>
@@ -3005,20 +3276,44 @@
3005
3276
  <fo:inline text-decoration="underline">
3006
3277
  <xsl:apply-templates/>
3007
3278
  </fo:inline>
3008
- </xsl:template><xsl:template match="*[local-name()='add']">
3279
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
3009
3280
  <xsl:param name="skip">true</xsl:param>
3281
+ <xsl:param name="block">false</xsl:param>
3282
+ <xsl:param name="type"/>
3283
+ <xsl:param name="text-align"/>
3010
3284
  <xsl:choose>
3011
3285
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3012
3286
  <xsl:choose>
3013
- <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>
3287
+ <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>
3014
3288
  <xsl:otherwise>
3015
- <fo:inline>
3289
+ <xsl:variable name="tag">
3016
3290
  <xsl:call-template name="insertTag">
3017
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
3291
+ <xsl:with-param name="type">
3292
+ <xsl:choose>
3293
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
3294
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
3295
+ </xsl:choose>
3296
+ </xsl:with-param>
3018
3297
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
3019
3298
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
3020
3299
  </xsl:call-template>
3021
- </fo:inline>
3300
+ </xsl:variable>
3301
+ <xsl:choose>
3302
+ <xsl:when test="$block = 'false'">
3303
+ <fo:inline>
3304
+ <xsl:copy-of select="$tag"/>
3305
+ </fo:inline>
3306
+ </xsl:when>
3307
+ <xsl:otherwise>
3308
+ <fo:block> <!-- for around figures -->
3309
+ <xsl:if test="$text-align != ''">
3310
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
3311
+ </xsl:if>
3312
+ <xsl:copy-of select="$tag"/>
3313
+ </fo:block>
3314
+ </xsl:otherwise>
3315
+ </xsl:choose>
3316
+
3022
3317
  </xsl:otherwise>
3023
3318
  </xsl:choose>
3024
3319
  </xsl:when>
@@ -3377,17 +3672,21 @@
3377
3672
  </xsl:apply-templates>
3378
3673
  </xsl:template><xsl:template name="getLang">
3379
3674
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3380
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3381
3675
  <xsl:variable name="language">
3382
3676
  <xsl:choose>
3383
3677
  <xsl:when test="$language_current != ''">
3384
3678
  <xsl:value-of select="$language_current"/>
3385
3679
  </xsl:when>
3386
- <xsl:when test="$language_current_2 != ''">
3387
- <xsl:value-of select="$language_current_2"/>
3388
- </xsl:when>
3389
3680
  <xsl:otherwise>
3390
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3681
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3682
+ <xsl:choose>
3683
+ <xsl:when test="$language_current_2 != ''">
3684
+ <xsl:value-of select="$language_current_2"/>
3685
+ </xsl:when>
3686
+ <xsl:otherwise>
3687
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3688
+ </xsl:otherwise>
3689
+ </xsl:choose>
3391
3690
  </xsl:otherwise>
3392
3691
  </xsl:choose>
3393
3692
  </xsl:variable>
@@ -3590,6 +3889,9 @@
3590
3889
  </fo:inline>
3591
3890
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
3592
3891
  <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
3892
+ <xsl:if test="parent::*[local-name() = 'add']">
3893
+ <xsl:call-template name="append_add-style"/>
3894
+ </xsl:if>
3593
3895
  <xsl:apply-templates/>
3594
3896
  </fo:basic-link>
3595
3897
  </xsl:template><xsl:template match="*[local-name() = 'formula']" name="formula">
@@ -3604,8 +3906,8 @@
3604
3906
 
3605
3907
  </xsl:if>
3606
3908
  <fo:block-container margin-left="0mm">
3607
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
3608
- <xsl:apply-templates/>
3909
+ <fo:block id="{@id}">
3910
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
3609
3911
  </fo:block>
3610
3912
  </fo:block-container>
3611
3913
  </fo:block-container>
@@ -3617,10 +3919,43 @@
3617
3919
  <fo:inline>
3618
3920
  <xsl:apply-templates/>
3619
3921
  </fo:inline>
3620
- </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 -->
3922
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
3621
3923
  <xsl:if test="normalize-space() != ''">
3622
3924
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
3623
3925
  </xsl:if>
3926
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
3927
+ <fo:block xsl:use-attribute-sets="formula-style">
3928
+
3929
+
3930
+
3931
+ <fo:table table-layout="fixed" width="100%">
3932
+ <fo:table-column column-width="95%"/>
3933
+ <fo:table-column column-width="5%"/>
3934
+ <fo:table-body>
3935
+ <fo:table-row>
3936
+ <fo:table-cell display-align="center">
3937
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
3938
+
3939
+
3940
+
3941
+ <xsl:apply-templates/>
3942
+ </fo:block>
3943
+ </fo:table-cell>
3944
+ <fo:table-cell display-align="center">
3945
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
3946
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
3947
+ </fo:block>
3948
+ </fo:table-cell>
3949
+ </fo:table-row>
3950
+ </fo:table-body>
3951
+ </fo:table>
3952
+ </fo:block>
3953
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
3954
+ <fo:block xsl:use-attribute-sets="formula-style">
3955
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
3956
+ <xsl:apply-templates/>
3957
+ </fo:block>
3958
+ </fo:block>
3624
3959
  </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
3625
3960
 
3626
3961
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
@@ -3654,6 +3989,13 @@
3654
3989
 
3655
3990
 
3656
3991
 
3992
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
3993
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
3994
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
3995
+ <xsl:call-template name="append_add-style"/>
3996
+ </xsl:if>
3997
+
3998
+
3657
3999
  <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
3658
4000
  <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
3659
4001
  <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
@@ -3692,6 +4034,12 @@
3692
4034
 
3693
4035
 
3694
4036
 
4037
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4038
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
4039
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
4040
+ <xsl:call-template name="append_add-style"/>
4041
+ </xsl:if>
4042
+
3695
4043
  <xsl:apply-templates select="*[local-name() = 'name']"/>
3696
4044
 
3697
4045
  </fo:inline>
@@ -3741,6 +4089,7 @@
3741
4089
  </fo:block>
3742
4090
  </xsl:template><xsl:template match="*[local-name() = 'term']">
3743
4091
  <fo:block id="{@id}" xsl:use-attribute-sets="term-style">
4092
+
3744
4093
 
3745
4094
 
3746
4095
 
@@ -4177,7 +4526,11 @@
4177
4526
  <xsl:value-of select="."/>
4178
4527
  </xsl:template><xsl:template match="node()" mode="contents">
4179
4528
  <xsl:apply-templates mode="contents"/>
4180
- </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'floating-title' or @type = 'section-title']" priority="2" mode="contents">
4529
+ </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">
4530
+ <xsl:call-template name="contents_section-title"/>
4531
+ </xsl:template><xsl:template match="*[local-name() = 'p'][@type = 'section-title']" mode="contents_in_clause">
4532
+ <xsl:call-template name="contents_section-title"/>
4533
+ </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">
4181
4534
  <xsl:variable name="level">
4182
4535
  <xsl:call-template name="getLevel">
4183
4536
  <xsl:with-param name="depth" select="@depth"/>
@@ -4246,13 +4599,14 @@
4246
4599
  <xsl:apply-templates mode="bookmarks"/>
4247
4600
  </xsl:template><xsl:template name="addBookmarks">
4248
4601
  <xsl:param name="contents"/>
4249
- <xsl:if test="xalan:nodeset($contents)//item">
4602
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
4603
+ <xsl:if test="$contents_nodes//item">
4250
4604
  <fo:bookmark-tree>
4251
4605
  <xsl:choose>
4252
- <xsl:when test="xalan:nodeset($contents)/doc">
4606
+ <xsl:when test="$contents_nodes/doc">
4253
4607
  <xsl:choose>
4254
- <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
4255
- <xsl:for-each select="xalan:nodeset($contents)/doc">
4608
+ <xsl:when test="count($contents_nodes/doc) &gt; 1">
4609
+ <xsl:for-each select="$contents_nodes/doc">
4256
4610
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
4257
4611
  <xsl:if test="@bundle = 'true'">
4258
4612
  <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
@@ -4303,7 +4657,7 @@
4303
4657
  </xsl:for-each>
4304
4658
  </xsl:when>
4305
4659
  <xsl:otherwise>
4306
- <xsl:for-each select="xalan:nodeset($contents)/doc">
4660
+ <xsl:for-each select="$contents_nodes/doc">
4307
4661
 
4308
4662
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4309
4663
 
@@ -4321,25 +4675,36 @@
4321
4675
  </xsl:choose>
4322
4676
  </xsl:when>
4323
4677
  <xsl:otherwise>
4324
- <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
4678
+ <xsl:apply-templates select="$contents_nodes/contents/item" mode="bookmark"/>
4679
+
4680
+ <xsl:call-template name="insertFigureBookmarks">
4681
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
4682
+ </xsl:call-template>
4683
+
4684
+ <xsl:call-template name="insertTableBookmarks">
4685
+ <xsl:with-param name="contents" select="$contents_nodes/contents"/>
4686
+ <xsl:with-param name="lang" select="@lang"/>
4687
+ </xsl:call-template>
4688
+
4325
4689
  </xsl:otherwise>
4326
4690
  </xsl:choose>
4327
4691
 
4692
+
4328
4693
 
4329
4694
 
4330
4695
 
4331
4696
 
4332
-
4333
-
4697
+
4334
4698
 
4335
4699
  </fo:bookmark-tree>
4336
4700
  </xsl:if>
4337
4701
  </xsl:template><xsl:template name="insertFigureBookmarks">
4338
4702
  <xsl:param name="contents"/>
4339
- <xsl:if test="xalan:nodeset($contents)/figure">
4340
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
4703
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
4704
+ <xsl:if test="$contents_nodes/figure">
4705
+ <fo:bookmark internal-destination="{$contents_nodes/figure[1]/@id}" starting-state="hide">
4341
4706
  <fo:bookmark-title>Figures</fo:bookmark-title>
4342
- <xsl:for-each select="xalan:nodeset($contents)/figure">
4707
+ <xsl:for-each select="$contents_nodes/figure">
4343
4708
  <fo:bookmark internal-destination="{@id}">
4344
4709
  <fo:bookmark-title>
4345
4710
  <xsl:value-of select="normalize-space(title)"/>
@@ -4348,18 +4713,40 @@
4348
4713
  </xsl:for-each>
4349
4714
  </fo:bookmark>
4350
4715
  </xsl:if>
4351
- </xsl:template><xsl:template name="insertTableBookmarks">
4352
- <xsl:param name="contents"/>
4716
+
4717
+
4718
+ <xsl:if test="$contents_nodes//figures/figure">
4719
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
4720
+
4721
+
4722
+
4723
+ <xsl:variable name="bookmark-title">
4724
+
4725
+ <xsl:value-of select="$title-list-figures"/>
4726
+
4727
+ </xsl:variable>
4728
+ <fo:bookmark-title><xsl:value-of select="normalize-space($bookmark-title)"/></fo:bookmark-title>
4729
+ <xsl:for-each select="$contents_nodes//figures/figure">
4730
+ <fo:bookmark internal-destination="{@id}">
4731
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
4732
+ </fo:bookmark>
4733
+ </xsl:for-each>
4734
+ </fo:bookmark>
4735
+ </xsl:if>
4736
+
4737
+ </xsl:template><xsl:template name="insertTableBookmarks">
4738
+ <xsl:param name="contents"/>
4353
4739
  <xsl:param name="lang"/>
4354
- <xsl:if test="xalan:nodeset($contents)/table">
4355
- <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
4740
+ <xsl:variable name="contents_nodes" select="xalan:nodeset($contents)"/>
4741
+ <xsl:if test="$contents_nodes/table">
4742
+ <fo:bookmark internal-destination="{$contents_nodes/table[1]/@id}" starting-state="hide">
4356
4743
  <fo:bookmark-title>
4357
4744
  <xsl:choose>
4358
4745
  <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
4359
4746
  <xsl:otherwise>Tables</xsl:otherwise>
4360
4747
  </xsl:choose>
4361
4748
  </fo:bookmark-title>
4362
- <xsl:for-each select="xalan:nodeset($contents)/table">
4749
+ <xsl:for-each select="$contents_nodes/table">
4363
4750
  <fo:bookmark internal-destination="{@id}">
4364
4751
  <fo:bookmark-title>
4365
4752
  <xsl:value-of select="normalize-space(title)"/>
@@ -4368,6 +4755,29 @@
4368
4755
  </xsl:for-each>
4369
4756
  </fo:bookmark>
4370
4757
  </xsl:if>
4758
+
4759
+
4760
+ <xsl:if test="$contents_nodes//tables/table">
4761
+ <fo:bookmark internal-destination="empty_bookmark" starting-state="hide">
4762
+
4763
+
4764
+
4765
+ <xsl:variable name="bookmark-title">
4766
+
4767
+ <xsl:value-of select="$title-list-tables"/>
4768
+
4769
+ </xsl:variable>
4770
+
4771
+ <fo:bookmark-title><xsl:value-of select="$bookmark-title"/></fo:bookmark-title>
4772
+
4773
+ <xsl:for-each select="$contents_nodes//tables/table">
4774
+ <fo:bookmark internal-destination="{@id}">
4775
+ <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
4776
+ </fo:bookmark>
4777
+ </xsl:for-each>
4778
+ </fo:bookmark>
4779
+ </xsl:if>
4780
+
4371
4781
  </xsl:template><xsl:template name="getLangVersion">
4372
4782
  <xsl:param name="lang"/>
4373
4783
  <xsl:param name="doctype" select="''"/>
@@ -4566,12 +4976,140 @@
4566
4976
  </fo:block-container>
4567
4977
  </fo:block-container>
4568
4978
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
4569
- <xsl:variable name="text">
4979
+ <xsl:choose>
4980
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
4981
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
4982
+ <xsl:choose>
4983
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
4984
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
4985
+ </xsl:when>
4986
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
4987
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4988
+ </xsl:otherwise>
4989
+ </xsl:choose>
4990
+ </xsl:when>
4991
+ <xsl:otherwise>
4992
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4993
+ </xsl:otherwise>
4994
+ </xsl:choose>
4995
+
4996
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
4997
+ <xsl:variable name="text_step1">
4570
4998
  <xsl:call-template name="add-zero-spaces-equal"/>
4571
4999
  </xsl:variable>
4572
- <xsl:call-template name="add-zero-spaces-java">
4573
- <xsl:with-param name="text" select="$text"/>
4574
- </xsl:call-template>
5000
+ <xsl:variable name="text_step2">
5001
+ <xsl:call-template name="add-zero-spaces-java">
5002
+ <xsl:with-param name="text" select="$text_step1"/>
5003
+ </xsl:call-template>
5004
+ </xsl:variable>
5005
+ <xsl:value-of select="$text_step2"/>
5006
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
5007
+ <xsl:apply-templates mode="syntax_highlight"/>
5008
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
5009
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
5010
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
5011
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
5012
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
5013
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
5014
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
5015
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
5016
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
5017
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
5018
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
5019
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
5020
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
5021
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
5022
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
5023
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
5024
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
5025
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
5026
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
5027
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
5028
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
5029
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
5030
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
5031
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
5032
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
5033
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
5034
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
5035
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
5036
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
5037
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
5038
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
5039
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
5040
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
5041
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
5042
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
5043
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
5044
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
5045
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
5046
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
5047
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
5048
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
5049
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
5050
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
5051
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
5052
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
5053
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
5054
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
5055
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
5056
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
5057
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
5058
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
5059
+ <fo:inline>
5060
+ <xsl:variable name="classes_">
5061
+ <xsl:call-template name="split">
5062
+ <xsl:with-param name="pText" select="@class"/>
5063
+ <xsl:with-param name="sep" select="' '"/>
5064
+ </xsl:call-template>
5065
+ <!-- a few classes together (_and_ suffix) -->
5066
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
5067
+ <item>hljs-char_and_escape_</item>
5068
+ </xsl:if>
5069
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
5070
+ <item>hljs-title_and_class_</item>
5071
+ </xsl:if>
5072
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
5073
+ <item>hljs-title_and_class__and_inherited__</item>
5074
+ </xsl:if>
5075
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
5076
+ <item>hljs-title_and_function_</item>
5077
+ </xsl:if>
5078
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
5079
+ <item>hljs-variable_and_language_</item>
5080
+ </xsl:if>
5081
+ <!-- with parent classes (_ suffix) -->
5082
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
5083
+ <item>hljs-meta_hljs-keyword</item>
5084
+ </xsl:if>
5085
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
5086
+ <item>hljs-meta_hljs-string</item>
5087
+ </xsl:if>
5088
+ </xsl:variable>
5089
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
5090
+
5091
+ <xsl:for-each select="$classes/item">
5092
+ <xsl:variable name="class_name" select="."/>
5093
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
5094
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
5095
+ </xsl:for-each>
5096
+ </xsl:for-each>
5097
+
5098
+ <!-- <xsl:variable name="class_name">
5099
+ <xsl:choose>
5100
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
5101
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
5102
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
5103
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
5104
+ </xsl:choose>
5105
+ </xsl:variable>
5106
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
5107
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
5108
+ </xsl:for-each> -->
5109
+
5110
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
5111
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
5112
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4575
5113
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
4576
5114
  <xsl:if test="normalize-space() != ''">
4577
5115
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -4896,6 +5434,8 @@
4896
5434
  </xsl:otherwise>
4897
5435
  </xsl:choose> -->
4898
5436
  </fo:block>
5437
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5438
+ <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
4899
5439
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
4900
5440
  <xsl:if test="normalize-space() != ''">
4901
5441
  <xsl:value-of select="."/>
@@ -4942,11 +5482,14 @@
4942
5482
 
4943
5483
 
4944
5484
  <fo:block-container margin-left="0mm">
4945
-
4946
- <fo:block xsl:use-attribute-sets="quote-style">
5485
+ <fo:block-container xsl:use-attribute-sets="quote-style">
4947
5486
 
4948
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4949
- </fo:block>
5487
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5488
+ <fo:block role="BlockQuote">
5489
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5490
+ </fo:block>
5491
+ </fo:block-container>
5492
+ </fo:block-container>
4950
5493
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4951
5494
  <fo:block xsl:use-attribute-sets="quote-source-style">
4952
5495
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -4967,26 +5510,11 @@
4967
5510
  </xsl:template><xsl:template match="*[local-name() = 'author']">
4968
5511
  <xsl:text>— </xsl:text>
4969
5512
  <xsl:apply-templates/>
4970
- </xsl:template><xsl:variable name="bibitem_hidden_">
4971
- <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden='true']">
4972
- <xsl:copy-of select="."/>
4973
- </xsl:for-each>
4974
- <xsl:for-each select="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem']">
4975
- <xsl:copy-of select="."/>
4976
- </xsl:for-each>
4977
- </xsl:variable><xsl:variable name="bibitem_hidden" select="xalan:nodeset($bibitem_hidden_)"/><xsl:template match="*[local-name() = 'eref']">
4978
-
4979
- <xsl:variable name="bibitemid">
4980
- <xsl:choose>
4981
- <!-- <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"></xsl:when>
4982
- <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"></xsl:when> -->
4983
- <xsl:when test="$bibitem_hidden/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4984
- <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4985
- </xsl:choose>
4986
- </xsl:variable>
4987
-
5513
+ </xsl:template><xsl:template match="*[local-name() = 'eref']">
5514
+ <xsl:variable name="current_bibitemid" select="@bibitemid"/>
5515
+ <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/>
4988
5516
  <xsl:choose>
4989
- <xsl:when test="normalize-space($bibitemid) != ''"> <!-- if in the bibliography there is the item with @bibitemid (and not hidden), then create link -->
5517
+ <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) -->
4990
5518
  <fo:inline xsl:use-attribute-sets="eref-style">
4991
5519
  <xsl:if test="@type = 'footnote'">
4992
5520
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
@@ -5000,8 +5528,8 @@
5000
5528
  <xsl:variable name="text" select="normalize-space()"/>
5001
5529
 
5002
5530
 
5003
-
5004
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5531
+
5532
+ <fo:basic-link fox:alt-text="{@citeas}">
5005
5533
  <xsl:if test="normalize-space(@citeas) = ''">
5006
5534
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5007
5535
  </xsl:if>
@@ -5014,14 +5542,21 @@
5014
5542
 
5015
5543
  </xsl:if>
5016
5544
 
5017
-
5545
+ <xsl:choose>
5546
+ <xsl:when test="$external-destination != ''"> <!-- external hyperlink -->
5547
+ <xsl:attribute name="external-destination"><xsl:value-of select="$external-destination"/></xsl:attribute>
5548
+ </xsl:when>
5549
+ <xsl:otherwise>
5550
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@bibitemid"/></xsl:attribute>
5551
+ </xsl:otherwise>
5552
+ </xsl:choose>
5018
5553
 
5019
5554
  <xsl:apply-templates/>
5020
5555
  </fo:basic-link>
5021
-
5556
+
5022
5557
  </fo:inline>
5023
5558
  </xsl:when>
5024
- <xsl:otherwise>
5559
+ <xsl:otherwise> <!-- if there is key('bibitems_hidden', $current_bibitemid) -->
5025
5560
  <fo:inline><xsl:apply-templates/></fo:inline>
5026
5561
  </xsl:otherwise>
5027
5562
  </xsl:choose>
@@ -5089,6 +5624,31 @@
5089
5624
  <xsl:with-param name="count" select="$count - 1"/>
5090
5625
  </xsl:call-template>
5091
5626
  </xsl:if>
5627
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
5628
+ <xsl:variable name="level">
5629
+ <xsl:call-template name="getLevel"/>
5630
+ </xsl:variable>
5631
+ <xsl:variable name="font-size">
5632
+ inherit
5633
+ </xsl:variable>
5634
+ <xsl:variable name="levelTerm">
5635
+ <xsl:call-template name="getLevelTermName"/>
5636
+ </xsl:variable>
5637
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
5638
+
5639
+
5640
+
5641
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
5642
+ <fo:block xsl:use-attribute-sets="term-name-style">
5643
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
5644
+ </fo:block>
5645
+ </xsl:if>
5646
+
5647
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
5648
+ <xsl:call-template name="setStyle_preferred"/>
5649
+ <xsl:apply-templates/>
5650
+ </fo:block>
5651
+ </fo:block>
5092
5652
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
5093
5653
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
5094
5654
  <xsl:text> </xsl:text>
@@ -5172,24 +5732,8 @@
5172
5732
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5173
5733
  </xsl:template><xsl:variable name="ul_labels_">
5174
5734
 
5175
-
5176
-
5177
-
5178
-
5179
-
5180
-
5181
-
5182
-
5183
-
5184
- <label>—</label> <!-- em dash -->
5185
-
5186
-
5187
-
5188
-
5189
-
5190
-
5191
-
5192
-
5735
+ <label>—</label> <!-- em dash -->
5736
+
5193
5737
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
5194
5738
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5195
5739
  <xsl:variable name="list_level">
@@ -5215,6 +5759,91 @@
5215
5759
  </xsl:template><xsl:template match="label" mode="ul_labels">
5216
5760
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
5217
5761
  <xsl:value-of select="."/>
5762
+ </xsl:template><xsl:template name="getListItemFormat">
5763
+ <!-- Example: for BSI <?list-type loweralpha?> -->
5764
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
5765
+ <xsl:choose>
5766
+ <xsl:when test="local-name(..) = 'ul'">
5767
+ <xsl:choose>
5768
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
5769
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
5770
+ </xsl:choose>
5771
+ </xsl:when>
5772
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
5773
+
5774
+ <!-- Example: for BSI <?list-start 2?> -->
5775
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
5776
+
5777
+ <xsl:variable name="start_value">
5778
+ <xsl:choose>
5779
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
5780
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
5781
+ </xsl:when>
5782
+ <xsl:when test="normalize-space(../@start) != ''">
5783
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
5784
+ </xsl:when>
5785
+ <xsl:otherwise>0</xsl:otherwise>
5786
+ </xsl:choose>
5787
+ </xsl:variable>
5788
+
5789
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
5790
+
5791
+ <xsl:variable name="type">
5792
+ <xsl:choose>
5793
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
5794
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
5795
+
5796
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
5797
+
5798
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5799
+ <xsl:variable name="list_level">
5800
+ <xsl:choose>
5801
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
5802
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
5803
+ </xsl:choose>
5804
+ </xsl:variable>
5805
+
5806
+ <xsl:choose>
5807
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
5808
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
5809
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
5810
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
5811
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
5812
+ <xsl:otherwise> <!-- level 1 -->
5813
+ <xsl:choose>
5814
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
5815
+ <xsl:otherwise>alphabet</xsl:otherwise>
5816
+ </xsl:choose>
5817
+ </xsl:otherwise>
5818
+ </xsl:choose>
5819
+
5820
+ </xsl:otherwise>
5821
+ </xsl:choose>
5822
+ </xsl:variable>
5823
+
5824
+ <xsl:variable name="format">
5825
+ <xsl:choose>
5826
+ <xsl:when test="$type = 'arabic'">
5827
+ 1.
5828
+ </xsl:when>
5829
+ <xsl:when test="$type = 'alphabet'">
5830
+ a)
5831
+ </xsl:when>
5832
+ <xsl:when test="$type = 'alphabet_upper'">
5833
+ A.
5834
+ </xsl:when>
5835
+ <xsl:when test="$type = 'roman'">
5836
+ i)
5837
+ </xsl:when>
5838
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
5839
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
5840
+ </xsl:choose>
5841
+ </xsl:variable>
5842
+
5843
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
5844
+
5845
+ </xsl:otherwise>
5846
+ </xsl:choose>
5218
5847
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5219
5848
  <xsl:choose>
5220
5849
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -5230,18 +5859,75 @@
5230
5859
 
5231
5860
  <fo:block-container margin-left="0mm">
5232
5861
  <fo:block>
5233
- <xsl:apply-templates select="." mode="ul_ol"/>
5862
+ <xsl:apply-templates select="." mode="list"/>
5234
5863
  </fo:block>
5235
5864
  </fo:block-container>
5236
5865
  </fo:block-container>
5237
5866
  </xsl:when>
5238
5867
  <xsl:otherwise>
5239
5868
  <fo:block>
5240
- <xsl:apply-templates select="." mode="ul_ol"/>
5869
+ <xsl:apply-templates select="." mode="list"/>
5241
5870
  </fo:block>
5242
5871
  </xsl:otherwise>
5243
5872
  </xsl:choose>
5244
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5873
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
5874
+ <fo:list-block xsl:use-attribute-sets="list-style">
5875
+
5876
+
5877
+
5878
+
5879
+
5880
+
5881
+ <xsl:if test="local-name() = 'ol'">
5882
+ <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute>
5883
+ </xsl:if>
5884
+
5885
+
5886
+
5887
+
5888
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
5889
+ </fo:list-block>
5890
+ <!-- <xsl:for-each select="./iho:note">
5891
+ <xsl:call-template name="note"/>
5892
+ </xsl:for-each> -->
5893
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
5894
+ </xsl:template><xsl:template match="*[local-name()='li']">
5895
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
5896
+ <xsl:copy-of select="@id"/>
5897
+
5898
+
5899
+
5900
+ <fo:list-item-label end-indent="label-end()">
5901
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
5902
+
5903
+
5904
+
5905
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5906
+ <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
5907
+ <xsl:call-template name="append_add-style"/>
5908
+ </xsl:if>
5909
+
5910
+ <xsl:call-template name="getListItemFormat"/>
5911
+ </fo:block>
5912
+ </fo:list-item-label>
5913
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
5914
+ <fo:block>
5915
+
5916
+
5917
+
5918
+
5919
+
5920
+ <xsl:apply-templates/>
5921
+
5922
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
5923
+
5924
+ <xsl:for-each select="./bsi:note">
5925
+ <xsl:call-template name="note"/>
5926
+ </xsl:for-each> -->
5927
+ </fo:block>
5928
+ </fo:list-item-body>
5929
+ </fo:list-item>
5930
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
5245
5931
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5246
5932
  <bookmark><xsl:value-of select="@id"/></bookmark>
5247
5933
  </xsl:for-each>
@@ -5263,7 +5949,7 @@
5263
5949
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5264
5950
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5265
5951
  <xsl:if test="@to">
5266
- <xsl:value-of select="$dash"/>
5952
+ <xsl:value-of select="$en_dash"/>
5267
5953
  <xsl:copy>
5268
5954
  <xsl:copy-of select="@*"/>
5269
5955
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -5288,7 +5974,7 @@
5288
5974
  <xsl:param name="target"/>
5289
5975
  <!-- <node></node> -->
5290
5976
  <xsl:choose>
5291
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
5977
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
5292
5978
  <!-- skip text (i.e. remove it) and process next element -->
5293
5979
  <!-- [removed_<xsl:value-of select="."/>] -->
5294
5980
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -5372,12 +6058,22 @@
5372
6058
  </xsl:variable>
5373
6059
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
5374
6060
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6061
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
6062
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
6063
+ <!-- Index -->
6064
+ <xsl:apply-templates/>
6065
+ </fo:block>
6066
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
6067
+ <!-- Letter A, B, C, ... -->
6068
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
6069
+ <xsl:apply-templates/>
6070
+ </fo:block>
5375
6071
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
5376
6072
  <xsl:apply-templates/>
5377
6073
  <fo:block>
5378
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
5379
- <fo:block> </fo:block>
5380
- </xsl:if>
6074
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6075
+ <fo:block> </fo:block>
6076
+ </xsl:if>
5381
6077
  </fo:block>
5382
6078
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
5383
6079
  <xsl:apply-templates/>
@@ -5387,6 +6083,9 @@
5387
6083
 
5388
6084
  <xsl:apply-templates/>
5389
6085
  </fo:block>
6086
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
6087
+ <!-- to split by '_' and other chars -->
6088
+ <xsl:call-template name="add-zero-spaces-java"/>
5390
6089
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
5391
6090
  <fo:inline id="{@id}" font-size="1pt"/>
5392
6091
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -5577,23 +6276,45 @@
5577
6276
  <xsl:apply-templates/>
5578
6277
  </fo:inline>
5579
6278
  </xsl:template><xsl:template match="*[local-name() = 'bibitem']/*[local-name() = 'note']" priority="2">
6279
+
6280
+ <!-- list of footnotes to calculate actual footnotes number -->
6281
+ <xsl:variable name="p_fn_">
6282
+ <xsl:call-template name="get_fn_list"/>
6283
+ </xsl:variable>
6284
+ <xsl:variable name="p_fn" select="xalan:nodeset($p_fn_)"/>
6285
+ <xsl:variable name="gen_id" select="generate-id(.)"/>
6286
+ <xsl:variable name="lang" select="ancestor::*[contains(local-name(), '-standard')]/*[local-name()='bibdata']//*[local-name()='language'][@current = 'true']"/>
6287
+ <!-- fn sequence number in document -->
6288
+ <xsl:variable name="current_fn_number">
6289
+ <xsl:choose>
6290
+ <xsl:when test="@current_fn_number"><xsl:value-of select="@current_fn_number"/></xsl:when> <!-- for BSI -->
6291
+ <xsl:otherwise>
6292
+ <!-- <xsl:value-of select="count($p_fn//fn[@reference = $reference]/preceding-sibling::fn) + 1" /> -->
6293
+ <xsl:value-of select="count($p_fn//fn[@gen_id = $gen_id]/preceding-sibling::fn) + 1"/>
6294
+ </xsl:otherwise>
6295
+ </xsl:choose>
6296
+ </xsl:variable>
5580
6297
  <fo:footnote>
5581
6298
  <xsl:variable name="number">
5582
6299
 
5583
- <xsl:number level="any" count="*[local-name() = 'bibitem']/*[local-name() = 'note']"/>
6300
+ <xsl:value-of select="$current_fn_number"/>
5584
6301
 
5585
6302
  </xsl:variable>
6303
+
6304
+ <xsl:variable name="current_fn_number_text">
6305
+ <xsl:value-of select="$number"/>
6306
+
6307
+ </xsl:variable>
6308
+
5586
6309
  <fo:inline xsl:use-attribute-sets="bibitem-note-fn-style">
5587
- <fo:basic-link internal-destination="{generate-id()}" fox:alt-text="footnote {$number}">
5588
- <xsl:value-of select="$number"/>
5589
-
6310
+ <fo:basic-link internal-destination="{$gen_id}" fox:alt-text="footnote {$number}">
6311
+ <xsl:value-of select="$current_fn_number_text"/>
5590
6312
  </fo:basic-link>
5591
6313
  </fo:inline>
5592
6314
  <fo:footnote-body>
5593
6315
  <fo:block xsl:use-attribute-sets="bibitem-note-fn-body-style">
5594
- <fo:inline id="{generate-id()}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
5595
- <xsl:value-of select="$number"/>
5596
-
6316
+ <fo:inline id="{$gen_id}" xsl:use-attribute-sets="bibitem-note-fn-number-style">
6317
+ <xsl:value-of select="$current_fn_number_text"/>
5597
6318
  </fo:inline>
5598
6319
  <xsl:apply-templates/>
5599
6320
  </fo:block>
@@ -5719,7 +6440,7 @@
5719
6440
  </fo:table-body>
5720
6441
  </fo:table>
5721
6442
  </fo:block>
5722
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
6443
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
5723
6444
  <fo:table-row min-height="5mm">
5724
6445
  <xsl:apply-templates/>
5725
6446
  </fo:table-row>
@@ -5834,6 +6555,78 @@
5834
6555
  <!-- processing for admonition/p found in the template for 'p' -->
5835
6556
  <xsl:call-template name="paragraph"/>
5836
6557
 
6558
+ </xsl:template><xsl:template match="@*|node()" mode="update_xml_step1">
6559
+ <xsl:copy>
6560
+ <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
6561
+ </xsl:copy>
6562
+ </xsl:template><xsl:template match="*[local-name() = 'preface']" mode="update_xml_step1">
6563
+ <xsl:copy>
6564
+ <xsl:copy-of select="@*"/>
6565
+
6566
+ <xsl:variable name="nodes_preface_">
6567
+ <xsl:for-each select="*">
6568
+ <node id="{@id}"/>
6569
+ </xsl:for-each>
6570
+ </xsl:variable>
6571
+ <xsl:variable name="nodes_preface" select="xalan:nodeset($nodes_preface_)"/>
6572
+
6573
+ <xsl:for-each select="*">
6574
+ <xsl:sort select="@displayorder" data-type="number"/>
6575
+
6576
+ <!-- process Section's title -->
6577
+ <xsl:variable name="preceding-sibling_id" select="$nodes_preface/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
6578
+ <xsl:if test="$preceding-sibling_id != ''">
6579
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
6580
+ </xsl:if>
6581
+
6582
+ <xsl:choose>
6583
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
6584
+ <xsl:otherwise>
6585
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
6586
+ </xsl:otherwise>
6587
+ </xsl:choose>
6588
+
6589
+ </xsl:for-each>
6590
+ </xsl:copy>
6591
+ </xsl:template><xsl:template match="*[local-name() = 'sections']" mode="update_xml_step1">
6592
+ <xsl:copy>
6593
+ <xsl:copy-of select="@*"/>
6594
+
6595
+ <xsl:variable name="nodes_sections_">
6596
+ <xsl:for-each select="*">
6597
+ <node id="{@id}"/>
6598
+ </xsl:for-each>
6599
+ </xsl:variable>
6600
+ <xsl:variable name="nodes_sections" select="xalan:nodeset($nodes_sections_)"/>
6601
+
6602
+ <!-- move section 'Normative references' inside 'sections' -->
6603
+ <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']]">
6604
+ <xsl:sort select="@displayorder" data-type="number"/>
6605
+
6606
+ <!-- process Section's title -->
6607
+ <xsl:variable name="preceding-sibling_id" select="$nodes_sections/node[@id = current()/@id]/preceding-sibling::node[1]/@id"/>
6608
+ <xsl:if test="$preceding-sibling_id != ''">
6609
+ <xsl:apply-templates select="parent::*/*[@type = 'section-title' and @id = $preceding-sibling_id and not(@displayorder)]" mode="update_xml_step1"/>
6610
+ </xsl:if>
6611
+
6612
+ <xsl:choose>
6613
+ <xsl:when test="@type = 'section-title' and not(@displayorder)"><!-- skip, don't copy, because copied in above 'apply-templates' --></xsl:when>
6614
+ <xsl:otherwise>
6615
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
6616
+ </xsl:otherwise>
6617
+ </xsl:choose>
6618
+
6619
+ </xsl:for-each>
6620
+ </xsl:copy>
6621
+ </xsl:template><xsl:template match="*[local-name() = 'bibliography']" mode="update_xml_step1">
6622
+ <xsl:copy>
6623
+ <xsl:copy-of select="@*"/>
6624
+ <!-- copy all elements from bibliography except 'Normative references' (moved to 'sections') -->
6625
+ <xsl:for-each select="*[not(@normative='true') and not(*[*[@normative='true']])]">
6626
+ <xsl:sort select="@displayorder" data-type="number"/>
6627
+ <xsl:apply-templates select="." mode="update_xml_step1"/>
6628
+ </xsl:for-each>
6629
+ </xsl:copy>
5837
6630
  </xsl:template><xsl:template name="convertDate">
5838
6631
  <xsl:param name="date"/>
5839
6632
  <xsl:param name="format" select="'short'"/>
@@ -5947,9 +6740,6 @@
5947
6740
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5948
6741
  </xsl:choose>
5949
6742
  </xsl:template><xsl:template name="addPDFUAmeta">
5950
- <xsl:variable name="lang">
5951
- <xsl:call-template name="getLang"/>
5952
- </xsl:variable>
5953
6743
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5954
6744
  <pdf:dictionary type="normal" key="ViewerPreferences">
5955
6745
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -6177,10 +6967,12 @@
6177
6967
  <xsl:param name="key"/>
6178
6968
  <xsl:param name="formatted">false</xsl:param>
6179
6969
  <xsl:param name="lang"/>
6970
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
6180
6971
 
6181
6972
  <xsl:variable name="curr_lang">
6182
6973
  <xsl:choose>
6183
6974
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
6975
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
6184
6976
  <xsl:otherwise>
6185
6977
  <xsl:call-template name="getLang"/>
6186
6978
  </xsl:otherwise>
@@ -6215,6 +7007,7 @@
6215
7007
  </xsl:otherwise>
6216
7008
  </xsl:choose>
6217
7009
  </xsl:when>
7010
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
6218
7011
  <xsl:otherwise>
6219
7012
  <xsl:variable name="key_">
6220
7013
  <xsl:call-template name="capitalize">
@@ -6284,53 +7077,153 @@
6284
7077
  <xsl:param name="first"/>
6285
7078
  <xsl:if test="$number != ''">
6286
7079
  <xsl:variable name="words">
6287
- <words>
6288
- <word cardinal="1">One-</word>
6289
- <word ordinal="1">First </word>
6290
- <word cardinal="2">Two-</word>
6291
- <word ordinal="2">Second </word>
6292
- <word cardinal="3">Three-</word>
6293
- <word ordinal="3">Third </word>
6294
- <word cardinal="4">Four-</word>
6295
- <word ordinal="4">Fourth </word>
6296
- <word cardinal="5">Five-</word>
6297
- <word ordinal="5">Fifth </word>
6298
- <word cardinal="6">Six-</word>
6299
- <word ordinal="6">Sixth </word>
6300
- <word cardinal="7">Seven-</word>
6301
- <word ordinal="7">Seventh </word>
6302
- <word cardinal="8">Eight-</word>
6303
- <word ordinal="8">Eighth </word>
6304
- <word cardinal="9">Nine-</word>
6305
- <word ordinal="9">Ninth </word>
6306
- <word ordinal="10">Tenth </word>
6307
- <word ordinal="11">Eleventh </word>
6308
- <word ordinal="12">Twelfth </word>
6309
- <word ordinal="13">Thirteenth </word>
6310
- <word ordinal="14">Fourteenth </word>
6311
- <word ordinal="15">Fifteenth </word>
6312
- <word ordinal="16">Sixteenth </word>
6313
- <word ordinal="17">Seventeenth </word>
6314
- <word ordinal="18">Eighteenth </word>
6315
- <word ordinal="19">Nineteenth </word>
6316
- <word cardinal="20">Twenty-</word>
6317
- <word ordinal="20">Twentieth </word>
6318
- <word cardinal="30">Thirty-</word>
6319
- <word ordinal="30">Thirtieth </word>
6320
- <word cardinal="40">Forty-</word>
6321
- <word ordinal="40">Fortieth </word>
6322
- <word cardinal="50">Fifty-</word>
6323
- <word ordinal="50">Fiftieth </word>
6324
- <word cardinal="60">Sixty-</word>
6325
- <word ordinal="60">Sixtieth </word>
6326
- <word cardinal="70">Seventy-</word>
6327
- <word ordinal="70">Seventieth </word>
6328
- <word cardinal="80">Eighty-</word>
6329
- <word ordinal="80">Eightieth </word>
6330
- <word cardinal="90">Ninety-</word>
6331
- <word ordinal="90">Ninetieth </word>
6332
- <word cardinal="100">Hundred-</word>
6333
- <word ordinal="100">Hundredth </word>
7080
+ <words>
7081
+ <xsl:choose>
7082
+ <xsl:when test="$lang = 'fr'"> <!-- https://en.wiktionary.org/wiki/Appendix:French_numbers -->
7083
+ <word cardinal="1">Une-</word>
7084
+ <word ordinal="1">Première </word>
7085
+ <word cardinal="2">Deux-</word>
7086
+ <word ordinal="2">Seconde </word>
7087
+ <word cardinal="3">Trois-</word>
7088
+ <word ordinal="3">Tierce </word>
7089
+ <word cardinal="4">Quatre-</word>
7090
+ <word ordinal="4">Quatrième </word>
7091
+ <word cardinal="5">Cinq-</word>
7092
+ <word ordinal="5">Cinquième </word>
7093
+ <word cardinal="6">Six-</word>
7094
+ <word ordinal="6">Sixième </word>
7095
+ <word cardinal="7">Sept-</word>
7096
+ <word ordinal="7">Septième </word>
7097
+ <word cardinal="8">Huit-</word>
7098
+ <word ordinal="8">Huitième </word>
7099
+ <word cardinal="9">Neuf-</word>
7100
+ <word ordinal="9">Neuvième </word>
7101
+ <word ordinal="10">Dixième </word>
7102
+ <word ordinal="11">Onzième </word>
7103
+ <word ordinal="12">Douzième </word>
7104
+ <word ordinal="13">Treizième </word>
7105
+ <word ordinal="14">Quatorzième </word>
7106
+ <word ordinal="15">Quinzième </word>
7107
+ <word ordinal="16">Seizième </word>
7108
+ <word ordinal="17">Dix-septième </word>
7109
+ <word ordinal="18">Dix-huitième </word>
7110
+ <word ordinal="19">Dix-neuvième </word>
7111
+ <word cardinal="20">Vingt-</word>
7112
+ <word ordinal="20">Vingtième </word>
7113
+ <word cardinal="30">Trente-</word>
7114
+ <word ordinal="30">Trentième </word>
7115
+ <word cardinal="40">Quarante-</word>
7116
+ <word ordinal="40">Quarantième </word>
7117
+ <word cardinal="50">Cinquante-</word>
7118
+ <word ordinal="50">Cinquantième </word>
7119
+ <word cardinal="60">Soixante-</word>
7120
+ <word ordinal="60">Soixantième </word>
7121
+ <word cardinal="70">Septante-</word>
7122
+ <word ordinal="70">Septantième </word>
7123
+ <word cardinal="80">Huitante-</word>
7124
+ <word ordinal="80">Huitantième </word>
7125
+ <word cardinal="90">Nonante-</word>
7126
+ <word ordinal="90">Nonantième </word>
7127
+ <word cardinal="100">Cent-</word>
7128
+ <word ordinal="100">Centième </word>
7129
+ </xsl:when>
7130
+ <xsl:when test="$lang = 'ru'">
7131
+ <word cardinal="1">Одна-</word>
7132
+ <word ordinal="1">Первое </word>
7133
+ <word cardinal="2">Две-</word>
7134
+ <word ordinal="2">Второе </word>
7135
+ <word cardinal="3">Три-</word>
7136
+ <word ordinal="3">Третье </word>
7137
+ <word cardinal="4">Четыре-</word>
7138
+ <word ordinal="4">Четвертое </word>
7139
+ <word cardinal="5">Пять-</word>
7140
+ <word ordinal="5">Пятое </word>
7141
+ <word cardinal="6">Шесть-</word>
7142
+ <word ordinal="6">Шестое </word>
7143
+ <word cardinal="7">Семь-</word>
7144
+ <word ordinal="7">Седьмое </word>
7145
+ <word cardinal="8">Восемь-</word>
7146
+ <word ordinal="8">Восьмое </word>
7147
+ <word cardinal="9">Девять-</word>
7148
+ <word ordinal="9">Девятое </word>
7149
+ <word ordinal="10">Десятое </word>
7150
+ <word ordinal="11">Одиннадцатое </word>
7151
+ <word ordinal="12">Двенадцатое </word>
7152
+ <word ordinal="13">Тринадцатое </word>
7153
+ <word ordinal="14">Четырнадцатое </word>
7154
+ <word ordinal="15">Пятнадцатое </word>
7155
+ <word ordinal="16">Шестнадцатое </word>
7156
+ <word ordinal="17">Семнадцатое </word>
7157
+ <word ordinal="18">Восемнадцатое </word>
7158
+ <word ordinal="19">Девятнадцатое </word>
7159
+ <word cardinal="20">Двадцать-</word>
7160
+ <word ordinal="20">Двадцатое </word>
7161
+ <word cardinal="30">Тридцать-</word>
7162
+ <word ordinal="30">Тридцатое </word>
7163
+ <word cardinal="40">Сорок-</word>
7164
+ <word ordinal="40">Сороковое </word>
7165
+ <word cardinal="50">Пятьдесят-</word>
7166
+ <word ordinal="50">Пятидесятое </word>
7167
+ <word cardinal="60">Шестьдесят-</word>
7168
+ <word ordinal="60">Шестидесятое </word>
7169
+ <word cardinal="70">Семьдесят-</word>
7170
+ <word ordinal="70">Семидесятое </word>
7171
+ <word cardinal="80">Восемьдесят-</word>
7172
+ <word ordinal="80">Восьмидесятое </word>
7173
+ <word cardinal="90">Девяносто-</word>
7174
+ <word ordinal="90">Девяностое </word>
7175
+ <word cardinal="100">Сто-</word>
7176
+ <word ordinal="100">Сотое </word>
7177
+ </xsl:when>
7178
+ <xsl:otherwise> <!-- default english -->
7179
+ <word cardinal="1">One-</word>
7180
+ <word ordinal="1">First </word>
7181
+ <word cardinal="2">Two-</word>
7182
+ <word ordinal="2">Second </word>
7183
+ <word cardinal="3">Three-</word>
7184
+ <word ordinal="3">Third </word>
7185
+ <word cardinal="4">Four-</word>
7186
+ <word ordinal="4">Fourth </word>
7187
+ <word cardinal="5">Five-</word>
7188
+ <word ordinal="5">Fifth </word>
7189
+ <word cardinal="6">Six-</word>
7190
+ <word ordinal="6">Sixth </word>
7191
+ <word cardinal="7">Seven-</word>
7192
+ <word ordinal="7">Seventh </word>
7193
+ <word cardinal="8">Eight-</word>
7194
+ <word ordinal="8">Eighth </word>
7195
+ <word cardinal="9">Nine-</word>
7196
+ <word ordinal="9">Ninth </word>
7197
+ <word ordinal="10">Tenth </word>
7198
+ <word ordinal="11">Eleventh </word>
7199
+ <word ordinal="12">Twelfth </word>
7200
+ <word ordinal="13">Thirteenth </word>
7201
+ <word ordinal="14">Fourteenth </word>
7202
+ <word ordinal="15">Fifteenth </word>
7203
+ <word ordinal="16">Sixteenth </word>
7204
+ <word ordinal="17">Seventeenth </word>
7205
+ <word ordinal="18">Eighteenth </word>
7206
+ <word ordinal="19">Nineteenth </word>
7207
+ <word cardinal="20">Twenty-</word>
7208
+ <word ordinal="20">Twentieth </word>
7209
+ <word cardinal="30">Thirty-</word>
7210
+ <word ordinal="30">Thirtieth </word>
7211
+ <word cardinal="40">Forty-</word>
7212
+ <word ordinal="40">Fortieth </word>
7213
+ <word cardinal="50">Fifty-</word>
7214
+ <word ordinal="50">Fiftieth </word>
7215
+ <word cardinal="60">Sixty-</word>
7216
+ <word ordinal="60">Sixtieth </word>
7217
+ <word cardinal="70">Seventy-</word>
7218
+ <word ordinal="70">Seventieth </word>
7219
+ <word cardinal="80">Eighty-</word>
7220
+ <word ordinal="80">Eightieth </word>
7221
+ <word cardinal="90">Ninety-</word>
7222
+ <word ordinal="90">Ninetieth </word>
7223
+ <word cardinal="100">Hundred-</word>
7224
+ <word ordinal="100">Hundredth </word>
7225
+ </xsl:otherwise>
7226
+ </xsl:choose>
6334
7227
  </words>
6335
7228
  </xsl:variable>
6336
7229
 
@@ -6404,4 +7297,18 @@
6404
7297
  <xsl:otherwise>_</xsl:otherwise>
6405
7298
  </xsl:choose>
6406
7299
  </xsl:attribute>
7300
+ </xsl:template><xsl:template name="substring-after-last">
7301
+ <xsl:param name="value"/>
7302
+ <xsl:param name="delimiter"/>
7303
+ <xsl:choose>
7304
+ <xsl:when test="contains($value, $delimiter)">
7305
+ <xsl:call-template name="substring-after-last">
7306
+ <xsl:with-param name="value" select="substring-after($value, $delimiter)"/>
7307
+ <xsl:with-param name="delimiter" select="$delimiter"/>
7308
+ </xsl:call-template>
7309
+ </xsl:when>
7310
+ <xsl:otherwise>
7311
+ <xsl:value-of select="$value"/>
7312
+ </xsl:otherwise>
7313
+ </xsl:choose>
6407
7314
  </xsl:template></xsl:stylesheet>