metanorma-mpfa 0.5.6 → 0.5.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -1129,6 +1138,7 @@
1129
1138
 
1130
1139
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1131
1140
 
1141
+
1132
1142
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1133
1143
 
1134
1144
 
@@ -1158,6 +1168,7 @@
1158
1168
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1159
1169
 
1160
1170
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1171
+
1161
1172
 
1162
1173
 
1163
1174
 
@@ -1277,7 +1288,9 @@
1277
1288
 
1278
1289
 
1279
1290
 
1280
-
1291
+ <!-- <xsl:if test="$namespace = 'bipm'">
1292
+ <fo:block>&#xA0;</fo:block>
1293
+ </xsl:if> -->
1281
1294
 
1282
1295
  <!-- $namespace = 'iso' or -->
1283
1296
 
@@ -1311,10 +1324,12 @@
1311
1324
 
1312
1325
 
1313
1326
  <xsl:variable name="colwidths">
1314
- <xsl:call-template name="calculate-column-widths">
1315
- <xsl:with-param name="cols-count" select="$cols-count"/>
1316
- <xsl:with-param name="table" select="$simple-table"/>
1317
- </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>
1318
1333
  </xsl:variable>
1319
1334
  <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1320
1335
 
@@ -1357,7 +1372,12 @@
1357
1372
 
1358
1373
  <xsl:variable name="table_attributes">
1359
1374
  <attribute name="table-layout">fixed</attribute>
1360
- <attribute name="width">100%</attribute>
1375
+ <attribute name="width">
1376
+ <xsl:choose>
1377
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1378
+ <xsl:otherwise>100%</xsl:otherwise>
1379
+ </xsl:choose>
1380
+ </attribute>
1361
1381
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1362
1382
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1363
1383
 
@@ -1389,16 +1409,25 @@
1389
1409
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1390
1410
  </xsl:if>
1391
1411
 
1392
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1393
- <xsl:choose>
1394
- <xsl:when test=". = 1 or . = 0">
1395
- <fo:table-column column-width="proportional-column-width(2)"/>
1396
- </xsl:when>
1397
- <xsl:otherwise>
1398
- <fo:table-column column-width="proportional-column-width({.})"/>
1399
- </xsl:otherwise>
1400
- </xsl:choose>
1401
- </xsl:for-each>
1412
+ <xsl:choose>
1413
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1414
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1415
+ <fo:table-column column-width="{@width}"/>
1416
+ </xsl:for-each>
1417
+ </xsl:when>
1418
+ <xsl:otherwise>
1419
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1420
+ <xsl:choose>
1421
+ <xsl:when test=". = 1 or . = 0">
1422
+ <fo:table-column column-width="proportional-column-width(2)"/>
1423
+ </xsl:when>
1424
+ <xsl:otherwise>
1425
+ <fo:table-column column-width="proportional-column-width({.})"/>
1426
+ </xsl:otherwise>
1427
+ </xsl:choose>
1428
+ </xsl:for-each>
1429
+ </xsl:otherwise>
1430
+ </xsl:choose>
1402
1431
 
1403
1432
  <xsl:choose>
1404
1433
  <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
@@ -1411,10 +1440,12 @@
1411
1440
 
1412
1441
  </fo:table>
1413
1442
 
1443
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1414
1444
  <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1415
1445
  <xsl:call-template name="insertTableFooterInSeparateTable">
1416
1446
  <xsl:with-param name="table_attributes" select="$table_attributes"/>
1417
1447
  <xsl:with-param name="colwidths" select="$colwidths"/>
1448
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1418
1449
  </xsl:call-template>
1419
1450
  </xsl:for-each>
1420
1451
 
@@ -1447,6 +1478,7 @@
1447
1478
  <xsl:if test="normalize-space() != ''">
1448
1479
  <fo:block xsl:use-attribute-sets="table-name-style">
1449
1480
 
1481
+
1450
1482
  <xsl:apply-templates/>
1451
1483
  </fo:block>
1452
1484
  </xsl:if>
@@ -1667,12 +1699,22 @@
1667
1699
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1668
1700
  <xsl:param name="table_attributes"/>
