metanorma-bipm 1.0.1 → 1.0.6

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>
@@ -278,8 +279,9 @@
278
279
 
279
280
  </fo:layout-master-set>
280
281
 
281
-
282
- <xsl:call-template name="addPDFUAmeta"/>
282
+ <fo:declarations>
283
+ <xsl:call-template name="addPDFUAmeta"/>
284
+ </fo:declarations>
283
285
 
284
286
  <xsl:call-template name="addBookmarks">
285
287
  <xsl:with-param name="contents" select="$contents"/>
@@ -830,7 +832,8 @@
830
832
  </xsl:choose>
831
833
  </xsl:template>
832
834
 
833
- <xsl:template match="bipm:clause[@type = 'index']" mode="flatxml"/>
835
+ <!-- <xsl:template match="bipm:clause[@type = 'index']" mode="flatxml"/> -->
836
+ <xsl:template match="bipm:indexsect" mode="flatxml"/>
834
837
  <!-- <xsl:template match="bipm:clause[@type = 'index']" mode="flatxml">
835
838
  <xsl:copy>
836
839
  <xsl:apply-templates select="@*" mode="flatxml_index"/>
@@ -1083,7 +1086,8 @@
1083
1086
  <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1084
1087
 
1085
1088
  <!-- Index -->
1086
- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index"/>
1089
+ <!-- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index" /> -->
1090
+ <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index"/>
1087
1091
 
1088
1092
  <!-- End Document Pages -->
1089
1093
 
@@ -1127,18 +1131,22 @@
1127
1131
  <fo:block-container font-size="18pt" font-weight="bold" text-align="center">
1128
1132
  <fo:block>
1129
1133
 
1130
- <xsl:variable name="title">
1131
- <xsl:choose>
1132
- <xsl:when test="$independentAppendix != ''">
1133
- <xsl:value-of select="//bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type='appendix']"/>
1134
- </xsl:when>
1135
- <xsl:otherwise> <!-- doctype = 'guide' -->
1136
- <xsl:value-of select="//bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type='main']"/>
1137
- </xsl:otherwise>
1138
- </xsl:choose>
1139
- </xsl:variable>
1134
+ <!-- <xsl:variable name="title"> -->
1135
+ <xsl:choose>
1136
+ <xsl:when test="$independentAppendix != ''">
1137
+ <xsl:apply-templates select="//bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type='appendix']" mode="title"/>
1138
+ <fo:block>
1139
+ <xsl:apply-templates select="//bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type='annex']" mode="title"/>
1140
+ </fo:block>
1141
+ </xsl:when>
1142
+ <xsl:otherwise> <!-- doctype = 'guide' -->
1143
+ <xsl:apply-templates select="//bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type='main']" mode="title"/>
1144
+ </xsl:otherwise>
1145
+ </xsl:choose>
1146
+ <!-- </xsl:variable> -->
1140
1147
 
1141
- <xsl:variable name="mep_text" select="'Mise en pratique'"/>
1148
+
1149
+ <!-- <xsl:variable name="mep_text" select="'Mise en pratique'"/>
1142
1150
 
1143
1151
  <xsl:choose>
1144
1152
  <xsl:when test="$curr_lang = 'en' and contains($title, $mep_text)">
@@ -1149,7 +1157,7 @@
1149
1157
  <xsl:otherwise>
1150
1158
  <xsl:value-of select="$title"/>
1151
1159
  </xsl:otherwise>
1152
- </xsl:choose>
1160
+ </xsl:choose> -->
1153
1161
 
1154
1162
  </fo:block>
1155
1163
 
@@ -1161,7 +1169,7 @@
1161
1169
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$curr_lang]),'#',$part_num)"/>
1162
1170
  </xsl:if>
1163
1171
  <xsl:text>: </xsl:text>
1164
- <xsl:value-of select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part']"/>
1172
+ <xsl:apply-templates select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part']" mode="title"/>
1165
1173
  </fo:block>
1166
1174
  </xsl:if>
1167
1175
  <xsl:variable name="subpart_num" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:subpart)"/>
@@ -1171,7 +1179,7 @@
1171
1179
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-subpart[@lang=$curr_lang]),'#',$subpart_num)"/>
1172
1180
  </xsl:if>
1173
1181
  <xsl:text>: </xsl:text>
1174
- <xsl:value-of select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'subpart']"/>
1182
+ <xsl:apply-templates select="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'subpart']" mode="title"/>
1175
1183
  </fo:block>
1176
1184
  </xsl:if>
1177
1185
 
@@ -1243,7 +1251,8 @@
1243
1251
  <xsl:apply-templates select="bipm:bibliography/bipm:references[not(@normative='true')]" mode="sections"/>
1244
1252
 
1245
1253
  <!-- Index -->
1246
- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index"/>
1254
+ <!-- <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:clause[@type = 'index']" mode="index" /> -->
1255
+ <xsl:apply-templates select="xalan:nodeset($indexes)/doc[@id = $docid]//bipm:indexsect" mode="index"/>
1247
1256
 
1248
1257
  </xsl:otherwise>
1249
1258
  </xsl:choose>
@@ -1354,71 +1363,143 @@
1354
1363
  <fo:block font-size="14pt" font-weight="{$weight-bold}" margin-top="4mm"><xsl:value-of select="concat((//bipm:bipm-standard)[1]/bipm:bibdata/bipm:edition, ' ', $edition_str, ' ', $copyrightYear)"/></fo:block>
1355
1364
  </fo:block-container>
1356
1365
 
1357
- <fo:block-container height="98%" display-align="center">
1366
+ <!-- <fo:block-container height="98%" display-align="center"> -->
1367
+ <fo:block-container absolute-position="fixed" left="12.5mm" top="92mm" height="170mm" width="144mm" display-align="center">
1358
1368
  <fo:block>
1369
+
1370
+ <xsl:variable name="title_appendix_fr">
1371
+ <xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'appendix']" mode="title"/>
1372
+ </xsl:variable>
1373
+ <xsl:variable name="title_appendix_en">
1374
+ <xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'appendix']" mode="title"/>
1375
+ </xsl:variable>
1376
+ <xsl:variable name="title_annex_fr">
1377
+ <xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'annex']" mode="title"/>
1378
+ </xsl:variable>
1379
+ <xsl:variable name="title_annex_en">
1380
+ <xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'annex']" mode="title"/>
1381
+ </xsl:variable>
1382
+ <xsl:variable name="title_part_fr">
1383
+ <xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'part']" mode="title"/>
1384
+ </xsl:variable>
1385
+ <xsl:variable name="title_part_en">
1386
+ <xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'part']" mode="title"/>
1387
+ </xsl:variable>
1388
+ <xsl:variable name="title_subpart_fr">
1389
+ <xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'subpart']" mode="title"/>
1390
+ </xsl:variable>
1391
+ <xsl:variable name="title_subpart_en">
1392
+ <xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'subpart']" mode="title"/>
1393
+ </xsl:variable>
1394
+
1395
+ <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)"/>
1396
+
1397
+ <!-- <xsl:variable name="font-size-number-factor">
1398
+ <xsl:choose>
1399
+ <xsl:when test="$titles_length &gt; 350">0.7</xsl:when>
1400
+ <xsl:when test="$titles_length &gt; 250">0.85</xsl:when>
1401
+ <xsl:when test="$titles_length &gt; 130">0.9</xsl:when>
1402
+ <xsl:otherwise>1</xsl:otherwise>
1403
+ </xsl:choose>
1404
+ </xsl:variable> -->
1405
+
1406
+ <xsl:variable name="space-factor">
1407
+ <xsl:choose>
1408
+ <xsl:when test="$titles_length &gt; 250">0.3</xsl:when>
1409
+ <xsl:when test="$titles_length &gt; 200">0.5</xsl:when>
1410
+ <xsl:when test="$titles_length &gt; 150">0.7</xsl:when>
1411
+ <xsl:otherwise>1</xsl:otherwise>
1412
+ </xsl:choose>
1413
+ </xsl:variable>
1414
+
1415
+ <xsl:variable name="font-size-factor">
1416
+ <xsl:choose>
1417
+ <xsl:when test="$titles_length &gt; 350">0.5</xsl:when>
1418
+ <xsl:when test="$titles_length &gt; 250">0.55</xsl:when>
1419
+ <xsl:when test="$titles_length &gt; 180">0.65</xsl:when>
1420
+ <xsl:when test="$titles_length &gt; 130">0.8</xsl:when>
1421
+ <xsl:otherwise>1</xsl:otherwise>
1422
+ </xsl:choose>
1423
+ </xsl:variable>
1424
+
1425
+ <xsl:variable name="font-size-number-factor">
1426
+ <xsl:choose>
1427
+ <xsl:when test="$font-size-factor &lt; 1"><xsl:value-of select="$font-size-factor *1.3"/></xsl:when>
1428
+ <xsl:otherwise>1</xsl:otherwise>
1429
+ </xsl:choose>
1430
+ </xsl:variable>
1431
+
1432
+ <!-- <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> -->
1359
1433
  <!-- Appendix titles processing -->
1360
1434
  <xsl:variable name="appendix_num" select="normalize-space((//bipm:bipm-standard)[1]/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:appendix)"/>
1361
1435
  <xsl:if test="$appendix_num != ''">
