metanorma-mpfa 0.8.2 → 0.8.3

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">
@@ -56,9 +46,6 @@
56
46
  </contents>
57
47
  </xsl:variable>
58
48
 
59
- <xsl:variable name="lang">
60
- <xsl:call-template name="getLang"/>
61
- </xsl:variable>
62
49
 
63
50
  <xsl:template match="/">
64
51
  <xsl:call-template name="namespaceCheck"/>
@@ -324,31 +311,7 @@
324
311
  <xsl:template match="mpfd:references" mode="contents">
325
312
  <xsl:apply-templates mode="contents"/>
326
313
  </xsl:template>
327
-
328
314
 
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
315
 
353
316
  <!-- ============================= -->
354
317
  <!-- ============================= -->
@@ -457,7 +420,7 @@
457
420
  </xsl:template>
458
421
 
459
422
 
460
- <xsl:template match="mpfd:ul | mpfd:ol" mode="ul_ol">
423
+ <xsl:template match="mpfd:ul | mpfd:ol" mode="list" priority="2">
461
424
  <fo:block-container margin-left="0mm">
462
425
  <xsl:variable name="margin-left">
463
426
  <xsl:variable name="countAncestorLists" select="count(ancestor::mpfd:ul) + count(ancestor::mpfd:ol)"/>
@@ -468,35 +431,13 @@
468
431
  </xsl:attribute>
469
432
 
470
433
  <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>
434
+ <xsl:call-template name="list"/>
480
435
  </fo:block-container>
481
436
  </fo:block-container>
482
437
  </xsl:template>
483
438
 
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
439
 
498
-
499
- <xsl:template match="mpfd:preferred">
440
+ <xsl:template match="mpfd:preferred" priority="2">
500
441
  <fo:inline font-weight="bold">
501
442
  <xsl:call-template name="setStyle_preferred"/>
502
443
  <xsl:apply-templates/>
@@ -515,12 +456,12 @@
515
456
  </xsl:template>
516
457
 
517
458
 
518
- <xsl:template match="mpfd:formula/mpfd:stem">
459
+ <xsl:template match="mpfd:formula/mpfd:stem" priority="2">
519
460
  <fo:block margin-top="14pt" margin-bottom="14pt" text-align-last="justify">
520
461
  <fo:inline padding-left="5mm"><xsl:apply-templates/></fo:inline>
521
462
  <fo:inline keep-together.within-line="always">
522
463
  <fo:leader leader-pattern="space"/>
523
- <xsl:apply-templates select="../mpfd:name" mode="formula_number"/>
464
+ <xsl:apply-templates select="../mpfd:name"/>
524
465
  </fo:inline>
525
466
  </fo:block>
526
467
  </xsl:template>
@@ -584,11 +525,21 @@
584
525
  </xsl:template>
585
526
 
586
527
 
587
- <xsl:variable name="pageWidth_">
528
+ <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:variable name="lang">
529
+ <xsl:call-template name="getLang"/>
530
+ </xsl:variable><xsl:variable name="pageWidth_">
588
531
  210
589
532
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
590
533
  297
591
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
534
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
535
+ 19
536
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
537
+ 19
538
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
539
+ 16.5
540
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
541
+ 10
542
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
592
543
 
593
544
  <title-edition lang="en">
594
545
 
@@ -650,7 +601,7 @@
650
601
  </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
651
602
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
652
603
  <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">
604
+ </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
605
  <xsl:param name="name"/>
655
606
  <xsl:param name="lang"/>
656
607
  <xsl:variable name="lang_">
@@ -673,7 +624,7 @@
673
624
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
674
625
  </xsl:otherwise>
675
626
  </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">
627
+ </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
628
 
678
629
 
679
630
 
@@ -830,7 +781,7 @@
830
781
  <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
831
782
 
832
783
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
833
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
784
+
834
785
 
835
786
 
836
787
 
@@ -846,6 +797,7 @@
846
797
 
847
798
 
848
799
 
800
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
849
801
  <xsl:attribute name="font-size">10pt</xsl:attribute>
850
802
  <xsl:attribute name="font-weight">bold</xsl:attribute>
851
803
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1187,7 +1139,8 @@
1187
1139
 
1188
1140
 
1189
1141
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1190
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
1142
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
1143
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
1191
1144
 