1669
1701
  <xsl:param name="colwidths"/>
1702
+ <xsl:param name="colgroup"/>
1670
1703
 
1671
1704
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1672
1705
 
1673
1706
  <xsl:if test="$isNoteOrFnExist = 'true'">
1674
1707
 
1675
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1708
+ <xsl:variable name="cols-count">
1709
+ <xsl:choose>
1710
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1711
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
1712
+ </xsl:when>
1713
+ <xsl:otherwise>
1714
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
1715
+ </xsl:otherwise>
1716
+ </xsl:choose>
1717
+ </xsl:variable>
1676
1718
 
1677
1719
  <fo:table keep-with-previous="always">
1678
1720
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -1690,16 +1732,25 @@
1690
1732
  </xsl:choose>
1691
1733
  </xsl:for-each>
1692
1734
 
1693
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1694
- <xsl:choose>
1695
- <xsl:when test=". = 1 or . = 0">
1696
- <fo:table-column column-width="proportional-column-width(2)"/>
1697
- </xsl:when>
1698
- <xsl:otherwise>
1699
- <fo:table-column column-width="proportional-column-width({.})"/>
1700
- </xsl:otherwise>
1701
- </xsl:choose>
1702
- </xsl:for-each>
1735
+ <xsl:choose>
1736
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1737
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
1738
+ <fo:table-column column-width="{@width}"/>
1739
+ </xsl:for-each>
1740
+ </xsl:when>
1741
+ <xsl:otherwise>
1742
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1743
+ <xsl:choose>
1744
+ <xsl:when test=". = 1 or . = 0">
1745
+ <fo:table-column column-width="proportional-column-width(2)"/>
1746
+ </xsl:when>
1747
+ <xsl:otherwise>
1748
+ <fo:table-column column-width="proportional-column-width({.})"/>
1749
+ </xsl:otherwise>
1750
+ </xsl:choose>
1751
+ </xsl:for-each>
1752
+ </xsl:otherwise>
1753
+ </xsl:choose>
1703
1754
 
1704
1755
  <fo:table-body>
1705
1756
  <fo:table-row>
@@ -1800,6 +1851,7 @@
1800
1851
 
1801
1852
 
1802
1853
 
1854
+
1803
1855
  <!-- <xsl:if test="$namespace = 'bipm'">
1804
1856
  <xsl:attribute name="height">8mm</xsl:attribute>
1805
1857
  </xsl:if> -->
@@ -1888,7 +1940,8 @@
1888
1940
  </xsl:attribute>
1889
1941
  </xsl:if>
1890
1942
  <xsl:call-template name="display-align"/>
1891
- <fo:block>
1943
+ <fo:block>
1944
+
1892
1945
  <xsl:apply-templates/>
1893
1946
  </fo:block>
1894
1947
  </fo:table-cell>
@@ -2098,7 +2151,13 @@
2098
2151
  <xsl:apply-templates/>
2099
2152
  </fo:inline>
2100
2153
  </xsl:template><xsl:template match="*[local-name()='dl']">
2101
- <fo:block-container margin-left="0mm">
2154
+ <fo:block-container>
2155
+
2156
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
2157
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2158
+ </xsl:if>
2159
+
2160
+
2102
2161
  <xsl:if test="parent::*[local-name() = 'note']">
2103
2162
  <xsl:attribute name="margin-left">
2104
2163
  <xsl:choose>
@@ -2108,8 +2167,12 @@
2108
2167
  </xsl:attribute>
2109
2168
 
2110
2169
  </xsl:if>
2111
- <fo:block-container margin-left="0mm">
2112
-
2170
+ <fo:block-container>
2171
+
2172
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2173
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2174
+
2175
+
2113
2176
  <xsl:variable name="parent" select="local-name(..)"/>
2114
2177
 
2115
2178
  <xsl:variable name="key_iso">
@@ -2123,9 +2186,12 @@
2123
2186
  <fo:block margin-bottom="12pt" text-align="left">
2124
2187
 
2125
2188
  <xsl:variable name="title-where">