1362
- <fo:block font-size="17pt" font-weight="{$weight-normal}">Annexe <xsl:value-of select="$appendix_num"/></fo:block>
1363
- <fo:block font-size="17pt" font-weight="{$weight-bold}">Appendix <xsl:value-of select="$appendix_num"/></fo:block>
1436
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-normal}">Annexe <xsl:value-of select="$appendix_num"/></fo:block>
1437
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-bold}">Appendix <xsl:value-of select="$appendix_num"/></fo:block>
1364
1438
  </xsl:if>
1365
-
1439
+
1440
+
1366
1441
  <xsl:if test="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@type = 'appendix']">
1367
- <fo:block font-size="30.4pt">
1368
- <fo:block> </fo:block>
1369
- <fo:block font-weight="{$weight-normal}"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'appendix']"/></fo:block>
1370
- <fo:block> </fo:block>
1442
+ <fo:block font-size="{$font-size-factor * 30.4}pt">
1443
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1444
+ <fo:block font-weight="{$weight-normal}"><xsl:copy-of select="$title_appendix_fr"/></fo:block>
1445
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1371
1446
  <fo:block font-weight="{$weight-bold}">
1372
- <xsl:variable name="title_en" select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'appendix']"/>
1373
- <xsl:variable name="mep_text" select="'Mise en pratique'"/>
1374
- <xsl:choose>
1375
- <xsl:when test="contains($title_en, $mep_text)">
1376
- <xsl:value-of select="substring-before($title_en, $mep_text)"/>
1377
- <xsl:text> </xsl:text><fo:inline font-style="italic"><xsl:value-of select="$mep_text"/></fo:inline><xsl:text> </xsl:text>
1378
- <xsl:value-of select="substring-after($title_en, $mep_text)"/>
1379
- </xsl:when>
1380
- <xsl:otherwise>
1381
- <xsl:value-of select="$title_en"/>
1382
- </xsl:otherwise>
1383
- </xsl:choose>
1447
+ <xsl:copy-of select="$title_appendix_en"/>
1384
1448
  </fo:block>
1385
1449
  </fo:block>
1386
1450
  </xsl:if>
1387
1451
  <!-- End Appendix titles processing -->
1388
1452
 
1453
+ <!-- Annex title processing -->
1454
+ <xsl:if test="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@type = 'annex']">
1455
+ <xsl:variable name="annex_num" select="normalize-space((//bipm:bipm-standard)[1]/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:annexid)"/>
1456
+ <xsl:if test="$annex_num != ''">
1457
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1458
+ <!-- Annexe -->
1459
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-normal}">Annexe <xsl:value-of select="$annex_num"/></fo:block>
1460
+ <!-- Annex -->
1461
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-bold}">Annex <xsl:value-of select="$annex_num"/></fo:block>
1462
+ </xsl:if>
1463
+
1464
+ <fo:block font-size="{$font-size-factor * 30.4}pt">
1465
+
1466
+ <xsl:if test="normalize-space($title_annex_fr) != ''">
1467
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1468
+ <fo:block font-weight="{$weight-normal}"><xsl:copy-of select="$title_annex_fr"/></fo:block>
1469
+ </xsl:if>
1470
+
1471
+ <xsl:if test="normalize-space($title_annex_en) != ''">
1472
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1473
+ <fo:block font-weight="{$weight-bold}">
1474
+ <xsl:copy-of select="$title_annex_en"/>
1475
+ </fo:block>
1476
+ </xsl:if>
1477
+ </fo:block>
1478
+ </xsl:if>
1479
+ <!-- End Annex titles processing -->
1389
1480
 
1390
- <!-- Part titles processing -->
1481
+ <!-- Part titles processing -->
1391
1482
  <xsl:if test="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@type = 'part']">
1392
1483
  <xsl:variable name="part_num" select="normalize-space((//bipm:bipm-standard)[1]/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:part)"/>
1393
1484
  <xsl:if test="$part_num != ''">
1485
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1394
1486
  <!-- Part -->
1395
- <fo:block font-size="17pt" font-weight="{$weight-normal}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part_num)"/></fo:block>
1487
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-normal}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='fr']),'#',$part_num)"/></fo:block>
1396
1488
  <!-- Partie -->
1397
- <fo:block font-size="17pt" font-weight="{$weight-bold}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part_num)"/></fo:block>
1489
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-bold}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang='en']),'#',$part_num)"/></fo:block>
1398
1490
  </xsl:if>
1399
1491
 
1400
- <fo:block font-size="30.4pt">
1492
+ <fo:block font-size="{$font-size-factor * 30.4}pt">
1401
1493
 
1402
- <xsl:if test="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'part']">
1403
- <fo:block> </fo:block>
1404
- <fo:block font-weight="{$weight-normal}"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'part']"/></fo:block>
1494
+ <xsl:if test="normalize-space($title_part_fr) != ''">
1495
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1496
+ <fo:block font-weight="{$weight-normal}"><xsl:copy-of select="$title_part_fr"/></fo:block>
1405
1497
  </xsl:if>
1406
1498
 
1407
- <xsl:if test="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'part']">
1408
- <fo:block> </fo:block>
1499
+ <xsl:if test="normalize-space($title_part_en) != ''">
1500
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1409
1501
  <fo:block font-weight="{$weight-bold}">
1410
- <xsl:variable name="title_en" select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'part']"/>
1411
- <xsl:variable name="mep_text" select="'Mise en pratique'"/>
1412
- <xsl:choose>
1413
- <xsl:when test="contains($title_en, $mep_text)">
1414
- <xsl:value-of select="substring-before($title_en, $mep_text)"/>
1415
- <xsl:text> </xsl:text><fo:inline font-style="italic"><xsl:value-of select="$mep_text"/></fo:inline><xsl:text> </xsl:text>
1416
- <xsl:value-of select="substring-after($title_en, $mep_text)"/>
1417
- </xsl:when>
1418
- <xsl:otherwise>
1419
- <xsl:value-of select="$title_en"/>
1420
- </xsl:otherwise>
1421
- </xsl:choose>
1502
+ <xsl:copy-of select="$title_part_en"/>
1422
1503
  </fo:block>
1423
1504
  </xsl:if>
1424
1505
  </fo:block>
@@ -1429,34 +1510,25 @@
1429
1510
  <xsl:if test="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@type = 'subpart']">
1430
1511
  <xsl:variable name="subpart_num" select="normalize-space((//bipm:bipm-standard)[1]/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:subpart)"/>
1431
1512
  <xsl:if test="$subpart_num != ''">
1513
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1432
1514
  <!-- Sub-part -->
1433
- <fo:block font-size="17pt" font-weight="{$weight-normal}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-subpart[@lang='fr']),'#',$subpart_num)"/> <xsl:value-of select="$subpart_num"/></fo:block>
1515
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-normal}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-subpart[@lang='fr']),'#',$subpart_num)"/> <xsl:value-of select="$subpart_num"/></fo:block>
1434
1516
  <!-- Partie de sub -->
1435
- <fo:block font-size="17pt" font-weight="{$weight-bold}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-subpart[@lang='en']),'#',$subpart_num)"/> <xsl:value-of select="$subpart_num"/></fo:block>
1517
+ <fo:block font-size="{$font-size-number-factor * 17}pt" font-weight="{$weight-bold}"><xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-subpart[@lang='en']),'#',$subpart_num)"/> <xsl:value-of select="$subpart_num"/></fo:block>
1436
1518
  </xsl:if>
1437
1519
 
1438
- <fo:block font-size="30.4pt">
1520
+ <fo:block font-size="{$font-size-factor * 30.4}pt">
1439
1521
 
1440
- <xsl:if test="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'subpart']">
1441
- <fo:block> </fo:block>
1442
- <fo:block font-weight="{$weight-normal}"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'subpart']"/></fo:block>
1522
+ <xsl:if test="normalize-space($title_subpart_fr) != ''">
1523
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1524
+ <fo:block font-weight="{$weight-normal}"><xsl:copy-of select="$title_subpart_fr"/></fo:block>
1443
1525
  </xsl:if>
1444
1526
 
1445
- <xsl:if test="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'subpart']">
1446
- <fo:block> </fo:block>
1527
+ <xsl:if test="normalize-space($title_subpart_en) != ''">
1528
+ <fo:block font-size="{$space-factor * 30.4}pt"> </fo:block>
1447
1529
  <fo:block font-weight="{$weight-bold}">
1448
- <xsl:variable name="title_en" select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'subpart']"/>
1449
- <xsl:variable name="mep_text" select="'Mise en pratique'"/>
1450
- <xsl:choose>
1451
- <xsl:when test="contains($title_en, $mep_text)">
1452
- <xsl:value-of select="substring-before($title_en, $mep_text)"/>
1453
- <xsl:text> </xsl:text><fo:inline font-style="italic"><xsl:value-of select="$mep_text"/></fo:inline><xsl:text> </xsl:text>
1454
- <xsl:value-of select="substring-after($title_en, $mep_text)"/>
1455
- </xsl:when>
1456
- <xsl:otherwise>
1457
- <xsl:value-of select="$title_en"/>
1458
- </xsl:otherwise>
1459
- </xsl:choose>
1530
+ <xsl:copy-of select="$title_subpart_en"/>
1531
+
1460
1532
  </fo:block>
1461
1533
  </xsl:if>
1462
1534
  </fo:block>
@@ -1619,6 +1691,24 @@
1619
1691
  </xsl:template>
