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
 
@@ -83,7 +84,9 @@
83
84
 
84
85
  </fo:layout-master-set>
85
86
 
86
- <xsl:call-template name="addPDFUAmeta"/>
87
+ <fo:declarations>
88
+ <xsl:call-template name="addPDFUAmeta"/>
89
+ </fo:declarations>
87
90
 
88
91
  <xsl:call-template name="addBookmarks">
89
92
  <xsl:with-param name="contents" select="$contents"/>
@@ -1307,6 +1310,7 @@
1307
1310
 
1308
1311
 
1309
1312
 
1313
+
1310
1314
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1311
1315
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1312
1316
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1428,6 +1432,7 @@
1428
1432
 
1429
1433
 
1430
1434
 
1435
+
1431
1436
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1432
1437
 
1433
1438
 
@@ -1557,200 +1562,233 @@
1557
1562
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1558
1563
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1559
1564
  <xsl:call-template name="add-zero-spaces-java"/>
1560
- </xsl:template><xsl:template match="*[local-name()='table']">
1565
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1561
1566
 
1562
- <xsl:variable name="simple-table">
1563
- <xsl:call-template name="getSimpleTable"/>
1564
- </xsl:variable>
1567
+ <xsl:variable name="table">
1565
1568
 
1566
-
1567
-
1568
-
1569
-
1570
- <!-- <xsl:if test="$namespace = 'bipm'">
1571
- <fo:block>&#xA0;</fo:block>
1572
- </xsl:if> -->
1573
-
1574
- <!-- $namespace = 'iso' or -->
1575
-
1576
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1577
-
1578
-
1579
-
1580
- <xsl:call-template name="fn_name_display"/>
1569
+ <xsl:variable name="simple-table">
1570
+ <xsl:call-template name="getSimpleTable"/>
1571
+ </xsl:variable>
1581
1572
 
1582
1573
 
1583
-
1584
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1585
-
1586
- <!-- <xsl:variable name="cols-count">
1587
- <xsl:choose>
1588
- <xsl:when test="*[local-name()='thead']">
1589
- <xsl:call-template name="calculate-columns-numbers">
1590
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1591
- </xsl:call-template>
1592
- </xsl:when>
1593
- <xsl:otherwise>
1594
- <xsl:call-template name="calculate-columns-numbers">
1595
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1596
- </xsl:call-template>
1597
- </xsl:otherwise>
1598
- </xsl:choose>
1599
- </xsl:variable> -->
1600
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1601
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1602
-
1603
-
1604
-
1605
- <xsl:variable name="colwidths">
1606
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1607
- <xsl:call-template name="calculate-column-widths">
1608
- <xsl:with-param name="cols-count" select="$cols-count"/>
1609
- <xsl:with-param name="table" select="$simple-table"/>
1610
- </xsl:call-template>
1611
- </xsl:if>
1612
- </xsl:variable>
1613
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1614
-
1615
- <!-- <xsl:variable name="colwidths2">
1616
- <xsl:call-template name="calculate-column-widths">
1617
- <xsl:with-param name="cols-count" select="$cols-count"/>
1618
- </xsl:call-template>
1619
- </xsl:variable> -->
1620
-
1621
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1622
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1623
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1624
-
1625
- <xsl:variable name="margin-left">
1626
- <xsl:choose>
1627
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1628
- <xsl:otherwise>0</xsl:otherwise>
1629
- </xsl:choose>
1630
- </xsl:variable>
1631
-
1632
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1633
1574
 
1634
1575
 
1635
-
1636
1576
 
1637
- <xsl:attribute name="space-after">12pt</xsl:attribute>
1638
- <xsl:if test="not(ancestor::*[local-name()='sections'])">
1639
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1640
- </xsl:if>
1641
-
1642
-
1577
+ <!-- <xsl:if test="$namespace = 'bipm'">
1578
+ <fo:block>&#xA0;</fo:block>
1579
+ </xsl:if> -->
1643
1580
 
1581
+ <!-- $namespace = 'iso' or -->
1644
1582
 
1645
-
1583
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1584
+
1585
+
1586
+
1587
+ <xsl:call-template name="fn_name_display"/>
1588
+
1589
+
1590
+
1591
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1592
+
1593
+ <!-- <xsl:variable name="cols-count">
1594
+ <xsl:choose>
1595
+ <xsl:when test="*[local-name()='thead']">
1596
+ <xsl:call-template name="calculate-columns-numbers">
1597
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1598
+ </xsl:call-template>
1599
+ </xsl:when>
1600
+ <xsl:otherwise>
1601
+ <xsl:call-template name="calculate-columns-numbers">
1602
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1603
+ </xsl:call-template>
1604
+ </xsl:otherwise>
1605
+ </xsl:choose>
1606
+ </xsl:variable> -->
1607
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1608
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1646
1609
 
