metanorma-ogc 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,19 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:ogc="https://www.metanorma.org/ns/ogc" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
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
-
4
+
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
- <xsl:variable name="marginLeftRight1" select="35"/>
13
- <xsl:variable name="marginLeftRight2" select="17"/>
14
- <xsl:variable name="marginTop" select="16.5"/>
15
- <xsl:variable name="marginBottom" select="22.5"/>
16
-
17
7
 
18
8
 
19
9
  <xsl:variable name="debug">false</xsl:variable>
@@ -146,9 +136,6 @@
146
136
  </contents>
147
137
  </xsl:variable>
148
138
 
149
- <xsl:variable name="lang">
150
- <xsl:call-template name="getLang"/>
151
- </xsl:variable>
152
139
 
153
140
  <xsl:template match="/">
154
141
  <xsl:call-template name="namespaceCheck"/>
@@ -702,15 +689,14 @@
702
689
  </fo:root>
703
690
  </xsl:template>
704
691
 
705
- <xsl:variable name="thinspace" select="' '"/>
706
692
 
707
693
  <!-- Lato font doesn't contain 'thin space' glyph -->
708
694
  <xsl:template match="text()" priority="1">
709
- <xsl:value-of select="translate(., $thinspace, ' ')"/>
695
+ <xsl:value-of select="translate(., $thin_space, ' ')"/>
710
696
  </xsl:template>
711
697
 
712
698
  <xsl:template match="ogc:title//text() | ogc:name//text()" priority="3" mode="contents">
713
- <xsl:value-of select="translate(., $thinspace, ' ')"/>
699
+ <xsl:value-of select="translate(., $thin_space, ' ')"/>
714
700
  </xsl:template>
715
701
 
716
702
  <xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text()" priority="2">
@@ -719,7 +705,7 @@
719
705
  </xsl:variable>
720
706
  <!-- add zero-width space in the words like 'adeOfAbstractTransportaonSpace' to split it in the table's cell -->
721
707
  <xsl:variable name="content2" select="java:replaceAll(java:java.lang.String.new($content),'([a-z]{2,})([A-Z])(.?)','$1​$2$3')"/>
722
- <xsl:value-of select="translate($content2, $thinspace, ' ')"/>
708
+ <xsl:value-of select="translate($content2, $thin_space, ' ')"/>
723
709
  </xsl:template>
724
710
 
725
711
 
@@ -1028,9 +1014,11 @@
1028
1014
  </xsl:choose>
1029
1015
  </xsl:variable>
1030
1016
  <xsl:element name="{$element-name}">
1031
- <xsl:attribute name="id">
1032
- <xsl:value-of select="@id"/>
1033
- </xsl:attribute>
1017
+ <xsl:if test="@id">
1018
+ <xsl:attribute name="id">
1019
+ <xsl:value-of select="@id"/>
1020
+ </xsl:attribute>
1021
+ </xsl:if>
1034
1022
  <xsl:attribute name="text-align">
1035
1023
  <xsl:choose>
1036
1024
  <!-- <xsl:when test="ancestor::ogc:preface">justify</xsl:when> -->
@@ -1070,7 +1058,7 @@
1070
1058
 
1071
1059
 
1072
1060
 
1073
- <xsl:template match="ogc:ul | ogc:ol" mode="ul_ol">
1061
+ <xsl:template match="ogc:ul | ogc:ol" mode="list" priority="2">
1074
1062
  <fo:block-container margin-left="13mm">
1075
1063
  <xsl:if test="ancestor::ogc:table">
1076
1064
  <xsl:attribute name="margin-left">4mm</xsl:attribute>
@@ -1082,7 +1070,7 @@
1082
1070
  </xsl:if>
1083
1071
  </xsl:if>
1084
1072
  <fo:block-container margin-left="0mm">
1085
- <fo:list-block provisional-distance-between-starts="12mm" space-after="12pt" line-height="115%">
1073
+ <fo:list-block xsl:use-attribute-sets="list-style">
1086
1074
  <xsl:if test="ancestor::ogc:table">
1087
1075
  <xsl:attribute name="provisional-distance-between-starts">5mm</xsl:attribute>
1088
1076
  </xsl:if>
@@ -1101,58 +1089,6 @@
1101
1089
  </fo:block-container>
1102
1090
  </xsl:template>
1103
1091
 
1104
- <xsl:template match="ogc:li">
1105
- <fo:list-item id="{@id}">
1106
- <fo:list-item-label end-indent="label-end()">
1107
- <fo:block>
1108
- <xsl:choose>
1109
- <xsl:when test="local-name(..) = 'ul'">
1110
- <xsl:call-template name="setULLabel"/>
1111
- </xsl:when>
1112
- <xsl:otherwise> <!-- for ordered lists -->
1113
- <xsl:choose>
1114
- <xsl:when test="../@class = 'steps'">
1115
- <xsl:number format="1."/>
1116
- </xsl:when>
1117
- <xsl:when test="../@type = 'arabic'">
1118
- <xsl:number format="a)" lang="en"/>
1119
- </xsl:when>
1120
- <xsl:when test="../@type = 'alphabet'">
1121
- <xsl:number format="1."/>
1122
- </xsl:when>
1123
- <xsl:when test="../@type = 'alphabet_upper'">
1124
- <xsl:number format="A)" lang="en"/>
1125
- </xsl:when>
1126
- <xsl:when test="../@type = 'roman'">
1127
- <xsl:number format="i)"/>
1128
- </xsl:when>
1129
- <xsl:otherwise>
1130
- <xsl:variable name="level" select="count(ancestor-or-self::ogc:li)"/>
1131
- <xsl:choose>
1132
- <xsl:when test="$level = 1"><xsl:number format="a)" lang="en"/></xsl:when>
1133
- <xsl:when test="$level = 2"><xsl:number format="1."/></xsl:when>
1134
- <xsl:when test="$level = 3"><xsl:number format="i)"/></xsl:when>
1135
- <xsl:otherwise><xsl:number format="a)" lang="en"/></xsl:otherwise>
1136
- </xsl:choose>
1137
- </xsl:otherwise>
1138
- </xsl:choose>
1139
- </xsl:otherwise>
1140
- </xsl:choose>
1141
- </fo:block>
1142
- </fo:list-item-label>
1143
- <fo:list-item-body start-indent="body-start()" line-height-shift-adjustment="disregard-shifts">
1144
- <fo:block margin-bottom="10pt">
1145
- <xsl:if test="ancestor::ogc:table[not(@class)]">
1146
- <xsl:attribute name="margin-bottom">1mm</xsl:attribute>
1147
- </xsl:if>
1148
- <xsl:if test="not(following-sibling::*) and not(../following-sibling::*)">
1149
- <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1150
- </xsl:if>
1151
- <xsl:apply-templates/>
1152
- </fo:block>
1153
- </fo:list-item-body>
1154
- </fo:list-item>
1155
- </xsl:template>
1156
1092
 
