metanorma-mpfa 0.5.5 → 0.5.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,9 @@ module IsoDoc
20
20
  {
21
21
  bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Titillium Web",sans-serif'),
22
22
  headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Titillium Web",sans-serif'),
23
- monospacefont: '"Space Mono",monospace'
23
+ monospacefont: '"Space Mono",monospace',
24
+ normalfontsize: "15px",
25
+ footnotefontsize: "0.9em",
24
26
  }
25
27
  end
26
28
 
@@ -328,16 +328,16 @@
328
328
  <xsl:otherwise> <!-- for ordered lists -->
329
329
  <xsl:choose>
330
330
  <xsl:when test="../@type = 'arabic'">
331
- <xsl:number format="a)"/>
331
+ <xsl:number format="a)" lang="en"/>
332
332
  </xsl:when>
333
333
  <xsl:when test="../@type = 'roman'">
334
334
  <xsl:number format="1)"/>
335
335
  </xsl:when>
336
336
  <xsl:when test="../@type = 'alphabet'">
337
- <xsl:number format="a)"/>
337
+ <xsl:number format="a)" lang="en"/>
338
338
  </xsl:when>
339
339
  <xsl:otherwise>
340
- <xsl:number format="a)"/>
340
+ <xsl:number format="a)" lang="en"/>
341
341
  </xsl:otherwise>
342
342
  </xsl:choose>
343
343
  </xsl:otherwise>
@@ -833,13 +833,22 @@
833
833
  <title-part lang="en">
834
834
 
835
835
 
836
+
836
837
  </title-part>
837
838
  <title-part lang="fr">
838
839
 
839
840
 
841
+
840
842
  </title-part>
841
843
  <title-part lang="zh">第 # 部分:</title-part>
842
844
 
845
+ <title-subpart lang="en">
846
+
847
+ </title-subpart>
848
+ <title-subpart lang="fr">
849
+
850
+ </title-subpart>
851
+
843
852
  <title-modified lang="en">modified</title-modified>
844
853
  <title-modified lang="fr">modifiée</title-modified>
845
854
 
@@ -1093,6 +1102,7 @@
1093
1102
 
1094
1103
 
1095
1104
 
1105
+
1096
1106
  </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
1097
1107
 
1098
1108
 
@@ -1128,6 +1138,7 @@
1128
1138
 
1129
1139
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1130
1140
 
1141
+
1131
1142
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1132
1143
 
1133
1144
 
@@ -1157,6 +1168,7 @@
1157
1168
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1158
1169
 
1159
1170
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1171
+
1160
1172
 
1161
1173
 
1162
1174
 
@@ -1276,7 +1288,9 @@
1276
1288
 
1277
1289
 
1278
1290
 
1279
-
1291
+ <!-- <xsl:if test="$namespace = 'bipm'">
1292
+ <fo:block>&#xA0;</fo:block>
1293
+ </xsl:if> -->
1280
1294
 
1281
1295
  <!-- $namespace = 'iso' or -->
1282
1296
 
@@ -1310,10 +1324,12 @@
1310
1324
 
1311
1325
 
1312
1326
  <xsl:variable name="colwidths">
1313
- <xsl:call-template name="calculate-column-widths">
1314
- <xsl:with-param name="cols-count" select="$cols-count"/>
1315
- <xsl:with-param name="table" select="$simple-table"/>
1316
- </xsl:call-template>
1327
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1328
+ <xsl:call-template name="calculate-column-widths">
1329
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1330
+ <xsl:with-param name="table" select="$simple-table"/>
1331
+ </xsl:call-template>
1332
+ </xsl:if>
1317
1333
  </xsl:variable>
1318
1334
  <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1319
1335
 
@@ -1388,16 +1404,25 @@
1388
1404
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1389
1405
  </xsl:if>
1390
1406
 
