metanorma-un 0.5.10 → 0.5.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
7
8
 
8
9
 
@@ -72,7 +73,9 @@
72
73
  </fo:page-sequence-master>
73
74
  </fo:layout-master-set>
74
75
 
75
- <xsl:call-template name="addPDFUAmeta"/>
76
+ <fo:declarations>
77
+ <xsl:call-template name="addPDFUAmeta"/>
78
+ </fo:declarations>
76
79
 
77
80
  <xsl:call-template name="addBookmarks">
78
81
  <xsl:with-param name="contents" select="$contents"/>
@@ -1448,6 +1451,7 @@
1448
1451
 
1449
1452
 
1450
1453
 
1454
+
1451
1455
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1452
1456
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1453
1457
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1568,6 +1572,7 @@
1568
1572
 
1569
1573
 
1570
1574
 
1575
+
1571
1576
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1572
1577
 
1573
1578
 
@@ -1697,195 +1702,228 @@
1697
1702
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1698
1703
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1699
1704
  <xsl:call-template name="add-zero-spaces-java"/>
1700
- </xsl:template><xsl:template match="*[local-name()='table']">
1705
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1701
1706
 
1702
- <xsl:variable name="simple-table">
1703
- <xsl:call-template name="getSimpleTable"/>
1704
- </xsl:variable>
1707
+ <xsl:variable name="table">
1705
1708
 
1706
-
1707
-
1708
-
1709
-
1710
- <!-- <xsl:if test="$namespace = 'bipm'">
1711
- <fo:block>&#xA0;</fo:block>
1712
- </xsl:if> -->
1713
-
1714
- <!-- $namespace = 'iso' or -->
1715
-
1716
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1717
-
1718
-
1719
-
1720
- <xsl:call-template name="fn_name_display"/>
1709
+ <xsl:variable name="simple-table">
1710
+ <xsl:call-template name="getSimpleTable"/>
1711
+ </xsl:variable>
1721
1712
 
1722
1713
 
1723
-
1724
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1725
-
1726
- <!-- <xsl:variable name="cols-count">
1727
- <xsl:choose>
1728
- <xsl:when test="*[local-name()='thead']">
1729
- <xsl:call-template name="calculate-columns-numbers">
1730
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1731
- </xsl:call-template>
1732
- </xsl:when>
1733
- <xsl:otherwise>
1734
- <xsl:call-template name="calculate-columns-numbers">
1735
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1736
- </xsl:call-template>
1737
- </xsl:otherwise>
1738
- </xsl:choose>
1739
- </xsl:variable> -->
1740
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1741
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1742
-
1743
-
1744
-
1745
- <xsl:variable name="colwidths">
1746
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1747
- <xsl:call-template name="calculate-column-widths">
1748
- <xsl:with-param name="cols-count" select="$cols-count"/>
1749
- <xsl:with-param name="table" select="$simple-table"/>
1750
- </xsl:call-template>
1751
- </xsl:if>
1752
- </xsl:variable>
1753
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1754
-
1755
- <!-- <xsl:variable name="colwidths2">
1756
- <xsl:call-template name="calculate-column-widths">
1757
- <xsl:with-param name="cols-count" select="$cols-count"/>
1758
- </xsl:call-template>
1759
- </xsl:variable> -->
1760
-
1761
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1762
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1763
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1764
-
1765
- <xsl:variable name="margin-left">
1766
- <xsl:choose>
1767
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1768
- <xsl:otherwise>0</xsl:otherwise>
1769
- </xsl:choose>
1770
- </xsl:variable>
1771
-
1772
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1773
1714
 
1774
1715
 
1775
-
1776
-
1777
1716
 
1778
- <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1779
- <xsl:attribute name="font-size">8pt</xsl:attribute>
1780
-
1717
+ <!-- <xsl:if test="$namespace = 'bipm'">
1718
+ <fo:block>&#xA0;</fo:block>
1719
+ </xsl:if> -->
1781
1720
 
1721
+ <!-- $namespace = 'iso' or -->
1782
1722
 
1783
-
1723
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1724
+
1725
+
1726
+
1727
+ <xsl:call-template name="fn_name_display"/>
1728
+
1729
+
1730
+
1731
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1732
+
1733
+ <!-- <xsl:variable name="cols-count">
1734
+ <xsl:choose>
1735
+ <xsl:when test="*[local-name()='thead']">
1736
+ <xsl:call-template name="calculate-columns-numbers">
1737
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1738
+ </xsl:call-template>
1739
+ </xsl:when>
1740
+ <xsl:otherwise>
1741
+ <xsl:call-template name="calculate-columns-numbers">
1742
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1743
+ </xsl:call-template>
1744
+ </xsl:otherwise>
1745
+ </xsl:choose>
1746
+ </xsl:variable> -->
1747
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1748
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1784
1749
 
