metanorma-csa 1.6.6 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,18 +5,8 @@ require 'isodoc'
5
5
  module IsoDoc
6
6
  module Csa
7
7
  module BaseConvert
8
- def cleanup(docxml)
9
- super
10
- term_cleanup(docxml)
11
- end
12
-
13
- def term_cleanup(docxml)
14
- docxml.xpath("//p[@class = 'Terms']").each do |d|
15
- h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
16
- h2.add_child(" ")
17
- h2.add_child(d.remove)
18
- end
19
- docxml
8
+ def configuration
9
+ Metanorma::Csa.configuration
20
10
  end
21
11
  end
22
12
  end
@@ -33,7 +33,7 @@
33
33
 
34
34
  <xsl:template match="/">
35
35
  <xsl:call-template name="namespaceCheck"/>
36
- <fo:root font-family="AzoSans, STIX Two Math" font-size="10pt" xml:lang="{$lang}">
36
+ <fo:root font-family="Azo Sans, STIX Two Math" font-size="10pt" xml:lang="{$lang}">
37
37
  <fo:layout-master-set>
38
38
  <!-- Cover page -->
39
39
  <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
@@ -519,7 +519,7 @@
519
519
  </fo:basic-link>
520
520
  </fo:inline>
521
521
  <fo:footnote-body>
522
- <fo:block font-family="AzoSans-Light" font-size="10pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" color="rgb(168, 170, 173)" text-align="left">
522
+ <fo:block font-family="Azo Sans Lt" font-size="10pt" margin-bottom="12pt" font-weight="normal" text-indent="0" start-indent="0" color="rgb(168, 170, 173)" text-align="left">
523
523
  <fo:inline id="footnote_{@reference}" keep-with-next.within-line="always" font-size="60%" vertical-align="super">
524
524
  <xsl:value-of select="$number "/><!-- + count(//csa:bibitem/csa:note) -->
525
525
  </fo:inline>
@@ -601,7 +601,7 @@
601
601
  </fo:basic-link>
602
602
  </fo:inline>
603
603
  <fo:footnote-body>
604
- <fo:block font-family="AzoSans-Light" font-size="10pt" margin-bottom="12pt" start-indent="0pt" color="rgb(168, 170, 173)">
604
+ <fo:block font-family="Azo Sans Lt" font-size="10pt" margin-bottom="12pt" start-indent="0pt" color="rgb(168, 170, 173)">
605
605
  <fo:inline id="{generate-id()}" keep-with-next.within-line="always" font-size="60%" vertical-align="super"><!-- baseline-shift="30%" padding-right="9mm" alignment-baseline="hanging" -->
606
606
  <xsl:value-of select="$number"/><!-- <xsl:text>)</xsl:text> -->
607
607
  </fo:inline>
@@ -658,13 +658,13 @@
658
658
  <xsl:otherwise> <!-- for ordered lists -->
659
659
  <xsl:choose>
660
660
  <xsl:when test="../@type = 'arabic'">
661
- <xsl:number format="a)"/>
661
+ <xsl:number format="a)" lang="en"/>
662
662
  </xsl:when>
663
663
  <xsl:when test="../@type = 'alphabet'">
664
664
  <xsl:number format="1)"/>
665
665
  </xsl:when>
666
666
  <xsl:when test="../@type = 'alphabet_upper'">
667
- <xsl:number format="A)"/>
667
+ <xsl:number format="A)" lang="en"/>
668
668
  </xsl:when>
669
669
 
670
670
  <xsl:when test="../@type = 'roman'">
@@ -856,7 +856,7 @@
856
856
  </fo:block-container>
857
857
  </fo:static-content>
858
858
  <fo:static-content flow-name="footer">
859
- <fo:block-container font-family="AzoSans-Light" font-size="10.1pt" height="100%" display-align="after"> <!-- 11.5pt -->
859
+ <fo:block-container font-family="Azo Sans Lt" font-size="10.1pt" height="100%" display-align="after"> <!-- 11.5pt -->
860
860
  <fo:block padding-bottom="13mm" text-align="right" color="rgb(144, 144, 144)">
861
861
  <fo:inline padding-right="7mm"><xsl:value-of select="$copyright"/></fo:inline>
862
862
  <fo:page-number/>
@@ -928,13 +928,22 @@
928
928
  <title-part lang="en">
929
929
 
930
930
 