1157
1093
  <xsl:template match="ogc:ul/ogc:note | ogc:ol/ogc:note" priority="2">
1158
1094
  <fo:list-item font-size="10pt">
@@ -1225,30 +1161,6 @@
1225
1161
  </xsl:template>
1226
1162
 
1227
1163
 
1228
-
1229
- <xsl:template match="ogc:formula/ogc:stem">
1230
- <fo:block margin-top="6pt" margin-bottom="12pt">
1231
- <fo:table table-layout="fixed" width="100%">
1232
- <fo:table-column column-width="95%"/>
1233
- <fo:table-column column-width="5%"/>
1234
- <fo:table-body>
1235
- <fo:table-row>
1236
- <fo:table-cell display-align="center">
1237
- <fo:block text-align="left"> <!-- margin-left="5mm" -->
1238
- <xsl:apply-templates/>
1239
- </fo:block>
1240
- </fo:table-cell>
1241
- <fo:table-cell display-align="center">
1242
- <fo:block text-align="right">
1243
- <xsl:apply-templates select="../ogc:name" mode="formula_number"/>
1244
- </fo:block>
1245
- </fo:table-cell>
1246
- </fo:table-row>
1247
- </fo:table-body>
1248
- </fo:table>
1249
- </fo:block>
1250
- </xsl:template>
1251
-
1252
1164
  <xsl:template match="*[local-name()='th']//text()" priority="2">
1253
1165
  <xsl:variable name="text">
1254
1166
  <xsl:call-template name="add-zero-spaces-java"/>
@@ -1574,11 +1486,21 @@
1574
1486
  </fo:static-content>
1575
1487
  </xsl:template>
1576
1488
 
1577
- <xsl:variable name="pageWidth_">
1489
+ <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">
1490
+ <xsl:call-template name="getLang"/>
1491
+ </xsl:variable><xsl:variable name="pageWidth_">
1578
1492
  215.9
1579
1493
  </xsl:variable><xsl:variable name="pageWidth" select="normalize-space($pageWidth_)"/><xsl:variable name="pageHeight_">
1580
1494
  279.4
1581
- </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="titles_">
1495
+ </xsl:variable><xsl:variable name="pageHeight" select="normalize-space($pageHeight_)"/><xsl:variable name="marginLeftRight1_">
1496
+ 35
1497
+ </xsl:variable><xsl:variable name="marginLeftRight1" select="normalize-space($marginLeftRight1_)"/><xsl:variable name="marginLeftRight2_">
1498
+ 17
1499
+ </xsl:variable><xsl:variable name="marginLeftRight2" select="normalize-space($marginLeftRight2_)"/><xsl:variable name="marginTop_">
1500
+ 16.5
1501
+ </xsl:variable><xsl:variable name="marginTop" select="normalize-space($marginTop_)"/><xsl:variable name="marginBottom_">
1502
+ 22.5
1503
+ </xsl:variable><xsl:variable name="marginBottom" select="normalize-space($marginBottom_)"/><xsl:variable name="titles_">
1582
1504
 
1583
1505
  <title-edition lang="en">
1584
1506
 
@@ -1640,7 +1562,7 @@
1640
1562
  </xsl:variable><xsl:variable name="titles" select="xalan:nodeset($titles_)"/><xsl:variable name="bibdata">
1641
1563
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
1642
1564
  <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
1643
- </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
1565
+ </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">
1644
1566
  <xsl:param name="name"/>
1645
1567
  <xsl:param name="lang"/>
1646
1568
  <xsl:variable name="lang_">
@@ -1663,7 +1585,7 @@
1663
1585
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1664
1586
  </xsl:otherwise>
1665
1587
  </xsl:choose>
1666
- </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">
1588
+ </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">
1667
1589
 
1668
1590
 
1669
1591
 
@@ -1890,7 +1812,7 @@
1890
1812
 
1891
1813
 
1892
1814
  </xsl:attribute-set><xsl:attribute-set name="example-name-style">
1893
- <xsl:attribute name="keep-with-next">always</xsl:attribute>
1815
+
1894
1816
 
1895
1817
 
1896
1818
 
@@ -2284,11 +2206,11 @@
2284
2206
 
2285
2207
 
2286
2208
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2287
- <xsl:attribute name="role">BlockQuote</xsl:attribute>
2209
+ <xsl:attribute name="margin-left">12mm</xsl:attribute>
2210
+ <xsl:attribute name="margin-right">12mm</xsl:attribute>
2288
2211
 
2289
2212
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2290
2213
  <xsl:attribute name="margin-left">13mm</xsl:attribute>
2291
- <xsl:attribute name="margin-right">12mm</xsl:attribute>
2292
2214
 
2293
2215
 
2294
2216
 
@@ -2297,12 +2219,11 @@
2297
2219
 
2298
2220
 
2299
2221
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2222
+ <xsl:attribute name="text-align">right</xsl:attribute>
2300
2223
 
2301
- <xsl:attribute name="text-align">right</xsl:attribute>
2302
2224
  <xsl:attribute name="margin-right">25mm</xsl:attribute>
2303
2225
 
2304
2226
 
2305
-
2306
2227
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
2307
2228
 
2308
2229
 
@@ -2327,6 +2248,9 @@
2327
2248
 
2328
2249
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2329
2250
 
2251
+ </xsl:attribute-set><xsl:attribute-set name="term-name-style">
2252
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2253
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2330
2254
  </xsl:attribute-set><xsl:attribute-set name="figure-style">
2331
2255
 
2332
2256
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
@@ -2360,6 +2284,35 @@
2360
2284
 
2361
2285
 
2362
2286
  </xsl:attribute-set><xsl:attribute-set name="formula-style">
2287
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2288
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2289
+
2290
+
2291
+
2292
+
2293
+
2294
+
2295
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-block-style">
2296
+ <xsl:attribute name="text-align">center</xsl:attribute>
2297
+
2298
+
2299
+
2300
+
2301
+
2302
+
2303
+
2304
+
2305
+
2306
+ <xsl:attribute name="text-align">left</xsl:attribute>
2307
+
2308
+
2309
+
2310
+ </xsl:attribute-set><xsl:attribute-set name="formula-stem-number-style">
2311
+ <xsl:attribute name="text-align">right</xsl:attribute>
2312
+
2313
+
2314
+
2315
+
2363
2316
 
2364
2317
  </xsl:attribute-set><xsl:attribute-set name="image-style">
2365
2318
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -2398,6 +2351,18 @@
2398
2351
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2399
2352
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2400
2353
 
2354
+ </xsl:attribute-set><xsl:attribute-set name="preferred-block-style">
2355
+
2356
+
2357
+
2358
+
2359
+
2360
+
2361
+ </xsl:attribute-set><xsl:attribute-set name="preferred-term-style">
2362
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2363
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2364
+
2365
+
2401
2366
  </xsl:attribute-set><xsl:attribute-set name="domain-style">