1391
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1392
- <xsl:choose>
1393
- <xsl:when test=". = 1 or . = 0">
1394
- <fo:table-column column-width="proportional-column-width(2)"/>
1395
- </xsl:when>
1396
- <xsl:otherwise>
1397
- <fo:table-column column-width="proportional-column-width({.})"/>
1398
- </xsl:otherwise>
1399
- </xsl:choose>
1400
- </xsl:for-each>
1407
+ <xsl:choose>
1408
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1409
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1410
+ <fo:table-column column-width="{@width}"/>
1411
+ </xsl:for-each>
1412
+ </xsl:when>
1413
+ <xsl:otherwise>
1414
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1415
+ <xsl:choose>
1416
+ <xsl:when test=". = 1 or . = 0">
1417
+ <fo:table-column column-width="proportional-column-width(2)"/>
1418
+ </xsl:when>
1419
+ <xsl:otherwise>
1420
+ <fo:table-column column-width="proportional-column-width({.})"/>
1421
+ </xsl:otherwise>
1422
+ </xsl:choose>
1423
+ </xsl:for-each>
1424
+ </xsl:otherwise>
1425
+ </xsl:choose>
1401
1426
 
1402
1427
  <xsl:choose>
1403
1428
  <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
@@ -1410,10 +1435,12 @@
1410
1435
 
1411
1436
  </fo:table>
1412
1437
 
1438
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1413
1439
  <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1414
1440
  <xsl:call-template name="insertTableFooterInSeparateTable">
1415
1441
  <xsl:with-param name="table_attributes" select="$table_attributes"/>
1416
1442
  <xsl:with-param name="colwidths" select="$colwidths"/>
1443
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1417
1444
  </xsl:call-template>
1418
1445
  </xsl:for-each>
1419
1446
 
@@ -1446,6 +1473,7 @@
1446
1473
  <xsl:if test="normalize-space() != ''">
1447
1474
  <fo:block xsl:use-attribute-sets="table-name-style">
1448
1475
 
1476
+
1449
1477
  <xsl:apply-templates/>
1450
1478
  </fo:block>
1451
1479
  </xsl:if>
@@ -1628,12 +1656,26 @@
1628
1656
 
1629
1657
 
1630
1658
 
1631
- <!-- except gb and bipm -->
1632
1659
 
1633
- <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1634
1660
 
1635
1661
 
1662
+ <!-- except gb -->
1663
+
1664
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1665
+
1636
1666
 
1667
+ <!-- show Note under table in preface (ex. abstract) sections -->
1668
+ <!-- empty, because notes show at page side in main sections -->
1669
+ <!-- <xsl:if test="$namespace = 'bipm'">
1670
+ <xsl:choose>
1671
+ <xsl:when test="ancestor::*[local-name()='preface']">
1672
+ <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1673
+ </xsl:when>
1674
+ <xsl:otherwise>
1675
+ <fo:block/>
1676
+ </xsl:otherwise>
1677
+ </xsl:choose>
1678
+ </xsl:if> -->
1637
1679
 
1638
1680
 
1639
1681
  <!-- horizontal row separator -->
@@ -1652,12 +1694,22 @@
1652
1694
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1653
1695
  <xsl:param name="table_attributes"/>
1654
1696
  <xsl:param name="colwidths"/>
1697
+ <xsl:param name="colgroup"/>
1655
1698
 
1656
1699
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1657
1700
 
1658
1701
  <xsl:if test="$isNoteOrFnExist = 'true'">
1659
1702
 
1660
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1703
+ <xsl:variable name="cols-count">
1704
+ <xsl:choose>
1705
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1706
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
1707
+ </xsl:when>
1708
+ <xsl:otherwise>
1709
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
1710
+ </xsl:otherwise>
1711
+ </xsl:choose>
1712
+ </xsl:variable>
1661
1713
 
1662
1714
  <fo:table keep-with-previous="always">
1663
1715
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -1675,16 +1727,25 @@
1675
1727
  </xsl:choose>