1785
1750
 
1786
1751
 
1752
+ <xsl:variable name="colwidths">
1753
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1754
+ <xsl:call-template name="calculate-column-widths">
1755
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1756
+ <xsl:with-param name="table" select="$simple-table"/>
1757
+ </xsl:call-template>
1758
+ </xsl:if>
1759
+ </xsl:variable>
1760
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1787
1761
 
1762
+ <!-- <xsl:variable name="colwidths2">
1763
+ <xsl:call-template name="calculate-column-widths">
1764
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1765
+ </xsl:call-template>
1766
+ </xsl:variable> -->
1788
1767
 
1768
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1769
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1770
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1789
1771
 
1772
+ <xsl:variable name="margin-left">
1773
+ <xsl:choose>
1774
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1775
+ <xsl:otherwise>0</xsl:otherwise>
1776
+ </xsl:choose>
1777
+ </xsl:variable>
1790
1778
 
1791
- <xsl:variable name="table_attributes">
1792
- <attribute name="table-layout">fixed</attribute>
1793
- <attribute name="width">100%</attribute>
1794
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1795
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1779
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1796
1780
 
1797
1781
 
1782
+
1783
+
1798
1784
 
1785
+ <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1786
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
1787
+
1799
1788
 
1800
-
1801
-
1802
1789
 
1803
- <attribute name="border-top">0.5pt solid black</attribute>
1804
-
1790
+
1805
1791
 
1806
-
1807
1792
 
1808
- </xsl:variable>
1809
-
1810
-
1811
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1812
1793
 
1813
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1814
- <xsl:attribute name="{@name}">
1815
- <xsl:value-of select="."/>
1816
- </xsl:attribute>
1817
- </xsl:for-each>
1818
1794
 
1819
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1820
- <xsl:if test="$isNoteOrFnExist = 'true'">
1821
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1822
- </xsl:if>
1823
1795
 
1824
- <xsl:choose>
1825
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1826
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1827
- <fo:table-column column-width="{@width}"/>
1828
- </xsl:for-each>
1829
- </xsl:when>
1830
- <xsl:otherwise>
1831
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1832
- <xsl:choose>
1833
- <xsl:when test=". = 1 or . = 0">
1834
- <fo:table-column column-width="proportional-column-width(2)"/>
1835
- </xsl:when>
1836
- <xsl:otherwise>
1837
- <fo:table-column column-width="proportional-column-width({.})"/>
1838
- </xsl:otherwise>
1839
- </xsl:choose>
1840
- </xsl:for-each>
1841
- </xsl:otherwise>
1842
- </xsl:choose>
1843
1796
 
1844
- <xsl:choose>
1845
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1846
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1847
- </xsl:when>
1848
- <xsl:otherwise>
1849
- <xsl:apply-templates/>
1850
- </xsl:otherwise>
1851
- </xsl:choose>
1797
+ <xsl:variable name="table_width">
1798
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1799
+
1800
+
1801
+
1802
+ <xsl:choose>
1803
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1804
+ <xsl:otherwise>100%</xsl:otherwise>
1805
+ </xsl:choose>
1806
+
1807
+ </xsl:variable>
1852
1808
 
1853
- </fo:table>
1854
-
1855
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1856
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1857
- <xsl:call-template name="insertTableFooterInSeparateTable">
1858
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1859
- <xsl:with-param name="colwidths" select="$colwidths"/>
1860
- <xsl:with-param name="colgroup" select="$colgroup"/>
1861
- </xsl:call-template>
1862
- </xsl:for-each>
1863
-
1864
- <!-- insert footer as table -->
1865
- <!-- <fo:table>
1866
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1867
- <xsl:attribute name="{@name}">
1868
- <xsl:value-of select="."/>
1869
- </xsl:attribute>
1870
- </xsl:for-each>
1809
+ <xsl:variable name="table_attributes">
1810
+ <attribute name="table-layout">fixed</attribute>
1811
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1812
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1813
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1814
+
1815
+
1816
+
1817
+
1818
+
1819
+
1820
+
1821
+ <attribute name="border-top">0.5pt solid black</attribute>
1822
+
1823
+
1824
+
1825
+
1826
+ </xsl:variable>
1871
1827
 
