metanorma-bipm 1.0.2 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,6 @@
11
11
  <!-- <item id="#">N_page</item> -->
12
12
  <!-- param for second pass -->
13
13
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
14
- <xsl:variable name="index" select="document($external_index)"/>
15
14
 
16
15
  <xsl:variable name="first_pass" select="count($index//item) = 0"/>
17
16
 
@@ -114,7 +113,8 @@
114
113
 
115
114
  <!-- add id to xref and split xref with @to into two xref -->
116
115
  <xsl:variable name="current_document_index_id">
117
- <xsl:apply-templates select=".//bipm:clause[@type = 'index']" mode="index_add_id"/>
116
+ <!-- <xsl:apply-templates select=".//bipm:clause[@type = 'index']" mode="index_add_id"/> -->
117
+ <xsl:apply-templates select=".//bipm:indexsect" mode="index_add_id"/>
118
118
  </xsl:variable>
119
119
 
120
120
  <xsl:variable name="current_document_index">
@@ -145,7 +145,8 @@
145
145
  </xsl:variable>
146
146
 
147
147
  <xsl:variable name="current_document_index_id">
148
- <xsl:apply-templates select=".//bipm:clause[@type = 'index']" mode="index_add_id"/>
148
+ <!-- <xsl:apply-templates select=".//bipm:clause[@type = 'index']" mode="index_add_id"/> -->
149
+ <xsl:apply-templates select=".//bipm:indexsect" mode="index_add_id"/>
149
150
  </xsl:variable>
150
151
 
151
152
  <xsl:variable name="current_document_index">
@@ -165,8 +166,7 @@
165
166
  </xsl:choose>
166
167
  </xsl:variable>
167
168
 
168
- <xsl:variable name="dash" select="'–'"/>
169
-
169
+
170
170
  <xsl:variable name="ids">
171
171
  <xsl:for-each select="//*[@id]">
172
172
  <id><xsl:value-of select="@id"/></id>
@@ -194,7 +194,8 @@
194
194
  <xsl:apply-templates select="/*/bipm:bibliography/bipm:references[not(@normative='true')]" mode="contents"/>
195
195
 
196
196
  <!-- Index -->
197
- <xsl:apply-templates select="//bipm:clause[@type = 'index']" mode="contents"/>
197
+ <!-- <xsl:apply-templates select="//bipm:clause[@type = 'index']" mode="contents"/> -->
198
+ <xsl:apply-templates select="//bipm:indexsect" mode="contents"/>
198
199
 
199
200
  </contents>
200
201
  </xsl:template>
@@ -253,6 +254,28 @@
253
254
  </fo:repeatable-page-master-alternatives>
254
255
  </fo:page-sequence-master>
255
256
 
257
+ <!-- Document pages (landscape orientation) -->
258
+ <fo:simple-page-master master-name="document-landscape-odd" page-width="{$pageHeight}" page-height="{$pageWidth}">
259
+ <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="40mm"/>
260
+ <fo:region-before region-name="header-odd" extent="25.4mm"/>
261
+ <fo:region-after region-name="footer" extent="22mm"/> <!-- debug: background-color="green" -->
262
+ <fo:region-start region-name="left-region" extent="17mm"/>
263
+ <fo:region-end region-name="right-region" extent="26.5mm"/>
264
+ </fo:simple-page-master>
265
+ <fo:simple-page-master master-name="document-landscape-even" page-width="{$pageHeight}" page-height="{$pageWidth}">
266
+ <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="40mm"/>
267
+ <fo:region-before region-name="header-even" extent="25.4mm"/>
268
+ <fo:region-after region-name="footer" extent="22mm"/> <!-- debug: background-color="green" -->
269
+ <fo:region-start region-name="left-region" extent="17mm"/>
270
+ <fo:region-end region-name="right-region" extent="26.5mm"/>
271
+ </fo:simple-page-master>
272
+ <fo:page-sequence-master master-name="document-landscape">
273
+ <fo:repeatable-page-master-alternatives>
274
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="document-landscape-even"/>
275
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="document-landscape-odd"/>
276
+ </fo:repeatable-page-master-alternatives>
277
+ </fo:page-sequence-master>
278
+
256
279
  <!-- Index pages -->
257
280
  <fo:simple-page-master master-name="index-odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
258
281
  <fo:region-body margin-top="25.4mm" margin-bottom="22mm" margin-left="31.7mm" margin-right="41.7mm" column-count="2" column-gap="10mm"/>
@@ -278,8 +301,9 @@
278
301
 
279
302
  </fo:layout-master-set>
280
303
 
281
-
282
- <xsl:call-template name="addPDFUAmeta"/>
304
+ <fo:declarations>
305
+ <xsl:call-template name="addPDFUAmeta"/>
306
+ </fo:declarations>
283
307
 
284
308
  <xsl:call-template name="addBookmarks">
285
309
  <xsl:with-param name="contents" select="$contents"/>
@@ -327,10 +351,14 @@
327
351
  <xsl:apply-templates select="xalan:nodeset($current_document)" mode="flatxml"/>
328
352
  </xsl:variable> -->
329
353
 
330
- <xsl:variable name="flatxml">
354
+ <xsl:variable name="flatxml_">
331
355
  <xsl:apply-templates select="." mode="flatxml"/>
332
356
  </xsl:variable>
333
357
 
358
+ <xsl:variable name="flatxml">
359
+ <xsl:apply-templates select="xalan:nodeset($flatxml_)" mode="pagebreak"/>
360
+ </xsl:variable>
361
+
334
362
  <!-- flatxml=<xsl:copy-of select="$flatxml"/> -->
335
363
 
336
364
  <xsl:apply-templates select="xalan:nodeset($flatxml)/bipm:bipm-standard" mode="bipm-standard">
@@ -354,10 +382,14 @@
354
382
  <xsl:apply-templates select="xalan:nodeset($current_document)" mode="flatxml"/>
355
383
  </xsl:variable> -->
356
384
 
357
- <xsl:variable name="flatxml">
385
+ <xsl:variable name="flatxml_">
358
386
  <xsl:apply-templates select="." mode="flatxml"/>
359
387
  </xsl:variable>
360
388
 
389
+ <xsl:variable name="flatxml">
390
+ <xsl:apply-templates select="xalan:nodeset($flatxml_)" mode="pagebreak"/>
391
+ </xsl:variable>
392
+
361
393
  <xsl:apply-templates select="xalan:nodeset($flatxml)/bipm:bipm-standard" mode="bipm-standard">
362
394
  <xsl:with-param name="curr_docnum" select="$num"/>
363
395
  </xsl:apply-templates>
@@ -370,10 +402,14 @@
370
402
  </xsl:when>
371
403
  <xsl:otherwise>
372
404
 
373
- <xsl:variable name="flatxml">
405
+ <xsl:variable name="flatxml_">
374
406
  <xsl:apply-templates mode="flatxml"/>
375
407
  </xsl:variable>
376
-
408
+
409
+ <xsl:variable name="flatxml">
410
+ <xsl:apply-templates select="xalan:nodeset($flatxml_)" mode="pagebreak"/>
411
+ </xsl:variable>
412
+
377
413
  <!-- flatxml=<xsl:copy-of select="$flatxml"/> -->
378
414
 
379
415
  <!-- indexes=<xsl:copy-of select="$indexes"/> -->
@@ -830,7 +866,8 @@
830
866
  </xsl:choose>
831
867
  </xsl:template>
832
868
 
833
- <xsl:template match="bipm:clause[@type = 'index']" mode="flatxml"/>
869
+ <!-- <xsl:template match="bipm:clause[@type = 'index']" mode="flatxml"/> -->
870
+ <xsl:template match="bipm:indexsect" mode="flatxml"/>
834
871
  <!-- <xsl:template match="bipm:clause[@type = 'index']" mode="flatxml">
835
872
  <xsl:copy>
836
873
  <xsl:apply-templates select="@*" mode="flatxml_index"/>
@@ -858,8 +895,82 @@
858
895
  <!-- END: Flattening xml for fit notes at page sides (margins) -->
859
896
  <!-- ================================= -->
860
897
 
898
+ <!-- ================================= -->
899
+ <!-- Page breaks processing (close previous elements (clause) and start new) -->
900
+ <!-- ================================= -->
901
+ <xsl:template match="@*|node()" mode="pagebreak">
902
+ <xsl:copy>
903
+ <xsl:apply-templates select="@*|node()" mode="pagebreak"/>
904
+ </xsl:copy>
905
+ </xsl:template>
861
906
 
907
+ <xsl:template match="node()[bipm:pagebreak[@orientation]]" mode="pagebreak">
908
+ <xsl:variable name="element_name" select="local-name()"/>
909
+ <xsl:for-each select="bipm:pagebreak[@orientation]">
910
+ <xsl:variable name="pagebreak_id" select="generate-id()"/>
911
+ <xsl:variable name="pagebreak_previous_orientation" select="preceding-sibling::bipm:pagebreak[@orientation][1]/@orientation"/>
912
+
913
+ <!-- copy elements before page break -->
914
+ <xsl:element name="{$element_name}" namespace="https://www.metanorma.org/ns/bipm">
915
+ <xsl:if test="not(preceding-sibling::bipm:pagebreak[@orientation])">
916
+ <xsl:apply-templates select="../@*" mode="pagebreak"/>
917
+ </xsl:if>
918
+ <xsl:if test="$pagebreak_previous_orientation != ''">
919
+ <xsl:attribute name="orientation"><xsl:value-of select="$pagebreak_previous_orientation"/></xsl:attribute>
920
+ </xsl:if>
921
+
922
+ <xsl:apply-templates select="preceding-sibling::node()[following-sibling::bipm:pagebreak[@orientation][1][generate-id(.) = $pagebreak_id]][not(local-name() = 'pagebreak' and @orientation)]" mode="pagebreak"/>
923
+ </xsl:element>
924
+
925
+ <!-- copy elements after last page break -->
926
+ <xsl:if test="position() = last() and following-sibling::node()">
927
+ <xsl:element name="{$element_name}" namespace="https://www.metanorma.org/ns/bipm">
928
+ <xsl:attribute name="orientation"><xsl:value-of select="@orientation"/></xsl:attribute>
929
+ <xsl:apply-templates select="following-sibling::node()" mode="pagebreak"/>
930
+ </xsl:element>
931
+ </xsl:if>
932
+
933
+ </xsl:for-each>
934
+
935
+ </xsl:template>
862
936
 