1620
1692
  <!-- End Cover Pages -->
1621
1693
 
1694
+
1695
+ <xsl:template match="bipm:bipm-standard/bipm:bibdata/bipm:title[@language = 'en']/text()" priority="3">
1696
+ <xsl:variable name="mep_text" select="'Mise en pratique'"/>
1697
+ <xsl:choose>
1698
+ <xsl:when test="contains(., $mep_text)">
1699
+ <xsl:value-of select="substring-before(., $mep_text)"/>
1700
+ <xsl:text> </xsl:text><fo:inline font-style="italic"><xsl:value-of select="$mep_text"/></fo:inline><xsl:text> </xsl:text>
1701
+ <xsl:value-of select="substring-after(., $mep_text)"/>
1702
+ </xsl:when>
1703
+ <xsl:otherwise>
1704
+ <xsl:value-of select="."/>
1705
+ </xsl:otherwise>
1706
+ </xsl:choose>
1707
+ </xsl:template>
1708
+
1709
+
1710
+
1711
+
1622
1712
  <xsl:template name="insertSeparatorPage">
1623
1713
  <!-- 3 Pages with BIPM Metro logo -->
1624
1714
  <fo:page-sequence master-reference="document" force-page-count="no-force">
@@ -1759,11 +1849,12 @@
1759
1849
  <xsl:if test="@level &gt;= 3">
1760
1850
  <fo:inline padding-right="2mm"><xsl:value-of select="@section"/></fo:inline>
1761
1851
  </xsl:if>
1762
- <xsl:variable name="sectionTitle">
1852
+ <!-- <xsl:variable name="sectionTitle">
1763
1853
  <xsl:apply-templates select="title"/>
1764
- </xsl:variable>
1854
+ </xsl:variable> -->
1765
1855
  <fo:inline>
1766
- <xsl:value-of select="$sectionTitle"/>
1856
+ <!-- <xsl:value-of select="$sectionTitle"/> -->
1857
+ <xsl:apply-templates select="title"/>
1767
1858
  </fo:inline>
1768
1859
  <!-- <xsl:text> </xsl:text> -->
1769
1860
  <!-- keep-together.within-line="always" -->
@@ -1841,6 +1932,7 @@
1841
1932
  <xsl:variable name="type">
1842
1933
  <xsl:choose>
1843
1934
  <xsl:when test="@type = 'index'">index</xsl:when>
1935
+ <xsl:when test="local-name() = 'indexsect'">index</xsl:when>
1844
1936
  <xsl:otherwise><xsl:value-of select="local-name()"/></xsl:otherwise>
1845
1937
  </xsl:choose>
1846
1938
  </xsl:variable>
@@ -1859,6 +1951,12 @@
1859
1951
  </xsl:if>
1860
1952
  </xsl:template>
1861
1953
 
1954
+ <xsl:template match="*[local-name() = 'strong']" mode="contents_item" priority="2">
1955
+ <!-- <xsl:copy> -->
1956
+ <xsl:apply-templates mode="contents_item"/>
1957
+ <!-- </xsl:copy> -->
1958
+ </xsl:template>
1959
+
1862
1960
  <!-- ============================= -->
1863
1961
  <!-- ============================= -->
1864
1962
 
@@ -2968,6 +3066,18 @@
2968
3066
  </fo:block>
2969
3067
  </xsl:template>
2970
3068
 
3069
+ <xsl:template match="bipm:preferred">
3070
+ <fo:block font-weight="bold" keep-with-next="always" space-before="8pt" margin-bottom="6pt">
3071
+ <xsl:if test="ancestor::bipm:term/bipm:name">
3072
+ <fo:inline>
3073
+ <xsl:attribute name="padding-right">2mm</xsl:attribute>
3074
+ <xsl:apply-templates select="ancestor::bipm:term/bipm:name" mode="presentation"/>
3075
+ </fo:inline>
3076
+ </xsl:if>
3077
+ <xsl:apply-templates/>
3078
+ </fo:block>
3079
+ </xsl:template>
3080
+
2971
3081
  <xsl:template match="bipm:bibitem">
2972
3082
  <fo:block id="{@id}" margin-bottom="12pt" start-indent="25mm" text-indent="-25mm" line-height="115%">
2973
3083
  <xsl:if test=".//bipm:fn">
@@ -3211,6 +3321,51 @@
3211
3321
  </mathml:mstyle>
3212
3322
  </xsl:template>
3213
3323
 
3324
+ <!-- Decrease space between ()
3325
+ from:
3326
+ <mfenced open="(" close=")">
3327
+ <mrow>
3328
+ <mtext>Cu</mtext>
3329
+ </mrow>
3330
+ </mfenced>
3331
+ to:
3332
+ <mrow>
3333
+ <mtext>(Cu)</mtext>
3334
+ </mrow> -->
3335
+ <xsl:template match="mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 0]] | mathml:mfenced[count(*) = 1 and *[count(*) = 1] and */*[count(*) = 1] and */*/*[count(*) = 0]]" mode="mathml" priority="2">
3336
+ <xsl:apply-templates mode="mathml"/>
3337
+ </xsl:template>
3338
+
3339
+ <xsl:template match="mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0] | mathml:mfenced[count(*) = 1]/*[count(*) = 1]/*[count(*) = 1]/*[count(*) = 0]" mode="mathml" priority="2"> <!-- [not(following-sibling::*) and not(preceding-sibling::*)] -->
3340
+ <xsl:copy>
3341
+ <xsl:apply-templates select="@*" mode="mathml"/>
3342
+ <xsl:value-of select="ancestor::mathml:mfenced[1]/@open"/>
3343
+ <xsl:value-of select="."/>
3344
+ <xsl:value-of select="ancestor::mathml:mfenced[1]/@close"/>
3345
+ </xsl:copy>
3346
+ </xsl:template>
3347
+
3348
+ <!-- Decrease height of / and | -->
3349
+ <xsl:template match="mathml:mo[normalize-space(text()) = '/' or normalize-space(text()) = '|']" mode="mathml">
3350
+ <xsl:copy>
3351
+ <xsl:apply-templates select="@*" mode="mathml"/>
3352
+ <xsl:if test="not(@stretchy) and not(preceding-sibling::*[1][local-name() = 'mfrac'] and following-sibling::*[1][local-name() = 'mfrac'])">
3353
+ <xsl:attribute name="stretchy">false</xsl:attribute>
3354
+ </xsl:if>
3355
+ <xsl:apply-templates mode="mathml"/>
3356
+ </xsl:copy>
3357
+ </xsl:template>
3358
+
3359
+ <xsl:template match="mathml:mi[string-length(normalize-space()) &gt; 1]" mode="mathml" priority="2">
3360
+ <xsl:if test="preceding-sibling::* and preceding-sibling::*[1][not(local-name() = 'mfenced' or local-name() = 'mo')]">
3361
+ <mathml:mspace width="0.3em"/>
3362
+ </xsl:if>
3363
+ <xsl:copy-of select="."/>
3364
+ <xsl:if test="following-sibling::* and following-sibling::*[1][not(local-name() = 'mfenced' or local-name() = 'mo')]">
3365
+ <mathml:mspace width="0.3em"/>
3366
+ </xsl:if>
3367
+ </xsl:template>
3368
+
3214
3369
  <xsl:template name="insertHeaderFooter">
3215
3370
  <xsl:param name="header-title"/>
3216
3371
  <fo:static-content flow-name="header-odd">
@@ -3337,7 +3492,12 @@
3337
3492
  <xsl:value-of select="concat($day, ' ', $monthStr, ' ', $year)"/>
3338
3493
  </xsl:when>
3339
3494
  <xsl:otherwise>
3340
- <xsl:value-of select="concat($monthStr, ' ', $day, ', ', $year)"/>
3495
+ <!-- <xsl:value-of select="concat($monthStr, ' ', $day, ', ', $year)"/> -->
3496
+ <xsl:value-of select="$monthStr"/>
3497
+ <xsl:text> </xsl:text>
3498
+ <xsl:value-of select="$day"/>
3499
+ <xsl:if test="$day != '' and $year != ''"><xsl:text>, </xsl:text></xsl:if>
3500
+ <xsl:value-of select="$year"/>
3341
3501
  </xsl:otherwise>
3342
3502
  </xsl:choose>
3343
3503
 
@@ -3382,127 +3542,10 @@
3382
3542
  <!-- Index processing -->
3383
3543
  <!-- =================== -->
3384
3544
 
