metanorma-un 0.5.12 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,9 @@
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)"/>
8
+ <xsl:param name="basepath"/>
7
9
 
8
10
 
9
11
 
@@ -83,7 +85,9 @@
83
85
 
84
86
  </fo:layout-master-set>
85
87
 
86
- <xsl:call-template name="addPDFUAmeta"/>
88
+ <fo:declarations>
89
+ <xsl:call-template name="addPDFUAmeta"/>
90
+ </fo:declarations>
87
91
 
88
92
  <xsl:call-template name="addBookmarks">
89
93
  <xsl:with-param name="contents" select="$contents"/>
@@ -1307,6 +1311,7 @@
1307
1311
 
1308
1312
 
1309
1313
 
1314
+
1310
1315
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1311
1316
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1312
1317
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1509,12 +1514,18 @@
1509
1514
 
1510
1515
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1511
1516
 
1512
-
1517
+
1513
1518
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1514
1519
 
1515
1520
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1516
1521
 
1517
1522
 
1523
+ </xsl:attribute-set><xsl:attribute-set name="add-style">
1524
+ <xsl:attribute name="color">red</xsl:attribute>
1525
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1526
+ </xsl:attribute-set><xsl:attribute-set name="del-style">
1527
+ <xsl:attribute name="color">red</xsl:attribute>
1528
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1518
1529
  </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1519
1530
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1520
1531
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -1560,203 +1571,231 @@
1560
1571
  <xsl:call-template name="add-zero-spaces-java"/>
1561
1572
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1562
1573
 
1563
- <xsl:variable name="simple-table">
1564
- <xsl:call-template name="getSimpleTable"/>
1565
- </xsl:variable>
1574
+ <xsl:variable name="table">
1566
1575
 
1567
-
1568
-
1569
-
1570
-
1571
- <!-- <xsl:if test="$namespace = 'bipm'">
1572
- <fo:block>&#xA0;</fo:block>
1573
- </xsl:if> -->
1574
-
1575
- <!-- $namespace = 'iso' or -->
1576
-
1577
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1578
-
1579
-
1580
-
1581
- <xsl:call-template name="fn_name_display"/>
1576
+ <xsl:variable name="simple-table">
1577
+ <xsl:call-template name="getSimpleTable"/>
1578
+ </xsl:variable>
1582
1579
 
1583
1580
 
1584
-
1585
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1586
-
1587
- <!-- <xsl:variable name="cols-count">
1588
- <xsl:choose>
1589
- <xsl:when test="*[local-name()='thead']">
1590
- <xsl:call-template name="calculate-columns-numbers">
1591
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1592
- </xsl:call-template>
1593
- </xsl:when>
1594
- <xsl:otherwise>
1595
- <xsl:call-template name="calculate-columns-numbers">
1596
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1597
- </xsl:call-template>
1598
- </xsl:otherwise>
1599
- </xsl:choose>
1600
- </xsl:variable> -->
1601
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1602
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1603
-
1604
-
1605
-
1606
- <xsl:variable name="colwidths">
1607
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1608
- <xsl:call-template name="calculate-column-widths">
1609
- <xsl:with-param name="cols-count" select="$cols-count"/>
1610
- <xsl:with-param name="table" select="$simple-table"/>
1611
- </xsl:call-template>
1612
- </xsl:if>
1613
- </xsl:variable>
1614
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1615
-
1616
- <!-- <xsl:variable name="colwidths2">
1617
- <xsl:call-template name="calculate-column-widths">
1618
- <xsl:with-param name="cols-count" select="$cols-count"/>
1619
- </xsl:call-template>
1620
- </xsl:variable> -->
1621
-
1622
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1623
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1624
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1625
-
1626
- <xsl:variable name="margin-left">
1627
- <xsl:choose>
1628
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1629
- <xsl:otherwise>0</xsl:otherwise>
1630
- </xsl:choose>
1631
- </xsl:variable>
1632
-
1633
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1634
1581
 
1635
1582
 
1636
-
1637
1583
 