1647
1610
 
1648
1611
 
1612
+ <xsl:variable name="colwidths">
1613
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1614
+ <xsl:call-template name="calculate-column-widths">
1615
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1616
+ <xsl:with-param name="table" select="$simple-table"/>
1617
+ </xsl:call-template>
1618
+ </xsl:if>
1619
+ </xsl:variable>
1620
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1649
1621
 
1622
+ <!-- <xsl:variable name="colwidths2">
1623
+ <xsl:call-template name="calculate-column-widths">
1624
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1625
+ </xsl:call-template>
1626
+ </xsl:variable> -->
1650
1627
 
1628
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1629
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1630
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1651
1631
 
1632
+ <xsl:variable name="margin-left">
1633
+ <xsl:choose>
1634
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1635
+ <xsl:otherwise>0</xsl:otherwise>
1636
+ </xsl:choose>
1637
+ </xsl:variable>
1652
1638
 
1653
- <xsl:variable name="table_attributes">
1654
- <attribute name="table-layout">fixed</attribute>
1655
- <attribute name="width">100%</attribute>
1656
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1657
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1639
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1658
1640
 
1659
1641
 
1642
+
1660
1643
 
1644
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
1645
+ <xsl:if test="not(ancestor::*[local-name()='sections'])">
1646
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1647
+ </xsl:if>
1648
+
1649
+
1661
1650
 
1662
-
1663
1651
 
1664
- <xsl:if test="ancestor::*[local-name()='sections']">
1665
- <attribute name="border-top">1.5pt solid black</attribute>
1666
- <attribute name="border-bottom">1.5pt solid black</attribute>
1667
- </xsl:if>
1668
-
1669
-
1652
+
1670
1653
 
1671
-
1672
1654
 
1673
- </xsl:variable>
1674
-
1675
-
1676
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1677
1655
 
1678
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1679
- <xsl:attribute name="{@name}">
1680
- <xsl:value-of select="."/>
1681
- </xsl:attribute>
1682
- </xsl:for-each>
1683
1656
 
1684
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1685
- <xsl:if test="$isNoteOrFnExist = 'true'">
1686
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1687
- </xsl:if>
1688
1657
 
1689
- <xsl:choose>
1690
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1691
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1692
- <fo:table-column column-width="{@width}"/>
1693
- </xsl:for-each>
1694
- </xsl:when>
1695
- <xsl:otherwise>
1696
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1697
- <xsl:choose>
1698
- <xsl:when test=". = 1 or . = 0">
1699
- <fo:table-column column-width="proportional-column-width(2)"/>
1700
- </xsl:when>
1701
- <xsl:otherwise>
1702
- <fo:table-column column-width="proportional-column-width({.})"/>
1703
- </xsl:otherwise>
1704
- </xsl:choose>
1705
- </xsl:for-each>
1706
- </xsl:otherwise>
1707
- </xsl:choose>
1708
1658
 
1709
- <xsl:choose>
1710
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1711
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1712
- </xsl:when>
1713
- <xsl:otherwise>
1714
- <xsl:apply-templates/>
1715
- </xsl:otherwise>
1716
- </xsl:choose>
1659
+ <xsl:variable name="table_width">
1660
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1661
+
1662
+
1663
+
1664
+ <xsl:choose>
1665
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1666
+ <xsl:otherwise>100%</xsl:otherwise>
1667
+ </xsl:choose>
1668
+
1669
+ </xsl:variable>
1717
1670
 
1718
- </fo:table>
1719
-
1720
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1721
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1722
- <xsl:call-template name="insertTableFooterInSeparateTable">
1723
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1724
- <xsl:with-param name="colwidths" select="$colwidths"/>
1725
- <xsl:with-param name="colgroup" select="$colgroup"/>
1726
- </xsl:call-template>
1727
- </xsl:for-each>
1728
-
1729
- <!-- insert footer as table -->
1730
- <!-- <fo:table>
1731
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1732
- <xsl:attribute name="{@name}">
1733
- <xsl:value-of select="."/>
1734
- </xsl:attribute>
1735
- </xsl:for-each>
1671
+ <xsl:variable name="table_attributes">
1672
+ <attribute name="table-layout">fixed</attribute>
1673
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1674
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1675
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1676
+
1677
+
1678
+
1679
+
1680
+
1681
+
1682
+ <xsl:if test="ancestor::*[local-name()='sections']">
1683
+ <attribute name="border-top">1.5pt solid black</attribute>
1684
+ <attribute name="border-bottom">1.5pt solid black</attribute>
1685
+ </xsl:if>
1686
+
1687
+
1688
+
1689
+
1690
+
1691
+ </xsl:variable>
1736
1692
 