1872
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1828
+
1829
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1830
+
1831
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1832
+ <xsl:attribute name="{@name}">
1833
+ <xsl:value-of select="."/>
1834
+ </xsl:attribute>
1835
+ </xsl:for-each>
1836
+
1837
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1838
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1839
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1840
+ </xsl:if>
1841
+
1842
+ <xsl:choose>
1843
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1844
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1845
+ <fo:table-column column-width="{@width}"/>
1846
+ </xsl:for-each>
1847
+ </xsl:when>
1848
+ <xsl:otherwise>
1849
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1850
+ <xsl:choose>
1851
+ <xsl:when test=". = 1 or . = 0">
1852
+ <fo:table-column column-width="proportional-column-width(2)"/>
1853
+ </xsl:when>
1854
+ <xsl:otherwise>
1855
+ <fo:table-column column-width="proportional-column-width({.})"/>
1856
+ </xsl:otherwise>
1857
+ </xsl:choose>
1858
+ </xsl:for-each>
1859
+ </xsl:otherwise>
1860
+ </xsl:choose>
1861
+
1873
1862
  <xsl:choose>
1874
- <xsl:when test=". = 1 or . = 0">
1875
- <fo:table-column column-width="proportional-column-width(2)"/>
1863
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1864
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1876
1865
  </xsl:when>
1877
1866
  <xsl:otherwise>
1878
- <fo:table-column column-width="proportional-column-width({.})"/>
1867
+ <xsl:apply-templates/>
1879
1868
  </xsl:otherwise>
1880
1869
  </xsl:choose>
1870
+
1871
+ </fo:table>
1872
+
1873
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1874
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1875
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1876
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1877
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1878
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1879
+ </xsl:call-template>
1881
1880
  </xsl:for-each>
1882
- </fo:table>-->
1883
-
1884
-
1885
-
1886
-
1887
-
1888
- </fo:block-container>
1881
+
1882
+ <!-- insert footer as table -->
1883
+ <!-- <fo:table>
1884
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1885
+ <xsl:attribute name="{@name}">
1886
+ <xsl:value-of select="."/>
1887
+ </xsl:attribute>
1888
+ </xsl:for-each>
1889
+
1890
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1891
+ <xsl:choose>
1892
+ <xsl:when test=". = 1 or . = 0">
1893
+ <fo:table-column column-width="proportional-column-width(2)"/>
1894
+ </xsl:when>
1895
+ <xsl:otherwise>
1896
+ <fo:table-column column-width="proportional-column-width({.})"/>
1897
+ </xsl:otherwise>
1898
+ </xsl:choose>
1899
+ </xsl:for-each>
1900
+ </fo:table>-->
1901
+
1902
+
1903
+
1904
+
1905
+
1906
+ </fo:block-container>
1907
+ </xsl:variable>
1908
+
1909
+
1910
+
1911
+ <xsl:choose>
1912
+ <xsl:when test="@width">
1913
+
1914
+ <!-- centered table when table name is centered (see table-name-style) -->
1915
+
1916
+
1917
+
1918
+ <xsl:copy-of select="$table"/>
1919
+
1920
+
1921
+ </xsl:when>
1922
+ <xsl:otherwise>
1923
+ <xsl:copy-of select="$table"/>
1924
+ </xsl:otherwise>
1925
+ </xsl:choose>
1926
+
1889
1927
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1890
1928
  <xsl:if test="normalize-space() != ''">
1891
1929
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -2013,7 +2051,15 @@
2013
2051
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2014
2052
  <xsl:value-of select="@target"/>
2015
2053
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2016
- <xsl:variable name="math_text" select="normalize-space(.)"/>
2054
+ <xsl:variable name="mathml">
2055
+ <xsl:for-each select="*">
2056
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2057
+ <xsl:copy-of select="."/>
2058
+ </xsl:if>
2059
+ </xsl:for-each>
2060
+ </xsl:variable>
2061
+
2062
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2017
2063
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2018
2064
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2019
2065
  <xsl:param name="cols-count"/>
@@ -2730,7 +2776,7 @@
2730
2776
  <xsl:with-param name="table" select="$html-table"/>
2731
2777
  </xsl:call-template>
2732
2778
  </xsl:variable>
2733
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2779
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2734
2780
  <xsl:variable name="maxlength_dt">