1676
1728
  </xsl:for-each>
1677
1729
 
1678
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1679
- <xsl:choose>
1680
- <xsl:when test=". = 1 or . = 0">
1681
- <fo:table-column column-width="proportional-column-width(2)"/>
1682
- </xsl:when>
1683
- <xsl:otherwise>
1684
- <fo:table-column column-width="proportional-column-width({.})"/>
1685
- </xsl:otherwise>
1686
- </xsl:choose>
1687
- </xsl:for-each>
1730
+ <xsl:choose>
1731
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1732
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
1733
+ <fo:table-column column-width="{@width}"/>
1734
+ </xsl:for-each>
1735
+ </xsl:when>
1736
+ <xsl:otherwise>
1737
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1738
+ <xsl:choose>
1739
+ <xsl:when test=". = 1 or . = 0">
1740
+ <fo:table-column column-width="proportional-column-width(2)"/>
1741
+ </xsl:when>
1742
+ <xsl:otherwise>
1743
+ <fo:table-column column-width="proportional-column-width({.})"/>
1744
+ </xsl:otherwise>
1745
+ </xsl:choose>
1746
+ </xsl:for-each>
1747
+ </xsl:otherwise>
1748
+ </xsl:choose>
1688
1749
 
1689
1750
  <fo:table-body>
1690
1751
  <fo:table-row>
@@ -1696,7 +1757,11 @@
1696
1757
 
1697
1758
 
1698
1759
 
1699
- <!-- except gb and bipm -->
1760
+
1761
+
1762
+
1763
+
1764
+ <!-- except gb -->
1700
1765
 
1701
1766
  <xsl:apply-templates select="../*[local-name()='note']" mode="process"/>
1702
1767
 
@@ -1782,6 +1847,10 @@
1782
1847
 
1783
1848
 
1784
1849
 
1850
+ <!-- <xsl:if test="$namespace = 'bipm'">
1851
+ <xsl:attribute name="height">8mm</xsl:attribute>
1852
+ </xsl:if> -->
1853
+
1785
1854
  <xsl:apply-templates/>
1786
1855
  </fo:table-row>
1787
1856
  </xsl:template><xsl:template match="*[local-name()='th']">
@@ -1866,7 +1935,8 @@
1866
1935
  </xsl:attribute>
1867
1936
  </xsl:if>
1868
1937
  <xsl:call-template name="display-align"/>
1869
- <fo:block>
1938
+ <fo:block>
1939
+
1870
1940
  <xsl:apply-templates/>
1871
1941
  </fo:block>
1872
1942
  </fo:table-cell>
@@ -2076,7 +2146,13 @@
2076
2146
  <xsl:apply-templates/>
2077
2147
  </fo:inline>
2078
2148
  </xsl:template><xsl:template match="*[local-name()='dl']">
2079
- <fo:block-container margin-left="0mm">
2149
+ <fo:block-container>
2150
+
2151
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
2152
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2153
+ </xsl:if>
2154
+
2155
+
2080
2156
  <xsl:if test="parent::*[local-name() = 'note']">
2081
2157
  <xsl:attribute name="margin-left">
2082
2158
  <xsl:choose>
@@ -2086,8 +2162,12 @@
2086
2162
  </xsl:attribute>
2087
2163
 
2088
2164
  </xsl:if>
2089
- <fo:block-container margin-left="0mm">
2090
-
2165
+ <fo:block-container>
2166
+
2167
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2168
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2169
+
2170
+
2091
2171
  <xsl:variable name="parent" select="local-name(..)"/>
2092
2172
 
2093
2173
  <xsl:variable name="key_iso">
@@ -2101,9 +2181,12 @@
2101
2181
  <fo:block margin-bottom="12pt" text-align="left">
2102
2182
 
2103
2183
  <xsl:variable name="title-where">