1737
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1693
+
1694
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1695
+
1696
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1697
+ <xsl:attribute name="{@name}">
1698
+ <xsl:value-of select="."/>
1699
+ </xsl:attribute>
1700
+ </xsl:for-each>
1701
+
1702
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1703
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1704
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1705
+ </xsl:if>
1706
+
1707
+ <xsl:choose>
1708
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1709
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1710
+ <fo:table-column column-width="{@width}"/>
1711
+ </xsl:for-each>
1712
+ </xsl:when>
1713
+ <xsl:otherwise>
1714
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1715
+ <xsl:choose>
1716
+ <xsl:when test=". = 1 or . = 0">
1717
+ <fo:table-column column-width="proportional-column-width(2)"/>
1718
+ </xsl:when>
1719
+ <xsl:otherwise>
1720
+ <fo:table-column column-width="proportional-column-width({.})"/>
1721
+ </xsl:otherwise>
1722
+ </xsl:choose>
1723
+ </xsl:for-each>
1724
+ </xsl:otherwise>
1725
+ </xsl:choose>
1726
+
1738
1727
  <xsl:choose>
1739
- <xsl:when test=". = 1 or . = 0">
1740
- <fo:table-column column-width="proportional-column-width(2)"/>
1728
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1729
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1741
1730
  </xsl:when>
1742
1731
  <xsl:otherwise>
1743
- <fo:table-column column-width="proportional-column-width({.})"/>
1732
+ <xsl:apply-templates/>
1744
1733
  </xsl:otherwise>
1745
1734
  </xsl:choose>
1735
+
1736
+ </fo:table>
1737
+
1738
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1739
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1740
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1741
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1742
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1743
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1744
+ </xsl:call-template>
1746
1745
  </xsl:for-each>
1747
- </fo:table>-->
1748
-
1749
-
1750
-
1751
-
1752
-
1753
- </fo:block-container>
1746
+
1747
+ <!-- insert footer as table -->
1748
+ <!-- <fo:table>
1749
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1750
+ <xsl:attribute name="{@name}">
1751
+ <xsl:value-of select="."/>
1752
+ </xsl:attribute>
1753
+ </xsl:for-each>
1754
+
1755
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1756
+ <xsl:choose>
1757
+ <xsl:when test=". = 1 or . = 0">
1758
+ <fo:table-column column-width="proportional-column-width(2)"/>
1759
+ </xsl:when>
1760
+ <xsl:otherwise>
1761
+ <fo:table-column column-width="proportional-column-width({.})"/>
1762
+ </xsl:otherwise>
1763
+ </xsl:choose>
1764
+ </xsl:for-each>
1765
+ </fo:table>-->
1766
+
1767
+
1768
+
1769
+
1770
+
1771
+ </fo:block-container>
1772
+ </xsl:variable>
1773
+
1774
+
1775
+
1776
+ <xsl:choose>
1777
+ <xsl:when test="@width">
1778
+
1779
+ <!-- centered table when table name is centered (see table-name-style) -->
1780
+
1781
+
1782
+
1783
+ <xsl:copy-of select="$table"/>
1784
+
1785
+
1786
+ </xsl:when>
1787
+ <xsl:otherwise>
1788
+ <xsl:copy-of select="$table"/>
1789
+ </xsl:otherwise>
1790
+ </xsl:choose>
1791
+
1754
1792
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1755
1793
  <xsl:if test="normalize-space() != ''">
1756
1794
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1878,7 +1916,15 @@
1878
1916
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1879
1917
  <xsl:value-of select="@target"/>
1880
1918
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1881
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1919
+ <xsl:variable name="mathml">
1920
+ <xsl:for-each select="*">
1921
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1922
+ <xsl:copy-of select="."/>
1923
+ </xsl:if>
1924
+ </xsl:for-each>
1925
+ </xsl:variable>
1926
+
1927
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1882
1928
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1883
1929
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1884
1930
  <xsl:param name="cols-count"/>