2735
2781
  <xsl:call-template name="getMaxLength_dt"/>
2736
2782
  </xsl:variable>
@@ -2759,13 +2805,22 @@
2759
2805
  </xsl:when>
2760
2806
  <xsl:otherwise>
2761
2807
  <xsl:choose>
2808
+ <!-- to set width check most wide chars like `W` -->
2762
2809
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2763
- <fo:table-column column-width="5%"/>
2764
- <fo:table-column column-width="95%"/>
2810
+ <fo:table-column column-width="7%"/>
2811
+ <fo:table-column column-width="93%"/>
2812
+ </xsl:when>
2813
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2814
+ <fo:table-column column-width="15%"/>
2815
+ <fo:table-column column-width="85%"/>
2765
2816
  </xsl:when>
2766
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2767
- <fo:table-column column-width="10%"/>
2768
- <fo:table-column column-width="90%"/>
2817
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2818
+ <fo:table-column column-width="20%"/>
2819
+ <fo:table-column column-width="80%"/>
2820
+ </xsl:when>
2821
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2822
+ <fo:table-column column-width="25%"/>
2823
+ <fo:table-column column-width="75%"/>
2769
2824
  </xsl:when>
2770
2825
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2771
2826
  <fo:table-column column-width="60%"/>
@@ -2961,6 +3016,7 @@
2961
3016
 
2962
3017
 
2963
3018
 
3019
+
2964
3020
 
2965
3021
  </xsl:variable>
2966
3022
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2974,10 +3030,18 @@
2974
3030
  </xsl:if>
2975
3031
  <xsl:apply-templates/>
2976
3032
  </fo:inline>
3033
+ </xsl:template><xsl:template match="*[local-name()='underline']">
3034
+ <fo:inline text-decoration="underline">
3035
+ <xsl:apply-templates/>
3036
+ </fo:inline>
2977
3037
  </xsl:template><xsl:template match="*[local-name()='del']">
2978
3038
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2979
3039
  <xsl:apply-templates/>
2980
3040
  </fo:inline>
3041
+ </xsl:template><xsl:template match="*[local-name()='hi']">
3042
+ <fo:inline background-color="yellow">
3043
+ <xsl:apply-templates/>
3044
+ </fo:inline>
2981
3045
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2982
3046
  <xsl:variable name="text" select="normalize-space(.)"/>
2983
3047
  <fo:inline font-size="75%">
@@ -3067,6 +3131,10 @@
3067
3131
  <xsl:param name="text" select="."/>
3068
3132
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3069
3133
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3134
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
3135
+ <xsl:param name="text" select="."/>
3136
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3137
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
3070
3138
  </xsl:template><xsl:template name="add-zero-spaces">
3071
3139
  <xsl:param name="text" select="."/>
3072
3140
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3314,6 +3382,7 @@
3314
3382
  <xsl:apply-templates select="." mode="mathml"/>
3315
3383
  </xsl:variable>
3316
3384
  <fo:instream-foreign-object fox:alt-text="Math">
3385
+
3317
3386
  <!-- <xsl:copy-of select="."/> -->
3318
3387
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3319
3388
  </fo:instream-foreign-object>
@@ -3327,7 +3396,12 @@
3327
3396
  <!-- replace start and end spaces to non-break space -->
3328
3397
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3329
3398
  </xsl:copy>
3330
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3399
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3400
+ <xsl:copy>
3401
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3402
+ </xsl:copy>
3403
+ <mathml:mspace width="0.5ex"/>
3404
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3331
3405
  <xsl:variable name="target">
3332
3406
  <xsl:choose>
3333
3407
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3348,7 +3422,10 @@
3348
3422
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3349
3423
  <xsl:choose>
3350
3424
  <xsl:when test="normalize-space(.) = ''">
3351
- <xsl:value-of select="$target"/>
3425
+ <!-- <xsl:value-of select="$target"/> -->
3426
+ <xsl:call-template name="add-zero-spaces-link-java">
3427
+ <xsl:with-param name="text" select="$target"/>
3428
+ </xsl:call-template>
3352
3429
  </xsl:when>
3353
3430
  <xsl:otherwise>
3354
3431
  <xsl:apply-templates/>
@@ -3358,8 +3435,6 @@
3358
3435
  </xsl:otherwise>
3359
3436
  </xsl:choose>
3360
3437
  </fo:inline>
3361
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3362
- <fo:inline id="{@id}"/>
3363
3438
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3364
3439
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3365
3440
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3563,7 +3638,7 @@
3563
3638
  </xsl:if> -->