2104
- <xsl:call-template name="getTitle">
2105
- <xsl:with-param name="name" select="'title-where'"/>
2106
- </xsl:call-template>
2184
+
2185
+
2186
+ <xsl:call-template name="getTitle">
2187
+ <xsl:with-param name="name" select="'title-where'"/>
2188
+ </xsl:call-template>
2189
+
2107
2190
  </xsl:variable>
2108
2191
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2109
2192
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2119,9 +2202,12 @@
2119
2202
 
2120
2203
 
2121
2204
  <xsl:variable name="title-where">
2122
- <xsl:call-template name="getTitle">
2123
- <xsl:with-param name="name" select="'title-where'"/>
2124
- </xsl:call-template>
2205
+
2206
+
2207
+ <xsl:call-template name="getTitle">
2208
+ <xsl:with-param name="name" select="'title-where'"/>
2209
+ </xsl:call-template>
2210
+
2125
2211
  </xsl:variable>
2126
2212
  <xsl:value-of select="$title-where"/>
2127
2213
  </fo:block>
@@ -2132,9 +2218,12 @@
2132
2218
 
2133
2219
 
2134
2220
  <xsl:variable name="title-key">
2135
- <xsl:call-template name="getTitle">
2136
- <xsl:with-param name="name" select="'title-key'"/>
2137
- </xsl:call-template>
2221
+
2222
+
2223
+ <xsl:call-template name="getTitle">
2224
+ <xsl:with-param name="name" select="'title-key'"/>
2225
+ </xsl:call-template>
2226
+
2138
2227
  </xsl:variable>
2139
2228
  <xsl:value-of select="$title-key"/>
2140
2229
  </fo:block>
@@ -2260,12 +2349,32 @@
2260
2349
  </xsl:otherwise>
2261
2350
  </xsl:choose>
2262
2351
  </xsl:template><xsl:template name="getMaxLength_dt">
2263
- <xsl:for-each select="*[local-name()='dt']">
2264
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2265
- <xsl:if test="position() = 1">
2266
- <xsl:value-of select="string-length(normalize-space(.))"/>
2267
- </xsl:if>
2268
- </xsl:for-each>
2352
+ <xsl:variable name="lengths">
2353
+ <xsl:for-each select="*[local-name()='dt']">
2354
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
2355
+ <xsl:variable name="attributes">
2356
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
2357
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
2358
+ </xsl:variable>
2359
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
2360
+ </xsl:for-each>
2361
+ </xsl:variable>
2362
+ <xsl:variable name="maxLength">
2363
+ <!-- <xsl:for-each select="*[local-name()='dt']">
2364
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2365
+ <xsl:if test="position() = 1">
2366
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2367
+ </xsl:if>
2368
+ </xsl:for-each> -->
2369
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
2370
+ <xsl:sort select="." data-type="number" order="descending"/>
2371
+ <xsl:if test="position() = 1">
2372
+ <xsl:value-of select="."/>
2373
+ </xsl:if>
2374
+ </xsl:for-each>
2375
+ </xsl:variable>
2376
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
2377
+ <xsl:value-of select="$maxLength"/>
2269
2378
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2270
2379
  <xsl:param name="key_iso"/>
2271
2380
 
@@ -2377,6 +2486,7 @@
2377
2486
  </fo:inline>
2378
2487
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
2379
2488
  <fo:inline font-weight="bold">
2489
+
2380
2490
  <xsl:apply-templates/>
2381
2491
  </fo:inline>
2382
2492
  </xsl:template><xsl:template match="*[local-name()='sup']">
@@ -2705,7 +2815,18 @@
2705
2815
  <xsl:with-param name="previousRow" select="$newRow"/>
2706
2816
  </xsl:apply-templates>
2707
2817
  </xsl:template><xsl:template name="getLang">
2708
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2818
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
2819
+ <xsl:variable name="language">
2820
+ <xsl:choose>
2821
+ <xsl:when test="$language_current != ''">
2822
+ <xsl:value-of select="$language_current"/>
2823
+ </xsl:when>
2824
+ <xsl:otherwise>
2825
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2826
+ </xsl:otherwise>
2827
+ </xsl:choose>
2828
+ </xsl:variable>
2829
+
2709
2830
  <xsl:choose>