3385
- <xsl:template match="@*|node()" mode="index_add_id">
3386
- <xsl:copy>
3387
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
3388
- </xsl:copy>
3389
- </xsl:template>
3390
-
3391
- <xsl:template match="bipm:xref" mode="index_add_id">
3392
- <xsl:variable name="id">
3393
- <xsl:call-template name="generateIndexXrefId"/>
3394
- </xsl:variable>
3395
- <xsl:copy> <!-- add id to xref -->
3396
- <xsl:apply-templates select="@*" mode="index_add_id"/>
3397
- <xsl:attribute name="id">
3398
- <xsl:value-of select="$id"/>
3399
- </xsl:attribute>
3400
- <xsl:apply-templates mode="index_add_id"/>
3401
- </xsl:copy>
3402
- <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
3403
- <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
3404
- <xsl:if test="@to">
3405
- <xsl:value-of select="$dash"/>
3406
- <xsl:copy>
3407
- <xsl:copy-of select="@*"/>
3408
- <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
3409
- <xsl:attribute name="id">
3410
- <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
3411
- </xsl:attribute>
3412
- <xsl:apply-templates mode="index_add_id"/>
3413
- </xsl:copy>
3414
- </xsl:if>
3415
- </xsl:template>
3416
-
3417
- <xsl:template match="@*|node()" mode="index_update">
3418
- <xsl:copy>
3419
- <xsl:apply-templates select="@*|node()" mode="index_update"/>
3420
- </xsl:copy>
3421
- </xsl:template>
3422
-
3423
- <xsl:template match="bipm:clause[@type = 'index']//bipm:li" mode="index_update">
3424
- <xsl:copy>
3425
- <xsl:apply-templates select="@*" mode="index_update"/>
3426
- <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
3427
- </xsl:copy>
3428
- </xsl:template>
3429
-
3430
- <xsl:template match="bipm:clause[@type = 'index']//bipm:li/node()" mode="process_li_element" priority="2">
3431
- <xsl:param name="element"/>
3432
- <xsl:param name="remove" select="'false'"/>
3433
- <!-- <node></node> -->
3434
- <xsl:choose>
3435
- <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
3436
- <!-- skip text (i.e. remove it) and process next element -->
3437
- <!-- [removed_<xsl:value-of select="."/>] -->
3438
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3439
- </xsl:when>
3440
- <xsl:when test="self::text()">
3441
- <xsl:value-of select="."/>
3442
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3443
- </xsl:when>
3444
- <xsl:when test="self::* and local-name(.) = 'xref'">
3445
- <xsl:variable name="id" select="@id"/>
3446
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
3447
- <xsl:variable name="id_next" select="following-sibling::bipm:xref[1]/@id"/>
3448
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
3449
-
3450
- <xsl:variable name="id_prev" select="preceding-sibling::bipm:xref[1]/@id"/>
3451
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
3452
-
3453
- <xsl:choose>
3454
- <!-- 2nd pass -->
3455
- <!-- if page is equal to page for next and page is not the end of range -->
3456
- <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
3457
- <!-- skip element (i.e. remove it) and remove next text ',' -->
3458
- <!-- [removed_xref] -->
3459
-
3460
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
3461
- <xsl:with-param name="remove">true</xsl:with-param>
3462
- </xsl:apply-templates>
3463
- </xsl:when>
3464
-
3465
- <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
3466
- <!-- remove xref -->
3467
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
3468
- <xsl:with-param name="remove">true</xsl:with-param>
3469
- </xsl:apply-templates>
3470
- </xsl:when>
3471
-
3472
- <xsl:otherwise>
3473
- <xsl:copy-of select="."/>
3474
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3475
- </xsl:otherwise>
3476
- </xsl:choose>
3477
- </xsl:when>
3478
- <xsl:when test="self::* and local-name(.) = 'ul'">
3479
- <!-- ul -->
3480
- <xsl:apply-templates select="." mode="index_update"/>
3481
- </xsl:when>
3482
- <xsl:otherwise>
3483
- <xsl:copy-of select="."/>
3484
- <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
3485
- </xsl:otherwise>
3486
- </xsl:choose>
3487
- </xsl:template>
3488
-
3489
-
3490
- <xsl:template name="generateIndexXrefId">
3491
- <xsl:variable name="level" select="count(ancestor::bipm:ul)"/>
3492
- <!-- <xsl:variable name="parent_ul_id" select="generate-id(ancestor::bipm:ul[1])"/>
3493
- <xsl:variable name="item_number" select="count(ancestor::bipm:li[ancestor::bipm:ul[generate-id() = $parent_ul_id]])"/> -->
3494
- <xsl:variable name="docid">
3495
- <xsl:call-template name="getDocumentId"/>
3496
- </xsl:variable>
3497
- <xsl:variable name="item_number">
3498
- <xsl:number count="bipm:li[ancestor::bipm:clause[@type = 'index']]" level="any"/>
3499
- </xsl:variable>
3500
- <xsl:variable name="xref_number"><xsl:number count="bipm:xref"/></xsl:variable>
3501
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
3502
- </xsl:template>
3503
-
3504
- <xsl:template match="bipm:clause[@type = 'index']"/>
3505
- <xsl:template match="bipm:clause[@type = 'index']" mode="index">
3545
+ <!-- <xsl:template match="bipm:clause[@type = 'index']" /> -->
3546
+ <!-- <xsl:template match="bipm:clause[@type = 'index']" mode="index"> -->
3547
+ <xsl:template match="bipm:indexsect"/>
3548
+ <xsl:template match="bipm:indexsect" mode="index">
3506
3549
 
3507
3550
  <fo:page-sequence master-reference="index" force-page-count="no-force">
3508
3551
  <xsl:variable name="header-title">
@@ -3520,8 +3563,11 @@
3520
3563
  </xsl:call-template>
3521
3564
 
3522
3565
  <fo:flow flow-name="xsl-region-body">
3523
- <fo:block id="{@id}">
3524
- <xsl:apply-templates/>
3566
+ <fo:block id="{@id}" span="all">
3567
+ <xsl:apply-templates select="bipm:title"/>
3568
+ </fo:block>
3569
+ <fo:block>
3570
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
3525
3571
 
3526
3572
  <!-- TEST <xsl:variable name="alphabet" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
3527
3573
  <xsl:for-each select="(document('')//node())[position() &lt; 26]">
@@ -3544,42 +3590,25 @@
3544
3590
  </fo:page-sequence>
3545
3591
  </xsl:template>
3546
3592
 
3547
- <xsl:template match="bipm:clause[@type = 'index']/bipm:title" priority="4">
3548
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm" span="all">
3593
+ <!-- <xsl:template match="bipm:clause[@type = 'index']/bipm:title" priority="4"> -->
3594
+ <xsl:template match="bipm:indexsect/bipm:title" priority="4">
3595
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm">
3549
3596
  <!-- Index -->
3550
3597
  <xsl:apply-templates/>
3551
3598
  </fo:block>
3552
3599
  </xsl:template>
3553
-
3554
- <xsl:template match="bipm:clause[@type = 'index']/bipm:clause" priority="4">
3555
- <xsl:apply-templates/>
3556
- <fo:block>
3557
- <xsl:if test="following-sibling::bipm:clause">
3558
- <fo:block> </fo:block>
3559
- </xsl:if>
3560
- </fo:block>
3561
- </xsl:template>
3562
-
3563
- <xsl:template match="bipm:clause[@type = 'index']/bipm:clause/bipm:title" priority="4">
3600
+
3601
+ <!-- <xsl:template match="bipm:clause[@type = 'index']/bipm:clause/bipm:title" priority="4"> -->
3602
+ <xsl:template match="bipm:indexsect/bipm:clause/bipm:title" priority="4">
3564
3603
  <!-- Letter A, B, C, ... -->
3565
3604
  <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
3566
3605
  <xsl:apply-templates/>
3567
3606
  </fo:block>
3568
3607
  </xsl:template>
3569
3608
 
3570
- <xsl:template match="bipm:clause[@type = 'index']//bipm:ul" priority="4">
3571
- <xsl:apply-templates/>
3572
- </xsl:template>
3573
-
3574
- <xsl:template match="bipm:clause[@type = 'index']//bipm:li" priority="4">
3575
- <xsl:variable name="level" select="count(ancestor::bipm:ul)"/>
3576
- <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
3577
- <xsl:apply-templates/>
3578
- </fo:block>
3579
- </xsl:template>
3580
-
3581
- <xsl:template match="bipm:bookmark">
3582
- <fo:inline id="{@id}"/>
3609
+
3610
+ <xsl:template match="*[local-name() = 'stem']/text()">
3611
+ <xsl:value-of select="normalize-space()"/>
3583
3612
  </xsl:template>
3584
3613
 
3585
3614
  <!-- =================== -->
@@ -4243,6 +4272,7 @@
4243
4272
 
4244
4273
 
4245
4274
 
4275
+
4246
4276
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
4247
4277
 
4248
4278
 
@@ -4350,6 +4380,7 @@
4350
4380
 
4351
4381
 
4352
4382
 
4383
+
4353
4384
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
4354
4385
 
4355
4386
 
@@ -4476,209 +4507,242 @@
4476
4507
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
4477
4508
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
4478
4509
  <xsl:call-template name="add-zero-spaces-java"/>
4479
- </xsl:template><xsl:template match="*[local-name()='table']">
4510
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
4480
4511
 
4481
- <xsl:variable name="simple-table">
4482
- <xsl:call-template name="getSimpleTable"/>
4483
- </xsl:variable>
4512
+ <xsl:variable name="table">
4484
4513
 
4485
-
4486
-
4487
-
4488
-
4489
- <!-- <xsl:if test="$namespace = 'bipm'">
4490
- <fo:block>&#xA0;</fo:block>
4491
- </xsl:if> -->
4492
-
4493
- <!-- $namespace = 'iso' or -->
4494
-
4495
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4496
-
4497
-
4498
-
4499
- <xsl:call-template name="fn_name_display"/>
4514
+ <xsl:variable name="simple-table">
4515
+ <xsl:call-template name="getSimpleTable"/>
4516
+ </xsl:variable>
4500
4517
 
4501
4518
 
