metanorma-un 0.5.8 → 0.5.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45db2caa7f93f4ff5b5f36f7a0beca9f651c179145bed2f9d9c7fe2e7ab82d2d
4
- data.tar.gz: 7bf800953c990b82199377d8e1a222d53b35b19015287bdf2d587dfcab3a67f5
3
+ metadata.gz: 4ac4dfb800b093d690e6794598aa8156d689d00ee3d60056c2a8f75de4c603e2
4
+ data.tar.gz: 4005cbaf627818c531ec208e0d2f53f90067f0d2e812582973264fa680639a1c
5
5
  SHA512:
6
- metadata.gz: 2bac1b91fe5b759e9d3022ae5fdb297b7412e51625cc12e9bb0e3cc7500f151fe13d91823b97c9cbdac862aef044a01c040d8ae48008f977c46a5541b8baea1e
7
- data.tar.gz: d9db8fcca10946a9224dad32bb5ab589bbd12b2ceaba758e0fe1ebd2bb2b0fef0b2e1db9ced4a87e28632a53bf77b7739ed6bcb9eab0686eded5eb2e405246d0
6
+ metadata.gz: 7fbc779c9ab63e8689a1224fcc4b725faf59fd6b6f40e1e71a81ff5227a286590ca02e23a92cf69593d29fb98f95526af24fa156d639f0dc4b52fb693bfc046a
7
+ data.tar.gz: 996c353ed8ee929fd8d3d95df7d6b59049cb38f054b14e993abea7d820110f7a32dfbd129f067e9961ffe26e06392588391cdf56be1ccef3e010377e8cfead00
@@ -36,6 +36,9 @@ jobs:
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
38
 
39
+ - if: matrix.os == 'macos-latest'
40
+ run: brew install autoconf automake libtool
41
+
39
42
  - uses: actions/cache@v2
40
43
  with:
41
44
  path: vendor/bundle
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -728,13 +729,61 @@
728
729
  </define>
729
730
  <define name="index">
730
731
  <element name="index">
731
- <attribute name="primary"/>
732
732
  <optional>
733
- <attribute name="secondary"/>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
737
+ <element name="primary">
738
+ <oneOrMore>
739
+ <ref name="PureTextElement"/>
740
+ </oneOrMore>
741
+ </element>
742
+ <optional>
743
+ <element name="secondary">
744
+ <oneOrMore>
745
+ <ref name="PureTextElement"/>
746
+ </oneOrMore>
747
+ </element>
748
+ </optional>
749
+ <optional>
750
+ <element name="tertiary">
751
+ <oneOrMore>
752
+ <ref name="PureTextElement"/>
753
+ </oneOrMore>
754
+ </element>
755
+ </optional>
756
+ </element>
757
+ </define>
758
+ <define name="index-xref">
759
+ <element name="index-xref">
760
+ <attribute name="also">
761
+ <data type="boolean"/>
762
+ </attribute>
763
+ <element name="primary">
764
+ <oneOrMore>
765
+ <ref name="PureTextElement"/>
766
+ </oneOrMore>
767
+ </element>
768
+ <optional>
769
+ <element name="secondary">
770
+ <oneOrMore>
771
+ <ref name="PureTextElement"/>
772
+ </oneOrMore>
773
+ </element>
734
774
  </optional>
735
775
  <optional>
736
- <attribute name="tertiary"/>
776
+ <element name="tertiary">
777
+ <oneOrMore>
778
+ <ref name="PureTextElement"/>
779
+ </oneOrMore>
780
+ </element>
737
781
  </optional>
782
+ <element name="target">
783
+ <oneOrMore>
784
+ <ref name="PureTextElement"/>
785
+ </oneOrMore>
786
+ </element>
738
787
  </element>
739
788
  </define>
740
789
  <!-- bare ID element, used for referencing arbitrary spans of text -->
@@ -30,7 +30,7 @@ module Asciidoctor
30
30
  end
31
31
 
32
32
  def asciidoc_sub(text)
33
- Asciidoctor::Standoc::Utils::asciidoc_sub(text)
33
+ Metanorma::Utils::asciidoc_sub(text)
34
34
  end
35
35
 
36
36
  def title(node, xml)
@@ -55,6 +55,13 @@
55
55
  <param name="pattern">\i\c*|\c+#\c+</param>
56
56
  </data>
57
57
  </attribute>
58
+ <optional>
59
+ <attribute name="to">
60
+ <data type="string">
61
+ <param name="pattern">\i\c*|\c+#\c+</param>
62
+ </data>
63
+ </attribute>
64
+ </optional>
58
65
  <optional>
59
66
  <attribute name="type">
60
67
  <ref name="ReferenceFormat"/>
@@ -246,6 +253,12 @@
246
253
  <data type="boolean"/>
247
254
  </attribute>
248
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
259
+ <optional>
260
+ <ref name="colgroup"/>
261
+ </optional>
249
262
  <optional>
250
263
  <ref name="tname"/>
251
264
  </optional>
@@ -764,6 +777,21 @@
764
777
  </define>
765
778
  </include>
766
779
  <!-- end overrides -->
780
+ <define name="colgroup">
781
+ <element name="colgroup">
782
+ <oneOrMore>
783
+ <ref name="col"/>
784
+ </oneOrMore>
785
+ </element>
786
+ </define>
787
+ <define name="col">
788
+ <element name="col">
789
+ <attribute name="width"/>
790
+ </element>
791
+ </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
767
795
  <define name="TextElement" combine="choice">
768
796
  <ref name="concept"/>