931
+
931
932
  </title-part>
932
933
  <title-part lang="fr">
933
934
 
934
935
 
936
+
935
937
  </title-part>
936
938
  <title-part lang="zh">第 # 部分:</title-part>
937
939
 
940
+ <title-subpart lang="en">
941
+
942
+ </title-subpart>
943
+ <title-subpart lang="fr">
944
+
945
+ </title-subpart>
946
+
938
947
  <title-modified lang="en">modified</title-modified>
939
948
  <title-modified lang="fr">modifiée</title-modified>
940
949
 
@@ -1031,7 +1040,7 @@
1031
1040
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1032
1041
 
1033
1042
 
1034
- <xsl:attribute name="font-family">SourceCodePro</xsl:attribute>
1043
+ <xsl:attribute name="font-family">Source Code Pro</xsl:attribute>
1035
1044
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1036
1045
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1037
1046
  <xsl:attribute name="line-height">113%</xsl:attribute>
@@ -1243,6 +1252,7 @@
1243
1252
 
1244
1253
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1245
1254
 
1255
+
1246
1256
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1247
1257
 
1248
1258
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1281,6 +1291,7 @@
1281
1291
 
1282
1292
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1283
1293
 
1294
+
1284
1295
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1285
1296
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1286
1297
  <xsl:attribute name="text-align">center</xsl:attribute>
@@ -1327,7 +1338,7 @@
1327
1338
 
1328
1339
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1329
1340
 
1330
- <xsl:attribute name="font-family">SourceCodePro</xsl:attribute>
1341
+ <xsl:attribute name="font-family">Source Code Pro</xsl:attribute>
1331
1342
 
1332
1343
 
1333
1344
 
@@ -1403,7 +1414,9 @@
1403
1414
 
1404
1415
 
1405
1416
 
1406
-
1417
+ <!-- <xsl:if test="$namespace = 'bipm'">
1418
+ <fo:block>&#xA0;</fo:block>
1419
+ </xsl:if> -->
1407
1420
 
1408
1421
  <!-- $namespace = 'iso' or -->
1409
1422
 
@@ -1435,10 +1448,12 @@
1435
1448
 
1436
1449
 
1437
1450
  <xsl:variable name="colwidths">
1438
- <xsl:call-template name="calculate-column-widths">
1439
- <xsl:with-param name="cols-count" select="$cols-count"/>
1440
- <xsl:with-param name="table" select="$simple-table"/>
1441
- </xsl:call-template>
1451
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1452
+ <xsl:call-template name="calculate-column-widths">
1453
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1454
+ <xsl:with-param name="table" select="$simple-table"/>
1455
+ </xsl:call-template>
1456
+ </xsl:if>
1442
1457
  </xsl:variable>
1443
1458
  <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1444
1459
 
@@ -1477,7 +1492,12 @@
1477
1492
 
1478
1493
  <xsl:variable name="table_attributes">
1479
1494
  <attribute name="table-layout">fixed</attribute>
1480
- <attribute name="width">100%</attribute>
1495
+ <attribute name="width">
1496
+ <xsl:choose>
1497
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1498
+ <xsl:otherwise>100%</xsl:otherwise>
1499
+ </xsl:choose>
1500
+ </attribute>
1481
1501
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1482
1502
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1483
1503
 
@@ -1506,16 +1526,25 @@
1506
1526
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1507
1527
  </xsl:if>
1508
1528
 
1509
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1510
- <xsl:choose>
1511
- <xsl:when test=". = 1 or . = 0">
1512
- <fo:table-column column-width="proportional-column-width(2)"/>
1513
- </xsl:when>
1514
- <xsl:otherwise>
1515
- <fo:table-column column-width="proportional-column-width({.})"/>
1516
- </xsl:otherwise>
1517
- </xsl:choose>
1518
- </xsl:for-each>
1529
+ <xsl:choose>
1530
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1531
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1532
+ <fo:table-column column-width="{@width}"/>
1533
+ </xsl:for-each>
1534
+ </xsl:when>
1535
+ <xsl:otherwise>
1536
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1537
+ <xsl:choose>
1538
+ <xsl:when test=". = 1 or . = 0">
1539
+ <fo:table-column column-width="proportional-column-width(2)"/>
1540
+ </xsl:when>
1541
+ <xsl:otherwise>
1542
+ <fo:table-column column-width="proportional-column-width({.})"/>
1543
+ </xsl:otherwise>
1544
+ </xsl:choose>
1545
+ </xsl:for-each>
1546
+ </xsl:otherwise>
1547
+ </xsl:choose>
1519
1548
 