3564
3639
  </fo:inline>
3565
3640
  </xsl:if>
3566
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3641
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3567
3642
  <fo:block-container id="{@id}">
3568
3643
 
3569
3644
  <fo:block>
@@ -3579,6 +3654,7 @@
3579
3654
  <fo:block id="{@id}">
3580
3655
  <xsl:apply-templates/>
3581
3656
  </fo:block>
3657
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3582
3658
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3583
3659
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3584
3660
  <xsl:apply-templates/>
@@ -3770,6 +3846,12 @@
3770
3846
  <!-- <xsl:text> </xsl:text> -->
3771
3847
  </xsl:template><xsl:template name="getSection">
3772
3848
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3849
+ <!--
3850
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3851
+ <xsl:value-of select="."/>
3852
+ </xsl:for-each>
3853
+ -->
3854
+
3773
3855
  </xsl:template><xsl:template name="getName">
3774
3856
  <xsl:choose>
3775
3857
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3822,6 +3904,12 @@
3822
3904
  <xsl:copy>
3823
3905
  <xsl:apply-templates mode="contents_item"/>
3824
3906
  </xsl:copy>
3907
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3908
+ <xsl:copy>
3909
+ <xsl:apply-templates mode="contents_item"/>
3910
+ </xsl:copy>
3911
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3912
+ <xsl:copy-of select="."/>
3825
3913
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3826
3914
  <xsl:text> </xsl:text>
3827
3915
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3847,6 +3935,7 @@
3847
3935
 
3848
3936
 
3849
3937
 
3938
+
3850
3939
 
3851
3940
 
3852
3941
 
@@ -4149,10 +4238,11 @@
4149
4238
  </xsl:choose>
4150
4239
 
4151
4240
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4152
-
4241
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4153
4242
  <xsl:variable name="element">
4154
4243
  block
4155
4244
 
4245
+
4156
4246
  </xsl:variable>
4157
4247
  <xsl:choose>
4158
4248
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4219,11 +4309,13 @@
4219
4309
  </xsl:if>
4220
4310
  </xsl:if>
4221
4311
 
4312
+
4222
4313
  <fo:block-container margin-left="0mm">
4223
4314
 
4224
4315
  <fo:block xsl:use-attribute-sets="quote-style">
4225
4316
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4226
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4317
+
4318
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4227
4319
  </fo:block>
4228
4320
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4229
4321
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4246,31 +4338,49 @@
4246
4338
  <xsl:text>— </xsl:text>
4247
4339
  <xsl:apply-templates/>
4248
4340
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4249
- <fo:inline xsl:use-attribute-sets="eref-style">
4250
- <xsl:if test="@type = 'footnote'">
4251
-
4252
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4253
- <xsl:attribute name="font-size">80%</xsl:attribute>
4254
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4255
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4256
-
4257
-
4258
- </xsl:if>
4259
-
4260
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4261
-
4262
- <xsl:if test="@type = 'inline'">
4263
-
4264
-
4265
-
4266
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
4267
-
4268
- </xsl:if>
4269
-
4270
-
4271
- <xsl:apply-templates/>
4272
- </fo:basic-link>
4273
- </fo:inline>
4341
+
4342
+ <xsl:variable name="bibitemid">
4343
+ <xsl:choose>
4344
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4345
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4346
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4347
+ </xsl:choose>
4348
+ </xsl:variable>
4349
+
4350
+ <xsl:choose>
4351
+ <xsl:when test="normalize-space($bibitemid) != ''">
4352
+ <fo:inline xsl:use-attribute-sets="eref-style">
4353
+ <xsl:if test="@type = 'footnote'">
4354
+
4355
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4356
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4357
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4358
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4359
+
4360
+
4361
+ </xsl:if>
4362
+
4363
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4364
+ <xsl:if test="normalize-space(@citeas) = ''">
4365
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4366
+ </xsl:if>
4367
+ <xsl:if test="@type = 'inline'">
4368
+
4369
+
4370
+
4371
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4372
+
4373
+ </xsl:if>
4374
+
4375
+ <xsl:apply-templates/>
4376
+ </fo:basic-link>
4377
+
4378
+ </fo:inline>
4379
+ </xsl:when>
4380
+ <xsl:otherwise>
4381
+ <fo:inline><xsl:apply-templates/></fo:inline>
4382
+ </xsl:otherwise>
4383
+ </xsl:choose>
4274
4384
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4275
4385
  <!-- zero-space char -->