2402
2367
 
2403
2368
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
@@ -2435,6 +2400,39 @@
2435
2400
 
2436
2401
  </xsl:attribute-set><xsl:attribute-set name="list-style">
2437
2402
 
2403
+
2404
+
2405
+
2406
+
2407
+
2408
+
2409
+
2410
+
2411
+
2412
+
2413
+
2414
+
2415
+ <xsl:attribute name="provisional-distance-between-starts">12mm</xsl:attribute>
2416
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
2417
+ <xsl:attribute name="line-height">115%</xsl:attribute>
2418
+
2419
+
2420
+
2421
+
2422
+
2423
+ </xsl:attribute-set><xsl:attribute-set name="list-item-style">
2424
+
2425
+
2426
+ </xsl:attribute-set><xsl:attribute-set name="list-item-label-style">
2427
+
2428
+
2429
+
2430
+ </xsl:attribute-set><xsl:attribute-set name="list-item-body-style">
2431
+
2432
+
2433
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
2434
+
2435
+
2438
2436
  </xsl:attribute-set><xsl:attribute-set name="toc-style">
2439
2437
  <xsl:attribute name="line-height">135%</xsl:attribute>
2440
2438
  </xsl:attribute-set><xsl:attribute-set name="fn-reference-style">
@@ -2729,6 +2727,111 @@
2729
2727
 
2730
2728
  <xsl:attribute name="line-height">120%</xsl:attribute>
2731
2729
 
2730
+ </xsl:attribute-set><xsl:attribute-set name="hljs-doctag">
2731
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2732
+ </xsl:attribute-set><xsl:attribute-set name="hljs-keyword">
2733
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2734
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-keyword">
2735
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2736
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-tag">
2737
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2738
+ </xsl:attribute-set><xsl:attribute-set name="hljs-template-variable">
2739
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2740
+ </xsl:attribute-set><xsl:attribute-set name="hljs-type">
2741
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2742
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable_and_language_">
2743
+ <xsl:attribute name="color">#d73a49</xsl:attribute>
2744
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title">
2745
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2746
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class_">
2747
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2748
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_class__and_inherited__">
2749
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2750
+ </xsl:attribute-set><xsl:attribute-set name="hljs-title_and_function_">
2751
+ <xsl:attribute name="color">#6f42c1</xsl:attribute>
2752
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attr">
2753
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2754
+ </xsl:attribute-set><xsl:attribute-set name="hljs-attribute">
2755
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2756
+ </xsl:attribute-set><xsl:attribute-set name="hljs-literal">
2757
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2758
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta">
2759
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2760
+ </xsl:attribute-set><xsl:attribute-set name="hljs-number">
2761
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2762
+ </xsl:attribute-set><xsl:attribute-set name="hljs-operator">
2763
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2764
+ </xsl:attribute-set><xsl:attribute-set name="hljs-variable">
2765
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2766
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-attr">
2767
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2768
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-class">
2769
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2770
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-id">
2771
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2772
+ </xsl:attribute-set><xsl:attribute-set name="hljs-regexp">
2773
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2774
+ </xsl:attribute-set><xsl:attribute-set name="hljs-string">
2775
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2776
+ </xsl:attribute-set><xsl:attribute-set name="hljs-meta_hljs-string">
2777
+ <xsl:attribute name="color">#032f62</xsl:attribute>
2778
+ </xsl:attribute-set><xsl:attribute-set name="hljs-built_in">
2779
+ <xsl:attribute name="color">#e36209</xsl:attribute>
2780
+ </xsl:attribute-set><xsl:attribute-set name="hljs-symbol">
2781
+ <xsl:attribute name="color">#e36209</xsl:attribute>
2782
+ </xsl:attribute-set><xsl:attribute-set name="hljs-comment">
2783
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2784
+ </xsl:attribute-set><xsl:attribute-set name="hljs-code">
2785
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2786
+ </xsl:attribute-set><xsl:attribute-set name="hljs-formula">
2787
+ <xsl:attribute name="color">#6a737d</xsl:attribute>
2788
+ </xsl:attribute-set><xsl:attribute-set name="hljs-name">
2789
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2790
+ </xsl:attribute-set><xsl:attribute-set name="hljs-quote">
2791
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2792
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-tag">
2793
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2794
+ </xsl:attribute-set><xsl:attribute-set name="hljs-selector-pseudo">
2795
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2796
+ </xsl:attribute-set><xsl:attribute-set name="hljs-subst">
2797
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2798
+ </xsl:attribute-set><xsl:attribute-set name="hljs-section">
2799
+ <xsl:attribute name="color">#005cc5</xsl:attribute>
2800
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2801
+ </xsl:attribute-set><xsl:attribute-set name="hljs-bullet">
2802
+ <xsl:attribute name="color">#735c0f</xsl:attribute>
2803
+ </xsl:attribute-set><xsl:attribute-set name="hljs-emphasis">
2804
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2805
+ <xsl:attribute name="font-style">italic</xsl:attribute>
2806
+ </xsl:attribute-set><xsl:attribute-set name="hljs-strong">
2807
+ <xsl:attribute name="color">#24292e</xsl:attribute>
2808
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
2809
+ </xsl:attribute-set><xsl:attribute-set name="hljs-addition">
2810
+ <xsl:attribute name="color">#22863a</xsl:attribute>
2811
+ <xsl:attribute name="background-color">#f0fff4</xsl:attribute>
2812
+ </xsl:attribute-set><xsl:attribute-set name="hljs-deletion">
2813
+ <xsl:attribute name="color">#b31d28</xsl:attribute>
2814
+ <xsl:attribute name="background-color">#ffeef0</xsl:attribute>
2815
+ </xsl:attribute-set><xsl:attribute-set name="hljs-char_and_escape_">
2816
+ </xsl:attribute-set><xsl:attribute-set name="hljs-link">
2817
+ </xsl:attribute-set><xsl:attribute-set name="hljs-params">
2818
+ </xsl:attribute-set><xsl:attribute-set name="hljs-property">
2819
+ </xsl:attribute-set><xsl:attribute-set name="hljs-punctuation">
2820
+ </xsl:attribute-set><xsl:attribute-set name="hljs-tag">
2821
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-title-style">
2822
+ <xsl:attribute name="role">H1</xsl:attribute>
2823
+
2824
+
2825
+
2826
+
2827
+
2828
+ </xsl:attribute-set><xsl:attribute-set name="indexsect-clause-title-style">
2829
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2830
+
2831
+
2832
+
2833
+
2834
+
2732
2835
  </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">
2733
2836
  <xsl:for-each select="/*/*[local-name()='preface']/*">
2734
2837
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -2836,9 +2939,12 @@
2836
2939
 
2837
2940
 
2838
2941
  </xsl:template><xsl:template match="*[local-name()='legal-statement']//*[local-name()='p']">