4502
-
4503
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
4504
-
4505
- <!-- <xsl:variable name="cols-count">
4506
- <xsl:choose>
4507
- <xsl:when test="*[local-name()='thead']">
4508
- <xsl:call-template name="calculate-columns-numbers">
4509
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
4510
- </xsl:call-template>
4511
- </xsl:when>
4512
- <xsl:otherwise>
4513
- <xsl:call-template name="calculate-columns-numbers">
4514
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
4515
- </xsl:call-template>
4516
- </xsl:otherwise>
4517
- </xsl:choose>
4518
- </xsl:variable> -->
4519
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
4520
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
4521
-
4522
-
4523
-
4524
- <xsl:variable name="colwidths">
4525
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
4526
- <xsl:call-template name="calculate-column-widths">
4527
- <xsl:with-param name="cols-count" select="$cols-count"/>
4528
- <xsl:with-param name="table" select="$simple-table"/>
4529
- </xsl:call-template>
4530
- </xsl:if>
4531
- </xsl:variable>
4532
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4533
-
4534
- <!-- <xsl:variable name="colwidths2">
4535
- <xsl:call-template name="calculate-column-widths">
4536
- <xsl:with-param name="cols-count" select="$cols-count"/>
4537
- </xsl:call-template>
4538
- </xsl:variable> -->
4539
-
4540
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
4541
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
4542
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
4543
-
4544
- <xsl:variable name="margin-left">
4545
- <xsl:choose>
4546
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
4547
- <xsl:otherwise>0</xsl:otherwise>
4548
- </xsl:choose>
4549
- </xsl:variable>
4550
-
4551
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
4552
4519
 
4553
4520
 
4554
-
4555
-
4556
-
4557
4521
 
4522
+ <!-- <xsl:if test="$namespace = 'bipm'">
4523
+ <fo:block>&#xA0;</fo:block>
4524
+ </xsl:if> -->
4558
4525
 
4559
-
4526
+ <!-- $namespace = 'iso' or -->
4527
+
4528
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4560
4529
 
4530
+
4561
4531
 
4532
+ <xsl:call-template name="fn_name_display"/>
4562
4533
 
4534
+
4563
4535
 
4536
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
4564
4537
 
4565
- <xsl:attribute name="space-after">12pt</xsl:attribute>
4566
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
4567
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
4568
- <xsl:if test="not(ancestor::*[local-name()='note_side'])">
4569
- <xsl:attribute name="font-size">10pt</xsl:attribute>
4570
- </xsl:if>
4571
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4572
- <xsl:if test="@parent-type = 'quote'">
4573
- <xsl:attribute name="font-family">Arial</xsl:attribute>
4574
- <xsl:attribute name="font-size">9pt</xsl:attribute>
4538
+ <!-- <xsl:variable name="cols-count">
4539
+ <xsl:choose>
4540
+ <xsl:when test="*[local-name()='thead']">
4541
+ <xsl:call-template name="calculate-columns-numbers">
4542
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
4543
+ </xsl:call-template>
4544
+ </xsl:when>
4545
+ <xsl:otherwise>
4546
+ <xsl:call-template name="calculate-columns-numbers">
4547
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
4548
+ </xsl:call-template>
4549
+ </xsl:otherwise>
4550
+ </xsl:choose>
4551
+ </xsl:variable> -->
4552
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
4553
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
4554
+
4555
+
4556
+
4557
+ <xsl:variable name="colwidths">
4558
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
4559
+ <xsl:call-template name="calculate-column-widths">
4560
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4561
+ <xsl:with-param name="table" select="$simple-table"/>
4562
+ </xsl:call-template>
4575
4563
  </xsl:if>
4564
+ </xsl:variable>
4565
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4576
4566
 
4567
+ <!-- <xsl:variable name="colwidths2">
4568
+ <xsl:call-template name="calculate-column-widths">
4569
+ <xsl:with-param name="cols-count" select="$cols-count"/>
4570
+ </xsl:call-template>
4571
+ </xsl:variable> -->
4577
4572
 
4573
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
4574
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
4575
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
4578
4576
 
4579
- <xsl:variable name="table_attributes">
4580
- <attribute name="table-layout">fixed</attribute>
4581
- <attribute name="width">100%</attribute>
4582
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
4583
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
4577
+ <xsl:variable name="margin-left">
4578
+ <xsl:choose>
4579
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
4580
+ <xsl:otherwise>0</xsl:otherwise>
4581
+ </xsl:choose>
4582
+ </xsl:variable>
4583
+
4584
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
4584
4585
 
4585
4586
 
4587
+
4588
+
4589
+
4586
4590
 
4587
4591
 
4588
-
4589
-
4590
-
4592
+
4591
4593
 
4592
-
4593
-
4594
- <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])">
4595
- <attribute name="border-top">0.5pt solid black</attribute>
4596
- <attribute name="border-bottom">0.5pt solid black</attribute>
4597
- </xsl:if>
4598
- <attribute name="margin-left">0mm</attribute>
4599
- <attribute name="margin-right">0mm</attribute>
4600
4594
 
4601
- </xsl:variable>
4602
-
4603
-
4604
- <fo:table id="{@id}" table-omit-footer-at-break="true">
4605
4595
 
4606
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
4607
- <xsl:attribute name="{@name}">
4608
- <xsl:value-of select="."/>
4609
- </xsl:attribute>
4610
- </xsl:for-each>
4611
4596
 
4612
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
4613
- <xsl:if test="$isNoteOrFnExist = 'true'">
4614
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4615
- </xsl:if>
4616
4597
 
4617
- <xsl:choose>
4618
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
4619
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
4620
- <fo:table-column column-width="{@width}"/>
4621
- </xsl:for-each>
4622
- </xsl:when>
4623
- <xsl:otherwise>
4624
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4625
- <xsl:choose>
4626
- <xsl:when test=". = 1 or . = 0">
4627
- <fo:table-column column-width="proportional-column-width(2)"/>
4628
- </xsl:when>
4629
- <xsl:otherwise>
4630
- <fo:table-column column-width="proportional-column-width({.})"/>
4631
- </xsl:otherwise>
4632
- </xsl:choose>
4633
- </xsl:for-each>
4634
- </xsl:otherwise>
4635
- </xsl:choose>
4598
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
4599
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
4600
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
4601
+ <xsl:if test="not(ancestor::*[local-name()='note_side'])">
4602
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
4603
+ </xsl:if>
4604
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4605
+ <xsl:if test="@parent-type = 'quote'">
4606
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
4607
+ <xsl:attribute name="font-size">9pt</xsl:attribute>
4608
+ </xsl:if>
4636
4609
 
4637
- <xsl:choose>
4638
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
4639
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4640
- </xsl:when>
4641
- <xsl:otherwise>
4642
- <xsl:apply-templates/>
4643
- </xsl:otherwise>
4644
- </xsl:choose>
4645
4610
 
4646
- </fo:table>
4647
-
4648
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
4649
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4650
- <xsl:call-template name="insertTableFooterInSeparateTable">
4651
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
4652
- <xsl:with-param name="colwidths" select="$colwidths"/>
4653
- <xsl:with-param name="colgroup" select="$colgroup"/>
4654
- </xsl:call-template>
4655
- </xsl:for-each>
4656
-
4657
- <!-- insert footer as table -->
4658
- <!-- <fo:table>
4659
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
4660
- <xsl:attribute name="{@name}">
4661
- <xsl:value-of select="."/>
4662
- </xsl:attribute>
4663
- </xsl:for-each>
4611
+ <xsl:variable name="table_width">
4612
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
4613
+
4614
+
4615
+
4616
+ <xsl:choose>
4617
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
4618
+ <xsl:otherwise>100%</xsl:otherwise>
4619
+ </xsl:choose>
4620
+
4621
+ </xsl:variable>
4622
+
4623
+ <xsl:variable name="table_attributes">
4624
+ <attribute name="table-layout">fixed</attribute>
4625
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
4626
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
4627
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
4628
+
4629
+
4630
+
4631
+
4632
+
4633
+
4634
+
4635
+
4636
+
4637
+
4638
+ <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])">
4639
+ <attribute name="border-top">0.5pt solid black</attribute>
4640
+ <attribute name="border-bottom">0.5pt solid black</attribute>
4641
+ </xsl:if>
4642
+ <attribute name="margin-left">0mm</attribute>
4643
+ <attribute name="margin-right">0mm</attribute>
4644
+
4645
+ </xsl:variable>
4646
+
4664
4647
 
4665
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4648
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
4649
+
4650
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
4651
+ <xsl:attribute name="{@name}">
4652
+ <xsl:value-of select="."/>
4653
+ </xsl:attribute>
4654
+ </xsl:for-each>
4655
+
4656
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
4657
+ <xsl:if test="$isNoteOrFnExist = 'true'">
4658
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4659
+ </xsl:if>
4660
+
4661
+ <xsl:choose>
4662
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
4663
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
4664
+ <fo:table-column column-width="{@width}"/>
4665
+ </xsl:for-each>
4666
+ </xsl:when>
4667
+ <xsl:otherwise>
4668
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4669
+ <xsl:choose>
4670
+ <xsl:when test=". = 1 or . = 0">
4671
+ <fo:table-column column-width="proportional-column-width(2)"/>
4672
+ </xsl:when>
4673
+ <xsl:otherwise>
4674
+ <fo:table-column column-width="proportional-column-width({.})"/>
4675
+ </xsl:otherwise>
4676
+ </xsl:choose>
4677
+ </xsl:for-each>
4678
+ </xsl:otherwise>
4679
+ </xsl:choose>
4680
+
4666
4681
  <xsl:choose>