1192
1145
 
1193
1146
 
@@ -1196,14 +1149,12 @@
1196
1149
 
1197
1150
 
1198
1151
  <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
1152
  <xsl:attribute name="text-align">justify</xsl:attribute>
1202
1153
 
1203
1154
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1155
+ <xsl:attribute name="text-align">right</xsl:attribute>
1204
1156
 
1205
1157
 
1206
-
1207
1158
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
1208
1159
 
1209
1160
 
@@ -1222,6 +1173,9 @@
1222
1173
 
1223
1174
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1224
1175
 
1176
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
1177
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1178
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1225
1179
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
1226
1180
 
1227
1181
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -1253,6 +1207,33 @@
1253
1207
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1254
1208
 
1255
1209
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
1210
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
1211
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1212
+
1213
+
1214
+
1215
+
1216
+
1217
+
1218
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
1219
+ <xsl:attribute name="text-align">center</xsl:attribute>
1220
+
1221
+
1222
+
1223
+
1224
+
1225
+
1226
+
1227
+
1228
+
1229
+
1230
+
1231
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
1232
+ <xsl:attribute name="text-align">right</xsl:attribute>
1233
+
1234
+
1235
+
1236
+
1256
1237
 
1257
1238
  </xsl:attribute-set><xsl:attribute-set name="image-style">
1258
1239
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1286,6 +1267,18 @@
1286
1267
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1287
1268
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
1288
1269
 
1270
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
1278
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1279
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1280
+
1281
+
1289
1282
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
1290
1283
 
1291
1284
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -1319,6 +1312,36 @@
1319
1312
 
1320
1313
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1321
1314
 
1315
+
1316
+
1317
+
1318
+
1319
+
1320
+
1321
+
1322
+
1323
+
1324
+ <xsl:attribute name="provisional-distance-between-starts">6mm</xsl:attribute>
1325
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1326
+
1327
+
1328
+
1329
+
1330
+
1331
+
1332
+
1333
+
1334
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
1335
+
1336
+
1337
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
1338
+
1339
+
1340
+
1341
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
1342
+
1343
+
1344
+
1322
1345
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
1323
1346
  <xsl:attribute name="line-height">135%</xsl:attribute>
1324
1347
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -1592,6 +1615,111 @@
1592
1615
 
1593
1616
 
1594
1617
 
1618
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
1619
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1620
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
1621
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1622
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
1623
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1624
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
1625
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1626
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
1627
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1628
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
1629
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1630
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
1631
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
1632
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
1633
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1634
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
1635
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1636
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
1637
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1638
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
1639
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
1640
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
1641
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1642
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
1643
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1644
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
1645
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1646
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
1647
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1648
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
1649
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1650
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
1651
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1652
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
1653
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1654
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
1655
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1656
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
1657
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1658
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
1659
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1660
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
1661
+ <xsl:attribute name="color">#032f62</xsl:attribute>
1662
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
1663
+ <xsl:attribute name="color">#032f62</xsl:attribute>
1664
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
1665
+ <xsl:attribute name="color">#032f62</xsl:attribute>
1666
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
1667
+ <xsl:attribute name="color">#e36209</xsl:attribute>
1668
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
1669
+ <xsl:attribute name="color">#e36209</xsl:attribute>
1670
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
1671
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
1672
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
1673
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
1674
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
1675
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
1676
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
1677
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1678
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
1679
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1680
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
1681
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1682
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
1683
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1684
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
1685
+ <xsl:attribute name="color">#24292e</xsl:attribute>
1686
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
1687
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
1688
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1689
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
1690
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
1691
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
1692
+ <xsl:attribute name="color">#24292e</xsl:attribute>
1693
+ <xsl:attribute name="font-style">italic</xsl:attribute>
1694
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
1695
+ <xsl:attribute name="color">#24292e</xsl:attribute>
1696
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1697
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
1698
+ <xsl:attribute name="color">#22863a</xsl:attribute>
1699
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
1700
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
1701
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
1702
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
1703
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
1704
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
1705
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
1706
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
1707
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
1708
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
1709
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
1710
+ <xsl:attribute name="role">H1</xsl:attribute>
1711
+
1712
+
1713
+
1714
+
1715
+
1716
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
1717
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1718
+
1719
+
1720
+
1721
+
1722
+
1595
1723
  </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">