@@ -2595,7 +2641,7 @@
2595
2641
  <xsl:with-param name="table" select="$html-table"/>
2596
2642
  </xsl:call-template>
2597
2643
  </xsl:variable>
2598
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2644
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2599
2645
  <xsl:variable name="maxlength_dt">
2600
2646
  <xsl:call-template name="getMaxLength_dt"/>
2601
2647
  </xsl:variable>
@@ -2624,13 +2670,22 @@
2624
2670
  </xsl:when>
2625
2671
  <xsl:otherwise>
2626
2672
  <xsl:choose>
2673
+ <!-- to set width check most wide chars like `W` -->
2627
2674
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2628
- <fo:table-column column-width="5%"/>
2629
- <fo:table-column column-width="95%"/>
2675
+ <fo:table-column column-width="7%"/>
2676
+ <fo:table-column column-width="93%"/>
2677
+ </xsl:when>
2678
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2679
+ <fo:table-column column-width="15%"/>
2680
+ <fo:table-column column-width="85%"/>
2630
2681
  </xsl:when>
2631
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2632
- <fo:table-column column-width="10%"/>
2633
- <fo:table-column column-width="90%"/>
2682
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2683
+ <fo:table-column column-width="20%"/>
2684
+ <fo:table-column column-width="80%"/>
2685
+ </xsl:when>
2686
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2687
+ <fo:table-column column-width="25%"/>
2688
+ <fo:table-column column-width="75%"/>
2634
2689
  </xsl:when>
2635
2690
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2636
2691
  <fo:table-column column-width="60%"/>
@@ -2826,6 +2881,7 @@
2826
2881
 
2827
2882
 
2828
2883
 
2884
+
2829
2885
 
2830
2886
  </xsl:variable>
2831
2887
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2839,10 +2895,18 @@
2839
2895
  </xsl:if>
2840
2896
  <xsl:apply-templates/>
2841
2897
  </fo:inline>
2898
+ </xsl:template><xsl:template match="*[local-name()='underline']">
2899
+ <fo:inline text-decoration="underline">
2900
+ <xsl:apply-templates/>
2901
+ </fo:inline>
2842
2902
  </xsl:template><xsl:template match="*[local-name()='del']">
2843
2903
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2844
2904
  <xsl:apply-templates/>
2845
2905
  </fo:inline>
2906
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2907
+ <fo:inline background-color="yellow">
2908
+ <xsl:apply-templates/>
2909
+ </fo:inline>
2846
2910
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2847
2911
  <xsl:variable name="text" select="normalize-space(.)"/>
2848
2912
  <fo:inline font-size="75%">
@@ -2932,6 +2996,10 @@
2932
2996
  <xsl:param name="text" select="."/>
2933
2997
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2934
2998
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2999
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
3000
+ <xsl:param name="text" select="."/>
3001
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3002
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2935
3003
  </xsl:template><xsl:template name="add-zero-spaces">
2936
3004
  <xsl:param name="text" select="."/>
2937
3005
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3179,6 +3247,7 @@
3179
3247
  <xsl:apply-templates select="." mode="mathml"/>
3180
3248
  </xsl:variable>
3181
3249
  <fo:instream-foreign-object fox:alt-text="Math">
3250
+
3182
3251
  <!-- <xsl:copy-of select="."/> -->
3183
3252
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3184
3253
  </fo:instream-foreign-object>
@@ -3192,7 +3261,12 @@
3192
3261
  <!-- replace start and end spaces to non-break space -->
3193
3262
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3194
3263
  </xsl:copy>
3195
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3264
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3265
+ <xsl:copy>
3266
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3267
+ </xsl:copy>
3268
+ <mathml:mspace width="0.5ex"/>
3269
+ </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">
3196
3270
  <xsl:variable name="target">
3197
3271
  <xsl:choose>
3198
3272
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3213,7 +3287,10 @@
3213
3287
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3214
3288
  <xsl:choose>
3215
3289
  <xsl:when test="normalize-space(.) = ''">
3216
- <xsl:value-of select="$target"/>
3290
+ <!-- <xsl:value-of select="$target"/> -->
3291
+ <xsl:call-template name="add-zero-spaces-link-java">
3292
+ <xsl:with-param name="text" select="$target"/>
3293
+ </xsl:call-template>
3217
3294
  </xsl:when>
3218
3295
  <xsl:otherwise>
3219
3296
  <xsl:apply-templates/>
@@ -3223,8 +3300,6 @@
3223
3300
  </xsl:otherwise>
