metanorma-un 0.5.11 → 0.5.16

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,205 +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"/>
1646
1588
 
1589
+
1647
1590
 
1591
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1648
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"/> -->
1649
1609
 
1650
1610
 
1651
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"/> -->
1652
1621
 
1653
- <xsl:variable name="table_attributes">
1654
- <attribute name="table-layout">fixed</attribute>
1655
- <attribute name="width">
1656
- <xsl:choose>
1657
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1658
- <xsl:otherwise>100%</xsl:otherwise>
1659
- </xsl:choose>
1660
- </attribute>
1661
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1662
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
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> -->
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 -->
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>
1638
+
1639
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1663
1640
 
1664
1641
 
1642
+
1665
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
+
1666
1650
 
1667
-
1668
1651
 
1669
- <xsl:if test="ancestor::*[local-name()='sections']">
1670
- <attribute name="border-top">1.5pt solid black</attribute>
1671
- <attribute name="border-bottom">1.5pt solid black</attribute>
1672
- </xsl:if>
1673
-
1674
-
1652
+
1675
1653
 
1676
-
1677
1654
 
1678
- </xsl:variable>
1679
-
1680
-
1681
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1682
1655
 
1683
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1684
- <xsl:attribute name="{@name}">
1685
- <xsl:value-of select="."/>
1686
- </xsl:attribute>
1687
- </xsl:for-each>
1688
1656
 
1689
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1690
- <xsl:if test="$isNoteOrFnExist = 'true'">
1691
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1692
- </xsl:if>
1693
1657
 
1694
- <xsl:choose>
1695
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1696
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1697
- <fo:table-column column-width="{@width}"/>
1698
- </xsl:for-each>
1699
- </xsl:when>
1700
- <xsl:otherwise>
1701
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1702
- <xsl:choose>
1703
- <xsl:when test=". = 1 or . = 0">
1704
- <fo:table-column column-width="proportional-column-width(2)"/>
1705
- </xsl:when>
1706
- <xsl:otherwise>
1707
- <fo:table-column column-width="proportional-column-width({.})"/>
1708
- </xsl:otherwise>
1709
- </xsl:choose>
1710
- </xsl:for-each>
1711
- </xsl:otherwise>
1712
- </xsl:choose>
1713
1658
 
1714
- <xsl:choose>
1715
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1716
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1717
- </xsl:when>
1718
- <xsl:otherwise>
1719
- <xsl:apply-templates/>
1720
- </xsl:otherwise>
1721
- </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>
1670
+
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>
1722
1692
 
1723
- </fo:table>
1724
-
1725
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1726
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1727
- <xsl:call-template name="insertTableFooterInSeparateTable">
1728
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1729
- <xsl:with-param name="colwidths" select="$colwidths"/>
1730
- <xsl:with-param name="colgroup" select="$colgroup"/>
1731
- </xsl:call-template>
1732
- </xsl:for-each>
1733
-
1734
- <!-- insert footer as table -->
1735
- <!-- <fo:table>
1736
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1737
- <xsl:attribute name="{@name}">
1738
- <xsl:value-of select="."/>
1739
- </xsl:attribute>
1740
- </xsl:for-each>
1741
1693
 
1742
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
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
+
1743
1727
  <xsl:choose>
1744
- <xsl:when test=". = 1 or . = 0">
1745
- <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"/>
1746
1730
  </xsl:when>
1747
1731
  <xsl:otherwise>
1748
- <fo:table-column column-width="proportional-column-width({.})"/>
1732
+ <xsl:apply-templates/>
1749
1733
  </xsl:otherwise>
1750
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>
1751
1745
  </xsl:for-each>
1752
- </fo:table>-->
1753
-
1754
-
1755
-
1756
-
1757
-
1758
- </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
+
1759
1792
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1760
1793
  <xsl:if test="normalize-space() != ''">
1761
1794
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1883,7 +1916,15 @@
1883
1916
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1884
1917
  <xsl:value-of select="@target"/>
1885
1918
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1886
- <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))"/>
1887
1928
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1888
1929
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1889
1930
  <xsl:param name="cols-count"/>
@@ -2600,7 +2641,7 @@
2600
2641
  <xsl:with-param name="table" select="$html-table"/>
2601
2642
  </xsl:call-template>
2602
2643
  </xsl:variable>
2603
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2644
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2604
2645
  <xsl:variable name="maxlength_dt">
2605
2646
  <xsl:call-template name="getMaxLength_dt"/>
2606
2647
  </xsl:variable>
@@ -2629,13 +2670,22 @@
2629
2670
  </xsl:when>
2630
2671
  <xsl:otherwise>
2631
2672
  <xsl:choose>
2673
+ <!-- to set width check most wide chars like `W` -->
2632
2674
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2633
- <fo:table-column column-width="5%"/>
2634
- <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%"/>
2681
+ </xsl:when>
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%"/>
2635
2685
  </xsl:when>