1596
1724
  <xsl:for-each select="/*/*[local-name()='preface']/*">
1597
1725
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -1678,9 +1806,12 @@
1678
1806
 
1679
1807
 
1680
1808
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
1809
+ <xsl:param name="margin"/>
1681
1810
 
1682
1811
  <!-- process in the template 'paragraph' -->
1683
- <xsl:call-template name="paragraph"/>
1812
+ <xsl:call-template name="paragraph">
1813
+ <xsl:with-param name="margin" select="$margin"/>
1814
+ </xsl:call-template>
1684
1815
 
1685
1816
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
1686
1817
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -1692,9 +1823,12 @@
1692
1823
  <xsl:call-template name="title"/>
1693
1824
 
1694
1825
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
1826
+ <xsl:param name="margin"/>
1695
1827
 
1696
1828
  <!-- process in the template 'paragraph' -->
1697
- <xsl:call-template name="paragraph"/>
1829
+ <xsl:call-template name="paragraph">
1830
+ <xsl:with-param name="margin" select="$margin"/>
1831
+ </xsl:call-template>
1698
1832
 
1699
1833
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1700
1834
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
@@ -2034,8 +2168,7 @@
2034
2168
  </xsl:call-template>
2035
2169
  </xsl:if>
2036
2170
  </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>
2171
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2039
2172
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2040
2173
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2041
2174
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -3005,20 +3138,44 @@
3005
3138
  <fo:inline text-decoration="underline">
3006
3139
  <xsl:apply-templates/>
3007
3140
  </fo:inline>
3008
- </xsl:template><xsl:template match="*[local-name()='add']">
3141
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
3009
3142
  <xsl:param name="skip">true</xsl:param>
3143
+ <xsl:param name="block">false</xsl:param>
3144
+ <xsl:param name="type"/>
3145
+ <xsl:param name="text-align"/>
3010
3146
  <xsl:choose>
3011
3147
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
3012
3148
  <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>
3149
+ <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
3150
  <xsl:otherwise>
3015
- <fo:inline>
3151
+ <xsl:variable name="tag">
3016
3152
  <xsl:call-template name="insertTag">
3017
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
3153
+ <xsl:with-param name="type">
3154
+ <xsl:choose>
3155
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
3156
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
3157
+ </xsl:choose>
3158
+ </xsl:with-param>
3018
3159
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
3019
3160
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
3020
3161
  </xsl:call-template>
3021
- </fo:inline>
3162
+ </xsl:variable>
3163
+ <xsl:choose>
3164
+ <xsl:when test="$block = 'false'">
3165
+ <fo:inline>
3166
+ <xsl:copy-of select="$tag"/>
3167
+ </fo:inline>
3168
+ </xsl:when>
3169
+ <xsl:otherwise>
3170
+ <fo:block> <!-- for around figures -->
3171
+ <xsl:if test="$text-align != ''">
3172
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
3173
+ </xsl:if>
3174
+ <xsl:copy-of select="$tag"/>
3175
+ </fo:block>
3176
+ </xsl:otherwise>
3177
+ </xsl:choose>
3178
+
3022
3179
  </xsl:otherwise>
3023
3180
  </xsl:choose>
3024
3181
  </xsl:when>
@@ -3377,17 +3534,21 @@
3377
3534
  </xsl:apply-templates>
3378
3535
  </xsl:template><xsl:template name="getLang">
3379
3536
  <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
3537
  <xsl:variable name="language">
3382
3538
  <xsl:choose>
3383
3539
  <xsl:when test="$language_current != ''">
3384
3540
  <xsl:value-of select="$language_current"/>
3385
3541
  </xsl:when>
3386
- <xsl:when test="$language_current_2 != ''">
3387
- <xsl:value-of select="$language_current_2"/>
3388
- </xsl:when>
3389
3542
  <xsl:otherwise>
3390
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3543
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3544
+ <xsl:choose>
3545
+ <xsl:when test="$language_current_2 != ''">
3546
+ <xsl:value-of select="$language_current_2"/>
3547
+ </xsl:when>
3548
+ <xsl:otherwise>
3549
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3550
+ </xsl:otherwise>
3551
+ </xsl:choose>
3391
3552
  </xsl:otherwise>