2126
- <xsl:call-template name="getTitle">
2127
- <xsl:with-param name="name" select="'title-where'"/>
2128
- </xsl:call-template>
2189
+
2190
+
2191
+ <xsl:call-template name="getTitle">
2192
+ <xsl:with-param name="name" select="'title-where'"/>
2193
+ </xsl:call-template>
2194
+
2129
2195
  </xsl:variable>
2130
2196
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2131
2197
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2141,9 +2207,12 @@
2141
2207
 
2142
2208
 
2143
2209
  <xsl:variable name="title-where">
2144
- <xsl:call-template name="getTitle">
2145
- <xsl:with-param name="name" select="'title-where'"/>
2146
- </xsl:call-template>
2210
+
2211
+
2212
+ <xsl:call-template name="getTitle">
2213
+ <xsl:with-param name="name" select="'title-where'"/>
2214
+ </xsl:call-template>
2215
+
2147
2216
  </xsl:variable>
2148
2217
  <xsl:value-of select="$title-where"/>
2149
2218
  </fo:block>
@@ -2154,9 +2223,12 @@
2154
2223
 
2155
2224
 
2156
2225
  <xsl:variable name="title-key">
2157
- <xsl:call-template name="getTitle">
2158
- <xsl:with-param name="name" select="'title-key'"/>
2159
- </xsl:call-template>
2226
+
2227
+
2228
+ <xsl:call-template name="getTitle">
2229
+ <xsl:with-param name="name" select="'title-key'"/>
2230
+ </xsl:call-template>
2231
+
2160
2232
  </xsl:variable>
2161
2233
  <xsl:value-of select="$title-key"/>
2162
2234
  </fo:block>
@@ -2282,12 +2354,32 @@
2282
2354
  </xsl:otherwise>
2283
2355
  </xsl:choose>
2284
2356
  </xsl:template><xsl:template name="getMaxLength_dt">
2285
- <xsl:for-each select="*[local-name()='dt']">
2286
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2287
- <xsl:if test="position() = 1">
2288
- <xsl:value-of select="string-length(normalize-space(.))"/>
2289
- </xsl:if>
2290
- </xsl:for-each>
2357
+ <xsl:variable name="lengths">
2358
+ <xsl:for-each select="*[local-name()='dt']">
2359
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
2360
+ <xsl:variable name="attributes">
2361
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
2362
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
2363
+ </xsl:variable>
2364
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
2365
+ </xsl:for-each>
2366
+ </xsl:variable>
2367
+ <xsl:variable name="maxLength">
2368
+ <!-- <xsl:for-each select="*[local-name()='dt']">
2369
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2370
+ <xsl:if test="position() = 1">
2371
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2372
+ </xsl:if>
2373
+ </xsl:for-each> -->
2374
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
2375
+ <xsl:sort select="." data-type="number" order="descending"/>
2376
+ <xsl:if test="position() = 1">
2377
+ <xsl:value-of select="."/>
2378
+ </xsl:if>
2379
+ </xsl:for-each>
2380
+ </xsl:variable>
2381
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
2382
+ <xsl:value-of select="$maxLength"/>
2291
2383
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2292
2384
  <xsl:param name="key_iso"/>
2293
2385
 
@@ -2399,6 +2491,7 @@
2399
2491
  </fo:inline>
2400
2492
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
2401
2493
  <fo:inline font-weight="bold">
2494
+
2402
2495
  <xsl:apply-templates/>
2403
2496
  </fo:inline>
2404
2497
  </xsl:template><xsl:template match="*[local-name()='sup']">
@@ -2438,6 +2531,10 @@
2438
2531
  </xsl:if>
2439
2532
  <xsl:apply-templates/>
2440
2533
  </fo:inline>
2534
+ </xsl:template><xsl:template match="*[local-name()='underline']">
2535
+ <fo:inline text-decoration="underline">
2536
+ <xsl:apply-templates/>
2537
+ </fo:inline>
2441
2538
  </xsl:template><xsl:template match="*[local-name()='del']">
2442
2539
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2443
2540
  <xsl:apply-templates/>
@@ -2727,7 +2824,18 @@
2727
2824
  <xsl:with-param name="previousRow" select="$newRow"/>