769
797
  </define>
@@ -784,6 +812,8 @@
784
812
  <ref name="requirement"/>
785
813
  <ref name="recommendation"/>
786
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
787
817
  </choice>
788
818
  </define>
789
819
  <define name="bibliography">
@@ -814,6 +844,9 @@
814
844
  <data type="boolean"/>
815
845
  </attribute>
816
846
  </optional>
847
+ <optional>
848
+ <attribute name="number"/>
849
+ </optional>
817
850
  <optional>
818
851
  <attribute name="obligation">
819
852
  <choice>
@@ -869,9 +902,11 @@
869
902
  <element name="code">
870
903
  <text/>
871
904
  </element>
872
- <element name="text">
873
- <text/>
874
- </element>
905
+ <optional>
906
+ <element name="text">
907
+ <text/>
908
+ </element>
909
+ </optional>
875
910
  </element>
876
911
  </define>
877
912
  <define name="standard-document">
@@ -1041,6 +1076,9 @@
1041
1076
  </choice>
1042
1077
  </attribute>
1043
1078
  </optional>
1079
+ <optional>
1080
+ <attribute name="number"/>
1081
+ </optional>
1044
1082
  <optional>
1045
1083
  <attribute name="type"/>
1046
1084
  </optional>
@@ -1094,6 +1132,9 @@
1094
1132
  <optional>
1095
1133
  <attribute name="type"/>
1096
1134
  </optional>
1135
+ <optional>
1136
+ <attribute name="number"/>
1137
+ </optional>
1097
1138
  <optional>
1098
1139
  <ref name="section-title"/>
1099
1140
  </optional>
@@ -1196,6 +1237,9 @@
1196
1237
  <optional>
1197
1238
  <attribute name="type"/>
1198
1239
  </optional>
1240
+ <optional>
1241
+ <attribute name="number"/>
1242
+ </optional>
1199
1243
  <optional>
1200
1244
  <attribute name="obligation">
1201
1245
  <choice>
@@ -1524,6 +1568,7 @@
1524
1568
  <value>add</value>
1525
1569
  <value>modify</value>
1526
1570
  <value>delete</value>
1571
+ <value>replace</value>
1527
1572
  </choice>
1528
1573
  </attribute>
1529
1574
  <optional>
@@ -1554,6 +1599,11 @@
1554
1599
  </optional>
1555
1600
  <optional>
1556
1601
  <element name="newcontent">
1602
+ <optional>
1603
+ <attribute name="id">
1604
+ <data type="ID"/>
1605
+ </attribute>
1606
+ </optional>
1557
1607
  <zeroOrMore>
1558
1608
  <ref name="BasicBlock"/>
1559
1609
  </zeroOrMore>
@@ -1587,4 +1637,65 @@
1587
1637
  <text/>
1588
1638
  </element>
1589
1639
  </define>
1640
+ <define name="imagemap">
1641
+ <element name="imagemap">
1642
+ <ref name="figure"/>
1643
+ <zeroOrMore>
1644
+ <element name="area">
1645
+ <attribute name="type">
1646
+ <choice>
1647
+ <value>rect</value>
1648
+ <value>circle</value>
1649
+ <value>ellipse</value>
1650
+ <value>poly</value>
1651
+ </choice>
1652
+ </attribute>
1653
+ <choice>
1654
+ <ref name="xref"/>
1655
+ <ref name="hyperlink"/>
1656
+ <ref name="eref"/>
1657
+ </choice>
1658
+ <oneOrMore>
1659
+ <element name="coords">
1660
+ <attribute name="x">
1661
+ <data type="float"/>
1662
+ </attribute>
1663
+ <attribute name="y">
1664
+ <data type="float"/>
1665
+ </attribute>
1666
+ </element>
1667
+ </oneOrMore>
1668
+ <optional>
1669
+ <element name="radius">
1670
+ <attribute name="x">
1671
+ <data type="float"/>
1672
+ </attribute>
1673
+ <optional>
1674
+ <attribute name="y">
1675
+ <data type="float"/>
1676
+ </attribute>
1677
+ </optional>
1678
+ </element>
1679
+ </optional>
1680
+ </element>
1681
+ </zeroOrMore>
1682
+ </element>
1683
+ </define>
1684
+ <define name="svgmap">
1685
+ <element name="svgmap">
1686
+ <ref name="figure"/>
1687
+ <zeroOrMore>
1688
+ <element name="target">
1689
+ <attribute name="href">
1690
+ <data type="anyURI"/>
1691
+ </attribute>
1692
+ <choice>
1693
+ <ref name="xref"/>
1694
+ <ref name="hyperlink"/>
1695
+ <ref name="eref"/>
1696
+ </choice>
1697
+ </element>
1698
+ </zeroOrMore>
1699
+ </element>
1700
+ </define>
1590
1701
  </grammar>
@@ -3,7 +3,7 @@ require "fileutils"
3
3
  module IsoDoc
4
4
  module UN
5
5
  module BaseConvert
6
- def middle_clause
6
+ def middle_clause(_docxml)
7
7
  "//clause[parent::sections]"
8
8
  end
9
9
 
@@ -6,7 +6,7 @@
6
6
  {% endif %}
7
7
 
8
8
  <nav>
9
- <h1 id="content">Contents</h1>
9
+ <h1 id="content">{{ labels["table_of_contents"] }}</h1>
10
10
  <div id="toc"></div>
11
11
 
12
12
  </nav>
@@ -9,7 +9,7 @@
9
9
  {% endif %}
10
10
 
11
11
  {% if toc %}