937
+ <xsl:template match="bipm:pagebreak2" mode="pagebreak">
938
+ <xsl:variable name="orientation" select="normalize-space(@orientation)"/>
939
+ <xsl:variable name="tree">
940
+ <xsl:for-each select="ancestor::*[ancestor::bipm:sections or ancestor::bipm:annex or ancestor::bipm:preface]">
941
+ <element pos="{position()}">
942
+ <xsl:value-of select="name()"/>
943
+ </element>
944
+ </xsl:for-each>
945
+ </xsl:variable>
946
+ <!-- close preceding elements -->
947
+ <xsl:for-each select="xalan:nodeset($tree)//element">
948
+ <xsl:sort data-type="number" order="descending" select="@pos"/>
949
+ <xsl:text disable-output-escaping="yes">&lt;/</xsl:text>
950
+ <xsl:value-of select="."/>
951
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
952
+ </xsl:for-each>
953
+ <!-- open elements -->
954
+ <xsl:for-each select="xalan:nodeset($tree)//element">
955
+ <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
956
+ <xsl:value-of select="."/>
957
+ <xsl:for-each select="@*[local-name() != 'pos']">
958
+ <xsl:text> </xsl:text>
959
+ <xsl:value-of select="local-name()"/>
960
+ <xsl:text>="</xsl:text>
961
+ <xsl:value-of select="."/>
962
+ <xsl:text>"</xsl:text>
963
+ </xsl:for-each>
964
+ <xsl:if test="position() = 1">
965
+ <xsl:text> orientation="</xsl:text><xsl:value-of select="$orientation"/><xsl:text>"</xsl:text>
966
+ </xsl:if>
967
+ <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
968
+ </xsl:for-each>
969
+
970
+ </xsl:template>
971
+ <!-- ================================= -->
972
+ <!-- END: Page breaks processing -->
973
+ <!-- ================================= -->
863
974
 
864
975
  <xsl:template match="bipm:bipm-standard"/>
865
976
  <xsl:template match="bipm:bipm-standard" mode="bipm-standard">
@@ -1069,12 +1180,11 @@
1069
1180
 
1070
1181
 
1071
1182
  <!-- Document Pages -->
1072
-
1073
1183
  <xsl:apply-templates select="bipm:sections/*" mode="sections"/>
1074
1184
 
1075
1185
 
1076
-
1077
1186
  <!-- Normative references -->
1187
+
1078
1188
  <xsl:apply-templates select="bipm:bibliography/bipm:references[@normative='true']" mode="sections"/>
1079
1189
 
1080
1190
  <xsl:apply-templates select="bipm:annex" mode="sections"/>
@@ -1082,8 +1192,12 @@
1082
1192
  <!-- Bibliography -->
1083
1193
  <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1084
1194
 
1195
+ <!-- Document Control -->
1196
+ <xsl:apply-templates select="bipm:doccontrol" mode="sections"/>
1197
+
1085
1198
  <!-- Index -->
1086
- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index"/>
1199
+ <!-- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index" /> -->
1200
+ <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index"/>
1087
1201
 
1088
1202
  <!-- End Document Pages -->
1089
1203
 
@@ -1234,7 +1348,6 @@
1234
1348
  <xsl:apply-templates select="bipm:preface/*" mode="sections"/> <!-- bipm:clause -->
1235
1349
 
1236
1350
  <!-- Document Pages -->
1237
-
1238
1351
  <xsl:apply-templates select="bipm:sections/*" mode="sections"/>
1239
1352
  <!-- <xsl:call-template name="sections_appendix"/> --> <!-- without pagebreaks -->
1240
1353
 
@@ -1246,8 +1359,12 @@
1246
1359
 
1247
1360
  <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1248
1361
 
1362
+ <!-- Document Control -->
1363
+ <xsl:apply-templates select="bipm:doccontrol" mode="sections"/>
1364
+
1249
1365
  <!-- Index -->
1250
- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index"/>
1366
+ <!-- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index" /> -->
1367
+ <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index"/>
1251
1368
 
1252
1369
  </xsl:otherwise>
1253
1370
  </xsl:choose>
@@ -1389,17 +1506,20 @@
1389
1506
 
1390
1507
  <xsl:variable name="titles_length" select="string-length($title_appendix_fr) + string-length($title_appendix_en) + string-length($title_annex_fr) + string-length($title_annex_en) + string-length($title_part_fr) + string-length($title_part_en) + string-length($title_subpart_fr) + string-length($title_subpart_fr)"/>
1391
1508
 
1392
- <xsl:variable name="font-size-number-factor">
1509
+ <!-- <xsl:variable name="font-size-number-factor">
1393
1510
  <xsl:choose>
1394
1511
  <xsl:when test="$titles_length &gt; 350">0.7</xsl:when>
1395
1512
  <xsl:when test="$titles_length &gt; 250">0.85</xsl:when>
1513
+ <xsl:when test="$titles_length &gt; 130">0.9</xsl:when>
1396
1514
  <xsl:otherwise>1</xsl:otherwise>
1397
1515
  </xsl:choose>
1398
- </xsl:variable>
1516
+ </xsl:variable> -->
1399
1517
 
1400
1518
  <xsl:variable name="space-factor">
1401
1519
  <xsl:choose>
1402
1520
  <xsl:when test="$titles_length &gt; 250">0.3</xsl:when>
1521
+ <xsl:when test="$titles_length &gt; 200">0.5</xsl:when>
1522
+ <xsl:when test="$titles_length &gt; 150">0.7</xsl:when>
1403
1523
  <xsl:otherwise>1</xsl:otherwise>
1404
1524
  </xsl:choose>
1405
1525
  </xsl:variable>
@@ -1407,11 +1527,21 @@
1407
1527
  <xsl:variable name="font-size-factor">
1408
1528
  <xsl:choose>
1409
1529
  <xsl:when test="$titles_length &gt; 350">0.5</xsl:when>
1410
- <xsl:when test="$titles_length &gt; 250">0.65</xsl:when>
1530
+ <xsl:when test="$titles_length &gt; 250">0.55</xsl:when>
1531
+ <xsl:when test="$titles_length &gt; 180">0.65</xsl:when>
1532
+ <xsl:when test="$titles_length &gt; 130">0.8</xsl:when>
1411
1533
  <xsl:otherwise>1</xsl:otherwise>
1412
1534
  </xsl:choose>
1413
1535
  </xsl:variable>
1414
-
1536
+
1537
+ <xsl:variable name="font-size-number-factor">
1538
+ <xsl:choose>
1539
+ <xsl:when test="$font-size-factor &lt; 1"><xsl:value-of select="$font-size-factor *1.3"/></xsl:when>
1540
+ <xsl:otherwise>1</xsl:otherwise>
1541
+ </xsl:choose>
1542
+ </xsl:variable>
1543
+
1544
+ <!-- <fo:block font-size="6pt">DEBUG font-size-factor=<xsl:value-of select="$font-size-factor"/>, titles_length=<xsl:value-of select="$titles_length"/></fo:block> -->
1415
1545
  <!-- Appendix titles processing -->
1416
1546
  <xsl:variable name="appendix_num" select="normalize-space((//bipm:bipm-standard)[1]/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:appendix)"/>
1417
1547
  <xsl:if test="$appendix_num != ''">
@@ -1831,11 +1961,12 @@
1831
1961
  <xsl:if test="@level &gt;= 3">
1832
1962
  <fo:inline padding-right="2mm"><xsl:value-of select="@section"/></fo:inline>
1833
1963
  </xsl:if>
1834
- <xsl:variable name="sectionTitle">
1964
+ <!-- <xsl:variable name="sectionTitle">
1835
1965
  <xsl:apply-templates select="title"/>
1836
- </xsl:variable>
1966
+ </xsl:variable> -->
1837
1967
  <fo:inline>
1838
- <xsl:value-of select="$sectionTitle"/>
1968
+ <!-- <xsl:value-of select="$sectionTitle"/> -->
1969
+ <xsl:apply-templates select="title"/>
1839
1970
  </fo:inline>
1840
1971
  <!-- <xsl:text> </xsl:text> -->
1841
1972
  <!-- keep-together.within-line="always" -->
@@ -1913,6 +2044,7 @@
1913
2044
  <xsl:variable name="type">
1914
2045
  <xsl:choose>
1915
2046
  <xsl:when test="@type = 'index'">index</xsl:when>
2047
+ <xsl:when test="local-name() = 'indexsect'">index</xsl:when>
1916
2048
  <xsl:otherwise><xsl:value-of select="local-name()"/></xsl:otherwise>
1917
2049
  </xsl:choose>
1918
2050
  </xsl:variable>
@@ -1931,17 +2063,26 @@
1931
2063
  </xsl:if>
1932
2064
  </xsl:template>
1933
2065
 
2066
+ <xsl:template match="*[local-name() = 'strong']" mode="contents_item" priority="2">
2067
+ <!-- <xsl:copy> -->
2068
+ <xsl:apply-templates mode="contents_item"/>
2069
+ <!-- </xsl:copy> -->
2070
+ </xsl:template>
2071
+
1934
2072
  <!-- ============================= -->
1935
2073
  <!-- ============================= -->
1936
2074
 
1937
2075
 
1938
2076
  <xsl:template match="node()" mode="sections">
1939
2077
  <fo:page-sequence master-reference="document" force-page-count="no-force">
2078
+ <xsl:if test="@orientation = 'landscape'">
2079
+ <xsl:attribute name="master-reference">document-landscape</xsl:attribute>
2080
+ </xsl:if>
2081
+
1940
2082
  <xsl:call-template name="insertFootnoteSeparator"/>
1941
2083
 
1942
2084
  <xsl:variable name="header-title">
1943
2085
  <xsl:choose>
1944
-
1945
2086
  <xsl:when test="local-name(..) = 'sections'">