2728
2825
  </xsl:apply-templates>
2729
2826
  </xsl:template><xsl:template name="getLang">
2730
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2827
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
2828
+ <xsl:variable name="language">
2829
+ <xsl:choose>
2830
+ <xsl:when test="$language_current != ''">
2831
+ <xsl:value-of select="$language_current"/>
2832
+ </xsl:when>
2833
+ <xsl:otherwise>
2834
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2835
+ </xsl:otherwise>
2836
+ </xsl:choose>
2837
+ </xsl:variable>
2838
+
2731
2839
  <xsl:choose>
2732
2840
  <xsl:when test="$language = 'English'">en</xsl:when>
2733
2841
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -2762,6 +2870,7 @@
2762
2870
  <xsl:value-of select="substring($str, 2)"/>
2763
2871
  </xsl:template><xsl:template match="mathml:math">
2764
2872
  <fo:inline font-family="STIX Two Math"> <!-- -->
2873
+
2765
2874
  <xsl:variable name="mathml">
2766
2875
  <xsl:apply-templates select="." mode="mathml"/>
2767
2876
  </xsl:variable>
@@ -2791,6 +2900,7 @@
2791
2900
  </xsl:choose>
2792
2901
  </xsl:variable>
2793
2902
  <fo:inline xsl:use-attribute-sets="link-style">
2903
+
2794
2904
  <xsl:choose>
2795
2905
  <xsl:when test="$target = ''">
2796
2906
  <xsl:apply-templates/>
@@ -2844,10 +2954,14 @@
2844
2954
  </fo:inline>
2845
2955
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
2846
2956
  <xsl:variable name="title-modified">
2847
- <xsl:call-template name="getTitle">
2848
- <xsl:with-param name="name" select="'title-modified'"/>
2849
- </xsl:call-template>
2957
+
2958
+
2959
+ <xsl:call-template name="getTitle">
2960
+ <xsl:with-param name="name" select="'title-modified'"/>
2961
+ </xsl:call-template>
2962
+
2850
2963
  </xsl:variable>
2964
+
2851
2965
  <xsl:choose>
2852
2966
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
2853
2967
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -2998,7 +3112,8 @@
2998
3112
  </fo:inline>
2999
3113
  </xsl:if>
3000
3114
  </xsl:template><xsl:template match="*[local-name() = 'figure']">
3001
- <fo:block-container id="{@id}">
3115
+ <fo:block-container id="{@id}">
3116
+
3002
3117
  <fo:block>
3003
3118
  <xsl:apply-templates/>
3004
3119
  </fo:block>
@@ -3049,7 +3164,7 @@
3049
3164
  <xsl:apply-templates mode="bookmarks"/>
3050
3165
  </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3051
3166
  <xsl:apply-templates select="."/>
3052
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3167
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3053
3168
  <xsl:apply-templates mode="bookmarks"/>
3054
3169
  </xsl:template><xsl:template name="addBookmarks">
3055
3170
  <xsl:param name="contents"/>
@@ -3065,6 +3180,8 @@
3065
3180
  <xsl:variable name="bookmark-title_">
3066
3181
  <xsl:call-template name="getLangVersion">
3067
3182
  <xsl:with-param name="lang" select="@lang"/>
3183
+ <xsl:with-param name="doctype" select="@doctype"/>
3184
+ <xsl:with-param name="title" select="@title-part"/>
3068
3185
  </xsl:call-template>
3069
3186
  </xsl:variable>
3070
3187
  <xsl:choose>
@@ -3082,13 +3199,34 @@
3082
3199
  </xsl:choose>
3083
3200
  </fo:bookmark-title>
3084
3201
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3202
+
3203
+ <xsl:call-template name="insertFigureBookmarks">
3204
+ <xsl:with-param name="contents" select="contents"/>
3205
+ </xsl:call-template>
3206
+
3207
+ <xsl:call-template name="insertTableBookmarks">
3208
+ <xsl:with-param name="contents" select="contents"/>
3209
+ <xsl:with-param name="lang" select="@lang"/>
3210
+ </xsl:call-template>
3211
+
3085
3212
  </fo:bookmark>