3224
3301
  </xsl:choose>
3225
3302
  </fo:inline>
3226
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3227
- <fo:inline id="{@id}"/>
3228
3303
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3229
3304
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3230
3305
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3432,7 +3507,7 @@
3432
3507
  </xsl:if> -->
3433
3508
  </fo:inline>
3434
3509
  </xsl:if>
3435
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3510
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3436
3511
  <fo:block-container id="{@id}">
3437
3512
 
3438
3513
  <fo:block>
@@ -3448,6 +3523,7 @@
3448
3523
  <fo:block id="{@id}">
3449
3524
  <xsl:apply-templates/>
3450
3525
  </fo:block>
3526
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3451
3527
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3452
3528
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3453
3529
  <xsl:apply-templates/>
@@ -3644,6 +3720,12 @@
3644
3720
  <!-- <xsl:text> </xsl:text> -->
3645
3721
  </xsl:template><xsl:template name="getSection">
3646
3722
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3723
+ <!--
3724
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3725
+ <xsl:value-of select="."/>
3726
+ </xsl:for-each>
3727
+ -->
3728
+
3647
3729
  </xsl:template><xsl:template name="getName">
3648
3730
  <xsl:choose>
3649
3731
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3696,6 +3778,12 @@
3696
3778
  <xsl:copy>
3697
3779
  <xsl:apply-templates mode="contents_item"/>
3698
3780
  </xsl:copy>
3781
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3782
+ <xsl:copy>
3783
+ <xsl:apply-templates mode="contents_item"/>
3784
+ </xsl:copy>
3785
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3786
+ <xsl:copy-of select="."/>
3699
3787
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3700
3788
  <xsl:text> </xsl:text>
3701
3789
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3721,6 +3809,7 @@
3721
3809
 
3722
3810
 
3723
3811
 
3812
+
3724
3813
 
3725
3814
 
3726
3815
 
@@ -4023,10 +4112,11 @@
4023
4112
  </xsl:choose>
4024
4113
 
4025
4114
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4026
-
4115
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4027
4116
  <xsl:variable name="element">
4028
4117
  block
4029
4118
 
4119
+
4030
4120
  </xsl:variable>
4031
4121
  <xsl:choose>
4032
4122
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4093,11 +4183,13 @@
4093
4183
  </xsl:if>
4094
4184
  </xsl:if>
4095
4185
 
4186
+
4096
4187
  <fo:block-container margin-left="0mm">
4097
4188
 
4098
4189
  <fo:block xsl:use-attribute-sets="quote-style">
4099
4190
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4100
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4191
+
4192
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4101
4193
  </fo:block>
4102
4194
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4103
4195
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4120,29 +4212,47 @@
4120
4212
  <xsl:text>— </xsl:text>
4121
4213
  <xsl:apply-templates/>
4122
4214
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4123
- <fo:inline xsl:use-attribute-sets="eref-style">
4124
- <xsl:if test="@type = 'footnote'">
4125
-
4126
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4127
- <xsl:attribute name="font-size">80%</xsl:attribute>
4128
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4129
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4130
-
4131
-
4132
- </xsl:if>
4133
-
4134
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4135
-
4136
- <xsl:if test="@type = 'inline'">
4137
-
4138
-
4139
-
4140
- </xsl:if>
4141
-
4142
-
4143
- <xsl:apply-templates/>
4144
- </fo:basic-link>
4145
- </fo:inline>
4215
+
4216
+ <xsl:variable name="bibitemid">
4217
+ <xsl:choose>
4218
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4219
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4220
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4221
+ </xsl:choose>
4222
+ </xsl:variable>
4223
+
4224
+ <xsl:choose>
4225
+ <xsl:when test="normalize-space($bibitemid) != ''">
4226
+ <fo:inline xsl:use-attribute-sets="eref-style">
4227
+ <xsl:if test="@type = 'footnote'">
4228
+
4229
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4230
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4231
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4232
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4233
+
4234
+
4235
+ </xsl:if>
4236
+
4237
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4238
+ <xsl:if test="normalize-space(@citeas) = ''">
4239
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4240
+ </xsl:if>
4241
+ <xsl:if test="@type = 'inline'">
4242
+
4243
+
4244
+
4245
+ </xsl:if>
4246
+
4247
+ <xsl:apply-templates/>
4248
+ </fo:basic-link>
4249
+
4250
+ </fo:inline>
4251
+ </xsl:when>
4252
+ <xsl:otherwise>
4253
+ <fo:inline><xsl:apply-templates/></fo:inline>
4254
+ </xsl:otherwise>
4255
+ </xsl:choose>
4146
4256
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4147
4257
  <!-- zero-space char -->