2942
+ <xsl:param name="margin"/>
2839
2943
 
2840
2944
  <!-- process in the template 'paragraph' -->
2841
- <xsl:call-template name="paragraph"/>
2945
+ <xsl:call-template name="paragraph">
2946
+ <xsl:with-param name="margin" select="$margin"/>
2947
+ </xsl:call-template>
2842
2948
 
2843
2949
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']">
2844
2950
  <fo:block xsl:use-attribute-sets="feedback-statement-style">
@@ -2850,6 +2956,7 @@
2850
2956
  <xsl:call-template name="title"/>
2851
2957
 
2852
2958
  </xsl:template><xsl:template match="*[local-name()='feedback-statement']//*[local-name()='p']">
2959
+ <xsl:param name="margin"/>
2853
2960
 
2854
2961
  <fo:block xsl:use-attribute-sets="feedback-statement-p-style">
2855
2962
  <xsl:apply-templates/>
@@ -3201,8 +3308,7 @@
3201
3308
  </xsl:call-template>
3202
3309
  </xsl:if>
3203
3310
  </xsl:template><xsl:template match="text()" mode="td_text">
3204
- <xsl:variable name="zero-space">​</xsl:variable>
3205
- <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
3311
+ <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3206
3312
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
3207
3313
  <xsl:value-of select="*[local-name()='origin']/@citeas"/>
3208
3314
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
@@ -4188,20 +4294,44 @@
4188
4294
  <fo:inline text-decoration="underline">
4189
4295
  <xsl:apply-templates/>
4190
4296
  </fo:inline>
4191
- </xsl:template><xsl:template match="*[local-name()='add']">
4297
+ </xsl:template><xsl:template match="*[local-name()='add']" name="tag_add">
4192
4298
  <xsl:param name="skip">true</xsl:param>
4299
+ <xsl:param name="block">false</xsl:param>
4300
+ <xsl:param name="type"/>
4301
+ <xsl:param name="text-align"/>
4193
4302
  <xsl:choose>
4194
4303
  <xsl:when test="starts-with(., $ace_tag)"> <!-- examples: ace-tag_A1_start, ace-tag_A2_end, C1_start, AC_start -->
4195
4304
  <xsl:choose>
4196
- <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>
4305
+ <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>
4197
4306
  <xsl:otherwise>
4198
- <fo:inline>
4307
+ <xsl:variable name="tag">
4199
4308
  <xsl:call-template name="insertTag">
4200
- <xsl:with-param name="type" select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end -->
4309
+ <xsl:with-param name="type">
4310
+ <xsl:choose>
4311
+ <xsl:when test="$type = ''"><xsl:value-of select="substring-after(substring-after(., $ace_tag), '_')"/> <!-- start or end --></xsl:when>
4312
+ <xsl:otherwise><xsl:value-of select="$type"/></xsl:otherwise>
4313
+ </xsl:choose>
4314
+ </xsl:with-param>
4201
4315
  <xsl:with-param name="kind" select="substring(substring-before(substring-after(., $ace_tag), '_'), 1, 1)"/> <!-- A or C -->
4202
4316
  <xsl:with-param name="value" select="substring(substring-before(substring-after(., $ace_tag), '_'), 2)"/> <!-- 1, 2, C -->
4203
4317
  </xsl:call-template>
4204
- </fo:inline>
4318
+ </xsl:variable>
4319
+ <xsl:choose>
4320
+ <xsl:when test="$block = 'false'">
4321
+ <fo:inline>
4322
+ <xsl:copy-of select="$tag"/>
4323
+ </fo:inline>
4324
+ </xsl:when>
4325
+ <xsl:otherwise>
4326
+ <fo:block> <!-- for around figures -->
4327
+ <xsl:if test="$text-align != ''">
4328
+ <xsl:attribute name="text-align"><xsl:value-of select="$text-align"/></xsl:attribute>
4329
+ </xsl:if>
4330
+ <xsl:copy-of select="$tag"/>
4331
+ </fo:block>
4332
+ </xsl:otherwise>
4333
+ </xsl:choose>
4334
+
4205
4335
  </xsl:otherwise>
4206
4336
  </xsl:choose>
4207
4337
  </xsl:when>
@@ -4560,17 +4690,21 @@
4560
4690
  </xsl:apply-templates>
4561
4691
  </xsl:template><xsl:template name="getLang">
4562
4692
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4563
- <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4564
4693
  <xsl:variable name="language">
4565
4694
  <xsl:choose>
4566
4695
  <xsl:when test="$language_current != ''">
4567
4696
  <xsl:value-of select="$language_current"/>
4568
4697
  </xsl:when>
4569
- <xsl:when test="$language_current_2 != ''">
4570
- <xsl:value-of select="$language_current_2"/>
4571
- </xsl:when>
4572
4698
  <xsl:otherwise>
4573
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4699
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4700
+ <xsl:choose>
4701
+ <xsl:when test="$language_current_2 != ''">
4702
+ <xsl:value-of select="$language_current_2"/>
4703
+ </xsl:when>
4704
+ <xsl:otherwise>
4705
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4706
+ </xsl:otherwise>
4707
+ </xsl:choose>
4574
4708
  </xsl:otherwise>
4575
4709
  </xsl:choose>
4576
4710
  </xsl:variable>
@@ -4787,8 +4921,8 @@
4787
4921
 
4788
4922
  </xsl:if>
4789
4923
  <fo:block-container margin-left="0mm">
4790
- <fo:block id="{@id}" xsl:use-attribute-sets="formula-style">
4791
- <xsl:apply-templates/>
4924
+ <fo:block id="{@id}">
4925
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/> <!-- formula's number will be process in 'stem' template -->
4792
4926
  </fo:block>
4793
4927
  </fo:block-container>
4794
4928
  </fo:block-container>
@@ -4800,10 +4934,43 @@
4800
4934
  <fo:inline>
4801
4935
  <xsl:apply-templates/>
4802
4936
  </fo:inline>
4803
- </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 -->
4937
+ </xsl:template><xsl:template match="*[local-name() = 'formula']/*[local-name() = 'name']"> <!-- show in 'stem' template -->
4804
4938
  <xsl:if test="normalize-space() != ''">
4805
4939
  <xsl:text>(</xsl:text><xsl:apply-templates/><xsl:text>)</xsl:text>
4806
4940
  </xsl:if>