4667
- <xsl:when test=". = 1 or . = 0">
4668
- <fo:table-column column-width="proportional-column-width(2)"/>
4682
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
4683
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
4669
4684
  </xsl:when>
4670
4685
  <xsl:otherwise>
4671
- <fo:table-column column-width="proportional-column-width({.})"/>
4686
+ <xsl:apply-templates/>
4672
4687
  </xsl:otherwise>
4673
4688
  </xsl:choose>
4689
+
4690
+ </fo:table>
4691
+
4692
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
4693
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
4694
+ <xsl:call-template name="insertTableFooterInSeparateTable">
4695
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
4696
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4697
+ <xsl:with-param name="colgroup" select="$colgroup"/>
4698
+ </xsl:call-template>
4674
4699
  </xsl:for-each>
4675
- </fo:table>-->
4676
-
4677
-
4678
-
4679
-
4680
-
4681
- </fo:block-container>
4700
+
4701
+ <!-- insert footer as table -->
4702
+ <!-- <fo:table>
4703
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
4704
+ <xsl:attribute name="{@name}">
4705
+ <xsl:value-of select="."/>
4706
+ </xsl:attribute>
4707
+ </xsl:for-each>
4708
+
4709
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4710
+ <xsl:choose>
4711
+ <xsl:when test=". = 1 or . = 0">
4712
+ <fo:table-column column-width="proportional-column-width(2)"/>
4713
+ </xsl:when>
4714
+ <xsl:otherwise>
4715
+ <fo:table-column column-width="proportional-column-width({.})"/>
4716
+ </xsl:otherwise>
4717
+ </xsl:choose>
4718
+ </xsl:for-each>
4719
+ </fo:table>-->
4720
+
4721
+
4722
+
4723
+
4724
+
4725
+ </fo:block-container>
4726
+ </xsl:variable>
4727
+
4728
+
4729
+
4730
+ <xsl:choose>
4731
+ <xsl:when test="@width">
4732
+
4733
+ <!-- centered table when table name is centered (see table-name-style) -->
4734
+
4735
+
4736
+
4737
+ <xsl:copy-of select="$table"/>
4738
+
4739
+
4740
+ </xsl:when>
4741
+ <xsl:otherwise>
4742
+ <xsl:copy-of select="$table"/>
4743
+ </xsl:otherwise>
4744
+ </xsl:choose>
4745
+
4682
4746
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
4683
4747
  <xsl:if test="normalize-space() != ''">
4684
4748
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -4810,7 +4874,15 @@
4810
4874
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
4811
4875
  <xsl:value-of select="@target"/>
4812
4876
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
4813
- <xsl:variable name="math_text" select="normalize-space(.)"/>
4877
+ <xsl:variable name="mathml">
4878
+ <xsl:for-each select="*">
4879
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
4880
+ <xsl:copy-of select="."/>
4881
+ </xsl:if>
4882
+ </xsl:for-each>
4883
+ </xsl:variable>
4884
+
4885
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
4814
4886
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
4815
4887
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
4816
4888
  <xsl:param name="cols-count"/>
@@ -5111,7 +5183,7 @@
5111
5183
 
5112
5184
  <xsl:attribute name="font-weight">normal</xsl:attribute>
5113
5185
  <xsl:attribute name="border">solid black 0pt</xsl:attribute>
5114
- <xsl:attribute name="border-top">solid black 0.5pt</xsl:attribute>
5186
+ <!-- <xsl:attribute name="border-top">solid black 0.5pt</xsl:attribute> -->
5115
5187
  <xsl:attribute name="border-bottom">solid black 0.5pt</xsl:attribute>
5116
5188
  <xsl:attribute name="height">8mm</xsl:attribute>
5117
5189
  <xsl:attribute name="padding-top">2mm</xsl:attribute>
@@ -5579,7 +5651,7 @@
5579
5651
  <xsl:with-param name="table" select="$html-table"/>
5580
5652
  </xsl:call-template>
5581
5653
  </xsl:variable>
5582
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
5654
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
5583
5655
  <xsl:variable name="maxlength_dt">
5584
5656
  <xsl:call-template name="getMaxLength_dt"/>
5585
5657
  </xsl:variable>
@@ -5608,13 +5680,22 @@
5608
5680
  </xsl:when>
5609
5681
  <xsl:otherwise>
5610
5682
  <xsl:choose>
5683
+ <!-- to set width check most wide chars like `W` -->
5611
5684
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
5612
- <fo:table-column column-width="5%"/>
5613
- <fo:table-column column-width="95%"/>
5685
+ <fo:table-column column-width="7%"/>
5686
+ <fo:table-column column-width="93%"/>
5614
5687
  </xsl:when>
5615
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
5616
- <fo:table-column column-width="10%"/>
5617
- <fo:table-column column-width="90%"/>
5688
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
5689
+ <fo:table-column column-width="15%"/>
5690
+ <fo:table-column column-width="85%"/>
5691
+ </xsl:when>
5692
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
5693
+ <fo:table-column column-width="20%"/>
5694
+ <fo:table-column column-width="80%"/>
5695
+ </xsl:when>
5696
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
5697
+ <fo:table-column column-width="25%"/>
5698
+ <fo:table-column column-width="75%"/>
5618
5699
  </xsl:when>
5619
5700
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
5620
5701
  <fo:table-column column-width="60%"/>
@@ -5813,6 +5894,7 @@
5813
5894
 
5814
5895
 
5815
5896
 
5897
+
5816
5898
 
5817
5899
  </xsl:variable>
5818
5900
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -5826,10 +5908,18 @@
5826
5908
  </xsl:if>
5827
5909
  <xsl:apply-templates/>
5828
5910
  </fo:inline>
5911
+ </xsl:template><xsl:template match="*[local-name()='underline']">
5912
+ <fo:inline text-decoration="underline">
5913
+ <xsl:apply-templates/>
5914
+ </fo:inline>
5829
5915
  </xsl:template><xsl:template match="*[local-name()='del']">
5830
5916
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
5831
5917
  <xsl:apply-templates/>
5832
5918
  </fo:inline>
5919
+ </xsl:template><xsl:template match="*[local-name()='hi']">
5920
+ <fo:inline background-color="yellow">
5921
+ <xsl:apply-templates/>
5922
+ </fo:inline>
5833
5923
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5834
5924
  <xsl:variable name="text" select="normalize-space(.)"/>
5835
5925
  <fo:inline font-size="75%">
@@ -5919,6 +6009,10 @@
5919
6009
  <xsl:param name="text" select="."/>
5920
6010
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
5921
6011
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
6012
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
6013
+ <xsl:param name="text" select="."/>
6014
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
6015
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
5922
6016
  </xsl:template><xsl:template name="add-zero-spaces">
5923
6017
  <xsl:param name="text" select="."/>
5924
6018
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -6170,6 +6264,14 @@
6170
6264
  <xsl:apply-templates select="." mode="mathml"/>
6171
6265
  </xsl:variable>
6172
6266
  <fo:instream-foreign-object fox:alt-text="Math">
6267
+
6268
+ <xsl:if test="ancestor::*[local-name() = 'formula']">
6269
+ <xsl:attribute name="width">95%</xsl:attribute>
6270
+ <xsl:attribute name="content-height">100%</xsl:attribute>
6271
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6272
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6273
+ </xsl:if>
6274
+
6173
6275
  <!-- <xsl:copy-of select="."/> -->
6174
6276
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
6175
6277
  </fo:instream-foreign-object>
@@ -6183,7 +6285,12 @@
6183
6285
  <!-- replace start and end spaces to non-break space -->
6184
6286
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
6185
6287
  </xsl:copy>
6186
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
6288
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
6289
+ <xsl:copy>
6290
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
6291
+ </xsl:copy>
6292
+ <mathml:mspace width="0.5ex"/>
6293
+ </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">
6187
6294
  <xsl:variable name="target">
6188
6295
  <xsl:choose>
6189
6296
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -6204,7 +6311,10 @@
6204
6311
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
6205
6312
  <xsl:choose>
6206
6313
  <xsl:when test="normalize-space(.) = ''">
6207
- <xsl:value-of select="$target"/>
6314
+ <!-- <xsl:value-of select="$target"/> -->
6315
+ <xsl:call-template name="add-zero-spaces-link-java">
6316
+ <xsl:with-param name="text" select="$target"/>
6317
+ </xsl:call-template>
6208
6318
  </xsl:when>
6209
6319
  <xsl:otherwise>
6210
6320
  <xsl:apply-templates/>
@@ -6214,8 +6324,6 @@
6214
6324
  </xsl:otherwise>
6215
6325
  </xsl:choose>
6216
6326
  </fo:inline>
6217
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
6218
- <fo:inline id="{@id}"/>
6219
6327
  </xsl:template><xsl:template match="*[local-name()='appendix']">
6220
6328
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
6221
6329
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -6417,7 +6525,7 @@
6417
6525
  </xsl:if> -->
6418
6526
  </fo:inline>
6419
6527
  </xsl:if>
6420
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
6528
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
6421
6529
  <fo:block-container id="{@id}">
6422
6530
 