1638
- <xsl:attribute name="space-after">12pt</xsl:attribute>
1639
- <xsl:if test="not(ancestor::*[local-name()='sections'])">
1640
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1641
- </xsl:if>
1642
-
1643
-
1584
+ <!-- <xsl:if test="$namespace = 'bipm'">
1585
+ <fo:block>&#xA0;</fo:block>
1586
+ </xsl:if> -->
1644
1587
 
1588
+ <!-- $namespace = 'iso' or -->
1645
1589
 
1646
-
1590
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1591
+
1592
+
1647
1593
 
1594
+ <xsl:call-template name="fn_name_display"/>
1648
1595
 
1596
+
1597
+
1598
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1649
1599
 
1600
+ <!-- <xsl:variable name="cols-count">
1601
+ <xsl:choose>
1602
+ <xsl:when test="*[local-name()='thead']">
1603
+ <xsl:call-template name="calculate-columns-numbers">
1604
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1605
+ </xsl:call-template>
1606
+ </xsl:when>
1607
+ <xsl:otherwise>
1608
+ <xsl:call-template name="calculate-columns-numbers">
1609
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1610
+ </xsl:call-template>
1611
+ </xsl:otherwise>
1612
+ </xsl:choose>
1613
+ </xsl:variable> -->
1614
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1615
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1650
1616
 
1651
1617
 
1652
1618
 
1619
+ <xsl:variable name="colwidths">
1620
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1621
+ <xsl:call-template name="calculate-column-widths">
1622
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1623
+ <xsl:with-param name="table" select="$simple-table"/>
1624
+ </xsl:call-template>
1625
+ </xsl:if>
1626
+ </xsl:variable>
1627
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1653
1628
 
1654
- <xsl:variable name="table_attributes">
1655
- <attribute name="table-layout">fixed</attribute>
1656
- <attribute name="width">
1657
- <xsl:choose>
1658
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1659
- <xsl:otherwise>100%</xsl:otherwise>
1660
- </xsl:choose>
1661
- </attribute>
1662
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1663
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1629
+ <!-- <xsl:variable name="colwidths2">
1630
+ <xsl:call-template name="calculate-column-widths">
1631
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1632
+ </xsl:call-template>
1633
+ </xsl:variable> -->
1634
+
1635
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1636
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1637
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1638
+
1639
+ <xsl:variable name="margin-left">
1640
+ <xsl:choose>
1641
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1642
+ <xsl:otherwise>0</xsl:otherwise>
1643
+ </xsl:choose>
1644
+ </xsl:variable>
1645
+
1646
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1664
1647
 
1665
1648
 
1649
+
1666
1650
 
1651
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
1652
+ <xsl:if test="not(ancestor::*[local-name()='sections'])">
1653
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1654
+ </xsl:if>
1655
+
1656
+
1667
1657
 
1668
-
1669
1658
 
1670
- <xsl:if test="ancestor::*[local-name()='sections']">
1671
- <attribute name="border-top">1.5pt solid black</attribute>
1672
- <attribute name="border-bottom">1.5pt solid black</attribute>
1673
- </xsl:if>
1674
-
1675
-
1659
+
1676
1660
 
1677
-
1678
1661
 
1679
- </xsl:variable>
1680
-
1681
-
1682
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1683
1662
 
1684
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1685
- <xsl:attribute name="{@name}">
1686
- <xsl:value-of select="."/>
1687
- </xsl:attribute>
1688
- </xsl:for-each>
1689
1663
 
1690
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1691
- <xsl:if test="$isNoteOrFnExist = 'true'">
1692
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1693
- </xsl:if>
1694
1664
 
1695
- <xsl:choose>
1696
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1697
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1698
- <fo:table-column column-width="{@width}"/>
1699
- </xsl:for-each>
1700
- </xsl:when>
1701
- <xsl:otherwise>
1702
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1703
- <xsl:choose>
1704
- <xsl:when test=". = 1 or . = 0">
1705
- <fo:table-column column-width="proportional-column-width(2)"/>
1706
- </xsl:when>
1707
- <xsl:otherwise>
1708
- <fo:table-column column-width="proportional-column-width({.})"/>
1709
- </xsl:otherwise>
1710
- </xsl:choose>
1711
- </xsl:for-each>
1712
- </xsl:otherwise>
1713
- </xsl:choose>
1714
1665
 