4941
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][*[local-name() = 'name']]/*[local-name() = 'stem']">
4942
+ <fo:block xsl:use-attribute-sets="formula-style">
4943
+
4944
+
4945
+
4946
+ <fo:table table-layout="fixed" width="100%">
4947
+ <fo:table-column column-width="95%"/>
4948
+ <fo:table-column column-width="5%"/>
4949
+ <fo:table-body>
4950
+ <fo:table-row>
4951
+ <fo:table-cell display-align="center">
4952
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
4953
+
4954
+
4955
+
4956
+ <xsl:apply-templates/>
4957
+ </fo:block>
4958
+ </fo:table-cell>
4959
+ <fo:table-cell display-align="center">
4960
+ <fo:block xsl:use-attribute-sets="formula-stem-number-style">
4961
+ <xsl:apply-templates select="../*[local-name() = 'name']"/>
4962
+ </fo:block>
4963
+ </fo:table-cell>
4964
+ </fo:table-row>
4965
+ </fo:table-body>
4966
+ </fo:table>
4967
+ </fo:block>
4968
+ </xsl:template><xsl:template match="*[local-name() = 'formula'][not(*[local-name() = 'name'])]/*[local-name() = 'stem']">
4969
+ <fo:block xsl:use-attribute-sets="formula-style">
4970
+ <fo:block xsl:use-attribute-sets="formula-stem-block-style">
4971
+ <xsl:apply-templates/>
4972
+ </fo:block>
4973
+ </fo:block>
4807
4974
  </xsl:template><xsl:template match="*[local-name() = 'note']" name="note">
4808
4975
 
4809
4976
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
@@ -5843,12 +6010,140 @@
5843
6010
  </fo:block-container>
5844
6011
  </fo:block-container>
5845
6012
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
5846
- <xsl:variable name="text">
6013
+ <xsl:choose>
6014
+ <xsl:when test="normalize-space($syntax-highlight) = 'true' and normalize-space(../@lang) != ''"> <!-- condition for turn on of highlighting -->
6015
+ <xsl:variable name="syntax" select="java:org.metanorma.fop.Util.syntaxHighlight(., ../@lang)"/>
6016
+ <xsl:choose>
6017
+ <xsl:when test="normalize-space($syntax) != ''"><!-- if there is highlighted result -->
6018
+ <xsl:apply-templates select="xalan:nodeset($syntax)" mode="syntax_highlight"/> <!-- process span tags -->
6019
+ </xsl:when>
6020
+ <xsl:otherwise> <!-- if case of non-succesfull syntax highlight (for instance, unknown lang), process without highlighting -->
6021
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6022
+ </xsl:otherwise>
6023
+ </xsl:choose>
6024
+ </xsl:when>
6025
+ <xsl:otherwise>
6026
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
6027
+ </xsl:otherwise>
6028
+ </xsl:choose>
6029
+
6030
+ </xsl:template><xsl:template name="add_spaces_to_sourcecode">
6031
+ <xsl:variable name="text_step1">
5847
6032
  <xsl:call-template name="add-zero-spaces-equal"/>
5848
6033
  </xsl:variable>
5849
- <xsl:call-template name="add-zero-spaces-java">
5850
- <xsl:with-param name="text" select="$text"/>
5851
- </xsl:call-template>
6034
+ <xsl:variable name="text_step2">
6035
+ <xsl:call-template name="add-zero-spaces-java">
6036
+ <xsl:with-param name="text" select="$text_step1"/>
6037
+ </xsl:call-template>
6038
+ </xsl:variable>
6039
+ <xsl:value-of select="$text_step2"/>
6040
+ </xsl:template><xsl:template match="*" mode="syntax_highlight">
6041
+ <xsl:apply-templates mode="syntax_highlight"/>
6042
+ </xsl:template><xsl:variable name="syntax_highlight_styles_">
6043
+ <style class="hljs-addition" xsl:use-attribute-sets="hljs-addition"/>
6044
+ <style class="hljs-attr" xsl:use-attribute-sets="hljs-attr"/>
6045
+ <style class="hljs-attribute" xsl:use-attribute-sets="hljs-attribute"/>
6046
+ <style class="hljs-built_in" xsl:use-attribute-sets="hljs-built_in"/>
6047
+ <style class="hljs-bullet" xsl:use-attribute-sets="hljs-bullet"/>
6048
+ <style class="hljs-char_and_escape_" xsl:use-attribute-sets="hljs-char_and_escape_"/>
6049
+ <style class="hljs-code" xsl:use-attribute-sets="hljs-code"/>
6050
+ <style class="hljs-comment" xsl:use-attribute-sets="hljs-comment"/>
6051
+ <style class="hljs-deletion" xsl:use-attribute-sets="hljs-deletion"/>
6052
+ <style class="hljs-doctag" xsl:use-attribute-sets="hljs-doctag"/>
6053
+ <style class="hljs-emphasis" xsl:use-attribute-sets="hljs-emphasis"/>
6054
+ <style class="hljs-formula" xsl:use-attribute-sets="hljs-formula"/>
6055
+ <style class="hljs-keyword" xsl:use-attribute-sets="hljs-keyword"/>
6056
+ <style class="hljs-link" xsl:use-attribute-sets="hljs-link"/>
6057
+ <style class="hljs-literal" xsl:use-attribute-sets="hljs-literal"/>
6058
+ <style class="hljs-meta" xsl:use-attribute-sets="hljs-meta"/>
6059
+ <style class="hljs-meta_hljs-string" xsl:use-attribute-sets="hljs-meta_hljs-string"/>
6060
+ <style class="hljs-meta_hljs-keyword" xsl:use-attribute-sets="hljs-meta_hljs-keyword"/>
6061
+ <style class="hljs-name" xsl:use-attribute-sets="hljs-name"/>
6062
+ <style class="hljs-number" xsl:use-attribute-sets="hljs-number"/>
6063
+ <style class="hljs-operator" xsl:use-attribute-sets="hljs-operator"/>
6064
+ <style class="hljs-params" xsl:use-attribute-sets="hljs-params"/>
6065
+ <style class="hljs-property" xsl:use-attribute-sets="hljs-property"/>
6066
+ <style class="hljs-punctuation" xsl:use-attribute-sets="hljs-punctuation"/>
6067
+ <style class="hljs-quote" xsl:use-attribute-sets="hljs-quote"/>
6068
+ <style class="hljs-regexp" xsl:use-attribute-sets="hljs-regexp"/>
6069
+ <style class="hljs-section" xsl:use-attribute-sets="hljs-section"/>
6070
+ <style class="hljs-selector-attr" xsl:use-attribute-sets="hljs-selector-attr"/>
6071
+ <style class="hljs-selector-class" xsl:use-attribute-sets="hljs-selector-class"/>
6072
+ <style class="hljs-selector-id" xsl:use-attribute-sets="hljs-selector-id"/>
6073
+ <style class="hljs-selector-pseudo" xsl:use-attribute-sets="hljs-selector-pseudo"/>
6074
+ <style class="hljs-selector-tag" xsl:use-attribute-sets="hljs-selector-tag"/>
6075
+ <style class="hljs-string" xsl:use-attribute-sets="hljs-string"/>
6076
+ <style class="hljs-strong" xsl:use-attribute-sets="hljs-strong"/>
6077
+ <style class="hljs-subst" xsl:use-attribute-sets="hljs-subst"/>
6078
+ <style class="hljs-symbol" xsl:use-attribute-sets="hljs-symbol"/>
6079
+ <style class="hljs-tag" xsl:use-attribute-sets="hljs-tag"/>
6080
+ <!-- <style class="hljs-tag_hljs-attr" xsl:use-attribute-sets="hljs-tag_hljs-attr"></style> -->
6081
+ <!-- <style class="hljs-tag_hljs-name" xsl:use-attribute-sets="hljs-tag_hljs-name"></style> -->
6082
+ <style class="hljs-template-tag" xsl:use-attribute-sets="hljs-template-tag"/>
6083
+ <style class="hljs-template-variable" xsl:use-attribute-sets="hljs-template-variable"/>
6084
+ <style class="hljs-title" xsl:use-attribute-sets="hljs-title"/>
6085
+ <style class="hljs-title_and_class_" xsl:use-attribute-sets="hljs-title_and_class_"/>
6086
+ <style class="hljs-title_and_class__and_inherited__" xsl:use-attribute-sets="hljs-title_and_class__and_inherited__"/>
6087
+ <style class="hljs-title_and_function_" xsl:use-attribute-sets="hljs-title_and_function_"/>
6088
+ <style class="hljs-type" xsl:use-attribute-sets="hljs-type"/>
6089
+ <style class="hljs-variable" xsl:use-attribute-sets="hljs-variable"/>
6090
+ <style class="hljs-variable_and_language_" xsl:use-attribute-sets="hljs-variable_and_language_"/>
6091
+ </xsl:variable><xsl:variable name="syntax_highlight_styles" select="xalan:nodeset($syntax_highlight_styles_)"/><xsl:template match="span" mode="syntax_highlight" priority="2">
6092
+ <!-- <fo:inline color="green" font-style="italic"><xsl:apply-templates mode="syntax_highlight"/></fo:inline> -->
6093
+ <fo:inline>
6094
+ <xsl:variable name="classes_">
6095
+ <xsl:call-template name="split">
6096
+ <xsl:with-param name="pText" select="@class"/>
6097
+ <xsl:with-param name="sep" select="' '"/>
6098
+ </xsl:call-template>
6099
+ <!-- a few classes together (_and_ suffix) -->
6100
+ <xsl:if test="contains(@class, 'hljs-char') and contains(@class, 'escape_')">
6101
+ <item>hljs-char_and_escape_</item>
6102
+ </xsl:if>
6103
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_')">
6104
+ <item>hljs-title_and_class_</item>
6105
+ </xsl:if>
6106
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'class_') and contains(@class, 'inherited__')">
6107
+ <item>hljs-title_and_class__and_inherited__</item>
6108
+ </xsl:if>
6109
+ <xsl:if test="contains(@class, 'hljs-title') and contains(@class, 'function_')">
6110
+ <item>hljs-title_and_function_</item>
6111
+ </xsl:if>
6112
+ <xsl:if test="contains(@class, 'hljs-variable') and contains(@class, 'language_')">
6113
+ <item>hljs-variable_and_language_</item>
6114
+ </xsl:if>
6115
+ <!-- with parent classes (_ suffix) -->
6116
+ <xsl:if test="contains(@class, 'hljs-keyword') and contains(ancestor::*/@class, 'hljs-meta')">
6117
+ <item>hljs-meta_hljs-keyword</item>
6118
+ </xsl:if>
6119
+ <xsl:if test="contains(@class, 'hljs-string') and contains(ancestor::*/@class, 'hljs-meta')">
6120
+ <item>hljs-meta_hljs-string</item>
6121
+ </xsl:if>
6122
+ </xsl:variable>
6123
+ <xsl:variable name="classes" select="xalan:nodeset($classes_)"/>
6124
+
6125
+ <xsl:for-each select="$classes/item">
6126
+ <xsl:variable name="class_name" select="."/>
6127
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
6128
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
6129
+ </xsl:for-each>
6130
+ </xsl:for-each>
6131
+
6132
+ <!-- <xsl:variable name="class_name">
6133
+ <xsl:choose>
6134
+ <xsl:when test="@class = 'hljs-attr' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-attr</xsl:when>
6135
+ <xsl:when test="@class = 'hljs-name' and ancestor::*/@class = 'hljs-tag'">hljs-tag_hljs-name</xsl:when>
6136
+ <xsl:when test="@class = 'hljs-string' and ancestor::*/@class = 'hljs-meta'">hljs-meta_hljs-string</xsl:when>
6137
+ <xsl:otherwise><xsl:value-of select="@class"/></xsl:otherwise>
6138
+ </xsl:choose>
6139
+ </xsl:variable>
6140
+ <xsl:for-each select="$syntax_highlight_styles/style[@class = $class_name]/@*[not(local-name() = 'class')]">
6141
+ <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>
6142
+ </xsl:for-each> -->
6143
+
6144
+ <xsl:apply-templates mode="syntax_highlight"/></fo:inline>
6145
+ </xsl:template><xsl:template match="text()" mode="syntax_highlight" priority="2">
6146
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
5852
6147
  </xsl:template><xsl:template match="*[local-name() = 'sourcecode']/*[local-name() = 'name']">