2710
2831
  <xsl:when test="$language = 'English'">en</xsl:when>
2711
2832
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -2740,6 +2861,7 @@
2740
2861
  <xsl:value-of select="substring($str, 2)"/>
2741
2862
  </xsl:template><xsl:template match="mathml:math">
2742
2863
  <fo:inline font-family="STIX Two Math"> <!-- -->
2864
+
2743
2865
  <xsl:variable name="mathml">
2744
2866
  <xsl:apply-templates select="." mode="mathml"/>
2745
2867
  </xsl:variable>
@@ -2769,6 +2891,7 @@
2769
2891
  </xsl:choose>
2770
2892
  </xsl:variable>
2771
2893
  <fo:inline xsl:use-attribute-sets="link-style">
2894
+
2772
2895
  <xsl:choose>
2773
2896
  <xsl:when test="$target = ''">
2774
2897
  <xsl:apply-templates/>
@@ -2822,10 +2945,14 @@
2822
2945
  </fo:inline>
2823
2946
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
2824
2947
  <xsl:variable name="title-modified">
2825
- <xsl:call-template name="getTitle">
2826
- <xsl:with-param name="name" select="'title-modified'"/>
2827
- </xsl:call-template>
2948
+
2949
+
2950
+ <xsl:call-template name="getTitle">
2951
+ <xsl:with-param name="name" select="'title-modified'"/>
2952
+ </xsl:call-template>
2953
+
2828
2954
  </xsl:variable>
2955
+
2829
2956
  <xsl:choose>
2830
2957
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
2831
2958
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -2886,6 +3013,8 @@
2886
3013
 
2887
3014
 
2888
3015
 
3016
+
3017
+
2889
3018
  <fo:inline xsl:use-attribute-sets="note-name-style">
2890
3019
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
2891
3020
  </fo:inline>
@@ -2974,7 +3103,8 @@
2974
3103
  </fo:inline>
2975
3104
  </xsl:if>
2976
3105
  </xsl:template><xsl:template match="*[local-name() = 'figure']">
2977
- <fo:block-container id="{@id}">
3106
+ <fo:block-container id="{@id}">
3107
+
2978
3108
  <fo:block>
2979
3109
  <xsl:apply-templates/>
2980
3110
  </fo:block>
@@ -3025,7 +3155,7 @@
3025
3155
  <xsl:apply-templates mode="bookmarks"/>
3026
3156
  </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3027
3157
  <xsl:apply-templates select="."/>
3028
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3158
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3029
3159
  <xsl:apply-templates mode="bookmarks"/>
3030
3160
  </xsl:template><xsl:template name="addBookmarks">
3031
3161
  <xsl:param name="contents"/>
@@ -3041,6 +3171,8 @@
3041
3171
  <xsl:variable name="bookmark-title_">
3042
3172
  <xsl:call-template name="getLangVersion">
3043
3173
  <xsl:with-param name="lang" select="@lang"/>
3174
+ <xsl:with-param name="doctype" select="@doctype"/>
3175
+ <xsl:with-param name="title" select="@title-part"/>
3044
3176
  </xsl:call-template>
3045
3177
  </xsl:variable>
3046
3178
  <xsl:choose>
@@ -3058,13 +3190,34 @@
3058
3190
  </xsl:choose>
3059
3191
  </fo:bookmark-title>
3060
3192
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3193
+
3194
+ <xsl:call-template name="insertFigureBookmarks">
3195
+ <xsl:with-param name="contents" select="contents"/>
3196
+ </xsl:call-template>
3197
+
3198
+ <xsl:call-template name="insertTableBookmarks">
3199
+ <xsl:with-param name="contents" select="contents"/>
3200
+ <xsl:with-param name="lang" select="@lang"/>
3201
+ </xsl:call-template>
3202
+
3061
3203
  </fo:bookmark>
