metanorma-un 0.5.9 → 0.5.14

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.
@@ -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,195 +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:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1746
- <xsl:call-template name="calculate-column-widths">
1747
- <xsl:with-param name="cols-count" select="$cols-count"/>
1748
- <xsl:with-param name="table" select="$simple-table"/>
1749
- </xsl:call-template>
1750
- </xsl:if>
1751
- </xsl:variable>
1752
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1753
-
1754
- <!-- <xsl:variable name="colwidths2">
1755
- <xsl:call-template name="calculate-column-widths">
1756
- <xsl:with-param name="cols-count" select="$cols-count"/>
1757
- </xsl:call-template>
1758
- </xsl:variable> -->
1759
-
1760
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1761
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1762
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1763
-
1764
- <xsl:variable name="margin-left">
1765
- <xsl:choose>
1766
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1767
- <xsl:otherwise>0</xsl:otherwise>
1768
- </xsl:choose>
1769
- </xsl:variable>
1770
-
1771
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1772
1710
 
1773
1711
 
1774
-
1775
-
1776
1712
 
1777
- <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1778
- <xsl:attribute name="font-size">8pt</xsl:attribute>
1779
-
1713
+ <!-- <xsl:if test="$namespace = 'bipm'">
1714
+ <fo:block>&#xA0;</fo:block>
1715
+ </xsl:if> -->
1780
1716
 
1717
+ <!-- $namespace = 'iso' or -->
1781
1718
 
1782
-
1719
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1783
1720
 
1721
+
1784
1722
 
1723
+ <xsl:call-template name="fn_name_display"/>
1785
1724
 
1725
+
1786
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"/> -->
1787
1745
 
1788
1746
 
1789
1747
 
1790
- <xsl:variable name="table_attributes">
1791
- <attribute name="table-layout">fixed</attribute>
1792
- <attribute name="width">100%</attribute>
1793
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1794
- <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">
1795
1776
 
1796
1777
 
1778
+
1779
+
1797
1780
 
1781
+ <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1782
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
1783
+
1798
1784
 
1799
-
1800
-
1801
1785
 
1802
- <attribute name="border-top">0.5pt solid black</attribute>
1803
-
1786
+
1804
1787
 
1805
-
1806
1788
 
1807
- </xsl:variable>
1808
-
1809
-
1810
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1811
1789
 
1812
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1813
- <xsl:attribute name="{@name}">
1814
- <xsl:value-of select="."/>
1815
- </xsl:attribute>
1816
- </xsl:for-each>
1817
1790
 
1818
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1819
- <xsl:if test="$isNoteOrFnExist = 'true'">
1820
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1821
- </xsl:if>
1822
1791
 
1823
- <xsl:choose>
1824
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1825
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1826
- <fo:table-column column-width="{@width}"/>
1827
- </xsl:for-each>
1828
- </xsl:when>
1829
- <xsl:otherwise>
1830
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1831
- <xsl:choose>
1832
- <xsl:when test=". = 1 or . = 0">
1833
- <fo:table-column column-width="proportional-column-width(2)"/>
1834
- </xsl:when>
1835
- <xsl:otherwise>
1836
- <fo:table-column column-width="proportional-column-width({.})"/>
1837
- </xsl:otherwise>
1838
- </xsl:choose>
1839
- </xsl:for-each>
1840
- </xsl:otherwise>
1841
- </xsl:choose>
1842
1792
 
1843
- <xsl:choose>
1844
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1845
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1846
- </xsl:when>
1847
- <xsl:otherwise>
1848
- <xsl:apply-templates/>
1849
- </xsl:otherwise>
1850
- </xsl:choose>
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>
1851
1823
 
1852
- </fo:table>
1853
-
1854
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1855
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1856
- <xsl:call-template name="insertTableFooterInSeparateTable">
1857
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1858
- <xsl:with-param name="colwidths" select="$colwidths"/>
1859
- <xsl:with-param name="colgroup" select="$colgroup"/>
1860
- </xsl:call-template>
1861
- </xsl:for-each>
1862
-
1863
- <!-- insert footer as table -->
1864
- <!-- <fo:table>
1865
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1866
- <xsl:attribute name="{@name}">
1867
- <xsl:value-of select="."/>
1868
- </xsl:attribute>
1869
- </xsl:for-each>
1870
1824
 
1871
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
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
+
1872
1838
  <xsl:choose>
1873
- <xsl:when test=". = 1 or . = 0">
1874
- <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>
1875
1843
  </xsl:when>
1876
1844
  <xsl:otherwise>
1877
- <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>
1878
1855
  </xsl:otherwise>
1879
1856
  </xsl:choose>
1857
+
1858
+ <xsl:choose>
1859
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1860
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1861
+ </xsl:when>
1862
+ <xsl:otherwise>
1863
+ <xsl:apply-templates/>
1864
+ </xsl:otherwise>
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>
1880
1876
  </xsl:for-each>
1881
- </fo:table>-->
1882
-
1883
-
1884
-
1885
-
1886
-
1887
- </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
+
1888
1923
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1889
1924
  <xsl:if test="normalize-space() != ''">