1520
1549
  <xsl:choose>
1521
1550
  <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
@@ -1528,10 +1557,12 @@
1528
1557
 
1529
1558
  </fo:table>
1530
1559
 
1560
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1531
1561
  <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1532
1562
  <xsl:call-template name="insertTableFooterInSeparateTable">
1533
1563
  <xsl:with-param name="table_attributes" select="$table_attributes"/>
1534
1564
  <xsl:with-param name="colwidths" select="$colwidths"/>
1565
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1535
1566
  </xsl:call-template>
1536
1567
  </xsl:for-each>
1537
1568
 
@@ -1564,6 +1595,7 @@
1564
1595
  <xsl:if test="normalize-space() != ''">
1565
1596
  <fo:block xsl:use-attribute-sets="table-name-style">
1566
1597
 
1598
+
1567
1599
  <xsl:apply-templates/>
1568
1600
  </fo:block>
1569
1601
  </xsl:if>
@@ -1784,12 +1816,22 @@
1784
1816
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1785
1817
  <xsl:param name="table_attributes"/>
1786
1818
  <xsl:param name="colwidths"/>
1819
+ <xsl:param name="colgroup"/>
1787
1820
 
1788
1821
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1789
1822
 
1790
1823
  <xsl:if test="$isNoteOrFnExist = 'true'">
1791
1824
 
1792
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1825
+ <xsl:variable name="cols-count">
1826
+ <xsl:choose>
1827
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1828
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
1829
+ </xsl:when>
1830
+ <xsl:otherwise>
1831
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
1832
+ </xsl:otherwise>
1833
+ </xsl:choose>
1834
+ </xsl:variable>
1793
1835
 
1794
1836
  <fo:table keep-with-previous="always">
1795
1837
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -1807,16 +1849,25 @@
1807
1849
  </xsl:choose>
1808
1850
  </xsl:for-each>
1809
1851
 
1810
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1811
- <xsl:choose>
1812
- <xsl:when test=". = 1 or . = 0">
1813
- <fo:table-column column-width="proportional-column-width(2)"/>
1814
- </xsl:when>
1815
- <xsl:otherwise>
1816
- <fo:table-column column-width="proportional-column-width({.})"/>
1817
- </xsl:otherwise>
1818
- </xsl:choose>
1819
- </xsl:for-each>
1852
+ <xsl:choose>
1853
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1854
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
1855
+ <fo:table-column column-width="{@width}"/>
1856
+ </xsl:for-each>
1857
+ </xsl:when>
1858
+ <xsl:otherwise>
1859
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1860
+ <xsl:choose>
1861
+ <xsl:when test=". = 1 or . = 0">
1862
+ <fo:table-column column-width="proportional-column-width(2)"/>
1863
+ </xsl:when>
1864
+ <xsl:otherwise>
1865
+ <fo:table-column column-width="proportional-column-width({.})"/>
1866
+ </xsl:otherwise>
1867
+ </xsl:choose>
1868
+ </xsl:for-each>
1869
+ </xsl:otherwise>
1870
+ </xsl:choose>
1820
1871
 
1821
1872
  <fo:table-body>
1822
1873
  <fo:table-row>
@@ -1917,6 +1968,7 @@
1917
1968
 
1918
1969
 
1919
1970
 
1971
+
1920
1972
  <!-- <xsl:if test="$namespace = 'bipm'">
1921
1973
  <xsl:attribute name="height">8mm</xsl:attribute>
1922
1974
  </xsl:if> -->
@@ -2002,7 +2054,8 @@
2002
2054
  </xsl:attribute>
2003
2055
  </xsl:if>
2004
2056
  <xsl:call-template name="display-align"/>
2005
- <fo:block>
2057
+ <fo:block>
2058
+
2006
2059
  <xsl:apply-templates/>
2007
2060
  </fo:block>
2008
2061
  </fo:table-cell>
@@ -2212,7 +2265,13 @@
2212
2265
  <xsl:apply-templates/>
2213
2266
  </fo:inline>
2214
2267
  </xsl:template><xsl:template match="*[local-name()='dl']">