5853
6148
  <xsl:if test="normalize-space() != ''">
5854
6149
  <fo:block xsl:use-attribute-sets="sourcecode-name-style">
@@ -6229,11 +6524,14 @@
6229
6524
 
6230
6525
 
6231
6526
  <fo:block-container margin-left="0mm">
6232
-
6233
- <fo:block xsl:use-attribute-sets="quote-style">
6527
+ <fo:block-container xsl:use-attribute-sets="quote-style">
6234
6528
 
6235
- <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
6236
- </fo:block>
6529
+ <fo:block-container margin-left="0mm" margin-right="0mm">
6530
+ <fo:block role="BlockQuote">
6531
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
6532
+ </fo:block>
6533
+ </fo:block-container>
6534
+ </fo:block-container>
6237
6535
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
6238
6536
  <fo:block xsl:use-attribute-sets="quote-source-style">
6239
6537
  <!-- — ISO, ISO 7301:2011, Clause 1 -->
@@ -6378,6 +6676,31 @@
6378
6676
  <xsl:with-param name="count" select="$count - 1"/>
6379
6677
  </xsl:call-template>
6380
6678
  </xsl:if>
6679
+ </xsl:template><xsl:template match="*[local-name() = 'preferred']">
6680
+ <xsl:variable name="level">
6681
+ <xsl:call-template name="getLevel"/>
6682
+ </xsl:variable>
6683
+ <xsl:variable name="font-size">
6684
+ inherit
6685
+ </xsl:variable>
6686
+ <xsl:variable name="levelTerm">
6687
+ <xsl:call-template name="getLevelTermName"/>
6688
+ </xsl:variable>
6689
+ <fo:block font-size="{normalize-space($font-size)}" role="H{$levelTerm}" xsl:use-attribute-sets="preferred-block-style">
6690
+
6691
+
6692
+
6693
+ <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
6694
+ <fo:block xsl:use-attribute-sets="term-name-style">
6695
+ <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
6696
+ </fo:block>
6697
+ </xsl:if>
6698
+
6699
+ <fo:block xsl:use-attribute-sets="preferred-term-style">
6700
+ <xsl:call-template name="setStyle_preferred"/>
6701
+ <xsl:apply-templates/>
6702
+ </fo:block>
6703
+ </fo:block>
6381
6704
  </xsl:template><xsl:template match="*[local-name() = 'domain']">