2636
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2637
- <fo:table-column column-width="10%"/>
2638
- <fo:table-column column-width="90%"/>
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%"/>
2639
2689
  </xsl:when>
2640
2690
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2641
2691
  <fo:table-column column-width="60%"/>
@@ -2831,6 +2881,7 @@
2831
2881
 
2832
2882
 
2833
2883
 
2884
+
2834
2885
 
2835
2886
  </xsl:variable>
2836
2887
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2852,6 +2903,10 @@
2852
2903
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2853
2904
  <xsl:apply-templates/>
2854
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>
2855
2910
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2856
2911
  <xsl:variable name="text" select="normalize-space(.)"/>
2857
2912
  <fo:inline font-size="75%">
@@ -2941,6 +2996,10 @@
2941
2996
  <xsl:param name="text" select="."/>
2942
2997
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2943
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​')"/>
2944
3003
  </xsl:template><xsl:template name="add-zero-spaces">
2945
3004
  <xsl:param name="text" select="."/>
2946
3005
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3188,6 +3247,7 @@
3188
3247
  <xsl:apply-templates select="." mode="mathml"/>
3189
3248
  </xsl:variable>
3190
3249
  <fo:instream-foreign-object fox:alt-text="Math">
3250
+
3191
3251
  <!-- <xsl:copy-of select="."/> -->
3192
3252
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3193
3253
  </fo:instream-foreign-object>
@@ -3201,7 +3261,12 @@
3201
3261
  <!-- replace start and end spaces to non-break space -->
3202
3262
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3203
3263
  </xsl:copy>
3204
- </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">
3205
3270
  <xsl:variable name="target">
3206
3271
  <xsl:choose>
3207
3272
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3222,7 +3287,10 @@
3222
3287
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3223
3288
  <xsl:choose>
3224
3289
  <xsl:when test="normalize-space(.) = ''">
3225
- <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>
3226
3294
  </xsl:when>
3227
3295
  <xsl:otherwise>
3228
3296
  <xsl:apply-templates/>
@@ -3232,8 +3300,6 @@
3232
3300
  </xsl:otherwise>
3233
3301
  </xsl:choose>
3234
3302
  </fo:inline>
3235
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3236
- <fo:inline id="{@id}"/>
3237
3303
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3238
3304
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3239
3305
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3441,7 +3507,7 @@
3441
3507
  </xsl:if> -->
3442
3508
  </fo:inline>
3443
3509
  </xsl:if>
3444
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3510
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3445
3511
  <fo:block-container id="{@id}">
3446
3512
 
3447
3513
  <fo:block>
@@ -3457,6 +3523,7 @@
3457
3523
  <fo:block id="{@id}">
3458
3524
  <xsl:apply-templates/>
3459
3525
  </fo:block>
3526
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3460
3527
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3461
3528
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3462
3529
  <xsl:apply-templates/>
@@ -3653,6 +3720,12 @@
3653
3720
  <!-- <xsl:text> </xsl:text> -->
3654
3721
  </xsl:template><xsl:template name="getSection">
3655
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
+
3656
3729
  </xsl:template><xsl:template name="getName">
3657
3730
  <xsl:choose>
3658
3731
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3705,6 +3778,12 @@
3705
3778
  <xsl:copy>
3706
3779
  <xsl:apply-templates mode="contents_item"/>
3707
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="."/>
3708
3787
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3709
3788
  <xsl:text> </xsl:text>
3710
3789
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3730,6 +3809,7 @@
3730
3809
 
3731
3810
 
3732
3811
 
3812
+
3733
3813
 
3734
3814
 
3735
3815
 
@@ -4032,10 +4112,11 @@
4032
4112
  </xsl:choose>
4033
4113
 
4034
4114
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4035
-
4115
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4036
4116
  <xsl:variable name="element">
4037
4117
  block
4038
4118
 
4119
+
4039
4120
  </xsl:variable>
4040
4121
  <xsl:choose>
4041
4122
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4102,11 +4183,13 @@
4102
4183
  </xsl:if>
4103
4184
  </xsl:if>
4104
4185
 
4186
+
4105
4187
  <fo:block-container margin-left="0mm">
4106
4188
 
4107
4189
  <fo:block xsl:use-attribute-sets="quote-style">
4108
4190
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4109
- <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 -->
4110
4193
  </fo:block>
4111
4194
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4112
4195
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4129,29 +4212,47 @@
4129
4212
  <xsl:text>— </xsl:text>
4130
4213
  <xsl:apply-templates/>