6423
6531
  <xsl:if test="*[local-name() = 'name']">
@@ -6437,6 +6545,7 @@
6437
6545
  <fo:block id="{@id}">
6438
6546
  <xsl:apply-templates/>
6439
6547
  </fo:block>
6548
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
6440
6549
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
6441
6550
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
6442
6551
  <xsl:apply-templates/>
@@ -6642,6 +6751,12 @@
6642
6751
  <!-- <xsl:text> </xsl:text> -->
6643
6752
  </xsl:template><xsl:template name="getSection">
6644
6753
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
6754
+ <!--
6755
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
6756
+ <xsl:value-of select="."/>
6757
+ </xsl:for-each>
6758
+ -->
6759
+
6645
6760
  </xsl:template><xsl:template name="getName">
6646
6761
  <xsl:choose>
6647
6762
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -6694,6 +6809,12 @@
6694
6809
  <xsl:copy>
6695
6810
  <xsl:apply-templates mode="contents_item"/>
6696
6811
  </xsl:copy>
6812
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
6813
+ <xsl:copy>
6814
+ <xsl:apply-templates mode="contents_item"/>
6815
+ </xsl:copy>
6816
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
6817
+ <xsl:copy-of select="."/>
6697
6818
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
6698
6819
  <xsl:text> </xsl:text>
6699
6820
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -6719,6 +6840,7 @@
6719
6840
 
6720
6841
 
6721
6842
 
6843
+
6722
6844
 
6723
6845
 
6724
6846
 
@@ -7021,10 +7143,11 @@
7021
7143
  </xsl:choose>
7022
7144
 
7023
7145
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
7024
-
7146
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
7025
7147
  <xsl:variable name="element">
7026
7148
  block
7027
7149
 
7150
+
7028
7151
  </xsl:variable>
7029
7152
  <xsl:choose>
7030
7153
  <xsl:when test="normalize-space($element) = 'block'">
@@ -7099,11 +7222,13 @@
7099
7222
  </xsl:if>
7100
7223
  </xsl:if>
7101
7224
 
7225
+
7102
7226
  <fo:block-container margin-left="0mm">
7103
7227
 
7104
7228
  <fo:block xsl:use-attribute-sets="quote-style">
7105
7229
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
7106
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
7230
+
7231
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
7107
7232
  </fo:block>
7108
7233
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
7109
7234
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -7126,32 +7251,50 @@
7126
7251
  <xsl:text>— </xsl:text>
7127
7252
  <xsl:apply-templates/>
7128
7253
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
7129
- <fo:inline xsl:use-attribute-sets="eref-style">
7130
- <xsl:if test="@type = 'footnote'">
7131
-
7132
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7133
- <xsl:attribute name="font-size">80%</xsl:attribute>
7134
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
7135
- <xsl:attribute name="vertical-align">super</xsl:attribute>
7136
-
7137
-
7138
- </xsl:if>
7139
-
7140
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7141
-
7142
- <xsl:if test="@type = 'inline'">
7143
-
7144
- <xsl:attribute name="color">blue</xsl:attribute>
7145
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
7146
-
7147
-
7148
-
7149
- </xsl:if>
7150
-
7151
-
7152
- <xsl:apply-templates/>
7153
- </fo:basic-link>
7154
- </fo:inline>
7254
+
7255
+ <xsl:variable name="bibitemid">
7256
+ <xsl:choose>
7257
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
7258
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
7259
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
7260
+ </xsl:choose>
7261
+ </xsl:variable>
7262
+
7263
+ <xsl:choose>
7264
+ <xsl:when test="normalize-space($bibitemid) != ''">
7265
+ <fo:inline xsl:use-attribute-sets="eref-style">
7266
+ <xsl:if test="@type = 'footnote'">
7267
+
7268
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7269
+ <xsl:attribute name="font-size">80%</xsl:attribute>
7270
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
7271
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
7272
+
7273
+
7274
+ </xsl:if>
7275
+
7276
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
7277
+ <xsl:if test="normalize-space(@citeas) = ''">
7278
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
7279
+ </xsl:if>
7280
+ <xsl:if test="@type = 'inline'">
7281
+
7282
+ <xsl:attribute name="color">blue</xsl:attribute>
7283
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
7284
+
7285
+
7286
+
7287
+ </xsl:if>
7288
+
7289
+ <xsl:apply-templates/>
7290
+ </fo:basic-link>
7291
+
7292
+ </fo:inline>
7293
+ </xsl:when>
7294
+ <xsl:otherwise>
7295
+ <fo:inline><xsl:apply-templates/></fo:inline>
7296
+ </xsl:otherwise>
7297
+ </xsl:choose>
7155
7298
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
7156
7299
  <!-- zero-space char -->
7157
7300
  <xsl:variable name="depth">
@@ -7257,6 +7400,7 @@
7257
7400
 
7258
7401
 
7259
7402
 
7403
+
7260
7404
 
7261
7405
 
7262
7406
 
@@ -7268,7 +7412,7 @@
7268
7412
 
7269
7413
 
7270
7414
 
7271
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
7415
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
7272
7416
  <fo:block break-after="page"/>
7273
7417
  <fo:block>
7274
7418
  <xsl:call-template name="setId"/>
@@ -7276,10 +7420,11 @@
7276
7420
  </fo:block>
7277
7421
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
7278
7422
  <fo:block>
7279
- <xsl:call-template name="setId"/>
7423
+ <xsl:call-template name="setId"/>
7280
7424
 
7281
7425
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
7282
7426
 
7427
+
7283
7428
  <xsl:apply-templates/>
7284
7429
  </fo:block>
7285
7430
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -7331,6 +7476,153 @@
7331
7476
  </fo:block>
7332
7477
  </xsl:otherwise>
7333
7478
  </xsl:choose>
7479
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
7480
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
7481
+ <bookmark><xsl:value-of select="@id"/></bookmark>
7482
+ </xsl:for-each>
7483
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
7484
+ <xsl:copy>
7485
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
7486
+ </xsl:copy>
7487
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
7488
+ <xsl:variable name="id">
7489
+ <xsl:call-template name="generateIndexXrefId"/>
7490
+ </xsl:variable>
7491
+ <xsl:copy> <!-- add id to xref -->
7492
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
7493
+ <xsl:attribute name="id">
7494
+ <xsl:value-of select="$id"/>
7495
+ </xsl:attribute>
7496
+ <xsl:apply-templates mode="index_add_id"/>
7497
+ </xsl:copy>
7498
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
7499
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
7500
+ <xsl:if test="@to">
7501
+ <xsl:value-of select="$dash"/>
7502
+ <xsl:copy>
7503
+ <xsl:copy-of select="@*"/>
7504
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
7505
+ <xsl:attribute name="id">
7506
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
7507
+ </xsl:attribute>
7508
+ <xsl:apply-templates mode="index_add_id"/>
7509
+ </xsl:copy>
7510
+ </xsl:if>
7511
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
7512
+ <xsl:copy>
7513
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
7514
+ </xsl:copy>
7515
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
7516
+ <xsl:copy>
7517
+ <xsl:apply-templates select="@*" mode="index_update"/>
7518
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
7519
+ </xsl:copy>
7520
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
7521
+ <xsl:param name="element"/>
7522
+ <xsl:param name="remove" select="'false'"/>
7523
+ <xsl:param name="target"/>
7524
+ <!-- <node></node> -->
7525
+ <xsl:choose>
7526
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
7527
+ <!-- skip text (i.e. remove it) and process next element -->
7528
+ <!-- [removed_<xsl:value-of select="."/>] -->
7529
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
7530
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
7531
+ </xsl:apply-templates>
7532
+ </xsl:when>
7533
+ <xsl:when test="self::text()">
7534
+ <xsl:value-of select="."/>
7535
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
7536
+ </xsl:when>
7537
+ <xsl:when test="self::* and local-name(.) = 'xref'">
7538
+ <xsl:variable name="id" select="@id"/>
7539
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
7540
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
7541
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
7542
+
7543
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
7544
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
7545
+
7546
+ <xsl:choose>
7547
+ <!-- 2nd pass -->
7548
+ <!-- if page is equal to page for next and page is not the end of range -->
7549
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
7550
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
7551
+ <!-- [removed_xref] -->
7552
+
7553
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
7554
+ <xsl:with-param name="remove">true</xsl:with-param>
7555
+ <xsl:with-param name="target">
7556
+ <xsl:choose>
7557
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
7558
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
7559
+ </xsl:choose>
7560
+ </xsl:with-param>
7561
+ </xsl:apply-templates>
7562
+ </xsl:when>
7563
+
7564
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
7565
+ <!-- remove xref -->
7566
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
7567
+ <xsl:with-param name="remove">true</xsl:with-param>
7568
+ </xsl:apply-templates>
7569
+ </xsl:when>
7570
+
7571
+ <xsl:otherwise>
7572
+ <xsl:apply-templates select="." mode="xref_copy">
7573
+ <xsl:with-param name="target" select="$target"/>
7574
+ </xsl:apply-templates>
7575
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
7576
+ </xsl:otherwise>
7577
+ </xsl:choose>
7578
+ </xsl:when>
7579
+ <xsl:when test="self::* and local-name(.) = 'ul'">
7580
+ <!-- ul -->
7581
+ <xsl:apply-templates select="." mode="index_update"/>
7582
+ </xsl:when>
7583
+ <xsl:otherwise>
7584
+ <xsl:apply-templates select="." mode="xref_copy">
7585
+ <xsl:with-param name="target" select="$target"/>
7586
+ </xsl:apply-templates>
7587
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
7588
+ </xsl:otherwise>
7589
+ </xsl:choose>
7590
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
7591
+ <xsl:param name="target"/>
7592
+ <xsl:copy>
7593
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
7594
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
7595
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
7596
+ </xsl:if>
7597
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
7598
+ </xsl:copy>
7599
+ </xsl:template><xsl:template name="generateIndexXrefId">
7600
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
7601
+
7602
+ <xsl:variable name="docid">
7603
+ <xsl:call-template name="getDocumentId"/>
7604
+ </xsl:variable>
7605
+ <xsl:variable name="item_number">
7606
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
7607
+ </xsl:variable>
7608
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
7609
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
7610
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
7611
+ <xsl:apply-templates/>
7612
+ <fo:block>
7613
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
7614
+ <fo:block> </fo:block>
7615
+ </xsl:if>
7616
+ </fo:block>
7617
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
7618
+ <xsl:apply-templates/>
7619
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
7620
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
7621
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
7622
+ <xsl:apply-templates/>
7623
+ </fo:block>
7624
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
7625
+ <fo:inline id="{@id}"/>
7334
7626
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
7335
7627
  <!-- <row>