3392
3553
  </xsl:choose>
3393
3554
  </xsl:variable>
@@ -3604,8 +3765,8 @@
3604
3765
 
3605
3766
  </xsl:if>
3606
3767
  <fo:block-container margin-left="0mm">
3607
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
3608
- <xsl:apply-templates/>
3768
+ <fo:block id="{@id}">
3769
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
3609
3770
  </fo:block>
3610
3771
  </fo:block-container>
3611
3772
  </fo:block-container>
@@ -3617,10 +3778,43 @@
3617
3778
  <fo:inline>
3618
3779
  <xsl:apply-templates/>
3619
3780
  </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 -->
3781
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
3621
3782
  <xsl:if test="normalize-space() != ''">
3622
3783
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
3623
3784
  </xsl:if>
3785
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
3786
+ <fo:block xsl:use-attribute-sets="formula-style">
3787
+
3788
+
3789
+
3790
+ <fo:table table-layout="fixed" width="100%">
3791
+ <fo:table-column column-width="95%"/>
3792
+ <fo:table-column column-width="5%"/>
3793
+ <fo:table-body>
3794
+ <fo:table-row>
3795
+ <fo:table-cell display-align="center">
3796
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
3797
+
3798
+
3799
+
3800
+ <xsl:apply-templates/>
3801
+ </fo:block>
3802
+ </fo:table-cell>
3803
+ <fo:table-cell display-align="center">
3804
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
3805
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
3806
+ </fo:block>
3807
+ </fo:table-cell>
3808
+ </fo:table-row>
3809
+ </fo:table-body>
3810
+ </fo:table>
3811
+ </fo:block>
3812
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
3813
+ <fo:block xsl:use-attribute-sets="formula-style">
3814
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
3815
+ <xsl:apply-templates/>
3816
+ </fo:block>
3817
+ </fo:block>
3624
3818
  </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
3625
3819
 
3626
3820
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
@@ -4566,12 +4760,140 @@
4566
4760
  </fo:block-container>
4567
4761
  </fo:block-container>
4568
4762
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
4569
- <xsl:variable name="text">
4763
+ <xsl:choose>
4764
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
4765
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
4766
+ <xsl:choose>
4767
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
4768
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
4769
+ </xsl:when>
4770
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
4771
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4772
+ </xsl:otherwise>
4773
+ </xsl:choose>
4774
+ </xsl:when>
4775
+ <xsl:otherwise>
4776
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4777
+ </xsl:otherwise>
4778
+ </xsl:choose>
4779
+
4780
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
4781
+ <xsl:variable name="text_step1">
4570
4782
  <xsl:call-template name="add-zero-spaces-equal"/>
4571
4783
  </xsl:variable>
4572
- <xsl:call-template name="add-zero-spaces-java">
4573
- <xsl:with-param name="text" select="$text"/>
4574
- </xsl:call-template>
4784
+ <xsl:variable name="text_step2">
4785
+ <xsl:call-template name="add-zero-spaces-java">
4786
+ <xsl:with-param name="text" select="$text_step1"/>
4787
+ </xsl:call-template>
4788
+ </xsl:variable>
4789
+ <xsl:value-of select="$text_step2"/>
4790
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
4791
+ <xsl:apply-templates mode="syntax_highlight"/>
4792
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
4793
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
4794
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
4795
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
4796
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
4797
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
4798
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
4799
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
4800
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
4801
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
4802
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
4803
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
4804
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
4805
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
4806
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
4807
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
4808
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
4809
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
4810
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
4811
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
4812
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
4813
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
4814
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
4815
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
4816
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
4817
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
4818
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
4819
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
4820
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
4821
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
4822
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
4823
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
4824
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
4825
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
4826
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
4827
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
4828
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
4829
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
4830
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
4831
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
4832
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
4833
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
4834
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
4835
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
4836
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
4837
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
4838
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
4839
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
4840
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
4841
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
4842
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
4843
+ <fo:inline>
4844
+ <xsl:variable name="classes_">
4845
+ <xsl:call-template name="split">
4846
+ <xsl:with-param name="pText" select="@class"/>
4847
+ <xsl:with-param name="sep" select="' '"/>
4848
+ </xsl:call-template>
4849
+ <!-- a few classes together (_and_ suffix) -->
4850
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
4851
+ <item>hljs-char_and_escape_</item>
4852
+ </xsl:if>
4853
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
4854
+ <item>hljs-title_and_class_</item>
4855
+ </xsl:if>
4856
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
4857
+ <item>hljs-title_and_class__and_inherited__</item>
4858
+ </xsl:if>
4859
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
4860
+ <item>hljs-title_and_function_</item>
4861
+ </xsl:if>
4862
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
4863
+ <item>hljs-variable_and_language_</item>
4864
+ </xsl:if>
4865
+ <!-- with parent classes (_ suffix) -->
4866
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
4867
+ <item>hljs-meta_hljs-keyword</item>
4868
+ </xsl:if>
4869
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
4870
+ <item>hljs-meta_hljs-string</item>
4871
+ </xsl:if>
4872
+ </xsl:variable>
4873
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
4874
+
4875
+ <xsl:for-each select="$classes/item">
4876
+ <xsl:variable name="class_name" select="."/>
4877
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
4878
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
4879
+ </xsl:for-each>
4880
+ </xsl:for-each>
4881
+
4882
+ <!-- <xsl:variable name="class_name">
4883
+ <xsl:choose>
4884
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
4885
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
4886
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
4887
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
4888
+ </xsl:choose>
4889
+ </xsl:variable>
4890
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
4891
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
4892
+ </xsl:for-each> -->
4893
+
4894
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
4895
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
4896
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4575
4897
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
4576
4898
  <xsl:if test="normalize-space() != ''">