1890
1925
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -2595,7 +2630,9 @@
2595
2630
  </xsl:template><xsl:template match="*[local-name()='dl']">
2596
2631
  <fo:block-container>
2597
2632
 
2598
- <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>
2599
2636
 
2600
2637
 
2601
2638
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -2610,6 +2647,7 @@
2610
2647
  <fo:block-container>
2611
2648
 
2612
2649
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2650
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2613
2651
 
2614
2652
 
2615
2653
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -2726,7 +2764,7 @@
2726
2764
  <xsl:with-param name="table" select="$html-table"/>
2727
2765
  </xsl:call-template>
2728
2766
  </xsl:variable>
2729
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2767
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2730
2768
  <xsl:variable name="maxlength_dt">
2731
2769
  <xsl:call-template name="getMaxLength_dt"/>
2732
2770
  </xsl:variable>
@@ -2755,13 +2793,22 @@
2755
2793
  </xsl:when>
2756
2794
  <xsl:otherwise>
2757
2795
  <xsl:choose>
2796
+ <!-- to set width check most wide chars like `W` -->
2758
2797
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2759
- <fo:table-column column-width="5%"/>
2760
- <fo:table-column column-width="95%"/>
2798
+ <fo:table-column column-width="7%"/>
2799
+ <fo:table-column column-width="93%"/>
2761
2800
  </xsl:when>
2762
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2763
- <fo:table-column column-width="10%"/>
2764
- <fo:table-column column-width="90%"/>
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%"/>
2808
+ </xsl:when>
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%"/>
2765
2812
  </xsl:when>
2766
2813
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2767
2814
  <fo:table-column column-width="60%"/>
@@ -2793,12 +2840,32 @@
2793
2840
  </xsl:otherwise>
2794
2841
  </xsl:choose>
2795
2842
  </xsl:template><xsl:template name="getMaxLength_dt">
2796
- <xsl:for-each select="*[local-name()='dt']">
2797
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2798
- <xsl:if test="position() = 1">
2799
- <xsl:value-of select="string-length(normalize-space(.))"/>
2800
- </xsl:if>
2801
- </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"/>
2802
2869
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2803
2870
  <xsl:param name="key_iso"/>
2804
2871
 
@@ -2937,6 +3004,7 @@
2937
3004
 
2938
3005
 
2939
3006
 
3007
+
2940
3008
 
2941
3009
  </xsl:variable>
2942
3010
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2950,6 +3018,10 @@
2950
3018
  </xsl:if>
2951
3019
  <xsl:apply-templates/>
2952
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>
2953
3025
  </xsl:template><xsl:template match="*[local-name()='del']">
2954
3026
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2955
3027
  <xsl:apply-templates/>
@@ -3043,6 +3115,10 @@
3043
3115
  <xsl:param name="text" select="."/>
3044
3116
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3045
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​')"/>
3046
3122
  </xsl:template><xsl:template name="add-zero-spaces">
3047
3123
  <xsl:param name="text" select="."/>
3048
3124
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3303,6 +3379,11 @@
3303
3379
  <!-- replace start and end spaces to non-break space -->
3304
3380
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3305
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"/>
3306
3387
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3307
3388
  <xsl:variable name="target">
3308
3389
  <xsl:choose>
@@ -3324,7 +3405,10 @@
3324
3405
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3325
3406
  <xsl:choose>
3326
3407
  <xsl:when test="normalize-space(.) = ''">
3327
- <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>
3328
3412
  </xsl:when>
3329
3413
  <xsl:otherwise>
3330
3414
  <xsl:apply-templates/>
@@ -3539,7 +3623,7 @@
3539
3623
  </xsl:if> -->
3540
3624
  </fo:inline>
3541
3625
  </xsl:if>
3542
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3626
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3543
3627
  <fo:block-container id="{@id}">
3544
3628
 
3545
3629
  <fo:block>
@@ -3608,6 +3692,8 @@
3608
3692
  <xsl:variable name="bookmark-title_">
3609
3693
  <xsl:call-template name="getLangVersion">
3610
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"/>
3611
3697
  </xsl:call-template>
3612
3698
  </xsl:variable>
3613
3699
  <xsl:choose>
@@ -3625,13 +3711,34 @@
3625
3711
  </xsl:choose>
3626
3712
  </fo:bookmark-title>
3627
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
+
3628
3724
  </fo:bookmark>
3629
3725
 
3630
3726
  </xsl:for-each>
3631
3727
  </xsl:when>
3632
3728
  <xsl:otherwise>
3633
3729
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3730
+
3634
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
+
3635
3742
  </xsl:for-each>
3636
3743
  </xsl:otherwise>
3637
3744
  </xsl:choose>
@@ -3650,8 +3757,44 @@
3650
3757
 
3651
3758
  </fo:bookmark-tree>
3652
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>
3653
3794
  </xsl:template><xsl:template name="getLangVersion">
3654
3795
  <xsl:param name="lang"/>
3796
+ <xsl:param name="doctype" select="''"/>
3797
+ <xsl:param name="title" select="''"/>
3655
3798
  <xsl:choose>