4276
4386
  <xsl:variable name="depth">
@@ -4376,6 +4486,7 @@
4376
4486
 
4377
4487
 
4378
4488
 
4489
+
4379
4490
 
4380
4491
 
4381
4492
 
@@ -4392,7 +4503,7 @@
4392
4503
 
4393
4504
 
4394
4505
 
4395
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4506
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4396
4507
  <fo:block break-after="page"/>
4397
4508
  <fo:block>
4398
4509
  <xsl:call-template name="setId"/>
@@ -4400,7 +4511,8 @@
4400
4511
  </fo:block>
4401
4512
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4402
4513
  <fo:block>
4403
- <xsl:call-template name="setId"/>
4514
+ <xsl:call-template name="setId"/>
4515
+
4404
4516
 
4405
4517
  <xsl:apply-templates/>
4406
4518
  </fo:block>
@@ -4456,6 +4568,153 @@
4456
4568
  </fo:block>
4457
4569
  </xsl:otherwise>
4458
4570
  </xsl:choose>
4571
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4572
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4573
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4574
+ </xsl:for-each>
4575
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4576
+ <xsl:copy>
4577
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4578
+ </xsl:copy>
4579
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4580
+ <xsl:variable name="id">
4581
+ <xsl:call-template name="generateIndexXrefId"/>
4582
+ </xsl:variable>
4583
+ <xsl:copy> <!-- add id to xref -->
4584
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4585
+ <xsl:attribute name="id">
4586
+ <xsl:value-of select="$id"/>
4587
+ </xsl:attribute>
4588
+ <xsl:apply-templates mode="index_add_id"/>
4589
+ </xsl:copy>
4590
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4591
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4592
+ <xsl:if test="@to">
4593
+ <xsl:value-of select="$dash"/>
4594
+ <xsl:copy>
4595
+ <xsl:copy-of select="@*"/>
4596
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4597
+ <xsl:attribute name="id">
4598
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4599
+ </xsl:attribute>
4600
+ <xsl:apply-templates mode="index_add_id"/>
4601
+ </xsl:copy>
4602
+ </xsl:if>
4603
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4604
+ <xsl:copy>
4605
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4606
+ </xsl:copy>
4607
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4608
+ <xsl:copy>
4609
+ <xsl:apply-templates select="@*" mode="index_update"/>
4610
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4611
+ </xsl:copy>
4612
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4613
+ <xsl:param name="element"/>
4614
+ <xsl:param name="remove" select="'false'"/>
4615
+ <xsl:param name="target"/>
4616
+ <!-- <node></node> -->
4617
+ <xsl:choose>
4618
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4619
+ <!-- skip text (i.e. remove it) and process next element -->
4620
+ <!-- [removed_<xsl:value-of select="."/>] -->
4621
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4622
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4623
+ </xsl:apply-templates>
4624
+ </xsl:when>
4625
+ <xsl:when test="self::text()">
4626
+ <xsl:value-of select="."/>
4627
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4628
+ </xsl:when>
4629
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4630
+ <xsl:variable name="id" select="@id"/>
4631
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4632
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4633
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4634
+
4635
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4636
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4637
+
4638
+ <xsl:choose>
4639
+ <!-- 2nd pass -->
4640
+ <!-- if page is equal to page for next and page is not the end of range -->
4641
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4642
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4643
+ <!-- [removed_xref] -->
4644
+
4645
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4646
+ <xsl:with-param name="remove">true</xsl:with-param>
4647
+ <xsl:with-param name="target">
4648
+ <xsl:choose>
4649
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4650
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4651
+ </xsl:choose>
4652
+ </xsl:with-param>
4653
+ </xsl:apply-templates>
4654
+ </xsl:when>
4655
+
4656
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4657
+ <!-- remove xref -->
4658
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4659
+ <xsl:with-param name="remove">true</xsl:with-param>
4660
+ </xsl:apply-templates>
4661
+ </xsl:when>
4662
+
4663
+ <xsl:otherwise>
4664
+ <xsl:apply-templates select="." mode="xref_copy">
4665
+ <xsl:with-param name="target" select="$target"/>
4666
+ </xsl:apply-templates>
4667
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4668
+ </xsl:otherwise>
4669
+ </xsl:choose>
4670
+ </xsl:when>
4671
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4672
+ <!-- ul -->
4673
+ <xsl:apply-templates select="." mode="index_update"/>
4674
+ </xsl:when>
4675
+ <xsl:otherwise>
4676
+ <xsl:apply-templates select="." mode="xref_copy">
4677
+ <xsl:with-param name="target" select="$target"/>
4678
+ </xsl:apply-templates>
4679
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4680
+ </xsl:otherwise>
4681
+ </xsl:choose>
4682
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4683
+ <xsl:param name="target"/>
4684
+ <xsl:copy>
4685
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4686
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4687
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4688
+ </xsl:if>
4689
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4690
+ </xsl:copy>
4691
+ </xsl:template><xsl:template name="generateIndexXrefId">
4692
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4693
+
4694
+ <xsl:variable name="docid">
4695
+ <xsl:call-template name="getDocumentId"/>
4696
+ </xsl:variable>
4697
+ <xsl:variable name="item_number">
4698
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4699
+ </xsl:variable>
4700
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4701
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4702
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4703
+ <xsl:apply-templates/>
4704
+ <fo:block>
4705
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4706
+ <fo:block> </fo:block>
4707
+ </xsl:if>
4708
+ </fo:block>
4709
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4710
+ <xsl:apply-templates/>
4711
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4712
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4713
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4714
+ <xsl:apply-templates/>
4715
+ </fo:block>
4716
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
4717
+ <fo:inline id="{@id}"/>
4459
4718
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4460
4719
  <!-- <row>