4577
4899
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -4942,11 +5264,14 @@
4942
5264
 
4943
5265
 
4944
5266
  <fo:block-container margin-left="0mm">
4945
-
4946
- <fo:block xsl:use-attribute-sets="quote-style">
5267
+ <fo:block-container xsl:use-attribute-sets="quote-style">
4947
5268
 
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>
5269
+ <fo:block-container margin-left="0mm" margin-right="0mm">
5270
+ <fo:block role="BlockQuote">
5271
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5272
+ </fo:block>
5273
+ </fo:block-container>
5274
+ </fo:block-container>
4950
5275
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4951
5276
  <fo:block xsl:use-attribute-sets="quote-source-style">
4952
5277
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -5089,6 +5414,31 @@
5089
5414
  <xsl:with-param name="count" select="$count - 1"/>
5090
5415
  </xsl:call-template>
5091
5416
  </xsl:if>
5417
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
5418
+ <xsl:variable name="level">
5419
+ <xsl:call-template name="getLevel"/>
5420
+ </xsl:variable>
5421
+ <xsl:variable name="font-size">
5422
+ inherit
5423
+ </xsl:variable>
5424
+ <xsl:variable name="levelTerm">
5425
+ <xsl:call-template name="getLevelTermName"/>
5426
+ </xsl:variable>
5427
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
5428
+
5429
+
5430
+
5431
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
5432
+ <fo:block xsl:use-attribute-sets="term-name-style">
5433
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
5434
+ </fo:block>
5435
+ </xsl:if>
5436
+
5437
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
5438
+ <xsl:call-template name="setStyle_preferred"/>
5439
+ <xsl:apply-templates/>
5440
+ </fo:block>
5441
+ </fo:block>
5092
5442
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
5093
5443
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
5094
5444
  <xsl:text> </xsl:text>
@@ -5172,24 +5522,8 @@
5172
5522
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5173
5523
  </xsl:template><xsl:variable name="ul_labels_">
5174
5524
 
5175
-
5176
-
5177
-
5178
-
5179
-
5180
-
5181
-
5182
-
5183
-
5184
- <label>—</label> <!-- em dash -->
5185
-
5186
-
5187
-
5188
-
5189
-
5190
-
5191
-
5192
-
5525
+ <label>—</label> <!-- em dash -->
5526
+
5193
5527
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
5194
5528
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5195
5529
  <xsl:variable name="list_level">
@@ -5215,6 +5549,91 @@
5215
5549
  </xsl:template><xsl:template match="label" mode="ul_labels">
5216
5550
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
5217
5551
  <xsl:value-of select="."/>