2215
- <fo:block-container margin-left="0mm">
2268
+ <fo:block-container>
2269
+
2270
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
2271
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2272
+ </xsl:if>
2273
+
2274
+
2216
2275
  <xsl:if test="parent::*[local-name() = 'note']">
2217
2276
  <xsl:attribute name="margin-left">
2218
2277
  <xsl:choose>
@@ -2222,8 +2281,12 @@
2222
2281
  </xsl:attribute>
2223
2282
 
2224
2283
  </xsl:if>
2225
- <fo:block-container margin-left="0mm">
2226
-
2284
+ <fo:block-container>
2285
+
2286
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2287
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2288
+
2289
+
2227
2290
  <xsl:variable name="parent" select="local-name(..)"/>
2228
2291
 
2229
2292
  <xsl:variable name="key_iso">
@@ -2237,9 +2300,12 @@
2237
2300
  <fo:block margin-bottom="12pt" text-align="left">
2238
2301
 
2239
2302
  <xsl:variable name="title-where">
2240
- <xsl:call-template name="getTitle">
2241
- <xsl:with-param name="name" select="'title-where'"/>
2242
- </xsl:call-template>
2303
+
2304
+
2305
+ <xsl:call-template name="getTitle">
2306
+ <xsl:with-param name="name" select="'title-where'"/>
2307
+ </xsl:call-template>
2308
+
2243
2309
  </xsl:variable>
2244
2310
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2245
2311
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2255,9 +2321,12 @@
2255
2321
 
2256
2322
 
2257
2323
  <xsl:variable name="title-where">
2258
- <xsl:call-template name="getTitle">
2259
- <xsl:with-param name="name" select="'title-where'"/>
2260
- </xsl:call-template>
2324
+
2325
+
2326
+ <xsl:call-template name="getTitle">
2327
+ <xsl:with-param name="name" select="'title-where'"/>
2328
+ </xsl:call-template>
2329
+
2261
2330
  </xsl:variable>
2262
2331
  <xsl:value-of select="$title-where"/>
2263
2332
  </fo:block>
@@ -2268,9 +2337,12 @@
2268
2337
 
2269
2338
 
2270
2339
  <xsl:variable name="title-key">
2271
- <xsl:call-template name="getTitle">
2272
- <xsl:with-param name="name" select="'title-key'"/>
2273
- </xsl:call-template>
2340
+
2341
+
2342
+ <xsl:call-template name="getTitle">
2343
+ <xsl:with-param name="name" select="'title-key'"/>
2344
+ </xsl:call-template>
2345
+
2274
2346
  </xsl:variable>
2275
2347
  <xsl:value-of select="$title-key"/>
2276
2348
  </fo:block>
@@ -2396,12 +2468,32 @@
2396
2468
  </xsl:otherwise>
2397
2469
  </xsl:choose>
2398
2470
  </xsl:template><xsl:template name="getMaxLength_dt">
2399
- <xsl:for-each select="*[local-name()='dt']">
2400
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2401
- <xsl:if test="position() = 1">
2402
- <xsl:value-of select="string-length(normalize-space(.))"/>
2403
- </xsl:if>
2404
- </xsl:for-each>
2471
+ <xsl:variable name="lengths">
2472
+ <xsl:for-each select="*[local-name()='dt']">
2473
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
2474
+ <xsl:variable name="attributes">
2475
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
2476
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
2477
+ </xsl:variable>
2478
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
2479
+ </xsl:for-each>
2480
+ </xsl:variable>
2481
+ <xsl:variable name="maxLength">
2482
+ <!-- <xsl:for-each select="*[local-name()='dt']">
2483
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2484
+ <xsl:if test="position() = 1">
2485
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2486
+ </xsl:if>
2487
+ </xsl:for-each> -->
2488
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
2489
+ <xsl:sort select="." data-type="number" order="descending"/>
2490
+ <xsl:if test="position() = 1">
2491
+ <xsl:value-of select="."/>
2492
+ </xsl:if>
2493
+ </xsl:for-each>
2494
+ </xsl:variable>
2495
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
2496
+ <xsl:value-of select="$maxLength"/>
2405
2497
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2406
2498
  <xsl:param name="key_iso"/>
2407
2499
 
@@ -2513,6 +2605,7 @@
2513
2605
  </fo:inline>
2514
2606
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
2515
2607
  <fo:inline font-weight="bold">
2608
+
2516
2609
  <xsl:apply-templates/>