4131
4214
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4132
- <fo:inline xsl:use-attribute-sets="eref-style">
4133
- <xsl:if test="@type = 'footnote'">
4134
-
4135
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4136
- <xsl:attribute name="font-size">80%</xsl:attribute>
4137
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4138
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4139
-
4140
-
4141
- </xsl:if>
4142
-
4143
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4144
-
4145
- <xsl:if test="@type = 'inline'">
4146
-
4147
-
4148
-
4149
- </xsl:if>
4150
-
4151
-
4152
- <xsl:apply-templates/>
4153
- </fo:basic-link>
4154
- </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>
4155
4256
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4156
4257
  <!-- zero-space char -->
4157
4258
  <xsl:variable name="depth">
@@ -4259,6 +4360,7 @@
4259
4360
 
4260
4361
 
4261
4362
 
4363
+
4262
4364
 
4263
4365
 
4264
4366
 
@@ -4275,7 +4377,7 @@
4275
4377
 
4276
4378
 
4277
4379
 
4278
- </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']/* -->
4279
4381
  <fo:block break-after="page"/>
4280
4382
  <fo:block>
4281
4383
  <xsl:call-template name="setId"/>
@@ -4283,7 +4385,8 @@
4283
4385
  </fo:block>
4284
4386
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4285
4387
  <fo:block>
4286
- <xsl:call-template name="setId"/>
4388
+ <xsl:call-template name="setId"/>
4389
+
4287
4390
 
4288
4391
  <xsl:apply-templates/>
4289
4392
  </fo:block>
@@ -4339,6 +4442,153 @@
4339
4442
  </fo:block>
4340
4443
  </xsl:otherwise>
4341
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']" name="bookmark">
4591
+ <fo:inline id="{@id}" font-size="1pt"/>
4342
4592
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4343
4593
  <!-- <row>
4344
4594
  <date>05-07-2013</date>
@@ -4460,6 +4710,57 @@
4460
4710
  </xsl:variable>
4461
4711
  <xsl:variable name="result">
4462
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>
4463
4764
  <xsl:when test="$format = 'short' or $day = ''">
4464
4765
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4465
4766
  </xsl:when>
@@ -4475,7 +4776,7 @@
4475
4776
  <xsl:param name="charDelim" select="', '"/>
4476
4777
  <xsl:choose>
4477
4778
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4478
- <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']">
4479
4780
  <xsl:sort data-type="text" order="ascending"/>
4480
4781
  <xsl:call-template name="insertKeyword">
4481
4782
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4484,7 +4785,7 @@
4484
4785
  </xsl:for-each>
4485
4786
  </xsl:when>
4486
4787
  <xsl:otherwise>
4487
- <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']">
4488
4789
  <xsl:call-template name="insertKeyword">
4489
4790
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4490
4791
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4501,63 +4802,71 @@
4501
4802
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4502
4803
  </xsl:choose>
4503
4804
  </xsl:template><xsl:template name="addPDFUAmeta">
4504
- <fo:declarations>
4505
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4506
- <pdf:dictionary type="normal" key="ViewerPreferences">
4507
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4508
- </pdf:dictionary>
4509
- </pdf:catalog>
4510
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4511
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4512
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4513
- <!-- Dublin Core properties go here -->
4514
- <dc:title>
4515
- <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']"/>
4516
4822
 
4517
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4518
4823
 
4519
4824
 
4520
4825
 
4521
4826
 
4522
4827
 
4523
- </xsl:variable>
4524
- <xsl:choose>
4525
- <xsl:when test="normalize-space($title) != ''">
4526
- <xsl:value-of select="$title"/>
4527
- </xsl:when>
4528
- <xsl:otherwise>
4529
- <xsl:text> </xsl:text>
4530
- </xsl:otherwise>
4531
- </xsl:choose>
4532
- </dc:title>
4533
- <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']">
4534
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>
4535
4846
 
4536
4847
 
4537
- </dc:creator>
4538
- <dc:description>
4539
- <xsl:variable name="abstract">
4540
-
4541
-
4542
-
4543
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4544
-
4545
-
4546
-
4547
- </xsl:variable>
4548
- <xsl:value-of select="normalize-space($abstract)"/>
4549
- </dc:description>
4550
- <pdf:Keywords>
4551
- <xsl:call-template name="insertKeywords"/>
4552
- </pdf:Keywords>
4553
- </rdf:Description>
4554
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4555
- <!-- XMP properties go here -->
4556
- <xmp:CreatorTool/>
4557
- </rdf:Description>
4558
- </rdf:RDF>
4559
- </x:xmpmeta>
4560
- </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>
4561
4870
  </xsl:template><xsl:template name="getId">
4562
4871
  <xsl:choose>
4563
4872
  <xsl:when test="../@id">
@@ -4654,6 +4963,7 @@
4654
4963
 
4655
4964
 
4656
4965
 
4966
+
4657
4967
  </xsl:variable>
4658
4968
  <xsl:if test="$documentNS != $XSLNS">
4659
4969
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>