4461
4720
  <date>05-07-2013</date>
@@ -4551,6 +4810,8 @@
4551
4810
  <xsl:value-of select="translate(.,'. ','')"/>
4552
4811
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4553
4812
  <xsl:value-of select="substring(.,1,1)"/>
4813
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4814
+ <fo:inline><xsl:apply-templates/></fo:inline>
4554
4815
  </xsl:template><xsl:template name="convertDate">
4555
4816
  <xsl:param name="date"/>
4556
4817
  <xsl:param name="format" select="'short'"/>
@@ -4575,6 +4836,57 @@
4575
4836
  </xsl:variable>
4576
4837
  <xsl:variable name="result">
4577
4838
  <xsl:choose>
4839
+ <xsl:when test="$format = 'ddMMyyyy'">
4840
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4841
+ <xsl:text> </xsl:text>
4842
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4843
+ </xsl:when>
4844
+ <xsl:when test="$format = 'ddMM'">
4845
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4846
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4847
+ </xsl:when>
4848
+ <xsl:when test="$format = 'short' or $day = ''">
4849
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4850
+ </xsl:when>
4851
+ <xsl:otherwise>
4852
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4853
+ </xsl:otherwise>
4854
+ </xsl:choose>
4855
+ </xsl:variable>
4856
+ <xsl:value-of select="$result"/>
4857
+ </xsl:template><xsl:template name="convertDateLocalized">
4858
+ <xsl:param name="date"/>
4859
+ <xsl:param name="format" select="'short'"/>
4860
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4861
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4862
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4863
+ <xsl:variable name="monthStr">
4864
+ <xsl:choose>
4865
+ <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>
4866
+ <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>
4867
+ <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>
4868
+ <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>
4869
+ <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>
4870
+ <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>
4871
+ <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>
4872
+ <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>
4873
+ <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>
4874
+ <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>
4875
+ <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>
4876
+ <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>
4877
+ </xsl:choose>
4878
+ </xsl:variable>
4879
+ <xsl:variable name="result">
4880
+ <xsl:choose>
4881
+ <xsl:when test="$format = 'ddMMyyyy'">
4882
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4883
+ <xsl:text> </xsl:text>
4884
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4885
+ </xsl:when>
4886
+ <xsl:when test="$format = 'ddMM'">
4887
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4888
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4889
+ </xsl:when>
4578
4890
  <xsl:when test="$format = 'short' or $day = ''">
4579
4891
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4580
4892
  </xsl:when>
@@ -4590,7 +4902,7 @@
4590
4902
  <xsl:param name="charDelim" select="', '"/>
4591
4903
  <xsl:choose>
4592
4904
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4593
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4905
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4594
4906
  <xsl:sort data-type="text" order="ascending"/>
4595
4907
  <xsl:call-template name="insertKeyword">
4596
4908
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4599,7 +4911,7 @@
4599
4911
  </xsl:for-each>
4600
4912
  </xsl:when>
4601
4913
  <xsl:otherwise>
4602
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4914
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4603
4915
  <xsl:call-template name="insertKeyword">