4148
4258
  <xsl:variable name="depth">
@@ -4250,6 +4360,7 @@
4250
4360
 
4251
4361
 
4252
4362
 
4363
+
4253
4364
 
4254
4365
 
4255
4366
 
@@ -4266,7 +4377,7 @@
4266
4377
 
4267
4378
 
4268
4379
 
4269
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4380
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4270
4381
  <fo:block break-after="page"/>
4271
4382
  <fo:block>
4272
4383
  <xsl:call-template name="setId"/>
@@ -4274,7 +4385,8 @@
4274
4385
  </fo:block>
4275
4386
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4276
4387
  <fo:block>
4277
- <xsl:call-template name="setId"/>
4388
+ <xsl:call-template name="setId"/>
4389
+
4278
4390
 
4279
4391
  <xsl:apply-templates/>
4280
4392
  </fo:block>
@@ -4330,6 +4442,153 @@
4330
4442
  </fo:block>
4331
4443
  </xsl:otherwise>
4332
4444
  </xsl:choose>
4445
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4446
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4447
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4448
+ </xsl:for-each>
4449
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4450
+ <xsl:copy>
4451
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4452
+ </xsl:copy>
4453
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4454
+ <xsl:variable name="id">
4455
+ <xsl:call-template name="generateIndexXrefId"/>
4456
+ </xsl:variable>
4457
+ <xsl:copy> <!-- add id to xref -->
4458
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4459
+ <xsl:attribute name="id">
4460
+ <xsl:value-of select="$id"/>
4461
+ </xsl:attribute>
4462
+ <xsl:apply-templates mode="index_add_id"/>
4463
+ </xsl:copy>
4464
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4465
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4466
+ <xsl:if test="@to">
4467
+ <xsl:value-of select="$dash"/>
4468
+ <xsl:copy>
4469
+ <xsl:copy-of select="@*"/>
4470
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4471
+ <xsl:attribute name="id">
4472
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4473
+ </xsl:attribute>
4474
+ <xsl:apply-templates mode="index_add_id"/>
4475
+ </xsl:copy>
4476
+ </xsl:if>
4477
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4478
+ <xsl:copy>
4479
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4480
+ </xsl:copy>
4481
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4482
+ <xsl:copy>
4483
+ <xsl:apply-templates select="@*" mode="index_update"/>
4484
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4485
+ </xsl:copy>
4486
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4487
+ <xsl:param name="element"/>
4488
+ <xsl:param name="remove" select="'false'"/>
4489
+ <xsl:param name="target"/>
4490
+ <!-- <node></node> -->
4491
+ <xsl:choose>
4492
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4493
+ <!-- skip text (i.e. remove it) and process next element -->
4494
+ <!-- [removed_<xsl:value-of select="."/>] -->
4495
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4496
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4497
+ </xsl:apply-templates>
4498
+ </xsl:when>
4499
+ <xsl:when test="self::text()">
4500
+ <xsl:value-of select="."/>
4501
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4502
+ </xsl:when>
4503
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4504
+ <xsl:variable name="id" select="@id"/>
4505
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4506
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4507
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4508
+
4509
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4510
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4511
+
4512
+ <xsl:choose>
4513
+ <!-- 2nd pass -->
4514
+ <!-- if page is equal to page for next and page is not the end of range -->
4515
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4516
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4517
+ <!-- [removed_xref] -->
4518
+
4519
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4520
+ <xsl:with-param name="remove">true</xsl:with-param>
4521
+ <xsl:with-param name="target">
4522
+ <xsl:choose>
4523
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4524
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4525
+ </xsl:choose>
4526
+ </xsl:with-param>
4527
+ </xsl:apply-templates>
4528
+ </xsl:when>
4529
+
4530
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4531
+ <!-- remove xref -->
4532
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4533
+ <xsl:with-param name="remove">true</xsl:with-param>
4534
+ </xsl:apply-templates>
4535
+ </xsl:when>
4536
+
4537
+ <xsl:otherwise>
4538
+ <xsl:apply-templates select="." mode="xref_copy">
4539
+ <xsl:with-param name="target" select="$target"/>
4540
+ </xsl:apply-templates>
4541
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4542
+ </xsl:otherwise>
4543
+ </xsl:choose>
4544
+ </xsl:when>
4545
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4546
+ <!-- ul -->
4547
+ <xsl:apply-templates select="." mode="index_update"/>
4548
+ </xsl:when>
4549
+ <xsl:otherwise>
4550
+ <xsl:apply-templates select="." mode="xref_copy">
4551
+ <xsl:with-param name="target" select="$target"/>
4552
+ </xsl:apply-templates>
4553
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4554
+ </xsl:otherwise>
4555
+ </xsl:choose>
4556
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4557
+ <xsl:param name="target"/>
4558
+ <xsl:copy>
4559
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4560
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4561
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4562
+ </xsl:if>
4563
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4564
+ </xsl:copy>
4565
+ </xsl:template><xsl:template name="generateIndexXrefId">
4566
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4567
+
4568
+ <xsl:variable name="docid">
4569
+ <xsl:call-template name="getDocumentId"/>
4570
+ </xsl:variable>
4571
+ <xsl:variable name="item_number">
4572
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4573
+ </xsl:variable>
4574
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4575
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4576
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4577
+ <xsl:apply-templates/>
4578
+ <fo:block>
4579
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4580
+ <fo:block> </fo:block>
4581
+ </xsl:if>
4582
+ </fo:block>
4583
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4584
+ <xsl:apply-templates/>
4585
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4586
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4587
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4588
+ <xsl:apply-templates/>
4589
+ </fo:block>
4590
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
4591
+ <fo:inline id="{@id}"/>
4333
4592
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4334
4593
  <!-- <row>