1715
- <xsl:choose>
1716
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1717
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1718
- </xsl:when>
1719
- <xsl:otherwise>
1720
- <xsl:apply-templates/>
1721
- </xsl:otherwise>
1722
- </xsl:choose>
1666
+ <xsl:variable name="table_width">
1667
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1668
+
1669
+
1670
+
1671
+ <xsl:choose>
1672
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1673
+ <xsl:otherwise>100%</xsl:otherwise>
1674
+ </xsl:choose>
1675
+
1676
+ </xsl:variable>
1677
+
1678
+ <xsl:variable name="table_attributes">
1679
+ <attribute name="table-layout">fixed</attribute>
1680
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1681
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1682
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1683
+
1684
+
1685
+
1686
+
1687
+
1688
+
1689
+ <xsl:if test="ancestor::*[local-name()='sections']">
1690
+ <attribute name="border-top">1.5pt solid black</attribute>
1691
+ <attribute name="border-bottom">1.5pt solid black</attribute>
1692
+ </xsl:if>
1693
+
1694
+
1695
+
1696
+
1697
+
1698
+ </xsl:variable>
1723
1699
 
1724
- </fo:table>
1725
-
1726
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1727
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1728
- <xsl:call-template name="insertTableFooterInSeparateTable">
1729
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1730
- <xsl:with-param name="colwidths" select="$colwidths"/>
1731
- <xsl:with-param name="colgroup" select="$colgroup"/>
1732
- </xsl:call-template>
1733
- </xsl:for-each>
1734
-
1735
- <!-- insert footer as table -->
1736
- <!-- <fo:table>
1737
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1738
- <xsl:attribute name="{@name}">
1739
- <xsl:value-of select="."/>
1740
- </xsl:attribute>
1741
- </xsl:for-each>
1742
1700
 
1743
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1701
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1702
+
1703
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1704
+ <xsl:attribute name="{@name}">
1705
+ <xsl:value-of select="."/>
1706
+ </xsl:attribute>
1707
+ </xsl:for-each>
1708
+
1709
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1710
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1711
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1712
+ </xsl:if>
1713
+
1744
1714
  <xsl:choose>
1745
- <xsl:when test=". = 1 or . = 0">
1746
- <fo:table-column column-width="proportional-column-width(2)"/>
1715
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1716
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1717
+ <fo:table-column column-width="{@width}"/>
1718
+ </xsl:for-each>
1747
1719
  </xsl:when>
1748
1720
  <xsl:otherwise>
1749
- <fo:table-column column-width="proportional-column-width({.})"/>
1721
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1722
+ <xsl:choose>
1723
+ <xsl:when test=". = 1 or . = 0">
1724
+ <fo:table-column column-width="proportional-column-width(2)"/>
1725
+ </xsl:when>
1726
+ <xsl:otherwise>
1727
+ <fo:table-column column-width="proportional-column-width({.})"/>
1728
+ </xsl:otherwise>
1729
+ </xsl:choose>
1730
+ </xsl:for-each>
1750
1731
  </xsl:otherwise>
1751
1732
  </xsl:choose>
1733
+
1734
+ <xsl:choose>
1735
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1736
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1737
+ </xsl:when>
1738
+ <xsl:otherwise>
1739
+ <xsl:apply-templates/>
1740
+ </xsl:otherwise>
1741
+ </xsl:choose>
1742
+
1743
+ </fo:table>
1744
+
1745
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1746
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1747
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1748
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1749
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1750
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1751
+ </xsl:call-template>
1752
1752
  </xsl:for-each>