2517
2610
  </fo:inline>
2518
2611
  </xsl:template><xsl:template match="*[local-name()='sup']">
@@ -2552,6 +2645,10 @@
2552
2645
  </xsl:if>
2553
2646
  <xsl:apply-templates/>
2554
2647
  </fo:inline>
2648
+ </xsl:template><xsl:template match="*[local-name()='underline']">
2649
+ <fo:inline text-decoration="underline">
2650
+ <xsl:apply-templates/>
2651
+ </fo:inline>
2555
2652
  </xsl:template><xsl:template match="*[local-name()='del']">
2556
2653
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2557
2654
  <xsl:apply-templates/>
@@ -2841,7 +2938,18 @@
2841
2938
  <xsl:with-param name="previousRow" select="$newRow"/>
2842
2939
  </xsl:apply-templates>
2843
2940
  </xsl:template><xsl:template name="getLang">
2844
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2941
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
2942
+ <xsl:variable name="language">
2943
+ <xsl:choose>
2944
+ <xsl:when test="$language_current != ''">
2945
+ <xsl:value-of select="$language_current"/>
2946
+ </xsl:when>
2947
+ <xsl:otherwise>
2948
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
2949
+ </xsl:otherwise>
2950
+ </xsl:choose>
2951
+ </xsl:variable>
2952
+
2845
2953
  <xsl:choose>
2846
2954
  <xsl:when test="$language = 'English'">en</xsl:when>
2847
2955
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -2876,6 +2984,7 @@
2876
2984
  <xsl:value-of select="substring($str, 2)"/>
2877
2985
  </xsl:template><xsl:template match="mathml:math">
2878
2986
  <fo:inline font-family="STIX Two Math"> <!-- -->
2987
+
2879
2988
  <xsl:variable name="mathml">
2880
2989
  <xsl:apply-templates select="." mode="mathml"/>
2881
2990
  </xsl:variable>
@@ -2905,6 +3014,7 @@
2905
3014
  </xsl:choose>
2906
3015
  </xsl:variable>
2907
3016
  <fo:inline xsl:use-attribute-sets="link-style">
3017
+
2908
3018
  <xsl:choose>
2909
3019
  <xsl:when test="$target = ''">
2910
3020
  <xsl:apply-templates/>
@@ -2958,10 +3068,14 @@
2958
3068
  </fo:inline>
2959
3069
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
2960
3070
  <xsl:variable name="title-modified">
2961
- <xsl:call-template name="getTitle">
2962
- <xsl:with-param name="name" select="'title-modified'"/>
2963
- </xsl:call-template>
3071
+
3072
+
3073
+ <xsl:call-template name="getTitle">
3074
+ <xsl:with-param name="name" select="'title-modified'"/>
3075
+ </xsl:call-template>
3076
+
2964
3077
  </xsl:variable>
3078
+
2965
3079
  <xsl:choose>
2966
3080
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
2967
3081
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -3116,7 +3230,8 @@
3116
3230
  </fo:inline>
3117
3231
  </xsl:if>
3118
3232
  </xsl:template><xsl:template match="*[local-name() = 'figure']">
3119
- <fo:block-container id="{@id}">
3233
+ <fo:block-container id="{@id}">
3234
+
3120
3235
  <fo:block>
3121
3236
  <xsl:apply-templates/>
3122
3237
  </fo:block>
@@ -3167,7 +3282,7 @@
3167
3282
  <xsl:apply-templates mode="bookmarks"/>
3168
3283
  </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3169
3284
  <xsl:apply-templates select="."/>
3170
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3285
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3171
3286
  <xsl:apply-templates mode="bookmarks"/>
3172
3287
  </xsl:template><xsl:template name="addBookmarks">
3173
3288
  <xsl:param name="contents"/>
@@ -3183,6 +3298,8 @@
3183
3298
  <xsl:variable name="bookmark-title_">
3184
3299
  <xsl:call-template name="getLangVersion">
3185
3300
  <xsl:with-param name="lang" select="@lang"/>
3301
+ <xsl:with-param name="doctype" select="@doctype"/>
3302
+ <xsl:with-param name="title" select="@title-part"/>
3186
3303
  </xsl:call-template>
3187
3304
  </xsl:variable>
3188
3305
  <xsl:choose>
@@ -3200,13 +3317,34 @@
3200
3317
  </xsl:choose>