4335
4594
  <date>05-07-2013</date>
@@ -4425,6 +4684,8 @@
4425
4684
  <xsl:value-of select="translate(.,'. ','')"/>
4426
4685
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4427
4686
  <xsl:value-of select="substring(.,1,1)"/>
4687
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4688
+ <fo:inline><xsl:apply-templates/></fo:inline>
4428
4689
  </xsl:template><xsl:template name="convertDate">
4429
4690
  <xsl:param name="date"/>
4430
4691
  <xsl:param name="format" select="'short'"/>
@@ -4449,6 +4710,57 @@
4449
4710
  </xsl:variable>
4450
4711
  <xsl:variable name="result">
4451
4712
  <xsl:choose>
4713
+ <xsl:when test="$format = 'ddMMyyyy'">
4714
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4715
+ <xsl:text> </xsl:text>
4716
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4717
+ </xsl:when>
4718
+ <xsl:when test="$format = 'ddMM'">
4719
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4720
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4721
+ </xsl:when>
4722
+ <xsl:when test="$format = 'short' or $day = ''">
4723
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4724
+ </xsl:when>
4725
+ <xsl:otherwise>
4726
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4727
+ </xsl:otherwise>
4728
+ </xsl:choose>
4729
+ </xsl:variable>
4730
+ <xsl:value-of select="$result"/>
4731
+ </xsl:template><xsl:template name="convertDateLocalized">
4732
+ <xsl:param name="date"/>
4733
+ <xsl:param name="format" select="'short'"/>
4734
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4735
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4736
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4737
+ <xsl:variable name="monthStr">
4738
+ <xsl:choose>
4739
+ <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>
4740
+ <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>
4741
+ <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>
4742
+ <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>
4743
+ <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>
4744
+ <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>
4745
+ <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>
4746
+ <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>
4747
+ <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>
4748
+ <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>
4749
+ <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>
4750
+ <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>
4751
+ </xsl:choose>
4752
+ </xsl:variable>
4753
+ <xsl:variable name="result">
4754
+ <xsl:choose>
4755
+ <xsl:when test="$format = 'ddMMyyyy'">
4756
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4757
+ <xsl:text> </xsl:text>
4758
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4759
+ </xsl:when>
4760
+ <xsl:when test="$format = 'ddMM'">
4761
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4762
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4763
+ </xsl:when>
4452
4764
  <xsl:when test="$format = 'short' or $day = ''">
4453
4765
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4454
4766
  </xsl:when>
@@ -4464,7 +4776,7 @@
4464
4776
  <xsl:param name="charDelim" select="', '"/>
4465
4777
  <xsl:choose>
4466
4778
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4467
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4779
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4468
4780
  <xsl:sort data-type="text" order="ascending"/>
4469
4781
  <xsl:call-template name="insertKeyword">
4470
4782
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4473,7 +4785,7 @@
4473
4785
  </xsl:for-each>
4474
4786
  </xsl:when>
4475
4787
  <xsl:otherwise>
4476
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4788
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4477
4789
  <xsl:call-template name="insertKeyword">