6382
6705
  <fo:inline xsl:use-attribute-sets="domain-style">&lt;<xsl:apply-templates/>&gt;</fo:inline>
6383
6706
  <xsl:text> </xsl:text>
@@ -6466,24 +6789,8 @@
6466
6789
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6467
6790
  </xsl:template><xsl:variable name="ul_labels_">
6468
6791
 
6469
-
6470
-
6471
-
6472
-
6473
-
6474
-
6475
-
6476
-
6477
-
6478
-
6479
-
6480
-
6481
- <label color="{$color_design}">•</label>
6482
-
6483
-
6484
-
6485
-
6486
-
6792
+ <label color="{$color_design}">•</label>
6793
+
6487
6794
  </xsl:variable><xsl:variable name="ul_labels" select="xalan:nodeset($ul_labels_)"/><xsl:template name="setULLabel">
6488
6795
  <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6489
6796
  <xsl:variable name="list_level">
@@ -6509,6 +6816,91 @@
6509
6816
  </xsl:template><xsl:template match="label" mode="ul_labels">
6510
6817
  <xsl:copy-of select="@*[not(local-name() = 'level')]"/>
6511
6818
  <xsl:value-of select="."/>
6819
+ </xsl:template><xsl:template name="getListItemFormat">
6820
+ <!-- Example: for BSI <?list-type loweralpha?> -->
6821
+ <xsl:variable name="processing_instruction_type" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-type'))"/>
6822
+ <xsl:choose>
6823
+ <xsl:when test="local-name(..) = 'ul'">
6824
+ <xsl:choose>
6825
+ <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
6826
+ <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
6827
+ </xsl:choose>
6828
+ </xsl:when>
6829
+ <xsl:otherwise> <!-- for ordered lists 'ol' -->
6830
+
6831
+ <!-- Example: for BSI <?list-start 2?> -->
6832
+ <xsl:variable name="processing_instruction_start" select="normalize-space(../preceding-sibling::*[1]/processing-instruction('list-start'))"/>
6833
+
6834
+ <xsl:variable name="start_value">
6835
+ <xsl:choose>
6836
+ <xsl:when test="normalize-space($processing_instruction_start) != ''">
6837
+ <xsl:value-of select="number($processing_instruction_start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
6838
+ </xsl:when>
6839
+ <xsl:when test="normalize-space(../@start) != ''">
6840
+ <xsl:value-of select="number(../@start) - 1"/><!-- if start="3" then start_value=2 + xsl:number(1) = 3 -->
6841
+ </xsl:when>
6842
+ <xsl:otherwise>0</xsl:otherwise>
6843
+ </xsl:choose>
6844
+ </xsl:variable>
6845
+
6846
+ <xsl:variable name="curr_value"><xsl:number/></xsl:variable>
6847
+
6848
+ <xsl:variable name="type">
6849
+ <xsl:choose>
6850
+ <xsl:when test="normalize-space($processing_instruction_type) != ''"><xsl:value-of select="$processing_instruction_type"/></xsl:when>
6851
+ <xsl:when test="normalize-space(../@type) != ''"><xsl:value-of select="../@type"/></xsl:when>
6852
+
6853
+ <xsl:otherwise> <!-- if no @type or @class = 'steps' -->
6854
+
6855
+ <xsl:variable name="list_level_" select="count(ancestor::*[local-name() = 'ul']) + count(ancestor::*[local-name() = 'ol'])"/>
6856
+ <xsl:variable name="list_level">
6857
+ <xsl:choose>
6858
+ <xsl:when test="$list_level_ &lt;= 5"><xsl:value-of select="$list_level_"/></xsl:when>
6859
+ <xsl:otherwise><xsl:value-of select="$list_level_ mod 5"/></xsl:otherwise>
6860
+ </xsl:choose>
6861
+ </xsl:variable>
6862
+
6863
+ <xsl:choose>
6864
+ <xsl:when test="$list_level mod 5 = 0">roman_upper</xsl:when> <!-- level 5 -->
6865
+ <xsl:when test="$list_level mod 4 = 0">alphabet_upper</xsl:when> <!-- level 4 -->
6866
+ <xsl:when test="$list_level mod 3 = 0">roman</xsl:when> <!-- level 3 -->
6867
+ <xsl:when test="$list_level mod 2 = 0 and ancestor::*/@class = 'steps'">alphabet</xsl:when> <!-- level 2 and @class = 'steps'-->
6868
+ <xsl:when test="$list_level mod 2 = 0">arabic</xsl:when> <!-- level 2 -->
6869
+ <xsl:otherwise> <!-- level 1 -->
6870
+ <xsl:choose>
6871
+ <xsl:when test="ancestor::*/@class = 'steps'">arabic</xsl:when>
6872
+ <xsl:otherwise>alphabet</xsl:otherwise>
6873
+ </xsl:choose>
6874
+ </xsl:otherwise>
6875
+ </xsl:choose>
6876
+
6877
+ </xsl:otherwise>
6878
+ </xsl:choose>
6879
+ </xsl:variable>
6880
+
6881
+ <xsl:variable name="format">
6882
+ <xsl:choose>
6883
+ <xsl:when test="$type = 'arabic'">
6884
+ 1.
6885
+ </xsl:when>
6886
+ <xsl:when test="$type = 'alphabet'">
6887
+ a)
6888
+ </xsl:when>
6889
+ <xsl:when test="$type = 'alphabet_upper'">
6890
+ A)
6891
+ </xsl:when>
6892
+ <xsl:when test="$type = 'roman'">
6893
+ i)
6894
+ </xsl:when>
6895
+ <xsl:when test="$type = 'roman_upper'">I.</xsl:when>
6896
+ <xsl:otherwise>1.</xsl:otherwise> <!-- for any case, if $type has non-determined value, not using -->
6897
+ </xsl:choose>
6898
+ </xsl:variable>
6899
+
6900
+ <xsl:number value="$start_value + $curr_value" format="{normalize-space($format)}" lang="en"/>
6901
+
6902
+ </xsl:otherwise>
6903
+ </xsl:choose>
6512
6904
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6513
6905
  <xsl:choose>
6514
6906
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
@@ -6524,18 +6916,74 @@
6524
6916
 
6525
6917
  <fo:block-container margin-left="0mm">
6526
6918
  <fo:block>