3086
3213
 
3087
3214
  </xsl:for-each>
3088
3215
  </xsl:when>
3089
3216
  <xsl:otherwise>
3090
3217
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3218
+
3091
3219
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3220
+
3221
+ <xsl:call-template name="insertFigureBookmarks">
3222
+ <xsl:with-param name="contents" select="contents"/>
3223
+ </xsl:call-template>
3224
+
3225
+ <xsl:call-template name="insertTableBookmarks">
3226
+ <xsl:with-param name="contents" select="contents"/>
3227
+ <xsl:with-param name="lang" select="@lang"/>
3228
+ </xsl:call-template>
3229
+
3092
3230
  </xsl:for-each>
3093
3231
  </xsl:otherwise>
3094
3232
  </xsl:choose>
@@ -3107,8 +3245,44 @@
3107
3245
 
3108
3246
  </fo:bookmark-tree>
3109
3247
  </xsl:if>
3248
+ </xsl:template><xsl:template name="insertFigureBookmarks">
3249
+ <xsl:param name="contents"/>
3250
+ <xsl:if test="xalan:nodeset($contents)/figure">
3251
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
3252
+ <fo:bookmark-title>Figures</fo:bookmark-title>
3253
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
3254
+ <fo:bookmark internal-destination="{@id}">
3255
+ <fo:bookmark-title>
3256
+ <xsl:value-of select="normalize-space(title)"/>
3257
+ </fo:bookmark-title>
3258
+ </fo:bookmark>
3259
+ </xsl:for-each>
3260
+ </fo:bookmark>
3261
+ </xsl:if>
3262
+ </xsl:template><xsl:template name="insertTableBookmarks">
3263
+ <xsl:param name="contents"/>
3264
+ <xsl:param name="lang"/>
3265
+ <xsl:if test="xalan:nodeset($contents)/table">
3266
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
3267
+ <fo:bookmark-title>
3268
+ <xsl:choose>
3269
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
3270
+ <xsl:otherwise>Tables</xsl:otherwise>
3271
+ </xsl:choose>
3272
+ </fo:bookmark-title>
3273
+ <xsl:for-each select="xalan:nodeset($contents)/table">
3274
+ <fo:bookmark internal-destination="{@id}">
3275
+ <fo:bookmark-title>
3276
+ <xsl:value-of select="normalize-space(title)"/>
3277
+ </fo:bookmark-title>
3278
+ </fo:bookmark>
3279
+ </xsl:for-each>
3280
+ </fo:bookmark>
3281
+ </xsl:if>
3110
3282
  </xsl:template><xsl:template name="getLangVersion">
3111
3283
  <xsl:param name="lang"/>
3284
+ <xsl:param name="doctype" select="''"/>
3285
+ <xsl:param name="title" select="''"/>
3112
3286
  <xsl:choose>
3113
3287
  <xsl:when test="$lang = 'en'">
3114
3288
 
@@ -3568,9 +3742,14 @@
3568
3742
 
3569
3743
  <fo:inline>
3570
3744
 
3571
- <xsl:call-template name="getTitle">
3572
- <xsl:with-param name="name" select="'title-source'"/>
3573
- </xsl:call-template>
3745
+
3746
+
3747
+
3748
+ <xsl:call-template name="getTitle">
3749
+ <xsl:with-param name="name" select="'title-source'"/>
3750
+ </xsl:call-template>
3751
+
3752
+
3574
3753
  <xsl:text>: </xsl:text>
3575
3754
  </fo:inline>
3576
3755
 
@@ -3595,7 +3774,8 @@
3595
3774
  <fo:block-container margin-left="0mm">
3596
3775
 
3597
3776
  <fo:block xsl:use-attribute-sets="quote-style">
3598
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
3777
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
3778
+ <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3599
3779
  </fo:block>
3600
3780
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3601
3781
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -3717,9 +3897,12 @@
3717
3897
  </fo:block>
3718
3898
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
3719
3899
  <xsl:variable name="title-deprecated">