3201
3318
  </fo:bookmark-title>
3202
3319
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3320
+
3321
+ <xsl:call-template name="insertFigureBookmarks">
3322
+ <xsl:with-param name="contents" select="contents"/>
3323
+ </xsl:call-template>
3324
+
3325
+ <xsl:call-template name="insertTableBookmarks">
3326
+ <xsl:with-param name="contents" select="contents"/>
3327
+ <xsl:with-param name="lang" select="@lang"/>
3328
+ </xsl:call-template>
3329
+
3203
3330
  </fo:bookmark>
3204
3331
 
3205
3332
  </xsl:for-each>
3206
3333
  </xsl:when>
3207
3334
  <xsl:otherwise>
3208
3335
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3336
+
3209
3337
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3338
+
3339
+ <xsl:call-template name="insertFigureBookmarks">
3340
+ <xsl:with-param name="contents" select="contents"/>
3341
+ </xsl:call-template>
3342
+
3343
+ <xsl:call-template name="insertTableBookmarks">
3344
+ <xsl:with-param name="contents" select="contents"/>
3345
+ <xsl:with-param name="lang" select="@lang"/>
3346
+ </xsl:call-template>
3347
+
3210
3348
  </xsl:for-each>
3211
3349
  </xsl:otherwise>
3212
3350
  </xsl:choose>
@@ -3225,8 +3363,44 @@
3225
3363
 
3226
3364
  </fo:bookmark-tree>
3227
3365
  </xsl:if>
3366
+ </xsl:template><xsl:template name="insertFigureBookmarks">
3367
+ <xsl:param name="contents"/>
3368
+ <xsl:if test="xalan:nodeset($contents)/figure">
3369
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
3370
+ <fo:bookmark-title>Figures</fo:bookmark-title>
3371
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
3372
+ <fo:bookmark internal-destination="{@id}">
3373
+ <fo:bookmark-title>
3374
+ <xsl:value-of select="normalize-space(title)"/>
3375
+ </fo:bookmark-title>
3376
+ </fo:bookmark>
3377
+ </xsl:for-each>
3378
+ </fo:bookmark>
3379
+ </xsl:if>
3380
+ </xsl:template><xsl:template name="insertTableBookmarks">
3381
+ <xsl:param name="contents"/>
3382
+ <xsl:param name="lang"/>
3383
+ <xsl:if test="xalan:nodeset($contents)/table">
3384
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
3385
+ <fo:bookmark-title>
3386
+ <xsl:choose>
3387
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
3388
+ <xsl:otherwise>Tables</xsl:otherwise>
3389
+ </xsl:choose>
3390
+ </fo:bookmark-title>
3391
+ <xsl:for-each select="xalan:nodeset($contents)/table">
3392
+ <fo:bookmark internal-destination="{@id}">
3393
+ <fo:bookmark-title>
3394
+ <xsl:value-of select="normalize-space(title)"/>
3395
+ </fo:bookmark-title>
3396
+ </fo:bookmark>
3397
+ </xsl:for-each>
3398
+ </fo:bookmark>
3399
+ </xsl:if>
3228
3400
  </xsl:template><xsl:template name="getLangVersion">
3229
3401
  <xsl:param name="lang"/>
3402
+ <xsl:param name="doctype" select="''"/>
3403
+ <xsl:param name="title" select="''"/>
3230
3404
  <xsl:choose>
3231
3405
  <xsl:when test="$lang = 'en'">
3232
3406
 
@@ -3690,9 +3864,14 @@
3690
3864
 
3691
3865
  <fo:inline>
3692
3866
 
3693
- <xsl:call-template name="getTitle">
3694
- <xsl:with-param name="name" select="'title-source'"/>
3695
- </xsl:call-template>
3867
+
3868
+
3869
+
3870
+ <xsl:call-template name="getTitle">
3871
+ <xsl:with-param name="name" select="'title-source'"/>
3872
+ </xsl:call-template>
3873
+
3874
+
3696
3875
  <xsl:text>: </xsl:text>
3697
3876
  </fo:inline>
3698
3877
 
@@ -3717,7 +3896,8 @@
3717
3896
  <fo:block-container margin-left="0mm">
3718
3897
 
3719
3898
  <fo:block xsl:use-attribute-sets="quote-style">
3720
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
3899
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
3900
+ <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3721
3901
  </fo:block>