1753
- </fo:table>-->
1754
-
1755
-
1756
-
1757
-
1758
-
1759
- </fo:block-container>
1753
+
1754
+ <!-- insert footer as table -->
1755
+ <!-- <fo:table>
1756
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1757
+ <xsl:attribute name="{@name}">
1758
+ <xsl:value-of select="."/>
1759
+ </xsl:attribute>
1760
+ </xsl:for-each>
1761
+
1762
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1763
+ <xsl:choose>
1764
+ <xsl:when test=". = 1 or . = 0">
1765
+ <fo:table-column column-width="proportional-column-width(2)"/>
1766
+ </xsl:when>
1767
+ <xsl:otherwise>
1768
+ <fo:table-column column-width="proportional-column-width({.})"/>
1769
+ </xsl:otherwise>
1770
+ </xsl:choose>
1771
+ </xsl:for-each>
1772
+ </fo:table>-->
1773
+
1774
+
1775
+
1776
+
1777
+
1778
+ </fo:block-container>
1779
+ </xsl:variable>
1780
+
1781
+
1782
+
1783
+ <xsl:choose>
1784
+ <xsl:when test="@width">
1785
+
1786
+ <!-- centered table when table name is centered (see table-name-style) -->
1787
+
1788
+
1789
+
1790
+ <xsl:copy-of select="$table"/>
1791
+
1792
+
1793
+ </xsl:when>
1794
+ <xsl:otherwise>
1795
+ <xsl:copy-of select="$table"/>
1796
+ </xsl:otherwise>
1797
+ </xsl:choose>
1798
+
1760
1799
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1761
1800
  <xsl:if test="normalize-space() != ''">
1762
1801
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1884,7 +1923,15 @@
1884
1923
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1885
1924
  <xsl:value-of select="@target"/>
1886
1925
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1887
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1926
+ <xsl:variable name="mathml">
1927
+ <xsl:for-each select="*">
1928
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1929
+ <xsl:copy-of select="."/>
1930
+ </xsl:if>
1931
+ </xsl:for-each>
1932
+ </xsl:variable>
1933
+
1934
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1888
1935
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1889
1936
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1890
1937
  <xsl:param name="cols-count"/>
@@ -2601,7 +2648,7 @@
2601
2648
  <xsl:with-param name="table" select="$html-table"/>
2602
2649
  </xsl:call-template>
2603
2650
  </xsl:variable>
2604
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2651
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2605
2652
  <xsl:variable name="maxlength_dt">
2606
2653
  <xsl:call-template name="getMaxLength_dt"/>
2607
2654
  </xsl:variable>
@@ -2630,13 +2677,22 @@
2630
2677
  </xsl:when>
2631
2678
  <xsl:otherwise>
2632
2679
  <xsl:choose>
2680
+ <!-- to set width check most wide chars like `W` -->
2633
2681
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2634
- <fo:table-column column-width="5%"/>
2635
- <fo:table-column column-width="95%"/>
2682
+ <fo:table-column column-width="7%"/>
2683
+ <fo:table-column column-width="93%"/>
2684
+ </xsl:when>
2685
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2686
+ <fo:table-column column-width="15%"/>
2687
+ <fo:table-column column-width="85%"/>
2636
2688
  </xsl:when>
2637
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2638
- <fo:table-column column-width="10%"/>
2639
- <fo:table-column column-width="90%"/>
2689
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2690
+ <fo:table-column column-width="20%"/>
2691
+ <fo:table-column column-width="80%"/>
2692
+ </xsl:when>
2693
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2694
+ <fo:table-column column-width="25%"/>
2695
+ <fo:table-column column-width="75%"/>
2640
2696
  </xsl:when>
2641
2697
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2642
2698
  <fo:table-column column-width="60%"/>
@@ -2850,8 +2906,16 @@
2850
2906
  <fo:inline text-decoration="underline">
2851
2907
  <xsl:apply-templates/>
2852
2908
  </fo:inline>
2909
+ </xsl:template><xsl:template match="*[local-name()='add']">
2910
+ <fo:inline xsl:use-attribute-sets="add-style">
2911
+ <xsl:apply-templates/>
2912
+ </fo:inline>
2853
2913
  </xsl:template><xsl:template match="*[local-name()='del']">
2854
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2914
+ <fo:inline xsl:use-attribute-sets="del-style">
2915
+ <xsl:apply-templates/>
2916
+ </fo:inline>
2917
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2918
+ <fo:inline background-color="yellow">
2855
2919
  <xsl:apply-templates/>
2856
2920
  </fo:inline>
2857
2921
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -2943,6 +3007,10 @@
2943
3007
  <xsl:param name="text" select="."/>
2944
3008
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2945
3009
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3010
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
3011
+ <xsl:param name="text" select="."/>
3012
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3013
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2946
3014
  </xsl:template><xsl:template name="add-zero-spaces">