1946
2087
  <xsl:choose>
1947
2088
  <xsl:when test="./bipm:title[1]/*[local-name() = 'tab']">
@@ -1982,6 +2123,7 @@
1982
2123
  </xsl:variable>
1983
2124
  <xsl:call-template name="insertHeaderFooter">
1984
2125
  <xsl:with-param name="header-title" select="$header-title"/>
2126
+ <xsl:with-param name="orientation" select="@orientation"/>
1985
2127
  </xsl:call-template>
1986
2128
 
1987
2129
  <fo:flow flow-name="xsl-region-body">
@@ -2453,13 +2595,25 @@
2453
2595
  <xsl:variable name="space-before-value" select="normalize-space($space-before)"/>
2454
2596
 
2455
2597
  <fo:table table-layout="fixed" width="174mm" line-height="135%">
2598
+ <xsl:if test="@orientation = 'landscape'">
2599
+ <xsl:attribute name="width">261mm</xsl:attribute> <!-- 87 = (297 - 210) -->
2600
+ </xsl:if>
2456
2601
  <xsl:call-template name="setId"/>
2457
2602
  <xsl:if test="$space-before-value != ''">
2458
2603
  <xsl:attribute name="space-before"><xsl:value-of select="$space-before-value"/></xsl:attribute>
2459
2604
  </xsl:if>
2460
- <fo:table-column column-width="137mm"/>
2605
+
2606
+ <xsl:choose>
2607
+ <xsl:when test="@orientation = 'landscape'">
2608
+ <fo:table-column column-width="224mm"/> <!-- +87 -->
2609
+ </xsl:when>
2610
+ <xsl:otherwise>
2611
+ <fo:table-column column-width="137mm"/>
2612
+ </xsl:otherwise>
2613
+ </xsl:choose>
2461
2614
  <fo:table-column column-width="5mm"/>
2462
2615
  <fo:table-column column-width="32mm"/>
2616
+
2463
2617
  <fo:table-body>
2464
2618
 
2465
2619
  <xsl:variable name="total_rows" select="count(*)"/>
@@ -3040,6 +3194,18 @@
3040
3194
  </fo:block>
3041
3195
  </xsl:template>
3042
3196
 
3197
+ <xsl:template match="bipm:preferred">
3198
+ <fo:block font-weight="bold" keep-with-next="always" space-before="8pt" margin-bottom="6pt">
3199
+ <xsl:if test="ancestor::bipm:term/bipm:name">
3200
+ <fo:inline>
3201
+ <xsl:attribute name="padding-right">2mm</xsl:attribute>
3202
+ <xsl:apply-templates select="ancestor::bipm:term/bipm:name" mode="presentation"/>
3203
+ </fo:inline>
3204
+ </xsl:if>
3205
+ <xsl:apply-templates/>
3206
+ </fo:block>
3207
+ </xsl:template>
3208
+
3043
3209
  <xsl:template match="bipm:bibitem">
3044
3210
  <fo:block id="{@id}" margin-bottom="12pt" start-indent="25mm" text-indent="-25mm" line-height="115%">
3045
3211
  <xsl:if test=".//bipm:fn">
@@ -3258,7 +3424,7 @@
3258
3424
 
3259
3425
  <!-- set height for sup -->
3260
3426
  <!-- <xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1 and mathml:mtext and (mathml:mtext/text() != '' and mathml:mtext/text() != ' ' and mathml:mtext/text() != '&#xa0;')]/mathml:mtext" mode="mtext"> -->