3062
3204
 
3063
3205
  </xsl:for-each>
3064
3206
  </xsl:when>
3065
3207
  <xsl:otherwise>
3066
3208
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3209
+
3067
3210
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3211
+
3212
+ <xsl:call-template name="insertFigureBookmarks">
3213
+ <xsl:with-param name="contents" select="contents"/>
3214
+ </xsl:call-template>
3215
+
3216
+ <xsl:call-template name="insertTableBookmarks">
3217
+ <xsl:with-param name="contents" select="contents"/>
3218
+ <xsl:with-param name="lang" select="@lang"/>
3219
+ </xsl:call-template>
3220
+
3068
3221
  </xsl:for-each>
3069
3222
  </xsl:otherwise>
3070
3223
  </xsl:choose>
@@ -3083,8 +3236,44 @@
3083
3236
 
3084
3237
  </fo:bookmark-tree>
3085
3238
  </xsl:if>
3239
+ </xsl:template><xsl:template name="insertFigureBookmarks">
3240
+ <xsl:param name="contents"/>
3241
+ <xsl:if test="xalan:nodeset($contents)/figure">
3242
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
3243
+ <fo:bookmark-title>Figures</fo:bookmark-title>
3244
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
3245
+ <fo:bookmark internal-destination="{@id}">
3246
+ <fo:bookmark-title>
3247
+ <xsl:value-of select="normalize-space(title)"/>
3248
+ </fo:bookmark-title>
3249
+ </fo:bookmark>
3250
+ </xsl:for-each>
3251
+ </fo:bookmark>
3252
+ </xsl:if>
3253
+ </xsl:template><xsl:template name="insertTableBookmarks">
3254
+ <xsl:param name="contents"/>
3255
+ <xsl:param name="lang"/>
3256
+ <xsl:if test="xalan:nodeset($contents)/table">
3257
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
3258
+ <fo:bookmark-title>
3259
+ <xsl:choose>
3260
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
3261
+ <xsl:otherwise>Tables</xsl:otherwise>
3262
+ </xsl:choose>
3263
+ </fo:bookmark-title>
3264
+ <xsl:for-each select="xalan:nodeset($contents)/table">
3265
+ <fo:bookmark internal-destination="{@id}">
3266
+ <fo:bookmark-title>
3267
+ <xsl:value-of select="normalize-space(title)"/>
3268
+ </fo:bookmark-title>
3269
+ </fo:bookmark>
3270
+ </xsl:for-each>
3271
+ </fo:bookmark>
3272
+ </xsl:if>
3086
3273
  </xsl:template><xsl:template name="getLangVersion">
3087
3274
  <xsl:param name="lang"/>
3275
+ <xsl:param name="doctype" select="''"/>
3276
+ <xsl:param name="title" select="''"/>
3088
3277
  <xsl:choose>
3089
3278
  <xsl:when test="$lang = 'en'">
3090
3279
 
@@ -3544,9 +3733,14 @@
3544
3733
 
3545
3734
  <fo:inline>
3546
3735
 
3547
- <xsl:call-template name="getTitle">
3548
- <xsl:with-param name="name" select="'title-source'"/>
3549
- </xsl:call-template>
3736
+
3737
+
3738
+
3739
+ <xsl:call-template name="getTitle">
3740
+ <xsl:with-param name="name" select="'title-source'"/>
3741
+ </xsl:call-template>
3742
+
3743
+
3550
3744
  <xsl:text>: </xsl:text>
3551
3745
  </fo:inline>
3552
3746
 
@@ -3571,7 +3765,8 @@
3571
3765
  <fo:block-container margin-left="0mm">
3572
3766
 
3573
3767
  <fo:block xsl:use-attribute-sets="quote-style">
3574
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
3768
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
3769
+ <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3575
3770
  </fo:block>