2947
3015
  <xsl:param name="text" select="."/>
2948
3016
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3190,6 +3258,7 @@
3190
3258
  <xsl:apply-templates select="." mode="mathml"/>
3191
3259
  </xsl:variable>
3192
3260
  <fo:instream-foreign-object fox:alt-text="Math">
3261
+
3193
3262
  <!-- <xsl:copy-of select="."/> -->
3194
3263
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3195
3264
  </fo:instream-foreign-object>
@@ -3203,7 +3272,12 @@
3203
3272
  <!-- replace start and end spaces to non-break space -->
3204
3273
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3205
3274
  </xsl:copy>
3206
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3275
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3276
+ <xsl:copy>
3277
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3278
+ </xsl:copy>
3279
+ <mathml:mspace width="0.5ex"/>
3280
+ </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">
3207
3281
  <xsl:variable name="target">
3208
3282
  <xsl:choose>
3209
3283
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3224,7 +3298,10 @@
3224
3298
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3225
3299
  <xsl:choose>
3226
3300
  <xsl:when test="normalize-space(.) = ''">
3227
- <xsl:value-of select="$target"/>
3301
+ <!-- <xsl:value-of select="$target"/> -->
3302
+ <xsl:call-template name="add-zero-spaces-link-java">
3303
+ <xsl:with-param name="text" select="$target"/>
3304
+ </xsl:call-template>
3228
3305
  </xsl:when>
3229
3306
  <xsl:otherwise>
3230
3307
  <xsl:apply-templates/>
@@ -3234,8 +3311,6 @@
3234
3311
  </xsl:otherwise>
3235
3312
  </xsl:choose>
3236
3313
  </fo:inline>
3237
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3238
- <fo:inline id="{@id}"/>
3239
3314
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3240
3315
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3241
3316
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3459,32 +3534,48 @@
3459
3534
  <fo:block id="{@id}">
3460
3535
  <xsl:apply-templates/>
3461
3536
  </fo:block>
3537
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3462
3538
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3463
3539
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3464
3540
  <xsl:apply-templates/>
3465
3541
  </fo:block>
3466
3542
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3467
- <fo:block xsl:use-attribute-sets="image-style">
3468
-
3469
- <xsl:if test="ancestor::un:admonition">
3470
- <xsl:attribute name="margin-top">-12mm</xsl:attribute>
3471
- <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3472
- </xsl:if>
3473
-
3474
-
3475
- <xsl:variable name="src">
3476
- <xsl:choose>
3477
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3478
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3479
- </xsl:when>
3480
- <xsl:otherwise>
3481
- <xsl:value-of select="@src"/>
3482
- </xsl:otherwise>
3483
- </xsl:choose>
3484
- </xsl:variable>
3485
-
3486
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3487
- </fo:block>
3543
+ <xsl:choose>
3544
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3545
+ <fo:inline padding-left="1mm" padding-right="1mm">
3546
+ <xsl:variable name="src">
3547
+ <xsl:call-template name="image_src"/>
3548
+ </xsl:variable>
3549
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3550
+ </fo:inline>
3551
+ </xsl:when>
3552
+ <xsl:otherwise>
3553
+ <fo:block xsl:use-attribute-sets="image-style">
3554
+
3555
+ <xsl:if test="ancestor::un:admonition">
3556
+ <xsl:attribute name="margin-top">-12mm</xsl:attribute>
3557
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3558
+ </xsl:if>
3559
+
3560
+ <xsl:variable name="src">
3561
+ <xsl:call-template name="image_src"/>
3562
+ </xsl:variable>
3563
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3564
+ </fo:block>
3565
+ </xsl:otherwise>
3566
+ </xsl:choose>
3567
+ </xsl:template><xsl:template name="image_src">
3568
+ <xsl:choose>
3569
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3570
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3571
+ </xsl:when>
3572
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3573
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3574
+ </xsl:when>
3575
+ <xsl:otherwise>
3576
+ <xsl:value-of select="@src"/>
3577
+ </xsl:otherwise>
3578
+ </xsl:choose>
3488
3579
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
3489
3580
  <xsl:apply-templates mode="contents"/>
3490
3581
  <xsl:text> </xsl:text>