12
- <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>
12
+ <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">{{ labels["table_of_contents"] }}</span></p>
13
13
 
14
14
  WORDTOC
15
15
  {% endif %}
@@ -18,12 +18,12 @@ module IsoDoc
18
18
  {
19
19
  bodyfont: (
20
20
  options[:script] == "Hans" ?
21
- '"SimSun",serif' :
21
+ '"Source Han Sans",serif' :
22
22
  '"Times New Roman", serif'
23
23
  ),
24
24
  headerfont: (
25
25
  options[:script] == "Hans" ?
26
- '"SimHei",sans-serif' :
26
+ '"Source Han Sans",sans-serif' :
27
27
  '"Times New Roman", serif'
28
28
  ),
29
29
  monospacefont: '"Courier New",monospace',
@@ -616,7 +616,7 @@
616
616
  <xsl:when test="ancestor::*[un:annex]">
617
617
  <xsl:choose>
618
618
  <xsl:when test="$level = 1">
619
- <xsl:number format="a)"/>
619
+ <xsl:number format="a)" lang="en"/>
620
620
  </xsl:when>
621
621
  <xsl:when test="$level = 2">
622
622
  <xsl:number format="i)"/>
@@ -1560,6 +1560,7 @@
1560
1560
 
1561
1561
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1562
1562
 
1563
+
1563
1564
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1564
1565
 
1565
1566
 
@@ -1567,6 +1568,7 @@
1567
1568
 
1568
1569
 
1569
1570
 
1571
+
1570
1572
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1571
1573
 
1572
1574
 
@@ -1696,182 +1698,228 @@
1696
1698
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1697
1699
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1698
1700
  <xsl:call-template name="add-zero-spaces-java"/>
1699
- </xsl:template><xsl:template match="*[local-name()='table']">
1701
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1700
1702
 
1701
- <xsl:variable name="simple-table">
1702
- <xsl:call-template name="getSimpleTable"/>
1703
- </xsl:variable>
1703
+ <xsl:variable name="table">
1704
1704
 
1705
-
1706
-
1707
-
1708
-
1709
- <!-- <xsl:if test="$namespace = 'bipm'">
1710
- <fo:block>&#xA0;</fo:block>
1711
- </xsl:if> -->
1712
-
1713
- <!-- $namespace = 'iso' or -->
1714
-
1715
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1716
-
1717
-
1718
-
1719
- <xsl:call-template name="fn_name_display"/>
1705
+ <xsl:variable name="simple-table">
1706
+ <xsl:call-template name="getSimpleTable"/>
1707
+ </xsl:variable>
1720
1708
 
1721
1709
 
1722
-
1723
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1724
-
1725
- <!-- <xsl:variable name="cols-count">
1726
- <xsl:choose>
1727
- <xsl:when test="*[local-name()='thead']">
1728
- <xsl:call-template name="calculate-columns-numbers">
1729
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1730
- </xsl:call-template>
1731
- </xsl:when>
1732
- <xsl:otherwise>
1733
- <xsl:call-template name="calculate-columns-numbers">
1734
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1735
- </xsl:call-template>
1736
- </xsl:otherwise>
1737
- </xsl:choose>
1738
- </xsl:variable> -->
1739
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1740
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1741
-
1742
-
1743
-
1744
- <xsl:variable name="colwidths">
1745
- <xsl:call-template name="calculate-column-widths">
1746
- <xsl:with-param name="cols-count" select="$cols-count"/>
1747
- <xsl:with-param name="table" select="$simple-table"/>
1748
- </xsl:call-template>
1749
- </xsl:variable>
1750
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1751
-
1752
- <!-- <xsl:variable name="colwidths2">
1753
- <xsl:call-template name="calculate-column-widths">
1754
- <xsl:with-param name="cols-count" select="$cols-count"/>
1755
- </xsl:call-template>
1756
- </xsl:variable> -->
1757
-
1758
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1759
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1760
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1761
-
1762
- <xsl:variable name="margin-left">
1763
- <xsl:choose>
1764
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1765
- <xsl:otherwise>0</xsl:otherwise>
1766
- </xsl:choose>
1767
- </xsl:variable>
1768
-
1769
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1770
1710
 
1771
1711
 
1772
-
1773
-
1774
1712
 
1775
- <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1776
- <xsl:attribute name="font-size">8pt</xsl:attribute>
1777
-
1713
+ <!-- <xsl:if test="$namespace = 'bipm'">
1714
+ <fo:block>&#xA0;</fo:block>
1715
+ </xsl:if> -->
1778
1716
 
1717
+ <!-- $namespace = 'iso' or -->
1779
1718
 
1780
-
1719
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1781
1720
 
1721
+
1782
1722
 
1723
+ <xsl:call-template name="fn_name_display"/>
1783
1724
 
1725
+
1784
1726
 
1727
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1728
+
1729
+ <!-- <xsl:variable name="cols-count">
1730
+ <xsl:choose>
1731
+ <xsl:when test="*[local-name()='thead']">
1732
+ <xsl:call-template name="calculate-columns-numbers">
1733
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1734
+ </xsl:call-template>
1735
+ </xsl:when>
1736
+ <xsl:otherwise>
1737
+ <xsl:call-template name="calculate-columns-numbers">
1738
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1739
+ </xsl:call-template>
1740
+ </xsl:otherwise>
1741
+ </xsl:choose>
1742
+ </xsl:variable> -->
1743
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1744
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1785
1745
 
1786
1746
 
1787
1747
 
1788
- <xsl:variable name="table_attributes">
1789
- <attribute name="table-layout">fixed</attribute>
1790
- <attribute name="width">100%</attribute>
1791
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1792
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1748
+ <xsl:variable name="colwidths">
1749
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1750
+ <xsl:call-template name="calculate-column-widths">
1751
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1752
+ <xsl:with-param name="table" select="$simple-table"/>
1753
+ </xsl:call-template>
1754
+ </xsl:if>
1755
+ </xsl:variable>
1756
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1757
+
1758
+ <!-- <xsl:variable name="colwidths2">
1759
+ <xsl:call-template name="calculate-column-widths">
1760
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1761
+ </xsl:call-template>
1762
+ </xsl:variable> -->
1763
+
1764
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1765
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1766
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1767
+
1768
+ <xsl:variable name="margin-left">
1769
+ <xsl:choose>
1770
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1771
+ <xsl:otherwise>0</xsl:otherwise>
1772
+ </xsl:choose>
1773
+ </xsl:variable>
1774
+
1775
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1793
1776
 
1794
1777
 
1778
+
1779
+
1795
1780
 
1781
+ <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1782
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
1783
+
1796
1784
 
1797
-
1798
-
1799
1785
 
1800
- <attribute name="border-top">0.5pt solid black</attribute>
1801
-
1786
+
1802
1787
 
1803
-
1804
1788
 
1805
- </xsl:variable>
1806
-
1807
-
1808
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1809
1789
 
1810
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1811
- <xsl:attribute name="{@name}">
1812
- <xsl:value-of select="."/>
1813
- </xsl:attribute>
1814
- </xsl:for-each>
1815
1790
 
1816
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1817
- <xsl:if test="$isNoteOrFnExist = 'true'">
1818
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1819
- </xsl:if>
1820
1791
 
1821
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1792
+
1793
+ <xsl:variable name="table_width">
1794
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1795
+
1796
+
1797
+
1798
+ <xsl:choose>
1799
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1800
+ <xsl:otherwise>100%</xsl:otherwise>
1801
+ </xsl:choose>
1802
+
1803
+ </xsl:variable>
1804
+
1805
+ <xsl:variable name="table_attributes">
1806
+ <attribute name="table-layout">fixed</attribute>
1807
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1808
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1809
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1810
+
1811
+
1812
+
1813
+
1814
+
1815
+
1816
+
1817
+ <attribute name="border-top">0.5pt solid black</attribute>
1818
+
1819
+
1820
+
1821
+
1822
+ </xsl:variable>
1823
+
1824
+
1825
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1826
+
1827
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1828
+ <xsl:attribute name="{@name}">
1829
+ <xsl:value-of select="."/>
1830
+ </xsl:attribute>
1831
+ </xsl:for-each>
1832
+
1833
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1834
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1835
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1836
+ </xsl:if>
1837
+
1822
1838
  <xsl:choose>
1823
- <xsl:when test=". = 1 or . = 0">
1824
- <fo:table-column column-width="proportional-column-width(2)"/>
1839
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1840
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1841
+ <fo:table-column column-width="{@width}"/>
1842
+ </xsl:for-each>
1825
1843
  </xsl:when>
1826
1844
  <xsl:otherwise>
1827
- <fo:table-column column-width="proportional-column-width({.})"/>
1845
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1846
+ <xsl:choose>
1847
+ <xsl:when test=". = 1 or . = 0">
1848
+ <fo:table-column column-width="proportional-column-width(2)"/>
1849
+ </xsl:when>
1850
+ <xsl:otherwise>
1851
+ <fo:table-column column-width="proportional-column-width({.})"/>
1852
+ </xsl:otherwise>
1853
+ </xsl:choose>
1854
+ </xsl:for-each>
1828
1855
  </xsl:otherwise>
1829
1856
  </xsl:choose>
1830
- </xsl:for-each>
1831
-
1832
- <xsl:choose>
1833
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1834
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1835
- </xsl:when>
1836
- <xsl:otherwise>
1837
- <xsl:apply-templates/>
1838
- </xsl:otherwise>
1839
- </xsl:choose>
1840
-
1841
- </fo:table>
1842
-
1843
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1844
- <xsl:call-template name="insertTableFooterInSeparateTable">
1845
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1846
- <xsl:with-param name="colwidths" select="$colwidths"/>
1847
- </xsl:call-template>
1848
- </xsl:for-each>
1849
-
1850
- <!-- insert footer as table -->
1851
- <!-- <fo:table>
1852
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1853
- <xsl:attribute name="{@name}">
1854
- <xsl:value-of select="."/>
1855
- </xsl:attribute>
1856
- </xsl:for-each>
1857
-
1858
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1857
+
1859
1858
  <xsl:choose>
1860
- <xsl:when test=". = 1 or . = 0">
1861
- <fo:table-column column-width="proportional-column-width(2)"/>
1859
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1860
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1862
1861
  </xsl:when>
1863
1862
  <xsl:otherwise>
1864
- <fo:table-column column-width="proportional-column-width({.})"/>
1863
+ <xsl:apply-templates/>
1865
1864
  </xsl:otherwise>
1866
1865
  </xsl:choose>
1866
+
1867
+ </fo:table>
1868
+
1869
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1870
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1871
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1872
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1873
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1874
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1875
+ </xsl:call-template>
1867
1876
  </xsl:for-each>
1868
- </fo:table>-->
1869
-
1870
-
1871
-
1872
-
1873
-
1874
- </fo:block-container>
1877
+
1878
+ <!-- insert footer as table -->
1879
+ <!-- <fo:table>
1880
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1881
+ <xsl:attribute name="{@name}">
1882
+ <xsl:value-of select="."/>
1883
+ </xsl:attribute>
1884
+ </xsl:for-each>
1885
+
1886
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1887
+ <xsl:choose>
1888
+ <xsl:when test=". = 1 or . = 0">
1889
+ <fo:table-column column-width="proportional-column-width(2)"/>
1890
+ </xsl:when>
1891
+ <xsl:otherwise>
1892
+ <fo:table-column column-width="proportional-column-width({.})"/>
1893
+ </xsl:otherwise>
1894
+ </xsl:choose>
1895
+ </xsl:for-each>
1896
+ </fo:table>-->
1897
+
1898
+
1899
+
1900
+
1901
+
1902
+ </fo:block-container>
1903
+ </xsl:variable>
1904
+
1905
+
1906
+
1907
+ <xsl:choose>
1908
+ <xsl:when test="@width">
1909
+
1910
+ <!-- centered table when table name is centered (see table-name-style) -->
1911
+
1912
+
1913
+
1914
+ <xsl:copy-of select="$table"/>
1915
+
1916
+
1917
+ </xsl:when>
1918
+ <xsl:otherwise>
1919
+ <xsl:copy-of select="$table"/>
1920
+ </xsl:otherwise>
1921
+ </xsl:choose>
1922
+
1875
1923
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1876
1924
  <xsl:if test="normalize-space() != ''">
1877
1925
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -2097,12 +2145,22 @@
2097
2145
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
2098
2146
  <xsl:param name="table_attributes"/>
2099
2147
  <xsl:param name="colwidths"/>
2148
+ <xsl:param name="colgroup"/>
2100
2149
 
2101
2150
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2102
2151
 
2103
2152
  <xsl:if test="$isNoteOrFnExist = 'true'">
2104
2153
 
2105
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
2154
+ <xsl:variable name="cols-count">
2155
+ <xsl:choose>
2156
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2157
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
2158
+ </xsl:when>
2159
+ <xsl:otherwise>
2160
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
2161
+ </xsl:otherwise>
2162
+ </xsl:choose>
2163
+ </xsl:variable>
2106
2164
 
2107
2165
  <fo:table keep-with-previous="always">
2108
2166
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -2120,16 +2178,25 @@
2120
2178
  </xsl:choose>
2121
2179
  </xsl:for-each>
2122
2180
 
2123
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2124
- <xsl:choose>
2125
- <xsl:when test=". = 1 or . = 0">
2126
- <fo:table-column column-width="proportional-column-width(2)"/>
2127
- </xsl:when>
2128
- <xsl:otherwise>
2129
- <fo:table-column column-width="proportional-column-width({.})"/>
2130
- </xsl:otherwise>
2131
- </xsl:choose>
2132
- </xsl:for-each>
2181
+ <xsl:choose>
2182
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2183
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
2184
+ <fo:table-column column-width="{@width}"/>
2185
+ </xsl:for-each>
2186
+ </xsl:when>
2187
+ <xsl:otherwise>
2188
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2189
+ <xsl:choose>
2190
+ <xsl:when test=". = 1 or . = 0">
2191
+ <fo:table-column column-width="proportional-column-width(2)"/>
2192
+ </xsl:when>
2193
+ <xsl:otherwise>
2194
+ <fo:table-column column-width="proportional-column-width({.})"/>
2195
+ </xsl:otherwise>
2196
+ </xsl:choose>
2197
+ </xsl:for-each>
2198
+ </xsl:otherwise>
2199
+ </xsl:choose>
2133
2200
 
2134
2201
  <fo:table-body>
2135
2202
  <fo:table-row>
@@ -2563,7 +2630,9 @@
2563
2630
  </xsl:template><xsl:template match="*[local-name()='dl']">
2564
2631
  <fo:block-container>
2565
2632
 
2566
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2633
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
2634
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2635
+ </xsl:if>
2567
2636
 
2568
2637
 
2569
2638
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -2578,6 +2647,7 @@
2578
2647
  <fo:block-container>
2579
2648
 
2580
2649
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2650
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2581
2651
 
2582
2652
 
2583
2653
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -2694,7 +2764,7 @@
2694
2764
  <xsl:with-param name="table" select="$html-table"/>
2695
2765
  </xsl:call-template>
2696
2766
  </xsl:variable>
2697
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2767
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2698
2768
  <xsl:variable name="maxlength_dt">
2699
2769
  <xsl:call-template name="getMaxLength_dt"/>
2700
2770
  </xsl:variable>
@@ -2723,13 +2793,22 @@
2723
2793
  </xsl:when>
2724
2794
  <xsl:otherwise>
2725
2795
  <xsl:choose>
2796
+ <!-- to set width check most wide chars like `W` -->
2726
2797
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2727
- <fo:table-column column-width="5%"/>
2728
- <fo:table-column column-width="95%"/>
2798
+ <fo:table-column column-width="7%"/>
2799
+ <fo:table-column column-width="93%"/>
2800
+ </xsl:when>
2801
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2802
+ <fo:table-column column-width="15%"/>
2803
+ <fo:table-column column-width="85%"/>
2804
+ </xsl:when>
2805
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2806
+ <fo:table-column column-width="20%"/>
2807
+ <fo:table-column column-width="80%"/>
2729
2808
  </xsl:when>
2730
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2731
- <fo:table-column column-width="10%"/>
2732
- <fo:table-column column-width="90%"/>
2809
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2810
+ <fo:table-column column-width="25%"/>
2811
+ <fo:table-column column-width="75%"/>
2733
2812
  </xsl:when>
2734
2813
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2735
2814
  <fo:table-column column-width="60%"/>
@@ -2761,12 +2840,32 @@
2761
2840
  </xsl:otherwise>
2762
2841
  </xsl:choose>
2763
2842
  </xsl:template><xsl:template name="getMaxLength_dt">
2764
- <xsl:for-each select="*[local-name()='dt']">
2765
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2766
- <xsl:if test="position() = 1">
2767
- <xsl:value-of select="string-length(normalize-space(.))"/>
2768
- </xsl:if>
2769
- </xsl:for-each>
2843
+ <xsl:variable name="lengths">
2844
+ <xsl:for-each select="*[local-name()='dt']">
2845
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
2846
+ <xsl:variable name="attributes">
2847
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
2848
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
2849
+ </xsl:variable>
2850
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
2851
+ </xsl:for-each>
2852
+ </xsl:variable>
2853
+ <xsl:variable name="maxLength">
2854
+ <!-- <xsl:for-each select="*[local-name()='dt']">
2855
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2856
+ <xsl:if test="position() = 1">
2857
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2858
+ </xsl:if>
2859
+ </xsl:for-each> -->
2860
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
2861
+ <xsl:sort select="." data-type="number" order="descending"/>
2862
+ <xsl:if test="position() = 1">
2863
+ <xsl:value-of select="."/>
2864
+ </xsl:if>
2865
+ </xsl:for-each>
2866
+ </xsl:variable>
2867
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
2868
+ <xsl:value-of select="$maxLength"/>
2770
2869
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2771
2870
  <xsl:param name="key_iso"/>
2772
2871
 
@@ -2905,6 +3004,7 @@
2905
3004
 
2906
3005
 
2907
3006
 
3007
+
2908
3008
 
2909
3009
  </xsl:variable>
2910
3010
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2918,6 +3018,10 @@
2918
3018
  </xsl:if>
2919
3019
  <xsl:apply-templates/>
2920
3020
  </fo:inline>
3021
+ </xsl:template><xsl:template match="*[local-name()='underline']">
3022
+ <fo:inline text-decoration="underline">
3023
+ <xsl:apply-templates/>
3024
+ </fo:inline>
2921
3025
  </xsl:template><xsl:template match="*[local-name()='del']">
2922
3026
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2923
3027
  <xsl:apply-templates/>
@@ -3011,6 +3115,10 @@
3011
3115
  <xsl:param name="text" select="."/>
3012
3116
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3013
3117
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3118
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
3119
+ <xsl:param name="text" select="."/>
3120
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3121
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
3014
3122
  </xsl:template><xsl:template name="add-zero-spaces">
3015
3123
  <xsl:param name="text" select="."/>
3016
3124
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3271,6 +3379,11 @@
3271
3379
  <!-- replace start and end spaces to non-break space -->
3272
3380
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3273
3381
  </xsl:copy>
3382
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3383
+ <xsl:copy>
3384
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3385
+ </xsl:copy>
3386
+ <mathml:mspace width="0.5ex"/>
3274
3387
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3275
3388
  <xsl:variable name="target">
3276
3389
  <xsl:choose>
@@ -3292,7 +3405,10 @@
3292
3405
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3293
3406
  <xsl:choose>
3294
3407
  <xsl:when test="normalize-space(.) = ''">
3295
- <xsl:value-of select="$target"/>
3408
+ <!-- <xsl:value-of select="$target"/> -->
3409
+ <xsl:call-template name="add-zero-spaces-link-java">
3410
+ <xsl:with-param name="text" select="$target"/>
3411
+ </xsl:call-template>
3296
3412
  </xsl:when>
3297
3413
  <xsl:otherwise>
3298
3414
  <xsl:apply-templates/>
@@ -3507,7 +3623,7 @@
3507
3623
  </xsl:if> -->
3508
3624
  </fo:inline>
3509
3625
  </xsl:if>
3510
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3626
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3511
3627
  <fo:block-container id="{@id}">
3512
3628
 
3513
3629
  <fo:block>
@@ -3576,6 +3692,8 @@
3576
3692
  <xsl:variable name="bookmark-title_">
3577
3693
  <xsl:call-template name="getLangVersion">
3578
3694
  <xsl:with-param name="lang" select="@lang"/>
3695
+ <xsl:with-param name="doctype" select="@doctype"/>
3696
+ <xsl:with-param name="title" select="@title-part"/>
3579
3697
  </xsl:call-template>
3580
3698
  </xsl:variable>
3581
3699
  <xsl:choose>
@@ -3593,13 +3711,34 @@
3593
3711
  </xsl:choose>
3594
3712
  </fo:bookmark-title>
3595
3713
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3714
+
3715
+ <xsl:call-template name="insertFigureBookmarks">
3716
+ <xsl:with-param name="contents" select="contents"/>
3717
+ </xsl:call-template>
3718
+
3719
+ <xsl:call-template name="insertTableBookmarks">
3720
+ <xsl:with-param name="contents" select="contents"/>
3721
+ <xsl:with-param name="lang" select="@lang"/>
3722
+ </xsl:call-template>
3723
+
3596
3724
  </fo:bookmark>
3597
3725
 
3598
3726
  </xsl:for-each>
3599
3727
  </xsl:when>
3600
3728
  <xsl:otherwise>
3601
3729
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3730
+
3602
3731
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3732
+
3733
+ <xsl:call-template name="insertFigureBookmarks">
3734
+ <xsl:with-param name="contents" select="contents"/>
3735
+ </xsl:call-template>
3736
+
3737
+ <xsl:call-template name="insertTableBookmarks">
3738
+ <xsl:with-param name="contents" select="contents"/>
3739
+ <xsl:with-param name="lang" select="@lang"/>
3740
+ </xsl:call-template>
3741
+
3603
3742
  </xsl:for-each>
3604
3743
  </xsl:otherwise>
3605
3744
  </xsl:choose>
@@ -3618,8 +3757,44 @@
3618
3757
 
3619
3758
  </fo:bookmark-tree>
3620
3759
  </xsl:if>
3760
+ </xsl:template><xsl:template name="insertFigureBookmarks">
3761
+ <xsl:param name="contents"/>
3762
+ <xsl:if test="xalan:nodeset($contents)/figure">
3763
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
3764
+ <fo:bookmark-title>Figures</fo:bookmark-title>
3765
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
3766
+ <fo:bookmark internal-destination="{@id}">
3767
+ <fo:bookmark-title>
3768
+ <xsl:value-of select="normalize-space(title)"/>
3769
+ </fo:bookmark-title>
3770
+ </fo:bookmark>
3771
+ </xsl:for-each>
3772
+ </fo:bookmark>
3773
+ </xsl:if>
3774
+ </xsl:template><xsl:template name="insertTableBookmarks">
3775
+ <xsl:param name="contents"/>
3776
+ <xsl:param name="lang"/>
3777
+ <xsl:if test="xalan:nodeset($contents)/table">
3778
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
3779
+ <fo:bookmark-title>
3780
+ <xsl:choose>
3781
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
3782
+ <xsl:otherwise>Tables</xsl:otherwise>
3783
+ </xsl:choose>
3784
+ </fo:bookmark-title>
3785
+ <xsl:for-each select="xalan:nodeset($contents)/table">
3786
+ <fo:bookmark internal-destination="{@id}">
3787
+ <fo:bookmark-title>
3788
+ <xsl:value-of select="normalize-space(title)"/>
3789
+ </fo:bookmark-title>
3790
+ </fo:bookmark>
3791
+ </xsl:for-each>
3792
+ </fo:bookmark>
3793
+ </xsl:if>
3621
3794
  </xsl:template><xsl:template name="getLangVersion">
3622
3795
  <xsl:param name="lang"/>
3796
+ <xsl:param name="doctype" select="''"/>
3797
+ <xsl:param name="title" select="''"/>
3623
3798
  <xsl:choose>
3624
3799
  <xsl:when test="$lang = 'en'">
3625
3800
 
@@ -3655,6 +3830,12 @@
3655
3830
  <!-- <xsl:text> </xsl:text> -->
3656
3831
  </xsl:template><xsl:template name="getSection">
3657
3832
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3833
+ <!--
3834
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3835
+ <xsl:value-of select="."/>
3836
+ </xsl:for-each>
3837
+ -->
3838
+
3658
3839
  </xsl:template><xsl:template name="getName">
3659
3840
  <xsl:choose>
3660
3841
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3707,6 +3888,12 @@
3707
3888
  <xsl:copy>
3708
3889
  <xsl:apply-templates mode="contents_item"/>
3709
3890
  </xsl:copy>
3891
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3892
+ <xsl:copy>
3893
+ <xsl:apply-templates mode="contents_item"/>
3894
+ </xsl:copy>
3895
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3896
+ <xsl:copy-of select="."/>
3710
3897
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3711
3898
  <xsl:text> </xsl:text>
3712
3899
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3732,6 +3919,7 @@
3732
3919
 
3733
3920
 
3734
3921
 
3922
+
3735
3923
 
3736
3924
 
3737
3925
 
@@ -4104,10 +4292,13 @@
4104
4292
  </xsl:if>
4105
4293
  </xsl:if>
4106
4294
 
4295
+
4107
4296
  <fo:block-container margin-left="0mm">
4108
4297
 
4109
4298
  <fo:block xsl:use-attribute-sets="quote-style">
4110
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
4299
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4300
+
4301
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4111
4302
  </fo:block>
4112
4303
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4113
4304
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4260,6 +4451,7 @@
4260
4451
 
4261
4452
 
4262
4453
 
4454
+
4263
4455
 
4264
4456
 
4265
4457
 
@@ -4276,7 +4468,7 @@
4276
4468
 
4277
4469
 
4278
4470
 
4279
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4471
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4280
4472
  <fo:block break-after="page"/>
4281
4473
  <fo:block>
4282
4474
  <xsl:call-template name="setId"/>
@@ -4284,7 +4476,8 @@
4284
4476
  </fo:block>
4285
4477
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4286
4478
  <fo:block>
4287
- <xsl:call-template name="setId"/>
4479
+ <xsl:call-template name="setId"/>
4480
+
4288
4481
 
4289
4482
  <xsl:apply-templates/>
4290
4483
  </fo:block>
@@ -4354,7 +4547,8 @@
4354
4547
  <fo:table-column column-width="107mm"/>
4355
4548
  <fo:table-column column-width="15mm"/>
4356
4549
  <fo:table-body>
4357
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
4550
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
4551
+
4358
4552
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
4359
4553
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
4360
4554
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -4372,6 +4566,10 @@
4372
4566
  <fo:block><xsl:apply-templates/></fo:block>
4373
4567
  </fo:table-cell>
4374
4568
  </xsl:template><xsl:template name="processBibitem">
4569
+
4570
+
4571
+ <!-- end BIPM bibitem processing-->
4572
+
4375
4573
 
4376
4574
 
4377
4575
 
@@ -4430,6 +4628,8 @@
4430
4628
  <xsl:value-of select="translate(.,'. ','')"/>
4431
4629
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4432
4630
  <xsl:value-of select="substring(.,1,1)"/>
4631
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4632
+ <fo:inline><xsl:apply-templates/></fo:inline>
4433
4633
  </xsl:template><xsl:template name="convertDate">
4434
4634
  <xsl:param name="date"/>
4435
4635
  <xsl:param name="format" select="'short'"/>
@@ -4454,6 +4654,57 @@
4454
4654
  </xsl:variable>
4455
4655
  <xsl:variable name="result">
4456
4656
  <xsl:choose>
4657
+ <xsl:when test="$format = 'ddMMyyyy'">
4658
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4659
+ <xsl:text> </xsl:text>
4660
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4661
+ </xsl:when>
4662
+ <xsl:when test="$format = 'ddMM'">
4663
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4664
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4665
+ </xsl:when>
4666
+ <xsl:when test="$format = 'short' or $day = ''">
4667
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4668
+ </xsl:when>
4669
+ <xsl:otherwise>
4670
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4671
+ </xsl:otherwise>
4672
+ </xsl:choose>
4673
+ </xsl:variable>
4674
+ <xsl:value-of select="$result"/>
4675
+ </xsl:template><xsl:template name="convertDateLocalized">
4676
+ <xsl:param name="date"/>
4677
+ <xsl:param name="format" select="'short'"/>
4678
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4679
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4680
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4681
+ <xsl:variable name="monthStr">
4682
+ <xsl:choose>
4683
+ <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>
4684
+ <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>
4685
+ <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>
4686
+ <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>
4687
+ <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>
4688
+ <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>
4689
+ <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>
4690
+ <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>
4691
+ <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>
4692
+ <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>
4693
+ <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>
4694
+ <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>
4695
+ </xsl:choose>
4696
+ </xsl:variable>
4697
+ <xsl:variable name="result">
4698
+ <xsl:choose>
4699
+ <xsl:when test="$format = 'ddMMyyyy'">
4700
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4701
+ <xsl:text> </xsl:text>
4702
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4703
+ </xsl:when>
4704
+ <xsl:when test="$format = 'ddMM'">
4705
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4706
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4707
+ </xsl:when>
4457
4708
  <xsl:when test="$format = 'short' or $day = ''">
4458
4709
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4459
4710
  </xsl:when>
@@ -4469,7 +4720,7 @@
4469
4720
  <xsl:param name="charDelim" select="', '"/>
4470
4721
  <xsl:choose>
4471
4722
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4472
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4723
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4473
4724
  <xsl:sort data-type="text" order="ascending"/>
4474
4725
  <xsl:call-template name="insertKeyword">
4475
4726
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4478,7 +4729,7 @@
4478
4729
  </xsl:for-each>
4479
4730
  </xsl:when>
4480
4731
  <xsl:otherwise>
4481
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4732
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4482
4733
  <xsl:call-template name="insertKeyword">
4483
4734
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4484
4735
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4495,6 +4746,9 @@
4495
4746
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4496
4747
  </xsl:choose>
4497
4748
  </xsl:template><xsl:template name="addPDFUAmeta">
4749
+ <xsl:variable name="lang">
4750
+ <xsl:call-template name="getLang"/>
4751
+ </xsl:variable>
4498
4752
  <fo:declarations>
4499
4753
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4500
4754
  <pdf:dictionary type="normal" key="ViewerPreferences">
@@ -4507,13 +4761,16 @@
4507
4761
  <!-- Dublin Core properties go here -->
4508
4762
  <dc:title>
4509
4763
  <xsl:variable name="title">
4510
-
4511
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4512
-
4513
-
4514
-
4515
-
4516
-
4764
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4765
+
4766
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4767
+
4768
+
4769
+
4770
+
4771
+
4772
+
4773
+ </xsl:for-each>
4517
4774
  </xsl:variable>
4518
4775
  <xsl:choose>
4519
4776
  <xsl:when test="normalize-space($title) != ''">
@@ -4525,17 +4782,21 @@
4525
4782
  </xsl:choose>
4526
4783
  </dc:title>
4527
4784
  <dc:creator>
4528
-
4529
-
4530
-
4531
- </dc:creator>
4532
- <dc:description>
4533
- <xsl:variable name="abstract">
4785
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4786
+
4787
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4788
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4789
+ <xsl:if test="position() != last()">; </xsl:if>
4790
+ </xsl:for-each>
4534
4791
 
4535
4792
 
4536
4793
 
4537
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4794
+ </xsl:for-each>
4795
+ </dc:creator>
4796
+ <dc:description>
4797
+ <xsl:variable name="abstract">
4538
4798
 
4799
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4539
4800
 
4540
4801
 
4541
4802
  </xsl:variable>
@@ -4648,6 +4909,7 @@
4648
4909
 
4649
4910
 
4650
4911
 
4912
+
4651
4913
  </xsl:variable>
4652
4914
  <xsl:if test="$documentNS != $XSLNS">
4653
4915
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4707,6 +4969,11 @@
4707
4969
  <xsl:call-template name="getLang"/>
4708
4970
  </xsl:variable>
4709
4971
 
4710
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4972
+ <xsl:choose>
4973
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4974
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4975
+ </xsl:when>
4976
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4977
+ </xsl:choose>
4711
4978
 
4712
4979
  </xsl:template></xsl:stylesheet>