7336
7628
  <date>05-07-2013</date>
@@ -7454,6 +7746,8 @@
7454
7746
  <xsl:value-of select="translate(.,'. ','')"/>
7455
7747
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
7456
7748
  <xsl:value-of select="substring(.,1,1)"/>
7749
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
7750
+ <fo:inline><xsl:apply-templates/></fo:inline>
7457
7751
  </xsl:template><xsl:template name="convertDate">
7458
7752
  <xsl:param name="date"/>
7459
7753
  <xsl:param name="format" select="'short'"/>
@@ -7478,6 +7772,57 @@
7478
7772
  </xsl:variable>
7479
7773
  <xsl:variable name="result">
7480
7774
  <xsl:choose>
7775
+ <xsl:when test="$format = 'ddMMyyyy'">
7776
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7777
+ <xsl:text> </xsl:text>
7778
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
7779
+ </xsl:when>
7780
+ <xsl:when test="$format = 'ddMM'">
7781
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7782
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
7783
+ </xsl:when>
7784
+ <xsl:when test="$format = 'short' or $day = ''">
7785
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
7786
+ </xsl:when>
7787
+ <xsl:otherwise>
7788
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
7789
+ </xsl:otherwise>
7790
+ </xsl:choose>
7791
+ </xsl:variable>
7792
+ <xsl:value-of select="$result"/>
7793
+ </xsl:template><xsl:template name="convertDateLocalized">
7794
+ <xsl:param name="date"/>
7795
+ <xsl:param name="format" select="'short'"/>
7796
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
7797
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
7798
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
7799
+ <xsl:variable name="monthStr">
7800
+ <xsl:choose>
7801
+ <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>
7802
+ <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>
7803
+ <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>
7804
+ <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>
7805
+ <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>
7806
+ <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>
7807
+ <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>
7808
+ <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>
7809
+ <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>
7810
+ <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>
7811
+ <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>
7812
+ <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>
7813
+ </xsl:choose>
7814
+ </xsl:variable>
7815
+ <xsl:variable name="result">
7816
+ <xsl:choose>
7817
+ <xsl:when test="$format = 'ddMMyyyy'">
7818
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7819
+ <xsl:text> </xsl:text>
7820
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
7821
+ </xsl:when>
7822
+ <xsl:when test="$format = 'ddMM'">
7823
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
7824
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
7825
+ </xsl:when>
7481
7826
  <xsl:when test="$format = 'short' or $day = ''">
7482
7827
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
7483
7828
  </xsl:when>
@@ -7493,7 +7838,7 @@
7493
7838
  <xsl:param name="charDelim" select="', '"/>
7494
7839
  <xsl:choose>
7495
7840
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
7496
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
7841
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
7497
7842
  <xsl:sort data-type="text" order="ascending"/>
7498
7843
  <xsl:call-template name="insertKeyword">
7499
7844
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -7502,7 +7847,7 @@
7502
7847
  </xsl:for-each>
7503
7848
  </xsl:when>
7504
7849
  <xsl:otherwise>
7505
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
7850
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
7506
7851
  <xsl:call-template name="insertKeyword">
7507
7852
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
7508
7853
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -7519,65 +7864,71 @@
7519
7864
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
7520
7865
  </xsl:choose>
7521
7866
  </xsl:template><xsl:template name="addPDFUAmeta">
7522
- <fo:declarations>
7523
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
7524
- <pdf:dictionary type="normal" key="ViewerPreferences">
7525
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
7526
- </pdf:dictionary>
7527
- </pdf:catalog>
7528
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
7529
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
7530
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
7531
- <!-- Dublin Core properties go here -->
7532
- <dc:title>
7533
- <xsl:variable name="title">
7867
+ <xsl:variable name="lang">
7868
+ <xsl:call-template name="getLang"/>
7869
+ </xsl:variable>
7870
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
7871
+ <pdf:dictionary type="normal" key="ViewerPreferences">
7872
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
7873
+ </pdf:dictionary>
7874
+ </pdf:catalog>
7875
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
7876
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
7877
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
7878
+ <!-- Dublin Core properties go here -->
7879
+ <dc:title>
7880
+ <xsl:variable name="title">
7881
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
7882
+
7534
7883
 
7884
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
7535
7885
 
7536
- <xsl:value-of select="//*[local-name() = 'bibdata'][@type='standard']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
7537
7886
 
7538
7887
 
7539
7888
 
7540
7889
 
7541
- </xsl:variable>
7542
- <xsl:choose>
7543
- <xsl:when test="normalize-space($title) != ''">
7544
- <xsl:value-of select="$title"/>
7545
- </xsl:when>
7546
- <xsl:otherwise>
7547
- <xsl:text> </xsl:text>
7548
- </xsl:otherwise>
7549
- </xsl:choose>
7550
- </dc:title>
7551
- <dc:creator>
7890
+ </xsl:for-each>
7891
+ </xsl:variable>
7892
+ <xsl:choose>
7893
+ <xsl:when test="normalize-space($title) != ''">
7894
+ <xsl:value-of select="$title"/>
7895
+ </xsl:when>
7896
+ <xsl:otherwise>
7897
+ <xsl:text> </xsl:text>
7898
+ </xsl:otherwise>
7899
+ </xsl:choose>
7900
+ </dc:title>
7901
+ <dc:creator>
7902
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
7552
7903
 
7904
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
7905
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
7906
+ <xsl:if test="position() != last()">; </xsl:if>
7907
+ </xsl:for-each>
7553
7908
 
7554
- <xsl:value-of select="//*[local-name() = 'bibdata'][@type='standard']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
7555
7909
 
7556
7910
 
7557
- </dc:creator>
7558
- <dc:description>
7559
- <xsl:variable name="abstract">
7560
-
7561
-
7562
-
7563
-
7564
-
7565
- <xsl:copy-of select="//*[local-name() = 'bibdata'][@type='standard']/*[local-name() = 'abstract']//text()"/>
7566
-
7567
- </xsl:variable>
7568
- <xsl:value-of select="normalize-space($abstract)"/>
7569
- </dc:description>
7570
- <pdf:Keywords>
7571
- <xsl:call-template name="insertKeywords"/>
7572
- </pdf:Keywords>
7573
- </rdf:Description>
7574
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
7575
- <!-- XMP properties go here -->
7576
- <xmp:CreatorTool/>
7577
- </rdf:Description>
7578
- </rdf:RDF>
7579
- </x:xmpmeta>
7580
- </fo:declarations>
7911
+ </xsl:for-each>
7912
+ </dc:creator>
7913
+ <dc:description>
7914
+ <xsl:variable name="abstract">
7915
+
7916
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
7917
+
7918
+
7919
+ </xsl:variable>
7920
+ <xsl:value-of select="normalize-space($abstract)"/>
7921
+ </dc:description>
7922
+ <pdf:Keywords>
7923
+ <xsl:call-template name="insertKeywords"/>
7924
+ </pdf:Keywords>
7925
+ </rdf:Description>
7926
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
7927
+ <!-- XMP properties go here -->
7928
+ <xmp:CreatorTool/>
7929
+ </rdf:Description>
7930
+ </rdf:RDF>
7931
+ </x:xmpmeta>
7581
7932
  </xsl:template><xsl:template name="getId">
7582
7933
  <xsl:choose>
7583
7934
  <xsl:when test="../@id">
@@ -7674,6 +8025,7 @@
7674
8025
 
7675
8026
  <xsl:value-of select="document('')//*/namespace::bipm"/>
7676
8027
 
8028
+
7677
8029
  </xsl:variable>
7678
8030
  <xsl:if test="$documentNS != $XSLNS">
7679
8031
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -7733,6 +8085,11 @@
7733
8085
  <xsl:call-template name="getLang"/>
7734
8086
  </xsl:variable>
7735
8087
 
7736
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
8088
+ <xsl:choose>
8089
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
8090
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
8091
+ </xsl:when>
8092
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
8093
+ </xsl:choose>
7737
8094
 
7738
8095
  </xsl:template></xsl:stylesheet>