@@ -3717,6 +3808,8 @@
3717
3808
  <xsl:copy>
3718
3809
  <xsl:apply-templates mode="contents_item"/>
3719
3810
  </xsl:copy>
3811
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3812
+ <xsl:copy-of select="."/>
3720
3813
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3721
3814
  <xsl:text> </xsl:text>
3722
3815
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4045,10 +4138,11 @@
4045
4138
  </xsl:choose>
4046
4139
 
4047
4140
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4048
-
4141
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4049
4142
  <xsl:variable name="element">
4050
4143
  block
4051
4144
 
4145
+
4052
4146
  </xsl:variable>
4053
4147
  <xsl:choose>
4054
4148
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4115,11 +4209,13 @@
4115
4209
  </xsl:if>
4116
4210
  </xsl:if>
4117
4211
 
4212
+
4118
4213
  <fo:block-container margin-left="0mm">
4119
4214
 
4120
4215
  <fo:block xsl:use-attribute-sets="quote-style">
4121
4216
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4122
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4217
+
4218
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4123
4219
  </fo:block>
4124
4220
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4125
4221
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4142,29 +4238,47 @@
4142
4238
  <xsl:text>— </xsl:text>
4143
4239
  <xsl:apply-templates/>
4144
4240
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4145
- <fo:inline xsl:use-attribute-sets="eref-style">
4146
- <xsl:if test="@type = 'footnote'">
4147
-
4148
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4149
- <xsl:attribute name="font-size">80%</xsl:attribute>
4150
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4151
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4152
-
4153
-
4154
- </xsl:if>
4155
-
4156
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4157
-
4158
- <xsl:if test="@type = 'inline'">
4159
-
4160
-
4161
-
4162
- </xsl:if>
4163
-
4164
-
4165
- <xsl:apply-templates/>
4166
- </fo:basic-link>
4167
- </fo:inline>
4241
+
4242
+ <xsl:variable name="bibitemid">
4243
+ <xsl:choose>
4244
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4245
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4246
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4247
+ </xsl:choose>
4248
+ </xsl:variable>
4249
+
4250
+ <xsl:choose>
4251
+ <xsl:when test="normalize-space($bibitemid) != ''">
4252
+ <fo:inline xsl:use-attribute-sets="eref-style">
4253
+ <xsl:if test="@type = 'footnote'">
4254
+
4255
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4256
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4257
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4258
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4259
+
4260
+
4261
+ </xsl:if>
4262
+
4263
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4264
+ <xsl:if test="normalize-space(@citeas) = ''">
4265
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4266
+ </xsl:if>
4267
+ <xsl:if test="@type = 'inline'">
4268
+
4269
+
4270
+
4271
+ </xsl:if>
4272
+
4273
+ <xsl:apply-templates/>
4274
+ </fo:basic-link>
4275
+
4276
+ </fo:inline>
4277
+ </xsl:when>
4278
+ <xsl:otherwise>
4279
+ <fo:inline><xsl:apply-templates/></fo:inline>
4280
+ </xsl:otherwise>
4281
+ </xsl:choose>
4168
4282
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4169
4283
  <!-- zero-space char -->
4170
4284
  <xsl:variable name="depth">
@@ -4354,6 +4468,153 @@
4354
4468
  </fo:block>
4355
4469
  </xsl:otherwise>
4356
4470
  </xsl:choose>