5552
+ </xsl:template><xsl:template name="getListItemFormat">
5553
+ <!-- Example: for BSI <?list-type loweralpha?> -->
5554
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
5555
+ <xsl:choose>
5556
+ <xsl:when test="local-name(..) = 'ul'">
5557
+ <xsl:choose>
5558
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
5559
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
5560
+ </xsl:choose>
5561
+ </xsl:when>
5562
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
5563
+
5564
+ <!-- Example: for BSI <?list-start 2?> -->
5565
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
5566
+
5567
+ <xsl:variable name="start_value">
5568
+ <xsl:choose>
5569
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
5570
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
5571
+ </xsl:when>
5572
+ <xsl:when test="normalize-space(../@start) != ''">
5573
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
5574
+ </xsl:when>
5575
+ <xsl:otherwise>0</xsl:otherwise>
5576
+ </xsl:choose>
5577
+ </xsl:variable>
5578
+
5579
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
5580
+
5581
+ <xsl:variable name="type">
5582
+ <xsl:choose>
5583
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
5584
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
5585
+
5586
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
5587
+
5588
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
5589
+ <xsl:variable name="list_level">
5590
+ <xsl:choose>
5591
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
5592
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
5593
+ </xsl:choose>
5594
+ </xsl:variable>
5595
+
5596
+ <xsl:choose>
5597
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
5598
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
5599
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
5600
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
5601
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
5602
+ <xsl:otherwise> <!-- level 1 -->
5603
+ <xsl:choose>
5604
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
5605
+ <xsl:otherwise>alphabet</xsl:otherwise>
5606
+ </xsl:choose>
5607
+ </xsl:otherwise>
5608
+ </xsl:choose>
5609
+
5610
+ </xsl:otherwise>
5611
+ </xsl:choose>
5612
+ </xsl:variable>
5613
+
5614
+ <xsl:variable name="format">
5615
+ <xsl:choose>
5616
+ <xsl:when test="$type = 'arabic'">
5617
+ 1.
5618
+ </xsl:when>
5619
+ <xsl:when test="$type = 'alphabet'">
5620
+ a)
5621
+ </xsl:when>
5622
+ <xsl:when test="$type = 'alphabet_upper'">
5623
+ A.
5624
+ </xsl:when>
5625
+ <xsl:when test="$type = 'roman'">
5626
+ i)
5627
+ </xsl:when>
5628
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
5629
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
5630
+ </xsl:choose>
5631
+ </xsl:variable>
5632
+
5633
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
5634
+
5635
+ </xsl:otherwise>
5636
+ </xsl:choose>
5218
5637
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5219
5638
  <xsl:choose>
5220
5639
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -5230,18 +5649,70 @@
5230
5649
 
5231
5650
  <fo:block-container margin-left="0mm">
5232
5651
  <fo:block>
5233
- <xsl:apply-templates select="." mode="ul_ol"/>
5652
+ <xsl:apply-templates select="." mode="list"/>
5234
5653
  </fo:block>
5235
5654
  </fo:block-container>
5236
5655
  </fo:block-container>
5237
5656
  </xsl:when>
5238
5657
  <xsl:otherwise>
5239
5658
  <fo:block>
5240
- <xsl:apply-templates select="." mode="ul_ol"/>
5659
+ <xsl:apply-templates select="." mode="list"/>
5241
5660
  </fo:block>
5242
5661
  </xsl:otherwise>
5243
5662
  </xsl:choose>
5244
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5663
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
5664
+ <fo:list-block xsl:use-attribute-sets="list-style">
5665
+
5666
+
5667
+
5668
+
5669
+
5670
+
5671
+ <xsl:if test="local-name() = 'ol'">
5672
+ <xsl:attribute name="provisional-distance-between-starts">7mm</xsl:attribute>
5673
+ </xsl:if>
5674
+
5675
+
5676
+
5677
+
5678
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
5679
+ </fo:list-block>
5680
+ <!-- <xsl:for-each select="./iho:note">
5681
+ <xsl:call-template name="note"/>
5682
+ </xsl:for-each> -->
5683
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
5684
+ </xsl:template><xsl:template match="*[local-name()='li']">
5685
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
5686
+ <xsl:copy-of select="@id"/>
5687
+
5688
+
5689
+
5690
+ <fo:list-item-label end-indent="label-end()">
5691
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
5692
+
5693
+
5694
+
5695
+ <xsl:call-template name="getListItemFormat"/>
5696
+ </fo:block>
5697
+ </fo:list-item-label>
5698
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
5699
+ <fo:block>
5700
+
5701
+
5702
+
5703
+
5704
+
5705
+ <xsl:apply-templates/>
5706
+
5707
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
5708
+
5709
+ <xsl:for-each select="./bsi:note">
5710
+ <xsl:call-template name="note"/>
5711
+ </xsl:for-each> -->
5712
+ </fo:block>
5713
+ </fo:list-item-body>
5714
+ </fo:list-item>
5715
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
5245
5716
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5246
5717
  <bookmark><xsl:value-of select="@id"/></bookmark>