4604
4916
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4605
4917
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4616,63 +4928,71 @@
4616
4928
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4617
4929
  </xsl:choose>
4618
4930
  </xsl:template><xsl:template name="addPDFUAmeta">
4619
- <fo:declarations>
4620
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4621
- <pdf:dictionary type="normal" key="ViewerPreferences">
4622
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4623
- </pdf:dictionary>
4624
- </pdf:catalog>
4625
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4626
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4627
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4628
- <!-- Dublin Core properties go here -->
4629
- <dc:title>
4630
- <xsl:variable name="title">
4931
+ <xsl:variable name="lang">
4932
+ <xsl:call-template name="getLang"/>
4933
+ </xsl:variable>
4934
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4935
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4936
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4937
+ </pdf:dictionary>
4938
+ </pdf:catalog>
4939
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4940
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4941
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4942
+ <!-- Dublin Core properties go here -->
4943
+ <dc:title>
4944
+ <xsl:variable name="title">
4945
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4946
+
4947
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4631
4948
 
4632
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4633
4949
 
4634
4950
 
4635
4951
 
4636
4952
 
4637
4953
 
4638
- </xsl:variable>
4639
- <xsl:choose>
4640
- <xsl:when test="normalize-space($title) != ''">
4641
- <xsl:value-of select="$title"/>
4642
- </xsl:when>
4643
- <xsl:otherwise>
4644
- <xsl:text> </xsl:text>
4645
- </xsl:otherwise>
4646
- </xsl:choose>
4647
- </dc:title>
4648
- <dc:creator>
4954
+ </xsl:for-each>
4955
+ </xsl:variable>
4956
+ <xsl:choose>
4957
+ <xsl:when test="normalize-space($title) != ''">
4958
+ <xsl:value-of select="$title"/>
4959
+ </xsl:when>
4960
+ <xsl:otherwise>
4961
+ <xsl:text> </xsl:text>
4962
+ </xsl:otherwise>
4963
+ </xsl:choose>
4964
+ </dc:title>
4965
+ <dc:creator>
4966
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4649
4967
 
4968
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4969
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4970
+ <xsl:if test="position() != last()">; </xsl:if>
4971
+ </xsl:for-each>
4650
4972
 
4651
4973
 
4652
- </dc:creator>
4653
- <dc:description>
4654
- <xsl:variable name="abstract">
4655
-
4656
-
4657
-
4658
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4659
-
4660
-
4661
-
4662
- </xsl:variable>
4663
- <xsl:value-of select="normalize-space($abstract)"/>
4664
- </dc:description>
4665
- <pdf:Keywords>
4666
- <xsl:call-template name="insertKeywords"/>
4667
- </pdf:Keywords>
4668
- </rdf:Description>
4669
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4670
- <!-- XMP properties go here -->
4671
- <xmp:CreatorTool/>
4672
- </rdf:Description>
4673
- </rdf:RDF>
4674
- </x:xmpmeta>
4675
- </fo:declarations>
4974
+
4975
+ </xsl:for-each>
4976
+ </dc:creator>
4977
+ <dc:description>
4978
+ <xsl:variable name="abstract">
4979
+
4980
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4981
+
4982
+
4983
+ </xsl:variable>
4984
+ <xsl:value-of select="normalize-space($abstract)"/>
4985
+ </dc:description>
4986
+ <pdf:Keywords>
4987
+ <xsl:call-template name="insertKeywords"/>
4988
+ </pdf:Keywords>
4989
+ </rdf:Description>
4990
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4991
+ <!-- XMP properties go here -->
4992
+ <xmp:CreatorTool/>
4993
+ </rdf:Description>
4994
+ </rdf:RDF>
4995
+ </x:xmpmeta>
4676
4996
  </xsl:template><xsl:template name="getId">
4677
4997
  <xsl:choose>
4678
4998
  <xsl:when test="../@id">
@@ -4769,6 +5089,7 @@
4769
5089
 
4770
5090
 
4771
5091
 
5092
+
4772
5093
  </xsl:variable>
4773
5094
  <xsl:if test="$documentNS != $XSLNS">
4774
5095
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4828,6 +5149,11 @@
4828
5149
  <xsl:call-template name="getLang"/>
4829
5150
  </xsl:variable>
4830
5151
 
4831
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5152
+ <xsl:choose>
5153
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5154
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5155
+ </xsl:when>
5156
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5157
+ </xsl:choose>
4832
5158
 
4833
5159
  </xsl:template></xsl:stylesheet>