4471
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4472
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4473
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4474
+ </xsl:for-each>
4475
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4476
+ <xsl:copy>
4477
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4478
+ </xsl:copy>
4479
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4480
+ <xsl:variable name="id">
4481
+ <xsl:call-template name="generateIndexXrefId"/>
4482
+ </xsl:variable>
4483
+ <xsl:copy> <!-- add id to xref -->
4484
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4485
+ <xsl:attribute name="id">
4486
+ <xsl:value-of select="$id"/>
4487
+ </xsl:attribute>
4488
+ <xsl:apply-templates mode="index_add_id"/>
4489
+ </xsl:copy>
4490
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4491
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4492
+ <xsl:if test="@to">
4493
+ <xsl:value-of select="$dash"/>
4494
+ <xsl:copy>
4495
+ <xsl:copy-of select="@*"/>
4496
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4497
+ <xsl:attribute name="id">
4498
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4499
+ </xsl:attribute>
4500
+ <xsl:apply-templates mode="index_add_id"/>
4501
+ </xsl:copy>
4502
+ </xsl:if>
4503
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4504
+ <xsl:copy>
4505
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4506
+ </xsl:copy>
4507
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4508
+ <xsl:copy>
4509
+ <xsl:apply-templates select="@*" mode="index_update"/>
4510
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4511
+ </xsl:copy>
4512
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4513
+ <xsl:param name="element"/>
4514
+ <xsl:param name="remove" select="'false'"/>
4515
+ <xsl:param name="target"/>
4516
+ <!-- <node></node> -->
4517
+ <xsl:choose>
4518
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4519
+ <!-- skip text (i.e. remove it) and process next element -->
4520
+ <!-- [removed_<xsl:value-of select="."/>] -->
4521
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4522
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4523
+ </xsl:apply-templates>
4524
+ </xsl:when>
4525
+ <xsl:when test="self::text()">
4526
+ <xsl:value-of select="."/>
4527
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4528
+ </xsl:when>
4529
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4530
+ <xsl:variable name="id" select="@id"/>
4531
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4532
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4533
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4534
+
4535
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4536
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4537
+
4538
+ <xsl:choose>
4539
+ <!-- 2nd pass -->
4540
+ <!-- if page is equal to page for next and page is not the end of range -->
4541
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4542
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4543
+ <!-- [removed_xref] -->
4544
+
4545
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4546
+ <xsl:with-param name="remove">true</xsl:with-param>
4547
+ <xsl:with-param name="target">
4548
+ <xsl:choose>
4549
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4550
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4551
+ </xsl:choose>
4552
+ </xsl:with-param>
4553
+ </xsl:apply-templates>
4554
+ </xsl:when>
4555
+
4556
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4557
+ <!-- remove xref -->
4558
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4559
+ <xsl:with-param name="remove">true</xsl:with-param>
4560
+ </xsl:apply-templates>
4561
+ </xsl:when>
4562
+
4563
+ <xsl:otherwise>
4564
+ <xsl:apply-templates select="." mode="xref_copy">
4565
+ <xsl:with-param name="target" select="$target"/>
4566
+ </xsl:apply-templates>
4567
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4568
+ </xsl:otherwise>
4569
+ </xsl:choose>
4570
+ </xsl:when>
4571
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4572
+ <!-- ul -->
4573
+ <xsl:apply-templates select="." mode="index_update"/>
4574
+ </xsl:when>
4575
+ <xsl:otherwise>
4576
+ <xsl:apply-templates select="." mode="xref_copy">
4577
+ <xsl:with-param name="target" select="$target"/>
4578
+ </xsl:apply-templates>
4579
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4580
+ </xsl:otherwise>
4581
+ </xsl:choose>
4582
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4583
+ <xsl:param name="target"/>
4584
+ <xsl:copy>
4585
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4586
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4587
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4588
+ </xsl:if>
4589
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4590
+ </xsl:copy>
4591
+ </xsl:template><xsl:template name="generateIndexXrefId">
4592
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4593
+
4594
+ <xsl:variable name="docid">
4595
+ <xsl:call-template name="getDocumentId"/>
4596
+ </xsl:variable>
4597
+ <xsl:variable name="item_number">
4598
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4599
+ </xsl:variable>
4600
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4601
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4602
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4603
+ <xsl:apply-templates/>
4604
+ <fo:block>
4605
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4606
+ <fo:block> </fo:block>
4607
+ </xsl:if>
4608
+ </fo:block>
4609
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4610
+ <xsl:apply-templates/>
4611
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4612
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4613
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4614
+ <xsl:apply-templates/>
4615
+ </fo:block>
4616
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4617
+ <fo:inline id="{@id}" font-size="1pt"/>
4357
4618
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4358
4619
  <!-- <row>
4359
4620
  <date>05-07-2013</date>
@@ -4541,7 +4802,7 @@
4541
4802
  <xsl:param name="charDelim" select="', '"/>
4542
4803
  <xsl:choose>
4543
4804
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4544
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4805
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4545
4806
  <xsl:sort data-type="text" order="ascending"/>