5247
5718
  </xsl:for-each>
@@ -5263,7 +5734,7 @@
5263
5734
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5264
5735
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5265
5736
  <xsl:if test="@to">
5266
- <xsl:value-of select="$dash"/>
5737
+ <xsl:value-of select="$en_dash"/>
5267
5738
  <xsl:copy>
5268
5739
  <xsl:copy-of select="@*"/>
5269
5740
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -5288,7 +5759,7 @@
5288
5759
  <xsl:param name="target"/>
5289
5760
  <!-- <node></node> -->
5290
5761
  <xsl:choose>
5291
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
5762
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
5292
5763
  <!-- skip text (i.e. remove it) and process next element -->
5293
5764
  <!-- [removed_<xsl:value-of select="."/>] -->
5294
5765
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -5372,12 +5843,22 @@
5372
5843
  </xsl:variable>
5373
5844
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
5374
5845
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
5846
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
5847
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
5848
+ <!-- Index -->
5849
+ <xsl:apply-templates/>
5850
+ </fo:block>
5851
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
5852
+ <!-- Letter A, B, C, ... -->
5853
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
5854
+ <xsl:apply-templates/>
5855
+ </fo:block>
5375
5856
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
5376
5857
  <xsl:apply-templates/>
5377
5858
  <fo:block>
5378
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
5379
- <fo:block> </fo:block>
5380
- </xsl:if>
5859
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
5860
+ <fo:block> </fo:block>
5861
+ </xsl:if>
5381
5862
  </fo:block>
5382
5863
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
5383
5864
  <xsl:apply-templates/>
@@ -5387,6 +5868,9 @@
5387
5868
 
5388
5869
  <xsl:apply-templates/>
5389
5870
  </fo:block>
5871
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
5872
+ <!-- to split by '_' and other chars -->
5873
+ <xsl:call-template name="add-zero-spaces-java"/>
5390
5874
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
5391
5875
  <fo:inline id="{@id}" font-size="1pt"/>
5392
5876
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -5719,7 +6203,7 @@
5719
6203
  </fo:table-body>
5720
6204
  </fo:table>
5721
6205
  </fo:block>
5722
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
6206
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
5723
6207
  <fo:table-row min-height="5mm">
5724
6208
  <xsl:apply-templates/>
5725
6209
  </fo:table-row>
@@ -5947,9 +6431,6 @@
5947
6431
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5948
6432
  </xsl:choose>
5949
6433
  </xsl:template><xsl:template name="addPDFUAmeta">
5950
- <xsl:variable name="lang">
5951
- <xsl:call-template name="getLang"/>
5952
- </xsl:variable>
5953
6434
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5954
6435
  <pdf:dictionary type="normal" key="ViewerPreferences">
5955
6436
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -6177,10 +6658,12 @@
6177
6658
  <xsl:param name="key"/>
6178
6659
  <xsl:param name="formatted">false</xsl:param>
6179
6660
  <xsl:param name="lang"/>
6661
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
6180
6662
 
6181
6663
  <xsl:variable name="curr_lang">
6182
6664
  <xsl:choose>
6183
6665
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
6666
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
6184
6667
  <xsl:otherwise>
6185
6668
  <xsl:call-template name="getLang"/>
6186
6669
  </xsl:otherwise>
@@ -6215,6 +6698,7 @@
6215
6698
  </xsl:otherwise>
6216
6699
  </xsl:choose>
6217
6700
  </xsl:when>
6701
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
6218
6702
  <xsl:otherwise>
6219
6703
  <xsl:variable name="key_">
6220
6704
  <xsl:call-template name="capitalize">