6527
- <xsl:apply-templates select="." mode="ul_ol"/>
6919
+ <xsl:apply-templates select="." mode="list"/>
6528
6920
  </fo:block>
6529
6921
  </fo:block-container>
6530
6922
  </fo:block-container>
6531
6923
  </xsl:when>
6532
6924
  <xsl:otherwise>
6533
6925
  <fo:block>
6534
- <xsl:apply-templates select="." mode="ul_ol"/>
6926
+ <xsl:apply-templates select="." mode="list"/>
6535
6927
  </fo:block>
6536
6928
  </xsl:otherwise>
6537
6929
  </xsl:choose>
6538
- </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
6930
+ </xsl:template><xsl:template match="*[local-name()='ul'] | *[local-name()='ol']" mode="list" name="list">
6931
+ <fo:list-block xsl:use-attribute-sets="list-style">
6932
+
6933
+
6934
+
6935
+
6936
+
6937
+
6938
+
6939
+
6940
+
6941
+ <xsl:apply-templates select="node()[not(local-name() = 'note')]"/>
6942
+ </fo:list-block>
6943
+ <!-- <xsl:for-each select="./iho:note">
6944
+ <xsl:call-template name="note"/>
6945
+ </xsl:for-each> -->
6946
+ <xsl:apply-templates select="./*[local-name() = 'note']"/>
6947
+ </xsl:template><xsl:template match="*[local-name()='li']">
6948
+ <fo:list-item xsl:use-attribute-sets="list-item-style">
6949
+ <xsl:copy-of select="@id"/>
6950
+
6951
+
6952
+
6953
+ <fo:list-item-label end-indent="label-end()">
6954
+ <fo:block xsl:use-attribute-sets="list-item-label-style">
6955
+
6956
+
6957
+
6958
+ <xsl:call-template name="getListItemFormat"/>
6959
+ </fo:block>
6960
+ </fo:list-item-label>
6961
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
6962
+ <fo:block>
6963
+
6964
+
6965
+
6966
+
6967
+ <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
6968
+ <xsl:if test="ancestor::ogc:table[not(@class)]">
6969
+ <xsl:attribute name="margin-bottom">1mm</xsl:attribute>
6970
+ </xsl:if>
6971
+ <xsl:if test="not(following-sibling::*) and not(../following-sibling::*)">
6972
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
6973
+ </xsl:if>
6974
+
6975
+
6976
+ <xsl:apply-templates/>
6977
+
6978
+ <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
6979
+
6980
+ <xsl:for-each select="./bsi:note">
6981
+ <xsl:call-template name="note"/>
6982
+ </xsl:for-each> -->
6983
+ </fo:block>
6984
+ </fo:list-item-body>
6985
+ </fo:list-item>
6986
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="bookmark_in_fn">
6539
6987
  <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
6540
6988
  <bookmark><xsl:value-of select="@id"/></bookmark>
6541
6989
  </xsl:for-each>
@@ -6557,7 +7005,7 @@
6557
7005
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6558
7006
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6559
7007
  <xsl:if test="@to">
6560
- <xsl:value-of select="$dash"/>
7008
+ <xsl:value-of select="$en_dash"/>
6561
7009
  <xsl:copy>
6562
7010
  <xsl:copy-of select="@*"/>
6563
7011
  <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
@@ -6582,7 +7030,7 @@
6582
7030
  <xsl:param name="target"/>
6583
7031
  <!-- <node></node> -->
6584
7032
  <xsl:choose>
6585
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
7033
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $en_dash) and $remove = 'true'">
6586
7034
  <!-- skip text (i.e. remove it) and process next element -->
6587
7035
  <!-- [removed_<xsl:value-of select="."/>] -->
6588
7036
  <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
@@ -6666,12 +7114,22 @@
6666
7114
  </xsl:variable>
6667
7115
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6668
7116
  <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
7117
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
7118
+ <fo:block xsl:use-attribute-sets="indexsect-title-style">
7119
+ <!-- Index -->
7120
+ <xsl:apply-templates/>
7121
+ </fo:block>
7122
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']/*[local-name() = 'title']" priority="4">
7123
+ <!-- Letter A, B, C, ... -->
7124
+ <fo:block xsl:use-attribute-sets="indexsect-clause-title-style">
7125
+ <xsl:apply-templates/>
7126
+ </fo:block>
6669
7127
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6670
7128
  <xsl:apply-templates/>
6671
7129
  <fo:block>
6672
- <xsl:if test="following-sibling::*[local-name() = 'clause']">
6673
- <fo:block> </fo:block>
6674
- </xsl:if>
7130
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
7131
+ <fo:block> </fo:block>
7132
+ </xsl:if>
6675
7133
  </fo:block>
6676
7134
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6677
7135
  <xsl:apply-templates/>
@@ -6681,6 +7139,9 @@
6681
7139
 
6682
7140
  <xsl:apply-templates/>
6683
7141
  </fo:block>
7142
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/text()">
7143
+ <!-- to split by '_' and other chars -->
7144
+ <xsl:call-template name="add-zero-spaces-java"/>
6684
7145
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6685
7146
  <fo:inline id="{@id}" font-size="1pt"/>
6686
7147
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
@@ -7135,7 +7596,7 @@
7135
7596
  </fo:table-body>
7136
7597
  </fo:table>
7137
7598
  </fo:block>
7138
- </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
7599
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']" priority="2">
7139
7600
  <fo:table-row min-height="5mm">
7140
7601
  <xsl:apply-templates/>
7141
7602
  </fo:table-row>
@@ -7368,9 +7829,6 @@
7368
7829
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
7369
7830
  </xsl:choose>
7370
7831
  </xsl:template><xsl:template name="addPDFUAmeta">
7371
- <xsl:variable name="lang">
7372
- <xsl:call-template name="getLang"/>
7373
- </xsl:variable>
7374
7832
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
7375
7833
  <pdf:dictionary type="normal" key="ViewerPreferences">
7376
7834
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
@@ -7598,10 +8056,12 @@
7598
8056
  <xsl:param name="key"/>
7599
8057
  <xsl:param name="formatted">false</xsl:param>
7600
8058
  <xsl:param name="lang"/>
8059
+ <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
7601
8060
 
7602
8061
  <xsl:variable name="curr_lang">
7603
8062
  <xsl:choose>
7604
8063
  <xsl:when test="$lang != ''"><xsl:value-of select="$lang"/></xsl:when>
8064
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
7605
8065
  <xsl:otherwise>
7606
8066
  <xsl:call-template name="getLang"/>
7607
8067
  </xsl:otherwise>
@@ -7636,6 +8096,7 @@
7636
8096
  </xsl:otherwise>
7637
8097
  </xsl:choose>
7638
8098
  </xsl:when>
8099
+ <xsl:when test="$returnEmptyIfNotFound = 'true'"/>
7639
8100
  <xsl:otherwise>
7640
8101
  <xsl:variable name="key_">
7641
8102
  <xsl:call-template name="capitalize">