4546
4807
  <xsl:call-template name="insertKeyword">
4547
4808
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4550,7 +4811,7 @@
4550
4811
  </xsl:for-each>
4551
4812
  </xsl:when>
4552
4813
  <xsl:otherwise>
4553
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4814
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4554
4815
  <xsl:call-template name="insertKeyword">
4555
4816
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4556
4817
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4567,63 +4828,71 @@
4567
4828
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4568
4829
  </xsl:choose>
4569
4830
  </xsl:template><xsl:template name="addPDFUAmeta">
4570
- <fo:declarations>
4571
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4572
- <pdf:dictionary type="normal" key="ViewerPreferences">
4573
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4574
- </pdf:dictionary>
4575
- </pdf:catalog>
4576
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4577
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4578
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4579
- <!-- Dublin Core properties go here -->
4580
- <dc:title>
4581
- <xsl:variable name="title">
4831
+ <xsl:variable name="lang">
4832
+ <xsl:call-template name="getLang"/>
4833
+ </xsl:variable>
4834
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4835
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4836
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4837
+ </pdf:dictionary>
4838
+ </pdf:catalog>
4839
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4840
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4841
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4842
+ <!-- Dublin Core properties go here -->
4843
+ <dc:title>
4844
+ <xsl:variable name="title">
4845
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4846
+
4847
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4582
4848
 
4583
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4584
4849
 
4585
4850
 
4586
4851
 
4587
4852
 
4588
4853
 
4589
- </xsl:variable>
4590
- <xsl:choose>
4591
- <xsl:when test="normalize-space($title) != ''">
4592
- <xsl:value-of select="$title"/>
4593
- </xsl:when>
4594
- <xsl:otherwise>
4595
- <xsl:text> </xsl:text>
4596
- </xsl:otherwise>
4597
- </xsl:choose>
4598
- </dc:title>
4599
- <dc:creator>
4854
+ </xsl:for-each>
4855
+ </xsl:variable>
4856
+ <xsl:choose>
4857
+ <xsl:when test="normalize-space($title) != ''">
4858
+ <xsl:value-of select="$title"/>
4859
+ </xsl:when>
4860
+ <xsl:otherwise>
4861
+ <xsl:text> </xsl:text>
4862
+ </xsl:otherwise>
4863
+ </xsl:choose>
4864
+ </dc:title>
4865
+ <dc:creator>
4866
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4600
4867
 
4868
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4869
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4870
+ <xsl:if test="position() != last()">; </xsl:if>
4871
+ </xsl:for-each>
4601
4872
 
4602
4873
 
4603
- </dc:creator>
4604
- <dc:description>
4605
- <xsl:variable name="abstract">
4606
-
4607
-
4608
-
4609
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4610
-
4611
-
4612
-
4613
- </xsl:variable>
4614
- <xsl:value-of select="normalize-space($abstract)"/>
4615
- </dc:description>
4616
- <pdf:Keywords>
4617
- <xsl:call-template name="insertKeywords"/>
4618
- </pdf:Keywords>
4619
- </rdf:Description>
4620
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4621
- <!-- XMP properties go here -->
4622
- <xmp:CreatorTool/>
4623
- </rdf:Description>
4624
- </rdf:RDF>
4625
- </x:xmpmeta>
4626
- </fo:declarations>
4874
+
4875
+ </xsl:for-each>
4876
+ </dc:creator>
4877
+ <dc:description>
4878
+ <xsl:variable name="abstract">
4879
+
4880
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4881
+
4882
+
4883
+ </xsl:variable>
4884
+ <xsl:value-of select="normalize-space($abstract)"/>
4885
+ </dc:description>
4886
+ <pdf:Keywords>
4887
+ <xsl:call-template name="insertKeywords"/>
4888
+ </pdf:Keywords>
4889
+ </rdf:Description>
4890
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4891
+ <!-- XMP properties go here -->
4892
+ <xmp:CreatorTool/>
4893
+ </rdf:Description>
4894
+ </rdf:RDF>
4895
+ </x:xmpmeta>
4627
4896
  </xsl:template><xsl:template name="getId">
4628
4897
  <xsl:choose>
4629
4898
  <xsl:when test="../@id">