3720
- <xsl:call-template name="getTitle">
3721
- <xsl:with-param name="name" select="'title-deprecated'"/>
3722
- </xsl:call-template>
3900
+
3901
+
3902
+ <xsl:call-template name="getTitle">
3903
+ <xsl:with-param name="name" select="'title-deprecated'"/>
3904
+ </xsl:call-template>
3905
+
3723
3906
  </xsl:variable>
3724
3907
  <fo:block xsl:use-attribute-sets="deprecates-style">
3725
3908
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -3768,7 +3951,7 @@
3768
3951
  <fo:block id="{@id}">
3769
3952
  <xsl:apply-templates/>
3770
3953
  </fo:block>
3771
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
3954
+ </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']">
3772
3955
 
3773
3956
  <fo:block id="{@id}">
3774
3957
  <xsl:apply-templates/>
@@ -3825,7 +4008,8 @@
3825
4008
  <fo:table-column column-width="107mm"/>
3826
4009
  <fo:table-column column-width="15mm"/>
3827
4010
  <fo:table-body>
3828
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
4011
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
4012
+
3829
4013
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
3830
4014
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
3831
4015
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -3843,6 +4027,10 @@
3843
4027
  <fo:block><xsl:apply-templates/></fo:block>
3844
4028
  </fo:table-cell>
3845
4029
  </xsl:template><xsl:template name="processBibitem">
4030
+
4031
+
4032
+ <!-- end BIPM bibitem processing-->
4033
+
3846
4034
 
3847
4035
 
3848
4036
 
@@ -3901,6 +4089,8 @@
3901
4089
  <xsl:value-of select="translate(.,'. ','')"/>
3902
4090
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
3903
4091
  <xsl:value-of select="substring(.,1,1)"/>
4092
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4093
+ <fo:inline><xsl:apply-templates/></fo:inline>
3904
4094
  </xsl:template><xsl:template name="convertDate">
3905
4095
  <xsl:param name="date"/>
3906
4096
  <xsl:param name="format" select="'short'"/>
@@ -4078,13 +4268,22 @@
4078
4268
  </xsl:template><xsl:template name="split">
4079
4269
  <xsl:param name="pText" select="."/>
4080
4270
  <xsl:param name="sep" select="','"/>
4271
+ <xsl:param name="normalize-space" select="'true'"/>
4081
4272
  <xsl:if test="string-length($pText) &gt;0">
4082
4273
  <item>
4083
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4274
+ <xsl:choose>
4275
+ <xsl:when test="$normalize-space = 'true'">
4276
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4277
+ </xsl:when>
4278
+ <xsl:otherwise>
4279
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4280
+ </xsl:otherwise>
4281
+ </xsl:choose>
4084
4282
  </item>
4085
4283
  <xsl:call-template name="split">
4086
4284
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4087
4285
  <xsl:with-param name="sep" select="$sep"/>
4286
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4088
4287
  </xsl:call-template>
4089
4288
  </xsl:if>
4090
4289
  </xsl:template><xsl:template name="getDocumentId">
@@ -4150,4 +4349,28 @@
4150
4349
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4151
4350
  </xsl:call-template>
4152
4351
  </xsl:if>
4352
+ </xsl:template><xsl:template name="repeat">
4353
+ <xsl:param name="char" select="'*'"/>
4354
+ <xsl:param name="count"/>
4355
+ <xsl:if test="$count &gt; 0">
4356
+ <xsl:value-of select="$char"/>
4357
+ <xsl:call-template name="repeat">
4358
+ <xsl:with-param name="char" select="$char"/>
4359
+ <xsl:with-param name="count" select="$count - 1"/>
4360
+ </xsl:call-template>
4361
+ </xsl:if>
4362
+ </xsl:template><xsl:template name="getLocalizedString">
4363
+ <xsl:param name="key"/>
4364
+
4365
+ <xsl:variable name="curr_lang">
4366
+ <xsl:call-template name="getLang"/>
4367
+ </xsl:variable>
4368
+
4369
+ <xsl:choose>
4370
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4371
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4372
+ </xsl:when>
4373
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4374
+ </xsl:choose>
4375
+
4153
4376
  </xsl:template></xsl:stylesheet>