3656
3799
  <xsl:when test="$lang = 'en'">
3657
3800
 
@@ -3687,6 +3830,12 @@
3687
3830
  <!-- <xsl:text> </xsl:text> -->
3688
3831
  </xsl:template><xsl:template name="getSection">
3689
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
+
3690
3839
  </xsl:template><xsl:template name="getName">
3691
3840
  <xsl:choose>
3692
3841
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3739,6 +3888,12 @@
3739
3888
  <xsl:copy>
3740
3889
  <xsl:apply-templates mode="contents_item"/>
3741
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="."/>
3742
3897
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3743
3898
  <xsl:text> </xsl:text>
3744
3899
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3764,6 +3919,7 @@
3764
3919
 
3765
3920
 
3766
3921
 
3922
+
3767
3923
 
3768
3924
 
3769
3925
 
@@ -4136,10 +4292,13 @@
4136
4292
  </xsl:if>
4137
4293
  </xsl:if>
4138
4294
 
4295
+
4139
4296
  <fo:block-container margin-left="0mm">
4140
4297
 
4141
4298
  <fo:block xsl:use-attribute-sets="quote-style">
4142
- <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 -->
4143
4302
  </fo:block>
4144
4303
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4145
4304
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4292,6 +4451,7 @@
4292
4451
 
4293
4452
 
4294
4453
 
4454
+
4295
4455
 
4296
4456
 
4297
4457
 
@@ -4308,7 +4468,7 @@
4308
4468
 
4309
4469
 
4310
4470
 
4311
- </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']/* -->
4312
4472
  <fo:block break-after="page"/>
4313
4473
  <fo:block>
4314
4474
  <xsl:call-template name="setId"/>
@@ -4316,7 +4476,8 @@
4316
4476
  </fo:block>
4317
4477
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4318
4478
  <fo:block>
4319
- <xsl:call-template name="setId"/>
4479
+ <xsl:call-template name="setId"/>
4480
+
4320
4481
 
4321
4482
  <xsl:apply-templates/>
4322
4483
  </fo:block>
@@ -4467,6 +4628,8 @@
4467
4628
  <xsl:value-of select="translate(.,'. ','')"/>
4468
4629
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4469
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>
4470
4633
  </xsl:template><xsl:template name="convertDate">
4471
4634
  <xsl:param name="date"/>
4472
4635
  <xsl:param name="format" select="'short'"/>
@@ -4491,6 +4654,57 @@
4491
4654
  </xsl:variable>
4492
4655
  <xsl:variable name="result">
4493
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>
4494
4708
  <xsl:when test="$format = 'short' or $day = ''">
4495
4709
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4496
4710
  </xsl:when>
@@ -4506,7 +4720,7 @@
4506
4720
  <xsl:param name="charDelim" select="', '"/>
4507
4721
  <xsl:choose>
4508
4722
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4509
- <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']">
4510
4724
  <xsl:sort data-type="text" order="ascending"/>
4511
4725
  <xsl:call-template name="insertKeyword">
4512
4726
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4515,7 +4729,7 @@
4515
4729
  </xsl:for-each>
4516
4730
  </xsl:when>
4517
4731
  <xsl:otherwise>
4518
- <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']">
4519
4733
  <xsl:call-template name="insertKeyword">
4520
4734
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4521
4735
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4532,6 +4746,9 @@
4532
4746
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4533
4747
  </xsl:choose>
4534
4748
  </xsl:template><xsl:template name="addPDFUAmeta">
4749
+ <xsl:variable name="lang">
4750
+ <xsl:call-template name="getLang"/>
4751
+ </xsl:variable>
4535
4752
  <fo:declarations>
4536
4753
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4537
4754
  <pdf:dictionary type="normal" key="ViewerPreferences">
@@ -4544,13 +4761,16 @@
4544
4761
  <!-- Dublin Core properties go here -->
4545
4762
  <dc:title>
4546
4763
  <xsl:variable name="title">
4547
-
4548
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4549
-
4550
-
4551
-
4552
-
4553
-
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>
4554
4774
  </xsl:variable>
4555
4775
  <xsl:choose>
4556
4776
  <xsl:when test="normalize-space($title) != ''">
@@ -4562,17 +4782,21 @@
4562
4782
  </xsl:choose>
4563
4783
  </dc:title>
4564
4784
  <dc:creator>
4565
-
4566
-
4567
-
4568
- </dc:creator>
4569
- <dc:description>
4570
- <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>
4571
4791
 
4572
4792
 
4573
4793
 
4574
- <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">
4575
4798
 
4799
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4576
4800
 
4577
4801
 
4578
4802
  </xsl:variable>
@@ -4685,6 +4909,7 @@
4685
4909
 
4686
4910
 
4687
4911
 
4912
+
4688
4913
  </xsl:variable>
4689
4914
  <xsl:if test="$documentNS != $XSLNS">
4690
4915
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4744,6 +4969,11 @@
4744
4969
  <xsl:call-template name="getLang"/>
4745
4970
  </xsl:variable>
4746
4971
 
4747
- <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>
4748
4978
 
4749
4979
  </xsl:template></xsl:stylesheet>