3261
- <xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1]/*" mode="mathml" priority="2">
3427
+ <xsl:template match="mathml:msup[count(*) = 2 and count(mathml:mrow) = 2]/mathml:mrow[1][count(*) = 1 and not(mathml:mfenced)]/*" mode="mathml" priority="3">
3262
3428
  <xsl:copy>
3263
3429
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3264
3430
  </xsl:copy>
@@ -3283,8 +3449,94 @@
3283
3449
  </mathml:mstyle>
3284
3450
  </xsl:template>
3285
3451
 
3452
+ <!-- Decrease space between ()
3453
+ from:
3454
+ <mfenced open="(" close=")">
3455
+ <mrow>
3456
+ <mtext>Cu</mtext>
3457
+ </mrow>
3458
+ </mfenced>
3459
+ to:
3460
+ <mfenced open="(" close=")" separators="">
3461
+ <mathml:mo rspace="-0.35em"></mathml:mo>
3462
+ <mathml:mspace width="-0.15em"/>
3463
+ <mrow>
3464
+ <mtext>Cu</mtext>
3465
+ </mrow>
3466
+ <mathml:mspace width="-0.1em"/>
3467
+ </mfenced>
3468
+ -->
3469
+ <xsl:template match="mathml:mfenced[count(*) = 1]" mode="mathml" priority="2">
3470
+ <xsl:if test="preceding-sibling::*">
3471
+ <mathml:mo rspace="-0.35em"/><!-- decrease space before opening bracket -->
3472
+ </xsl:if>
3473
+ <xsl:copy>
3474
+ <xsl:apply-templates select="@*" mode="mathml"/>
3475
+ <xsl:if test="not(@separators)">
3476
+ <xsl:attribute name="separators"/>
3477
+ </xsl:if>
3478
+ <mathml:mspace width="-0.15em"/> <!-- decrease space between opening brackets and inside text-->
3479
+ <xsl:apply-templates mode="mathml"/>
3480
+ <mathml:mspace width="-0.1em"/> <!-- decrease space between inside text and closing brackets -->
3481
+ </xsl:copy>
3482
+ </xsl:template>
3483
+
3484
+ <!-- to:
3485
+ <mrow>
3486
+ <mtext>(Cu)</mtext>
3487
+ </mrow> -->
3488
+ <!-- <xsl:template match="mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 0]] |
3489
+ mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 1] and */*/*[count(*) = 0]]" mode="mathml" priority="2">
3490
+ <xsl:apply-templates mode="mathml"/>
3491
+ </xsl:template>
3492
+ <xsl:template match="mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0] |
3493
+ mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0]" mode="mathml" priority="2">
3494
+ <xsl:copy>
3495
+ <xsl:apply-templates select="@*" mode="mathml"/>
3496
+ <xsl:value-of select="ancestor::mathml:mfenced[1]/@open"/>
3497
+ <xsl:value-of select="."/>
3498
+ <xsl:value-of select="ancestor::mathml:mfenced[1]/@close"/>
3499
+ </xsl:copy>
3500
+ </xsl:template> -->
3501
+
3502
+ <!-- Decrease height of / and | -->
3503
+ <xsl:template match="mathml:mo[normalize-space(text()) = '/' or normalize-space(text()) = '|']" mode="mathml">
3504
+ <xsl:copy>
3505
+ <xsl:apply-templates select="@*" mode="mathml"/>
3506
+ <xsl:if test="not(@stretchy) and not(preceding-sibling::*[1][local-name() = 'mfrac'] and following-sibling::*[1][local-name() = 'mfrac'])">
3507
+ <xsl:attribute name="stretchy">false</xsl:attribute>
3508
+ </xsl:if>
3509
+ <xsl:apply-templates mode="mathml"/>
3510
+ </xsl:copy>
3511
+ </xsl:template>
3512
+
3513
+ <!-- Decrease a distance before and after of delta -->
3514
+ <xsl:template match="mathml:mo[normalize-space(text()) = 'Δ']" mode="mathml">
3515
+ <xsl:copy>
3516
+ <xsl:apply-templates select="@*" mode="mathml"/>
3517
+ <xsl:if test="not(@rspace)">
3518
+ <xsl:attribute name="rspace">0em</xsl:attribute>
3519
+ </xsl:if>
3520
+ <xsl:if test="not(@lspace) and (preceding-sibling::*[1][local-name() = 'mo'] or not(preceding-sibling::*))">
3521
+ <xsl:attribute name="lspace">0em</xsl:attribute>
3522
+ </xsl:if>
3523
+ <xsl:apply-templates mode="mathml"/>
3524
+ </xsl:copy>
3525
+ </xsl:template>
3526
+
3527
+ <xsl:template match="mathml:mi[string-length(normalize-space()) &gt; 1]" mode="mathml" priority="2">
3528
+ <xsl:if test="preceding-sibling::* and preceding-sibling::*[1][not(local-name() = 'mfenced' or local-name() = 'mo')]">
3529
+ <mathml:mspace width="0.3em"/>
3530
+ </xsl:if>
3531
+ <xsl:copy-of select="."/>
3532
+ <xsl:if test="following-sibling::* and following-sibling::*[1][not(local-name() = 'mfenced' or local-name() = 'mo')]">
3533
+ <mathml:mspace width="0.3em"/>
3534
+ </xsl:if>
3535
+ </xsl:template>
3536
+
3286
3537
  <xsl:template name="insertHeaderFooter">
3287
- <xsl:param name="header-title"/>
3538
+ <xsl:param name="header-title"/>
3539
+ <xsl:param name="orientation"/>
3288
3540
  <fo:static-content flow-name="header-odd">
3289
3541
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3290
3542
  <fo:block text-align="right">
@@ -3299,9 +3551,12 @@
3299
3551
  </fo:block>
3300
3552
  </fo:block-container>
3301
3553
  <fo:block-container font-size="1pt" border-top="0.5pt solid black" margin-left="81mm" width="86mm">
3302
- <fo:block> </fo:block>
3303
- </fo:block-container>
3304
- </fo:static-content>
3554
+ <xsl:if test="$orientation = 'landscape'">
3555
+ <xsl:attribute name="margin-left">168mm</xsl:attribute>
3556
+ </xsl:if>
3557
+ <fo:block> </fo:block>
3558
+ </fo:block-container>
3559
+ </fo:static-content>
3305
3560
  <fo:static-content flow-name="header-even">
3306
3561
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3307
3562
  <fo:block>
@@ -3409,7 +3664,12 @@
3409
3664
  <xsl:value-of select="concat($day, ' ', $monthStr, ' ', $year)"/>
3410
3665
  </xsl:when>
3411
3666
  <xsl:otherwise>
3412
- <xsl:value-of select="concat($monthStr, ' ', $day, ', ', $year)"/>
3667
+ <!-- <xsl:value-of select="concat($monthStr, ' ', $day, ', ', $year)"/> -->
3668
+ <xsl:value-of select="$monthStr"/>
3669
+ <xsl:text> </xsl:text>
3670
+ <xsl:value-of select="$day"/>
3671
+ <xsl:if test="$day != '' and $year != ''"><xsl:text>, </xsl:text></xsl:if>
3672
+ <xsl:value-of select="$year"/>
3413
3673
  </xsl:otherwise>
3414
3674
  </xsl:choose>
3415
3675
 
@@ -3454,127 +3714,10 @@
3454
3714
  <!-- Index processing -->
3455
3715
  <!-- =================== -->
3456
3716
 
3457
- <xsl:template match="@*|node()" mode="index_add_id">
3458
- <xsl:copy>
3459
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
3460
- </xsl:copy>
3461
- </xsl:template>
3462
-
3463
- <xsl:template match="bipm:xref" mode="index_add_id">
3464
- <xsl:variable name="id">
3465
- <xsl:call-template name="generateIndexXrefId"/>
3466
- </xsl:variable>
3467
- <xsl:copy> <!-- add id to xref -->
3468
- <xsl:apply-templates select="@*" mode="index_add_id"/>
3469
- <xsl:attribute name="id">
3470
- <xsl:value-of select="$id"/>
3471
- </xsl:attribute>
3472
- <xsl:apply-templates mode="index_add_id"/>
3473
- </xsl:copy>
3474
- <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
3475
- <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
3476
- <xsl:if test="@to">
3477
- <xsl:value-of select="$dash"/>
3478
- <xsl:copy>
3479
- <xsl:copy-of select="@*"/>
3480
- <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
3481
- <xsl:attribute name="id">
3482
- <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
3483
- </xsl:attribute>
3484
- <xsl:apply-templates mode="index_add_id"/>
3485
- </xsl:copy>
3486
- </xsl:if>
3487
- </xsl:template>
3488
-
3489
- <xsl:template match="@*|node()" mode="index_update">
3490
- <xsl:copy>
3491
- <xsl:apply-templates select="@*|node()" mode="index_update"/>
3492
- </xsl:copy>
3493
- </xsl:template>
3494
-
3495
- <xsl:template match="bipm:clause[@type = 'index']//bipm:li" mode="index_update">
3496
- <xsl:copy>
3497
- <xsl:apply-templates select="@*" mode="index_update"/>
3498
- <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
3499
- </xsl:copy>
3500
- </xsl:template>
3501
-
3502
- <xsl:template match="bipm:clause[@type = 'index']//bipm:li/node()" mode="process_li_element" priority="2">
3503
- <xsl:param name="element"/>
3504
- <xsl:param name="remove" select="'false'"/>
3505
- <!-- <node></node> -->
3506
- <xsl:choose>
3507
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
3508
- <!-- skip text (i.e. remove it) and process next element -->
3509
- <!-- [removed_<xsl:value-of select="."/>] -->
3510
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3511
- </xsl:when>
3512
- <xsl:when test="self::text()">
3513
- <xsl:value-of select="."/>
3514
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3515
- </xsl:when>
3516
- <xsl:when test="self::* and local-name(.) = 'xref'">
3517
- <xsl:variable name="id" select="@id"/>
3518
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
3519
- <xsl:variable name="id_next" select="following-sibling::bipm:xref[1]/@id"/>
3520
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
3521
-
3522
- <xsl:variable name="id_prev" select="preceding-sibling::bipm:xref[1]/@id"/>
3523
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
3524
-
3525
- <xsl:choose>
3526
- <!-- 2nd pass -->
3527
- <!-- if page is equal to page for next and page is not the end of range -->
3528
- <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
3529
- <!-- skip element (i.e. remove it) and remove next text ',' -->
3530
- <!-- [removed_xref] -->
3531
-
3532
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
3533
- <xsl:with-param name="remove">true</xsl:with-param>
3534
- </xsl:apply-templates>
3535
- </xsl:when>
3536
-
3537
- <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
3538
- <!-- remove xref -->
3539
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
3540
- <xsl:with-param name="remove">true</xsl:with-param>
3541
- </xsl:apply-templates>
3542
- </xsl:when>
3543
-
3544
- <xsl:otherwise>
3545
- <xsl:copy-of select="."/>
3546
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3547
- </xsl:otherwise>
3548
- </xsl:choose>
3549
- </xsl:when>
3550
- <xsl:when test="self::* and local-name(.) = 'ul'">
3551
- <!-- ul -->
3552
- <xsl:apply-templates select="." mode="index_update"/>
3553
- </xsl:when>
3554
- <xsl:otherwise>
3555
- <xsl:copy-of select="."/>
3556
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3557
- </xsl:otherwise>
3558
- </xsl:choose>
3559
- </xsl:template>
3560
-
3561
-
3562
- <xsl:template name="generateIndexXrefId">
3563
- <xsl:variable name="level" select="count(ancestor::bipm:ul)"/>
3564
- <!-- <xsl:variable name="parent_ul_id" select="generate-id(ancestor::bipm:ul[1])"/>
3565
- <xsl:variable name="item_number" select="count(ancestor::bipm:li[ancestor::bipm:ul[generate-id() = $parent_ul_id]])"/> -->
3566
- <xsl:variable name="docid">
3567
- <xsl:call-template name="getDocumentId"/>
3568
- </xsl:variable>
3569
- <xsl:variable name="item_number">
3570
- <xsl:number count="bipm:li[ancestor::bipm:clause[@type = 'index']]" level="any"/>
3571
- </xsl:variable>
3572
- <xsl:variable name="xref_number"><xsl:number count="bipm:xref"/></xsl:variable>
3573
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
3574
- </xsl:template>
3575
-
3576
- <xsl:template match="bipm:clause[@type = 'index']"/>
3577
- <xsl:template match="bipm:clause[@type = 'index']" mode="index">
3717
+ <!-- <xsl:template match="bipm:clause[@type = 'index']" /> -->
3718
+ <!-- <xsl:template match="bipm:clause[@type = 'index']" mode="index"> -->
3719
+ <xsl:template match="bipm:indexsect"/>
3720
+ <xsl:template match="bipm:indexsect" mode="index">
3578
3721
 
3579
3722
  <fo:page-sequence master-reference="index" force-page-count="no-force">
3580
3723
  <xsl:variable name="header-title">
@@ -3592,8 +3735,11 @@
3592
3735
  </xsl:call-template>
3593
3736
 
3594
3737
  <fo:flow flow-name="xsl-region-body">
3595
- <fo:block id="{@id}">
3596
- <xsl:apply-templates/>
3738
+ <fo:block id="{@id}" span="all">
3739
+ <xsl:apply-templates select="bipm:title"/>
3740
+ </fo:block>
3741
+ <fo:block>
3742
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
3597
3743
 
3598
3744
  <!-- TEST <xsl:variable name="alphabet" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
3599
3745
  <xsl:for-each select="(document('')//node())[position() &lt; 26]">
@@ -3616,42 +3762,25 @@
3616
3762
  </fo:page-sequence>
3617
3763
  </xsl:template>
3618
3764
 
3619
- <xsl:template match="bipm:clause[@type = 'index']/bipm:title" priority="4">
3620
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm" span="all">
3765
+ <!-- <xsl:template match="bipm:clause[@type = 'index']/bipm:title" priority="4"> -->
3766
+ <xsl:template match="bipm:indexsect/bipm:title" priority="4">
3767
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm">
3621
3768
  <!-- Index -->
3622
3769
  <xsl:apply-templates/>
3623
3770
  </fo:block>
3624
3771
  </xsl:template>
3772
+
3773
+ <!-- <xsl:template match="bipm:clause[@type = 'index']/bipm:clause/bipm:title" priority="4"> -->
3774
+ <xsl:template match="bipm:indexsect/bipm:clause/bipm:title" priority="4">
3775
+ <!-- Letter A, B, C, ... -->
3776
+ <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
3777
+ <xsl:apply-templates/>
3778
+ </fo:block>
3779
+ </xsl:template>
3625
3780
 
3626
- <xsl:template match="bipm:clause[@type = 'index']/bipm:clause" priority="4">
3627
- <xsl:apply-templates/>
3628
- <fo:block>
3629
- <xsl:if test="following-sibling::bipm:clause">
3630
- <fo:block> </fo:block>
3631
- </xsl:if>
3632
- </fo:block>
3633
- </xsl:template>
3634
-
3635
- <xsl:template match="bipm:clause[@type = 'index']/bipm:clause/bipm:title" priority="4">
3636
- <!-- Letter A, B, C, ... -->
3637
- <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
3638
- <xsl:apply-templates/>
3639
- </fo:block>
3640
- </xsl:template>
3641
-
3642
- <xsl:template match="bipm:clause[@type = 'index']//bipm:ul" priority="4">
3643
- <xsl:apply-templates/>
3644
- </xsl:template>
3645
-
3646
- <xsl:template match="bipm:clause[@type = 'index']//bipm:li" priority="4">
3647
- <xsl:variable name="level" select="count(ancestor::bipm:ul)"/>
3648
- <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
3649
- <xsl:apply-templates/>
3650
- </fo:block>
3651
- </xsl:template>
3652
-
3653
- <xsl:template match="bipm:bookmark">
3654
- <fo:inline id="{@id}"/>
3781
+
3782
+ <xsl:template match="*[local-name() = 'stem']/text()">
3783
+ <xsl:value-of select="normalize-space()"/>
3655
3784
  </xsl:template>
3656
3785
 
3657
3786
  <!-- =================== -->
@@ -4315,6 +4444,7 @@
4315
4444
 
4316
4445
 
4317
4446
 
4447
+
4318
4448
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
4319
4449
 
4320
4450
 
@@ -4422,6 +4552,7 @@
4422
4552
 
4423
4553
 
4424
4554
 
4555
+
4425
4556
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
4426
4557
 
4427
4558
 
@@ -4548,214 +4679,242 @@
4548
4679
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
4549
4680
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
4550
4681
  <xsl:call-template name="add-zero-spaces-java"/>
4551
- </xsl:template><xsl:template match="*[local-name()='table']">
4682
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
4552
4683
 
4553
- <xsl:variable name="simple-table">
4554
- <xsl:call-template name="getSimpleTable"/>
4555
- </xsl:variable>
4684
+ <xsl:variable name="table">
4556
4685
 
4557
-
4558
-
4559
-
4560
-
4561
- <!-- <xsl:if test="$namespace = 'bipm'">
4562
- <fo:block>&#xA0;</fo:block>
4563
- </xsl:if> -->
4564
-
4565
- <!-- $namespace = 'iso' or -->
4566
-
4567
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4568
-
4569
-
4570
-
4571
- <xsl:call-template name="fn_name_display"/>
4686
+ <xsl:variable name="simple-table">
4687
+ <xsl:call-template name="getSimpleTable"/>
4688
+ </xsl:variable>
4572
4689
 
4573
4690
 
4574
-
4575
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
4576
-
4577
- <!-- <xsl:variable name="cols-count">
4578
- <xsl:choose>
4579
- <xsl:when test="*[local-name()='thead']">
4580
- <xsl:call-template name="calculate-columns-numbers">
4581
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
4582
- </xsl:call-template>
4583
- </xsl:when>
4584
- <xsl:otherwise>
4585
- <xsl:call-template name="calculate-columns-numbers">
4586
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
4587
- </xsl:call-template>
4588
- </xsl:otherwise>
4589
- </xsl:choose>
4590
- </xsl:variable> -->
4591
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
4592
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
4593
-
4594
-
4595
-
4596
- <xsl:variable name="colwidths">
4597
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
4598
- <xsl:call-template name="calculate-column-widths">
4599
- <xsl:with-param name="cols-count" select="$cols-count"/>
4600
- <xsl:with-param name="table" select="$simple-table"/>
4601
- </xsl:call-template>
4602
- </xsl:if>
4603
- </xsl:variable>
4604
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4605
-
4606
- <!-- <xsl:variable name="colwidths2">
4607
- <xsl:call-template name="calculate-column-widths">
4608
- <xsl:with-param name="cols-count" select="$cols-count"/>
4609
- </xsl:call-template>
4610
- </xsl:variable> -->
4611
-
4612
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
4613
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
4614
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
4615
-
4616
- <xsl:variable name="margin-left">
4617
- <xsl:choose>
4618
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
4619
- <xsl:otherwise>0</xsl:otherwise>
4620
- </xsl:choose>
4621
- </xsl:variable>
4622
-
4623
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
4624
4691
 
4625
4692
 
4626
-
4627
-
4628
-
4629
4693
 
4694
+ <!-- <xsl:if test="$namespace = 'bipm'">
4695
+ <fo:block>&#xA0;</fo:block>
4696
+ </xsl:if> -->
4630
4697
 
4631
-
4698
+ <!-- $namespace = 'iso' or -->
4632
4699
 
4700
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4633
4701
 
4702
+
4634
4703
 
4704
+ <xsl:call-template name="fn_name_display"/>
4635
4705
 
4706
+
4636
4707
 
4637
- <xsl:attribute name="space-after">12pt</xsl:attribute>
4638
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
4639
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
4640
- <xsl:if test="not(ancestor::*[local-name()='note_side'])">
4641
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4642
- </xsl:if>
4643
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4644
- <xsl:if test="@parent-type = 'quote'">
4645
- <xsl:attribute name="font-family">Arial</xsl:attribute>
4646
- <xsl:attribute name="font-size">9pt</xsl:attribute>
4708
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
4709
+
4710
+ <!-- <xsl:variable name="cols-count">
4711
+ <xsl:choose>
4712
+ <xsl:when test="*[local-name()='thead']">
4713
+ <xsl:call-template name="calculate-columns-numbers">
4714
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
4715
+ </xsl:call-template>
4716
+ </xsl:when>
4717
+ <xsl:otherwise>
4718
+ <xsl:call-template name="calculate-columns-numbers">
4719
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
4720
+ </xsl:call-template>
4721
+ </xsl:otherwise>
4722
+ </xsl:choose>
4723
+ </xsl:variable> -->
4724
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
4725
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
4726
+
4727
+
4728
+
4729
+ <xsl:variable name="colwidths">
4730
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
4731
+ <xsl:call-template name="calculate-column-widths">
4732
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4733
+ <xsl:with-param name="table" select="$simple-table"/>
4734
+ </xsl:call-template>
4647
4735
  </xsl:if>
4736
+ </xsl:variable>
4737
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4648
4738
 
4739
+ <!-- <xsl:variable name="colwidths2">
4740
+ <xsl:call-template name="calculate-column-widths">
4741
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4742
+ </xsl:call-template>
4743
+ </xsl:variable> -->
4649
4744
 
4745
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
4746
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
4747
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
4650
4748
 
4651
- <xsl:variable name="table_attributes">
4652
- <attribute name="table-layout">fixed</attribute>
4653
- <attribute name="width">
4654
- <xsl:choose>
4655
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
4656
- <xsl:otherwise>100%</xsl:otherwise>
4657
- </xsl:choose>
4658
- </attribute>
4659
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
4660
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
4749
+ <xsl:variable name="margin-left">
4750
+ <xsl:choose>
4751
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
4752
+ <xsl:otherwise>0</xsl:otherwise>
4753
+ </xsl:choose>
4754
+ </xsl:variable>
4755
+
4756
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
4661
4757
 
4662
4758
 
4759
+
4760
+
4761
+
4663
4762
 
4664
4763
 
4665
-
4666
-
4667
-
4764
+
4668
4765
 
4669
-
4670
-
4671
- <xsl:if test="not(ancestor::*[local-name()='preface']) and not(ancestor::*[local-name()='note_side']) and not(ancestor::*[local-name() = 'annex'] and .//*[local-name() = 'xref'][@pagenumber])">
4672
- <attribute name="border-top">0.5pt solid black</attribute>
4673
- <attribute name="border-bottom">0.5pt solid black</attribute>
4674
- </xsl:if>
4675
- <attribute name="margin-left">0mm</attribute>
4676
- <attribute name="margin-right">0mm</attribute>
4677
4766
 
4678
- </xsl:variable>
4679
-
4680
-
4681
- <fo:table id="{@id}" table-omit-footer-at-break="true">
4682
4767
 
4683
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
4684
- <xsl:attribute name="{@name}">
4685
- <xsl:value-of select="."/>
4686
- </xsl:attribute>
4687
- </xsl:for-each>
4688
4768
 
4689
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
4690
- <xsl:if test="$isNoteOrFnExist = 'true'">
4691
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4692
- </xsl:if>
4693
4769
 
4694
- <xsl:choose>
4695
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
4696
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
4697
- <fo:table-column column-width="{@width}"/>
4698
- </xsl:for-each>
4699
- </xsl:when>
4700
- <xsl:otherwise>
4701
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4702
- <xsl:choose>
4703
- <xsl:when test=". = 1 or . = 0">
4704
- <fo:table-column column-width="proportional-column-width(2)"/>
4705
- </xsl:when>
4706
- <xsl:otherwise>
4707
- <fo:table-column column-width="proportional-column-width({.})"/>
4708
- </xsl:otherwise>
4709
- </xsl:choose>
4710
- </xsl:for-each>
4711
- </xsl:otherwise>
4712
- </xsl:choose>
4770
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
4771
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
4772
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
4773
+ <xsl:if test="not(ancestor::*[local-name()='note_side'])">
4774
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4775
+ </xsl:if>
4776
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4777
+ <xsl:if test="@parent-type = 'quote'">
4778
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
4779
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
4780
+ </xsl:if>
4713
4781
 
4714
- <xsl:choose>
4715
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
4716
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4717
- </xsl:when>
4718
- <xsl:otherwise>
4719
- <xsl:apply-templates/>
4720
- </xsl:otherwise>
4721
- </xsl:choose>
4722
4782
 
4723
- </fo:table>
4724
-
4725
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
4726
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4727
- <xsl:call-template name="insertTableFooterInSeparateTable">
4728
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
4729
- <xsl:with-param name="colwidths" select="$colwidths"/>
4730
- <xsl:with-param name="colgroup" select="$colgroup"/>
4731
- </xsl:call-template>
4732
- </xsl:for-each>
4733
-
4734
- <!-- insert footer as table -->
4735
- <!-- <fo:table>
4736
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
4737
- <xsl:attribute name="{@name}">
4738
- <xsl:value-of select="."/>
4739
- </xsl:attribute>
4740
- </xsl:for-each>
4783
+ <xsl:variable name="table_width">
4784
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
4785
+
4786
+
4787
+
4788
+ <xsl:choose>
4789
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
4790
+ <xsl:otherwise>100%</xsl:otherwise>
4791
+ </xsl:choose>
4792
+
4793
+ </xsl:variable>
4741
4794
 
4742
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4795
+ <xsl:variable name="table_attributes">
4796
+ <attribute name="table-layout">fixed</attribute>
4797
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
4798
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
4799
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
4800
+
4801
+
4802
+
4803
+
4804
+
4805
+
4806
+
4807
+
4808
+
4809
+
4810
+ <xsl:if test="not(ancestor::*[local-name()='preface']) and not(ancestor::*[local-name()='note_side']) and not(ancestor::*[local-name() = 'annex'] and .//*[local-name() = 'xref'][@pagenumber]) and not(ancestor::*[local-name() = 'doccontrol'])">
4811
+ <attribute name="border-top">0.5pt solid black</attribute>
4812
+ <attribute name="border-bottom">0.5pt solid black</attribute>
4813
+ </xsl:if>
4814
+ <attribute name="margin-left">0mm</attribute>
4815
+ <attribute name="margin-right">0mm</attribute>
4816
+
4817
+ </xsl:variable>
4818
+
4819
+
4820
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
4821
+
4822
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
4823
+ <xsl:attribute name="{@name}">
4824
+ <xsl:value-of select="."/>
4825
+ </xsl:attribute>
4826
+ </xsl:for-each>
4827
+
4828
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
4829
+ <xsl:if test="$isNoteOrFnExist = 'true'">
4830
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4831
+ </xsl:if>
4832
+
4833
+ <xsl:choose>
4834
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
4835
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
4836
+ <fo:table-column column-width="{@width}"/>
4837
+ </xsl:for-each>
4838
+ </xsl:when>
4839
+ <xsl:otherwise>
4840
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4841
+ <xsl:choose>
4842
+ <xsl:when test=". = 1 or . = 0">
4843
+ <fo:table-column column-width="proportional-column-width(2)"/>
4844
+ </xsl:when>
4845
+ <xsl:otherwise>
4846
+ <fo:table-column column-width="proportional-column-width({.})"/>
4847
+ </xsl:otherwise>
4848
+ </xsl:choose>
4849
+ </xsl:for-each>
4850
+ </xsl:otherwise>
4851
+ </xsl:choose>
4852
+
4743
4853
  <xsl:choose>
4744
- <xsl:when test=". = 1 or . = 0">
4745
- <fo:table-column column-width="proportional-column-width(2)"/>
4854
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
4855
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4746
4856
  </xsl:when>
4747
4857
  <xsl:otherwise>
4748
- <fo:table-column column-width="proportional-column-width({.})"/>
4858
+ <xsl:apply-templates/>
4749
4859
  </xsl:otherwise>
4750
4860
  </xsl:choose>
4861
+
4862
+ </fo:table>
4863
+
4864
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
4865
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4866
+ <xsl:call-template name="insertTableFooterInSeparateTable">
4867
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
4868
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4869
+ <xsl:with-param name="colgroup" select="$colgroup"/>
4870
+ </xsl:call-template>
4751
4871
  </xsl:for-each>
4752
- </fo:table>-->
4753
-
4754
-
4755
-
4756
-
4757
-
4758
- </fo:block-container>
4872
+
4873
+ <!-- insert footer as table -->
4874
+ <!-- <fo:table>
4875
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
4876
+ <xsl:attribute name="{@name}">
4877
+ <xsl:value-of select="."/>
4878
+ </xsl:attribute>
4879
+ </xsl:for-each>
4880
+
4881
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4882
+ <xsl:choose>
4883
+ <xsl:when test=". = 1 or . = 0">
4884
+ <fo:table-column column-width="proportional-column-width(2)"/>
4885
+ </xsl:when>
4886
+ <xsl:otherwise>
4887
+ <fo:table-column column-width="proportional-column-width({.})"/>
4888
+ </xsl:otherwise>
4889
+ </xsl:choose>
4890
+ </xsl:for-each>
4891
+ </fo:table>-->
4892
+
4893
+
4894
+
4895
+
4896
+
4897
+ </fo:block-container>
4898
+ </xsl:variable>
4899
+
4900
+
4901
+
4902
+ <xsl:choose>
4903
+ <xsl:when test="@width">
4904
+
4905
+ <!-- centered table when table name is centered (see table-name-style) -->
4906
+
4907
+
4908
+
4909
+ <xsl:copy-of select="$table"/>
4910
+
4911
+
4912
+ </xsl:when>
4913
+ <xsl:otherwise>
4914
+ <xsl:copy-of select="$table"/>
4915
+ </xsl:otherwise>
4916
+ </xsl:choose>
4917
+
4759
4918
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
4760
4919
  <xsl:if test="normalize-space() != ''">
4761
4920
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -4764,6 +4923,9 @@
4764
4923
  <xsl:if test="not(*[local-name()='tab'])"> <!-- table without number -->
4765
4924
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
4766
4925
  </xsl:if>
4926
+ <xsl:if test="not(../preceding-sibling::*) and ancestor::node()[@orientation]">
4927
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
4928
+ </xsl:if>
4767
4929
 
4768
4930
  <xsl:apply-templates/>
4769
4931
  </fo:block>
@@ -4887,7 +5049,15 @@
4887
5049
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
4888
5050
  <xsl:value-of select="@target"/>
4889
5051
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
4890
- <xsl:variable name="math_text" select="normalize-space(.)"/>
5052
+ <xsl:variable name="mathml">
5053
+ <xsl:for-each select="*">
5054
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
5055
+ <xsl:copy-of select="."/>
5056
+ </xsl:if>
5057
+ </xsl:for-each>
5058
+ </xsl:variable>
5059
+
5060
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
4891
5061
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
4892
5062
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
4893
5063
  <xsl:param name="cols-count"/>
@@ -5192,10 +5362,21 @@
5192
5362
  <xsl:attribute name="border-bottom">solid black 0.5pt</xsl:attribute>
5193
5363
  <xsl:attribute name="height">8mm</xsl:attribute>
5194
5364
  <xsl:attribute name="padding-top">2mm</xsl:attribute>
5195
- <xsl:if test="ancestor::*[local-name() = 'annex'] and ancestor::*[local-name() = 'table']//*[local-name() = 'xref'][@pagenumber]"><!-- for Annex ToC -->
5365
+ <xsl:if test="(ancestor::*[local-name() = 'annex'] and ancestor::*[local-name() = 'table']//*[local-name() = 'xref'][@pagenumber]) or ancestor::*[local-name() = 'doccontrol']"><!-- for Annex ToC -->
5196
5366
  <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
5197
5367
  <xsl:attribute name="border-bottom">solid black 0pt</xsl:attribute>
5198
5368
  </xsl:if>
5369
+ <xsl:if test="ancestor::*[local-name() = 'doccontrol']">
5370
+ <xsl:attribute name="text-align">
5371
+ <xsl:choose>
5372
+ <xsl:when test="@align">
5373
+ <xsl:value-of select="@align"/>
5374
+ </xsl:when>
5375
+ <xsl:otherwise>left</xsl:otherwise>
5376
+ </xsl:choose>
5377
+ </xsl:attribute>
5378
+ <xsl:attribute name="display-align">before</xsl:attribute>
5379
+ </xsl:if>
5199
5380
 
5200
5381
  <xsl:if test="@colspan">
5201
5382
  <xsl:attribute name="number-columns-spanned">
@@ -5252,6 +5433,9 @@
5252
5433
  <xsl:if test="not(ancestor::*[local-name()='tr']/following-sibling::*[local-name()='tr'])"> <!-- last row -->
5253
5434
  <xsl:attribute name="padding-bottom">2mm</xsl:attribute>
5254
5435
  </xsl:if>
5436
+ <xsl:if test="ancestor::*[local-name() = 'doccontrol']">
5437
+ <xsl:attribute name="display-align">before</xsl:attribute>
5438
+ </xsl:if>
5255
5439
 
5256
5440
  <xsl:if test="@colspan">
5257
5441
  <xsl:attribute name="number-columns-spanned">
@@ -5656,7 +5840,7 @@
5656
5840
  <xsl:with-param name="table" select="$html-table"/>
5657
5841
  </xsl:call-template>
5658
5842
  </xsl:variable>
5659
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
5843
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
5660
5844
  <xsl:variable name="maxlength_dt">
5661
5845
  <xsl:call-template name="getMaxLength_dt"/>
5662
5846
  </xsl:variable>
@@ -5685,13 +5869,22 @@
5685
5869
  </xsl:when>
5686
5870
  <xsl:otherwise>
5687
5871
  <xsl:choose>
5872
+ <!-- to set width check most wide chars like `W` -->
5688
5873
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
5689
- <fo:table-column column-width="5%"/>
5690
- <fo:table-column column-width="95%"/>
5874
+ <fo:table-column column-width="7%"/>
5875
+ <fo:table-column column-width="93%"/>
5691
5876
  </xsl:when>
5692
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
5693
- <fo:table-column column-width="10%"/>
5694
- <fo:table-column column-width="90%"/>
5877
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
5878
+ <fo:table-column column-width="15%"/>
5879
+ <fo:table-column column-width="85%"/>
5880
+ </xsl:when>
5881
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
5882
+ <fo:table-column column-width="20%"/>
5883
+ <fo:table-column column-width="80%"/>
5884
+ </xsl:when>
5885
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
5886
+ <fo:table-column column-width="25%"/>
5887
+ <fo:table-column column-width="75%"/>
5695
5888
  </xsl:when>
5696
5889
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
5697
5890
  <fo:table-column column-width="60%"/>
@@ -5890,6 +6083,7 @@
5890
6083
 
5891
6084
 
5892
6085
 
6086
+
5893
6087
 
5894
6088
  </xsl:variable>
5895
6089
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -5911,6 +6105,10 @@
5911
6105
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
5912
6106
  <xsl:apply-templates/>
5913
6107
  </fo:inline>
6108
+ </xsl:template><xsl:template match="*[local-name()='hi']">
6109
+ <fo:inline background-color="yellow">
6110
+ <xsl:apply-templates/>
6111
+ </fo:inline>
5914
6112
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5915
6113
  <xsl:variable name="text" select="normalize-space(.)"/>
5916
6114
  <fo:inline font-size="75%">
@@ -6000,6 +6198,10 @@
6000
6198
  <xsl:param name="text" select="."/>
6001
6199
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
6002
6200
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
6201
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
6202
+ <xsl:param name="text" select="."/>
6203
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
6204
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
6003
6205
  </xsl:template><xsl:template name="add-zero-spaces">
6004
6206
  <xsl:param name="text" select="."/>
6005
6207
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -6251,6 +6453,14 @@
6251
6453
  <xsl:apply-templates select="." mode="mathml"/>
6252
6454
  </xsl:variable>
6253
6455
  <fo:instream-foreign-object fox:alt-text="Math">
6456
+
6457
+ <xsl:if test="local-name(../..) = 'formula'">
6458
+ <xsl:attribute name="width">95%</xsl:attribute>
6459
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6460
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6461
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6462
+ </xsl:if>
6463
+
6254
6464
  <!-- <xsl:copy-of select="."/> -->
6255
6465
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
6256
6466
  </fo:instream-foreign-object>
@@ -6264,7 +6474,12 @@
6264
6474
  <!-- replace start and end spaces to non-break space -->
6265
6475
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
6266
6476
  </xsl:copy>
6267
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
6477
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
6478
+ <xsl:copy>
6479
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
6480
+ </xsl:copy>
6481
+ <mathml:mspace width="0.5ex"/>
6482
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
6268
6483
  <xsl:variable name="target">
6269
6484
  <xsl:choose>
6270
6485
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -6285,7 +6500,10 @@
6285
6500
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
6286
6501
  <xsl:choose>
6287
6502
  <xsl:when test="normalize-space(.) = ''">
6288
- <xsl:value-of select="$target"/>
6503
+ <!-- <xsl:value-of select="$target"/> -->
6504
+ <xsl:call-template name="add-zero-spaces-link-java">
6505
+ <xsl:with-param name="text" select="$target"/>
6506
+ </xsl:call-template>
6289
6507
  </xsl:when>
6290
6508
  <xsl:otherwise>
6291
6509
  <xsl:apply-templates/>
@@ -6295,8 +6513,6 @@
6295
6513
  </xsl:otherwise>
6296
6514
  </xsl:choose>
6297
6515
  </fo:inline>
6298
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
6299
- <fo:inline id="{@id}"/>
6300
6516
  </xsl:template><xsl:template match="*[local-name()='appendix']">
6301
6517
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
6302
6518
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -6498,7 +6714,7 @@
6498
6714
  </xsl:if> -->
6499
6715
  </fo:inline>
6500
6716
  </xsl:if>
6501
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
6717
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
6502
6718
  <fo:block-container id="{@id}">
6503
6719
 
6504
6720
  <xsl:if test="*[local-name() = 'name']">
@@ -6518,6 +6734,7 @@
6518
6734
  <fo:block id="{@id}">
6519
6735
  <xsl:apply-templates/>
6520
6736
  </fo:block>
6737
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
6521
6738
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
6522
6739
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
6523
6740
  <xsl:apply-templates/>
@@ -6723,6 +6940,12 @@
6723
6940
  <!-- <xsl:text> </xsl:text> -->
6724
6941
  </xsl:template><xsl:template name="getSection">
6725
6942
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
6943
+ <!--
6944
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
6945
+ <xsl:value-of select="."/>
6946
+ </xsl:for-each>
6947
+ -->
6948
+
6726
6949
  </xsl:template><xsl:template name="getName">
6727
6950
  <xsl:choose>
6728
6951
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -6775,6 +6998,12 @@
6775
6998
  <xsl:copy>
6776
6999
  <xsl:apply-templates mode="contents_item"/>
6777
7000
  </xsl:copy>
7001
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
7002
+ <xsl:copy>
7003
+ <xsl:apply-templates mode="contents_item"/>
7004
+ </xsl:copy>
7005
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7006
+ <xsl:copy-of select="."/>
6778
7007
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
6779
7008
  <xsl:text> </xsl:text>
6780
7009
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -6800,6 +7029,7 @@
6800
7029
 
6801
7030
 
6802
7031
 
7032
+
6803
7033
 
6804
7034
 
6805
7035
 
@@ -7102,10 +7332,11 @@
7102
7332
  </xsl:choose>
7103
7333
 
7104
7334
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
7105
-
7335
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
7106
7336
  <xsl:variable name="element">
7107
7337
  block
7108
7338
 
7339
+
7109
7340
  </xsl:variable>
7110
7341
  <xsl:choose>
7111
7342
  <xsl:when test="normalize-space($element) = 'block'">
@@ -7180,11 +7411,13 @@
7180
7411
  </xsl:if>
7181
7412
  </xsl:if>
7182
7413
 
7414
+
7183
7415
  <fo:block-container margin-left="0mm">
7184
7416
 
7185
7417
  <fo:block xsl:use-attribute-sets="quote-style">
7186
7418
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
7187
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
7419
+
7420
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
7188
7421
  </fo:block>
7189
7422
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
7190
7423
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -7207,32 +7440,50 @@
7207
7440
  <xsl:text>— </xsl:text>
7208
7441
  <xsl:apply-templates/>
7209
7442
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
7210
- <fo:inline xsl:use-attribute-sets="eref-style">
7211
- <xsl:if test="@type = 'footnote'">
7212
-
7213
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7214
- <xsl:attribute name="font-size">80%</xsl:attribute>
7215
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
7216
- <xsl:attribute name="vertical-align">super</xsl:attribute>
7217
-
7218
-
7219
- </xsl:if>
7220
-
7221
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7222
-
7223
- <xsl:if test="@type = 'inline'">
7224
-
7225
- <xsl:attribute name="color">blue</xsl:attribute>
7226
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
7227
-
7228
-
7229
-
7230
- </xsl:if>
7231
-
7232
-
7233
- <xsl:apply-templates/>
7234
- </fo:basic-link>
7235
- </fo:inline>
7443
+
7444
+ <xsl:variable name="bibitemid">
7445
+ <xsl:choose>
7446
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
7447
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
7448
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
7449
+ </xsl:choose>
7450
+ </xsl:variable>
7451
+
7452
+ <xsl:choose>
7453
+ <xsl:when test="normalize-space($bibitemid) != ''">
7454
+ <fo:inline xsl:use-attribute-sets="eref-style">
7455
+ <xsl:if test="@type = 'footnote'">
7456
+
7457
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7458
+ <xsl:attribute name="font-size">80%</xsl:attribute>
7459
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
7460
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
7461
+
7462
+
7463
+ </xsl:if>
7464
+
7465
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7466
+ <xsl:if test="normalize-space(@citeas) = ''">
7467
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
7468
+ </xsl:if>
7469
+ <xsl:if test="@type = 'inline'">
7470
+
7471
+ <xsl:attribute name="color">blue</xsl:attribute>
7472
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
7473
+
7474
+
7475
+
7476
+ </xsl:if>
7477
+
7478
+ <xsl:apply-templates/>
7479
+ </fo:basic-link>
7480
+
7481
+ </fo:inline>
7482
+ </xsl:when>
7483
+ <xsl:otherwise>
7484
+ <fo:inline><xsl:apply-templates/></fo:inline>
7485
+ </xsl:otherwise>
7486
+ </xsl:choose>
7236
7487
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
7237
7488
  <!-- zero-space char -->
7238
7489
  <xsl:variable name="depth">
@@ -7338,6 +7589,7 @@
7338
7589
 
7339
7590
 
7340
7591
 
7592
+
7341
7593
 
7342
7594
 
7343
7595
 
@@ -7349,7 +7601,7 @@
7349
7601
 
7350
7602
 
7351
7603
 
7352
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
7604
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
7353
7605
  <fo:block break-after="page"/>
7354
7606
  <fo:block>
7355
7607
  <xsl:call-template name="setId"/>
@@ -7357,10 +7609,11 @@
7357
7609
  </fo:block>
7358
7610
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
7359
7611
  <fo:block>
7360
- <xsl:call-template name="setId"/>
7612
+ <xsl:call-template name="setId"/>
7361
7613
 
7362
7614
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
7363
7615
 
7616
+
7364
7617
  <xsl:apply-templates/>
7365
7618
  </fo:block>
7366
7619
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -7412,6 +7665,153 @@
7412
7665
  </fo:block>
7413
7666
  </xsl:otherwise>
7414
7667
  </xsl:choose>
7668
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
7669
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
7670
+ <bookmark><xsl:value-of select="@id"/></bookmark>
7671
+ </xsl:for-each>
7672
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
7673
+ <xsl:copy>
7674
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
7675
+ </xsl:copy>
7676
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
7677
+ <xsl:variable name="id">
7678
+ <xsl:call-template name="generateIndexXrefId"/>
7679
+ </xsl:variable>
7680
+ <xsl:copy> <!-- add id to xref -->
7681
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
7682
+ <xsl:attribute name="id">
7683
+ <xsl:value-of select="$id"/>
7684
+ </xsl:attribute>
7685
+ <xsl:apply-templates mode="index_add_id"/>
7686
+ </xsl:copy>
7687
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
7688
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
7689
+ <xsl:if test="@to">
7690
+ <xsl:value-of select="$dash"/>
7691
+ <xsl:copy>
7692
+ <xsl:copy-of select="@*"/>
7693
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
7694
+ <xsl:attribute name="id">
7695
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
7696
+ </xsl:attribute>
7697
+ <xsl:apply-templates mode="index_add_id"/>
7698
+ </xsl:copy>
7699
+ </xsl:if>
7700
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
7701
+ <xsl:copy>
7702
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
7703
+ </xsl:copy>
7704
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
7705
+ <xsl:copy>
7706
+ <xsl:apply-templates select="@*" mode="index_update"/>
7707
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
7708
+ </xsl:copy>
7709
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
7710
+ <xsl:param name="element"/>
7711
+ <xsl:param name="remove" select="'false'"/>
7712
+ <xsl:param name="target"/>
7713
+ <!-- <node></node> -->
7714
+ <xsl:choose>
7715
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
7716
+ <!-- skip text (i.e. remove it) and process next element -->
7717
+ <!-- [removed_<xsl:value-of select="."/>] -->
7718
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
7719
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
7720
+ </xsl:apply-templates>
7721
+ </xsl:when>
7722
+ <xsl:when test="self::text()">
7723
+ <xsl:value-of select="."/>
7724
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
7725
+ </xsl:when>
7726
+ <xsl:when test="self::* and local-name(.) = 'xref'">
7727
+ <xsl:variable name="id" select="@id"/>
7728
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
7729
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
7730
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
7731
+
7732
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
7733
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
7734
+
7735
+ <xsl:choose>
7736
+ <!-- 2nd pass -->
7737
+ <!-- if page is equal to page for next and page is not the end of range -->
7738
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
7739
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
7740
+ <!-- [removed_xref] -->
7741
+
7742
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
7743
+ <xsl:with-param name="remove">true</xsl:with-param>
7744
+ <xsl:with-param name="target">
7745
+ <xsl:choose>
7746
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
7747
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
7748
+ </xsl:choose>
7749
+ </xsl:with-param>
7750
+ </xsl:apply-templates>
7751
+ </xsl:when>
7752
+
7753
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
7754
+ <!-- remove xref -->
7755
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
7756
+ <xsl:with-param name="remove">true</xsl:with-param>
7757
+ </xsl:apply-templates>
7758
+ </xsl:when>
7759
+
7760
+ <xsl:otherwise>
7761
+ <xsl:apply-templates select="." mode="xref_copy">
7762
+ <xsl:with-param name="target" select="$target"/>
7763
+ </xsl:apply-templates>
7764
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
7765
+ </xsl:otherwise>
7766
+ </xsl:choose>
7767
+ </xsl:when>
7768
+ <xsl:when test="self::* and local-name(.) = 'ul'">
7769
+ <!-- ul -->
7770
+ <xsl:apply-templates select="." mode="index_update"/>
7771
+ </xsl:when>
7772
+ <xsl:otherwise>
7773
+ <xsl:apply-templates select="." mode="xref_copy">
7774
+ <xsl:with-param name="target" select="$target"/>
7775
+ </xsl:apply-templates>
7776
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
7777
+ </xsl:otherwise>
7778
+ </xsl:choose>
7779
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
7780
+ <xsl:param name="target"/>
7781
+ <xsl:copy>
7782
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
7783
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
7784
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
7785
+ </xsl:if>
7786
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
7787
+ </xsl:copy>
7788
+ </xsl:template><xsl:template name="generateIndexXrefId">
7789
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
7790
+
7791
+ <xsl:variable name="docid">
7792
+ <xsl:call-template name="getDocumentId"/>
7793
+ </xsl:variable>
7794
+ <xsl:variable name="item_number">
7795
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
7796
+ </xsl:variable>
7797
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
7798
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
7799
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
7800
+ <xsl:apply-templates/>
7801
+ <fo:block>
7802
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
7803
+ <fo:block> </fo:block>
7804
+ </xsl:if>
7805
+ </fo:block>
7806
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
7807
+ <xsl:apply-templates/>
7808
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
7809
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
7810
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
7811
+ <xsl:apply-templates/>
7812
+ </fo:block>
7813
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
7814
+ <fo:inline id="{@id}" font-size="1pt"/>
7415
7815
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
7416
7816
  <!-- <row>
7417
7817
  <date>05-07-2013</date>
@@ -7561,6 +7961,57 @@
7561
7961
  </xsl:variable>
7562
7962
  <xsl:variable name="result">
7563
7963
  <xsl:choose>
7964
+ <xsl:when test="$format = 'ddMMyyyy'">
7965
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7966
+ <xsl:text> </xsl:text>
7967
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
7968
+ </xsl:when>
7969
+ <xsl:when test="$format = 'ddMM'">
7970
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7971
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
7972
+ </xsl:when>
7973
+ <xsl:when test="$format = 'short' or $day = ''">
7974
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
7975
+ </xsl:when>
7976
+ <xsl:otherwise>
7977
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
7978
+ </xsl:otherwise>
7979
+ </xsl:choose>
7980
+ </xsl:variable>
7981
+ <xsl:value-of select="$result"/>
7982
+ </xsl:template><xsl:template name="convertDateLocalized">
7983
+ <xsl:param name="date"/>
7984
+ <xsl:param name="format" select="'short'"/>
7985
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
7986
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
7987
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
7988
+ <xsl:variable name="monthStr">
7989
+ <xsl:choose>
7990
+ <xsl:when test="$month = '01'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_january</xsl:with-param></xsl:call-template></xsl:when>
7991
+ <xsl:when test="$month = '02'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_february</xsl:with-param></xsl:call-template></xsl:when>
7992
+ <xsl:when test="$month = '03'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_march</xsl:with-param></xsl:call-template></xsl:when>
7993
+ <xsl:when test="$month = '04'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_april</xsl:with-param></xsl:call-template></xsl:when>
7994
+ <xsl:when test="$month = '05'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_may</xsl:with-param></xsl:call-template></xsl:when>
7995
+ <xsl:when test="$month = '06'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_june</xsl:with-param></xsl:call-template></xsl:when>
7996
+ <xsl:when test="$month = '07'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_july</xsl:with-param></xsl:call-template></xsl:when>
7997
+ <xsl:when test="$month = '08'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_august</xsl:with-param></xsl:call-template></xsl:when>
7998
+ <xsl:when test="$month = '09'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_september</xsl:with-param></xsl:call-template></xsl:when>
7999
+ <xsl:when test="$month = '10'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_october</xsl:with-param></xsl:call-template></xsl:when>
8000
+ <xsl:when test="$month = '11'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_november</xsl:with-param></xsl:call-template></xsl:when>
8001
+ <xsl:when test="$month = '12'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_december</xsl:with-param></xsl:call-template></xsl:when>
8002
+ </xsl:choose>
8003
+ </xsl:variable>
8004
+ <xsl:variable name="result">
8005
+ <xsl:choose>
8006
+ <xsl:when test="$format = 'ddMMyyyy'">
8007
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
8008
+ <xsl:text> </xsl:text>
8009
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
8010
+ </xsl:when>
8011
+ <xsl:when test="$format = 'ddMM'">
8012
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
8013
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
8014
+ </xsl:when>
7564
8015
  <xsl:when test="$format = 'short' or $day = ''">
7565
8016
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
7566
8017
  </xsl:when>
@@ -7576,7 +8027,7 @@
7576
8027
  <xsl:param name="charDelim" select="', '"/>
7577
8028
  <xsl:choose>
7578
8029
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
7579
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
8030
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
7580
8031
  <xsl:sort data-type="text" order="ascending"/>
7581
8032
  <xsl:call-template name="insertKeyword">
7582
8033
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -7585,7 +8036,7 @@
7585
8036
  </xsl:for-each>
7586
8037
  </xsl:when>
7587
8038
  <xsl:otherwise>
7588
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
8039
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
7589
8040
  <xsl:call-template name="insertKeyword">
7590
8041
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
7591
8042
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -7602,65 +8053,71 @@
7602
8053
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
7603
8054
  </xsl:choose>
7604
8055
  </xsl:template><xsl:template name="addPDFUAmeta">
7605
- <fo:declarations>
7606
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
7607
- <pdf:dictionary type="normal" key="ViewerPreferences">
7608
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
7609
- </pdf:dictionary>
7610
- </pdf:catalog>
7611
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
7612
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
7613
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
7614
- <!-- Dublin Core properties go here -->
7615
- <dc:title>
7616
- <xsl:variable name="title">
8056
+ <xsl:variable name="lang">
8057
+ <xsl:call-template name="getLang"/>
8058
+ </xsl:variable>
8059
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
8060
+ <pdf:dictionary type="normal" key="ViewerPreferences">
8061
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
8062
+ </pdf:dictionary>
8063
+ </pdf:catalog>
8064
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
8065
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
8066
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
8067
+ <!-- Dublin Core properties go here -->
8068
+ <dc:title>
8069
+ <xsl:variable name="title">
8070
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
7617
8071
 
7618
8072
 
7619
- <xsl:value-of select="//*[local-name() = 'bibdata'][@type='standard']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
8073
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
8074
+
7620
8075
 
7621
8076
 
7622
8077
 
7623
8078
 
7624
- </xsl:variable>
7625
- <xsl:choose>
7626
- <xsl:when test="normalize-space($title) != ''">
7627
- <xsl:value-of select="$title"/>
7628
- </xsl:when>
7629
- <xsl:otherwise>
7630
- <xsl:text> </xsl:text>
7631
- </xsl:otherwise>
7632
- </xsl:choose>
7633
- </dc:title>
7634
- <dc:creator>
8079
+ </xsl:for-each>
8080
+ </xsl:variable>
8081
+ <xsl:choose>
8082
+ <xsl:when test="normalize-space($title) != ''">
8083
+ <xsl:value-of select="$title"/>
8084
+ </xsl:when>
8085
+ <xsl:otherwise>
8086
+ <xsl:text> </xsl:text>
8087
+ </xsl:otherwise>
8088
+ </xsl:choose>
8089
+ </dc:title>
8090
+ <dc:creator>
8091
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
7635
8092
 
8093
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
8094
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
8095
+ <xsl:if test="position() != last()">; </xsl:if>
8096
+ </xsl:for-each>
7636
8097
 
7637
- <xsl:value-of select="//*[local-name() = 'bibdata'][@type='standard']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
7638
8098
 
7639
8099
 
7640
- </dc:creator>
7641
- <dc:description>
7642
- <xsl:variable name="abstract">
7643
-
7644
-
7645
-
7646
-
7647
-
7648
- <xsl:copy-of select="//*[local-name() = 'bibdata'][@type='standard']/*[local-name() = 'abstract']//text()"/>
7649
-
7650
- </xsl:variable>
7651
- <xsl:value-of select="normalize-space($abstract)"/>
7652
- </dc:description>
7653
- <pdf:Keywords>
7654
- <xsl:call-template name="insertKeywords"/>
7655
- </pdf:Keywords>
7656
- </rdf:Description>
7657
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
7658
- <!-- XMP properties go here -->
7659
- <xmp:CreatorTool/>
7660
- </rdf:Description>
7661
- </rdf:RDF>
7662
- </x:xmpmeta>
7663
- </fo:declarations>
8100
+ </xsl:for-each>
8101
+ </dc:creator>
8102
+ <dc:description>
8103
+ <xsl:variable name="abstract">
8104
+
8105
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
8106
+
8107
+
8108
+ </xsl:variable>
8109
+ <xsl:value-of select="normalize-space($abstract)"/>
8110
+ </dc:description>
8111
+ <pdf:Keywords>
8112
+ <xsl:call-template name="insertKeywords"/>
8113
+ </pdf:Keywords>
8114
+ </rdf:Description>
8115
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
8116
+ <!-- XMP properties go here -->
8117
+ <xmp:CreatorTool/>
8118
+ </rdf:Description>
8119
+ </rdf:RDF>
8120
+ </x:xmpmeta>
7664
8121
  </xsl:template><xsl:template name="getId">
7665
8122
  <xsl:choose>
7666
8123
  <xsl:when test="../@id">
@@ -7757,6 +8214,7 @@
7757
8214
 
7758
8215
  <xsl:value-of select="document('')//*/namespace::bipm"/>
7759
8216
 
8217
+
7760
8218
  </xsl:variable>
7761
8219
  <xsl:if test="$documentNS != $XSLNS">
7762
8220
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>