3722
3902
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3723
3903
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -3836,9 +4016,12 @@
3836
4016
  </fo:block>
3837
4017
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
3838
4018
  <xsl:variable name="title-deprecated">
3839
- <xsl:call-template name="getTitle">
3840
- <xsl:with-param name="name" select="'title-deprecated'"/>
3841
- </xsl:call-template>
4019
+
4020
+
4021
+ <xsl:call-template name="getTitle">
4022
+ <xsl:with-param name="name" select="'title-deprecated'"/>
4023
+ </xsl:call-template>
4024
+
3842
4025
  </xsl:variable>
3843
4026
  <fo:block xsl:use-attribute-sets="deprecates-style">
3844
4027
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -3892,7 +4075,7 @@
3892
4075
  <fo:block id="{@id}">
3893
4076
  <xsl:apply-templates/>
3894
4077
  </fo:block>
3895
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
4078
+ </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']">
3896
4079
 
3897
4080
  <fo:block id="{@id}">
3898
4081
  <xsl:apply-templates/>
@@ -3949,7 +4132,8 @@
3949
4132
  <fo:table-column column-width="107mm"/>
3950
4133
  <fo:table-column column-width="15mm"/>
3951
4134
  <fo:table-body>
3952
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
4135
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
4136
+
3953
4137
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
3954
4138
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
3955
4139
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -3967,6 +4151,10 @@
3967
4151
  <fo:block><xsl:apply-templates/></fo:block>
3968
4152
  </fo:table-cell>
3969
4153
  </xsl:template><xsl:template name="processBibitem">
4154
+
4155
+
4156
+ <!-- end BIPM bibitem processing-->
4157
+
3970
4158
 
3971
4159
 
3972
4160
 
@@ -4025,6 +4213,8 @@
4025
4213
  <xsl:value-of select="translate(.,'. ','')"/>
4026
4214
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4027
4215
  <xsl:value-of select="substring(.,1,1)"/>
4216
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4217
+ <fo:inline><xsl:apply-templates/></fo:inline>
4028
4218
  </xsl:template><xsl:template name="convertDate">
4029
4219
  <xsl:param name="date"/>
4030
4220
  <xsl:param name="format" select="'short'"/>
@@ -4204,13 +4394,22 @@
4204
4394
  </xsl:template><xsl:template name="split">
4205
4395
  <xsl:param name="pText" select="."/>
4206
4396
  <xsl:param name="sep" select="','"/>
4397
+ <xsl:param name="normalize-space" select="'true'"/>
4207
4398
  <xsl:if test="string-length($pText) &gt;0">
4208
4399
  <item>
4209
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4400
+ <xsl:choose>
4401
+ <xsl:when test="$normalize-space = 'true'">
4402
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4403
+ </xsl:when>
4404
+ <xsl:otherwise>
4405
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4406
+ </xsl:otherwise>
4407
+ </xsl:choose>
4210
4408
  </item>
4211
4409
  <xsl:call-template name="split">
4212
4410
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4213
4411
  <xsl:with-param name="sep" select="$sep"/>
4412
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4214
4413
  </xsl:call-template>
4215
4414
  </xsl:if>
4216
4415
  </xsl:template><xsl:template name="getDocumentId">
@@ -4276,4 +4475,28 @@
4276
4475
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4277
4476
  </xsl:call-template>
4278
4477
  </xsl:if>
4478
+ </xsl:template><xsl:template name="repeat">
4479
+ <xsl:param name="char" select="'*'"/>
4480
+ <xsl:param name="count"/>
4481
+ <xsl:if test="$count &gt; 0">
4482
+ <xsl:value-of select="$char"/>
4483
+ <xsl:call-template name="repeat">
4484
+ <xsl:with-param name="char" select="$char"/>
4485
+ <xsl:with-param name="count" select="$count - 1"/>
4486
+ </xsl:call-template>
4487
+ </xsl:if>
4488
+ </xsl:template><xsl:template name="getLocalizedString">
4489
+ <xsl:param name="key"/>
4490
+
4491
+ <xsl:variable name="curr_lang">
4492
+ <xsl:call-template name="getLang"/>
4493
+ </xsl:variable>
4494
+
4495
+ <xsl:choose>
4496
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4497
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4498
+ </xsl:when>
4499
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4500
+ </xsl:choose>
4501
+
4279
4502
  </xsl:template></xsl:stylesheet>