3576
3771
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3577
3772
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -3693,9 +3888,12 @@
3693
3888
  </fo:block>
3694
3889
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
3695
3890
  <xsl:variable name="title-deprecated">
3696
- <xsl:call-template name="getTitle">
3697
- <xsl:with-param name="name" select="'title-deprecated'"/>
3698
- </xsl:call-template>
3891
+
3892
+
3893
+ <xsl:call-template name="getTitle">
3894
+ <xsl:with-param name="name" select="'title-deprecated'"/>
3895
+ </xsl:call-template>
3896
+
3699
3897
  </xsl:variable>
3700
3898
  <fo:block xsl:use-attribute-sets="deprecates-style">
3701
3899
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -3744,7 +3942,7 @@
3744
3942
  <fo:block id="{@id}">
3745
3943
  <xsl:apply-templates/>
3746
3944
  </fo:block>
3747
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
3945
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" priority="3"/><xsl:template match="*[local-name() = 'bibitem'][@hidden='true']" priority="3"/><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
3748
3946
 
3749
3947
  <fo:block id="{@id}">
3750
3948
  <xsl:apply-templates/>
@@ -3801,7 +3999,8 @@
3801
3999
  <fo:table-column column-width="107mm"/>
3802
4000
  <fo:table-column column-width="15mm"/>
3803
4001
  <fo:table-body>
3804
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
4002
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
4003
+
3805
4004
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
3806
4005
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
3807
4006
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -3819,6 +4018,10 @@
3819
4018
  <fo:block><xsl:apply-templates/></fo:block>
3820
4019
  </fo:table-cell>
3821
4020
  </xsl:template><xsl:template name="processBibitem">
4021
+
4022
+
4023
+ <!-- end BIPM bibitem processing-->
4024
+
3822
4025
 
3823
4026
 
3824
4027
 
@@ -4054,13 +4257,22 @@
4054
4257
  </xsl:template><xsl:template name="split">
4055
4258
  <xsl:param name="pText" select="."/>
4056
4259
  <xsl:param name="sep" select="','"/>
4260
+ <xsl:param name="normalize-space" select="'true'"/>
4057
4261
  <xsl:if test="string-length($pText) &gt;0">
4058
4262
  <item>
4059
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4263
+ <xsl:choose>
4264
+ <xsl:when test="$normalize-space = 'true'">
4265
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4266
+ </xsl:when>
4267
+ <xsl:otherwise>
4268
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4269
+ </xsl:otherwise>
4270
+ </xsl:choose>
4060
4271
  </item>
4061
4272
  <xsl:call-template name="split">
4062
4273
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4063
4274
  <xsl:with-param name="sep" select="$sep"/>
4275
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4064
4276
  </xsl:call-template>
4065
4277
  </xsl:if>
4066
4278
  </xsl:template><xsl:template name="getDocumentId">
@@ -4126,4 +4338,23 @@
4126
4338
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4127
4339
  </xsl:call-template>
4128
4340
  </xsl:if>
4341
+ </xsl:template><xsl:template name="repeat">
4342
+ <xsl:param name="char" select="'*'"/>
4343
+ <xsl:param name="count"/>
4344
+ <xsl:if test="$count &gt; 0">
4345
+ <xsl:value-of select="$char"/>
4346
+ <xsl:call-template name="repeat">
4347
+ <xsl:with-param name="char" select="$char"/>
4348
+ <xsl:with-param name="count" select="$count - 1"/>
4349
+ </xsl:call-template>
4350
+ </xsl:if>
4351
+ </xsl:template><xsl:template name="getLocalizedString">
4352
+ <xsl:param name="key"/>
4353
+
4354
+ <xsl:variable name="curr_lang">
4355
+ <xsl:call-template name="getLang"/>
4356
+ </xsl:variable>
4357
+
4358
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4359
+
4129
4360
  </xsl:template></xsl:stylesheet>