4478
4790
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4479
4791
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4490,63 +4802,71 @@
4490
4802
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4491
4803
  </xsl:choose>
4492
4804
  </xsl:template><xsl:template name="addPDFUAmeta">
4493
- <fo:declarations>
4494
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4495
- <pdf:dictionary type="normal" key="ViewerPreferences">
4496
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4497
- </pdf:dictionary>
4498
- </pdf:catalog>
4499
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4500
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4501
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4502
- <!-- Dublin Core properties go here -->
4503
- <dc:title>
4504
- <xsl:variable name="title">
4805
+ <xsl:variable name="lang">
4806
+ <xsl:call-template name="getLang"/>
4807
+ </xsl:variable>
4808
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4809
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4810
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4811
+ </pdf:dictionary>
4812
+ </pdf:catalog>
4813
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4814
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4815
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4816
+ <!-- Dublin Core properties go here -->
4817
+ <dc:title>
4818
+ <xsl:variable name="title">
4819
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4820
+
4821
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4505
4822
 
4506
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4507
4823
 
4508
4824
 
4509
4825
 
4510
4826
 
4511
4827
 
4512
- </xsl:variable>
4513
- <xsl:choose>
4514
- <xsl:when test="normalize-space($title) != ''">
4515
- <xsl:value-of select="$title"/>
4516
- </xsl:when>
4517
- <xsl:otherwise>
4518
- <xsl:text> </xsl:text>
4519
- </xsl:otherwise>
4520
- </xsl:choose>
4521
- </dc:title>
4522
- <dc:creator>
4828
+ </xsl:for-each>
4829
+ </xsl:variable>
4830
+ <xsl:choose>
4831
+ <xsl:when test="normalize-space($title) != ''">
4832
+ <xsl:value-of select="$title"/>
4833
+ </xsl:when>
4834
+ <xsl:otherwise>
4835
+ <xsl:text> </xsl:text>
4836
+ </xsl:otherwise>
4837
+ </xsl:choose>
4838
+ </dc:title>
4839
+ <dc:creator>
4840
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4523
4841
 
4842
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4843
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4844
+ <xsl:if test="position() != last()">; </xsl:if>
4845
+ </xsl:for-each>
4524
4846
 
4525
4847
 
4526
- </dc:creator>
4527
- <dc:description>
4528
- <xsl:variable name="abstract">
4529
-
4530
-
4531
-
4532
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4533
-
4534
-
4535
-
4536
- </xsl:variable>
4537
- <xsl:value-of select="normalize-space($abstract)"/>
4538
- </dc:description>
4539
- <pdf:Keywords>
4540
- <xsl:call-template name="insertKeywords"/>
4541
- </pdf:Keywords>
4542
- </rdf:Description>
4543
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4544
- <!-- XMP properties go here -->
4545
- <xmp:CreatorTool/>
4546
- </rdf:Description>
4547
- </rdf:RDF>
4548
- </x:xmpmeta>
4549
- </fo:declarations>
4848
+
4849
+ </xsl:for-each>
4850
+ </dc:creator>
4851
+ <dc:description>
4852
+ <xsl:variable name="abstract">
4853
+
4854
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4855
+
4856
+
4857
+ </xsl:variable>
4858
+ <xsl:value-of select="normalize-space($abstract)"/>
4859
+ </dc:description>
4860
+ <pdf:Keywords>
4861
+ <xsl:call-template name="insertKeywords"/>
4862
+ </pdf:Keywords>
4863
+ </rdf:Description>
4864
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4865
+ <!-- XMP properties go here -->
4866
+ <xmp:CreatorTool/>
4867
+ </rdf:Description>
4868
+ </rdf:RDF>
4869
+ </x:xmpmeta>
4550
4870
  </xsl:template><xsl:template name="getId">
4551
4871
  <xsl:choose>
4552
4872
  <xsl:when test="../@id">
@@ -4643,6 +4963,7 @@
4643
4963
 
4644
4964
 
4645
4965
 
4966
+
4646
4967
  </xsl:variable>
4647
4968
  <xsl:if test="$documentNS != $XSLNS">
4648
4969
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4702,6 +5023,11 @@
4702
5023
  <xsl:call-template name="getLang"/>
4703
5024
  </xsl:variable>
4704
5025
 
4705
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5026
+ <xsl:choose>
5027
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5028
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5029
+ </xsl:when>
5030
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5031
+ </xsl:choose>
4706
5032
 
4707
5033
  </xsl:template></xsl:stylesheet>