metanorma-nist 1.2.10 → 1.2.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,7 +31,17 @@
31
31
  </xsl:choose>
32
32
  </xsl:variable>
33
33
  <xsl:variable name="color">rgb(36, 64, 97)</xsl:variable>
34
- <xsl:variable name="seriestitle" select="/nist:nist-standard/nist:bibdata/nist:series[@type = 'main']/nist:title"/>
34
+ <xsl:variable name="seriestitle">
35
+ <xsl:choose>
36
+ <xsl:when test="normalize-space(/nist:nist-standard/nist:bibdata/nist:series[@type = 'main']/nist:abbreviation) = 'NIST CSTS'">
37
+ <xsl:value-of select="/nist:nist-standard/nist:bibdata/nist:series[@type = 'secondary']/nist:title"/>
38
+ </xsl:when>
39
+ <xsl:otherwise>
40
+ <xsl:value-of select="/nist:nist-standard/nist:bibdata/nist:series[@type = 'main']/nist:title"/>
41
+ </xsl:otherwise>
42
+ </xsl:choose>
43
+ </xsl:variable>
44
+
35
45
  <!-- Example:
36
46
  <item level="1" id="Foreword" display="true">Foreword</item>
37
47
  <item id="term-script" display="false">3.2</item>
@@ -1290,6 +1300,7 @@
1290
1300
 
1291
1301
 
1292
1302
 
1303
+
1293
1304
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1294
1305
 
1295
1306
 
@@ -1410,6 +1421,7 @@
1410
1421
 
1411
1422
 
1412
1423
 
1424
+
1413
1425
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1414
1426
 
1415
1427
 
@@ -1536,200 +1548,239 @@
1536
1548
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1537
1549
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1538
1550
  <xsl:call-template name="add-zero-spaces-java"/>
1539
- </xsl:template><xsl:template match="*[local-name()='table']">
1551
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1540
1552
 
1541
- <xsl:variable name="simple-table">
1542
- <xsl:call-template name="getSimpleTable"/>
1543
- </xsl:variable>
1553
+ <xsl:variable name="table">
1544
1554
 
1545
-
1546
-
1547
-
1548
-
1549
- <!-- <xsl:if test="$namespace = 'bipm'">
1550
- <fo:block>&#xA0;</fo:block>
1551
- </xsl:if> -->
1552
-
1553
- <!-- $namespace = 'iso' or -->
1554
-
1555
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1556
-
1557
-
1555
+ <xsl:variable name="simple-table">
1556
+ <xsl:call-template name="getSimpleTable"/>
1557
+ </xsl:variable>
1558
1558
 
1559
1559
 
1560
-
1561
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1562
-
1563
- <!-- <xsl:variable name="cols-count">
1564
- <xsl:choose>
1565
- <xsl:when test="*[local-name()='thead']">
1566
- <xsl:call-template name="calculate-columns-numbers">
1567
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1568
- </xsl:call-template>
1569
- </xsl:when>
1570
- <xsl:otherwise>
1571
- <xsl:call-template name="calculate-columns-numbers">
1572
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1573
- </xsl:call-template>
1574
- </xsl:otherwise>
1575
- </xsl:choose>
1576
- </xsl:variable> -->
1577
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1578
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1579
-
1580
-
1581
-
1582
- <xsl:variable name="colwidths">
1583
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1584
- <xsl:call-template name="calculate-column-widths">
1585
- <xsl:with-param name="cols-count" select="$cols-count"/>
1586
- <xsl:with-param name="table" select="$simple-table"/>
1587
- </xsl:call-template>
1588
- </xsl:if>
1589
- </xsl:variable>
1590
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1591
-
1592
- <!-- <xsl:variable name="colwidths2">
1593
- <xsl:call-template name="calculate-column-widths">
1594
- <xsl:with-param name="cols-count" select="$cols-count"/>
1595
- </xsl:call-template>
1596
- </xsl:variable> -->
1597
-
1598
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1599
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1600
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1601
-
1602
- <xsl:variable name="margin-left">
1603
- <xsl:choose>
1604
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1605
- <xsl:otherwise>0</xsl:otherwise>
1606
- </xsl:choose>
1607
- </xsl:variable>
1608
-
1609
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1610
1560
 
1611
1561
 
1612
- <xsl:attribute name="space-after">6pt</xsl:attribute>
1613
1562
 
1614
-
1615
-
1616
-
1563
+ <!-- <xsl:if test="$namespace = 'bipm'">
1564
+ <fo:block>&#xA0;</fo:block>
1565
+ </xsl:if> -->
1617
1566
 
1567
+ <!-- $namespace = 'iso' or -->
1618
1568
 
1619
- <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
1620
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1621
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1622
- </xsl:if>
1623
- <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
1624
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1625
- <xsl:attribute name="font-size">12pt</xsl:attribute>
1626
- </xsl:if>
1627
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1569
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1628
1570
 
1629
-
1571
+
1630
1572
 
1573
+
1631
1574
 
1575
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1632
1576
 
1577
+ <!-- <xsl:variable name="cols-count">
1578
+ <xsl:choose>
1579
+ <xsl:when test="*[local-name()='thead']">
1580
+ <xsl:call-template name="calculate-columns-numbers">
1581
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1582
+ </xsl:call-template>
1583
+ </xsl:when>
1584
+ <xsl:otherwise>
1585
+ <xsl:call-template name="calculate-columns-numbers">
1586
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1587
+ </xsl:call-template>
1588
+ </xsl:otherwise>
1589
+ </xsl:choose>
1590
+ </xsl:variable> -->
1591
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1592
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1633
1593
 
1634
1594
 
1635
1595
 
1596
+ <xsl:variable name="colwidths">
1597
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1598
+ <xsl:call-template name="calculate-column-widths">
1599
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1600
+ <xsl:with-param name="table" select="$simple-table"/>
1601
+ </xsl:call-template>
1602
+ </xsl:if>
1603
+ </xsl:variable>
1604
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1605
+
1606
+ <!-- <xsl:variable name="colwidths2">
1607
+ <xsl:call-template name="calculate-column-widths">
1608
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1609
+ </xsl:call-template>
1610
+ </xsl:variable> -->
1611
+
1612
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1613
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1614
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1636
1615
 
1637
- <xsl:variable name="table_attributes">
1638
- <attribute name="table-layout">fixed</attribute>
1639
- <attribute name="width">100%</attribute>
1640
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1641
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1616
+ <xsl:variable name="margin-left">
1617
+ <xsl:choose>
1618
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1619
+ <xsl:otherwise>0</xsl:otherwise>
1620
+ </xsl:choose>
1621
+ </xsl:variable>
1622
+
1623
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1642
1624
 
1643
1625
 
1626
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
1644
1627
 
1628
+
1629
+
1630
+
1645
1631
 
1646
-
1647
-
1648
-
1649
1632
 
1650
-
1633
+ <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
1634
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1635
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1636
+ </xsl:if>
1637
+ <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
1638
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1639
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
1640
+ </xsl:if>
1641
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1651
1642
 
1652
- </xsl:variable>
1653
-
1654
-
1655
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1643
+
1656
1644
 
1657
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1658
- <xsl:attribute name="{@name}">
1659
- <xsl:value-of select="."/>
1660
- </xsl:attribute>
1661
- </xsl:for-each>
1662
1645
 
1663
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1664
- <xsl:if test="$isNoteOrFnExist = 'true'">
1665
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1666
- </xsl:if>
1667
1646
 
1668
- <xsl:choose>
1669
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1670
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1671
- <fo:table-column column-width="{@width}"/>
1672
- </xsl:for-each>
1673
- </xsl:when>
1674
- <xsl:otherwise>
1675
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1676
- <xsl:choose>
1677
- <xsl:when test=". = 1 or . = 0">
1678
- <fo:table-column column-width="proportional-column-width(2)"/>
1679
- </xsl:when>
1680
- <xsl:otherwise>
1681
- <fo:table-column column-width="proportional-column-width({.})"/>
1682
- </xsl:otherwise>
1683
- </xsl:choose>
1684
- </xsl:for-each>
1685
- </xsl:otherwise>
1686
- </xsl:choose>
1687
1647
 
1688
- <xsl:choose>
1689
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1690
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1691
- </xsl:when>
1692
- <xsl:otherwise>
1693
- <xsl:apply-templates/>
1694
- </xsl:otherwise>
1695
- </xsl:choose>
1696
1648
 
1697
- </fo:table>
1698
-
1699
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1700
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1701
- <xsl:call-template name="insertTableFooterInSeparateTable">
1702
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1703
- <xsl:with-param name="colwidths" select="$colwidths"/>
1704
- <xsl:with-param name="colgroup" select="$colgroup"/>
1705
- </xsl:call-template>
1706
- </xsl:for-each>
1707
-
1708
- <!-- insert footer as table -->
1709
- <!-- <fo:table>
1710
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1711
- <xsl:attribute name="{@name}">
1712
- <xsl:value-of select="."/>
1713
- </xsl:attribute>
1714
- </xsl:for-each>
1715
1649
 
1716
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1650
+ <xsl:variable name="table_width">
1651
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1652
+ 100%
1653
+
1654
+
1655
+ </xsl:variable>
1656
+
1657
+ <xsl:variable name="table_attributes">
1658
+ <attribute name="table-layout">fixed</attribute>
1659
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1660
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1661
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1662
+
1663
+
1664
+
1665
+
1666
+
1667
+
1668
+
1669
+
1670
+
1671
+
1672
+ </xsl:variable>
1673
+
1674
+
1675
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1676
+
1677
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1678
+ <xsl:attribute name="{@name}">
1679
+ <xsl:value-of select="."/>
1680
+ </xsl:attribute>
1681
+ </xsl:for-each>
1682
+
1683
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1684
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1685
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1686
+ </xsl:if>
1687
+
1717
1688
  <xsl:choose>
1718
- <xsl:when test=". = 1 or . = 0">
1719
- <fo:table-column column-width="proportional-column-width(2)"/>
1689
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1690
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1691
+ <fo:table-column column-width="{@width}"/>
1692
+ </xsl:for-each>
1720
1693
  </xsl:when>
1721
1694
  <xsl:otherwise>
1722
- <fo:table-column column-width="proportional-column-width({.})"/>
1695
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1696
+ <xsl:choose>
1697
+ <xsl:when test=". = 1 or . = 0">
1698
+ <fo:table-column column-width="proportional-column-width(2)"/>
1699
+ </xsl:when>
1700
+ <xsl:otherwise>
1701
+ <fo:table-column column-width="proportional-column-width({.})"/>
1702
+ </xsl:otherwise>
1703
+ </xsl:choose>
1704
+ </xsl:for-each>
1723
1705
  </xsl:otherwise>
1724
1706
  </xsl:choose>
1707
+
1708
+ <xsl:choose>
1709
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1710
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1711
+ </xsl:when>
1712
+ <xsl:otherwise>
1713
+ <xsl:apply-templates/>
1714
+ </xsl:otherwise>
1715
+ </xsl:choose>
1716
+
1717
+ </fo:table>
1718
+
1719
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1720
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1721
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1722
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1723
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1724
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1725
+ </xsl:call-template>
1725
1726
  </xsl:for-each>
1726
- </fo:table>-->
1727
-
1728
-
1729
-
1730
-
1731
-
1732
- </fo:block-container>
1727
+
1728
+ <!-- insert footer as table -->
1729
+ <!-- <fo:table>
1730
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1731
+ <xsl:attribute name="{@name}">
1732
+ <xsl:value-of select="."/>
1733
+ </xsl:attribute>
1734
+ </xsl:for-each>
1735
+
1736
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1737
+ <xsl:choose>
1738
+ <xsl:when test=". = 1 or . = 0">
1739
+ <fo:table-column column-width="proportional-column-width(2)"/>
1740
+ </xsl:when>
1741
+ <xsl:otherwise>
1742
+ <fo:table-column column-width="proportional-column-width({.})"/>
1743
+ </xsl:otherwise>
1744
+ </xsl:choose>
1745
+ </xsl:for-each>
1746
+ </fo:table>-->
1747
+
1748
+
1749
+
1750
+
1751
+
1752
+ </fo:block-container>
1753
+ </xsl:variable>
1754
+
1755
+
1756
+
1757
+ <xsl:choose>
1758
+ <xsl:when test="@width">
1759
+
1760
+ <!-- centered table when table name is centered (see table-name-style) -->
1761
+
1762
+ <fo:table table-layout="fixed" width="100%">
1763
+ <fo:table-column column-width="proportional-column-width(1)"/>
1764
+ <fo:table-column column-width="{@width}"/>
1765
+ <fo:table-column column-width="proportional-column-width(1)"/>
1766
+ <fo:table-body>
1767
+ <fo:table-row>
1768
+ <fo:table-cell column-number="2">
1769
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
1770
+ </fo:table-cell>
1771
+ </fo:table-row>
1772
+ </fo:table-body>
1773
+ </fo:table>
1774
+
1775
+
1776
+
1777
+
1778
+ </xsl:when>
1779
+ <xsl:otherwise>
1780
+ <xsl:copy-of select="$table"/>
1781
+ </xsl:otherwise>
1782
+ </xsl:choose>
1783
+
1733
1784
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1734
1785
  <xsl:if test="normalize-space() != ''">
1735
1786
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1857,7 +1908,15 @@
1857
1908
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1858
1909
  <xsl:value-of select="@target"/>
1859
1910
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1860
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1911
+ <xsl:variable name="mathml">
1912
+ <xsl:for-each select="*">
1913
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1914
+ <xsl:copy-of select="."/>
1915
+ </xsl:if>
1916
+ </xsl:for-each>
1917
+ </xsl:variable>
1918
+
1919
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1861
1920
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1862
1921
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1863
1922
  <xsl:param name="cols-count"/>
@@ -2570,7 +2629,7 @@
2570
2629
  <xsl:with-param name="table" select="$html-table"/>
2571
2630
  </xsl:call-template>
2572
2631
  </xsl:variable>
2573
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2632
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2574
2633
  <xsl:variable name="maxlength_dt">
2575
2634
  <xsl:call-template name="getMaxLength_dt"/>
2576
2635
  </xsl:variable>
@@ -2599,13 +2658,22 @@
2599
2658
  </xsl:when>
2600
2659
  <xsl:otherwise>
2601
2660
  <xsl:choose>
2661
+ <!-- to set width check most wide chars like `W` -->
2602
2662
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2603
- <fo:table-column column-width="5%"/>
2604
- <fo:table-column column-width="95%"/>
2663
+ <fo:table-column column-width="7%"/>
2664
+ <fo:table-column column-width="93%"/>
2665
+ </xsl:when>
2666
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2667
+ <fo:table-column column-width="15%"/>
2668
+ <fo:table-column column-width="85%"/>
2669
+ </xsl:when>
2670
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2671
+ <fo:table-column column-width="20%"/>
2672
+ <fo:table-column column-width="80%"/>
2605
2673
  </xsl:when>
2606
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2607
- <fo:table-column column-width="10%"/>
2608
- <fo:table-column column-width="90%"/>
2674
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2675
+ <fo:table-column column-width="25%"/>
2676
+ <fo:table-column column-width="75%"/>
2609
2677
  </xsl:when>
2610
2678
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2611
2679
  <fo:table-column column-width="60%"/>
@@ -2817,6 +2885,7 @@
2817
2885
 
2818
2886
 
2819
2887
 
2888
+
2820
2889
 
2821
2890
  </xsl:variable>
2822
2891
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2830,10 +2899,18 @@
2830
2899
  </xsl:if>
2831
2900
  <xsl:apply-templates/>
2832
2901
  </fo:inline>
2902
+ </xsl:template><xsl:template match="*[local-name()='underline']">
2903
+ <fo:inline text-decoration="underline">
2904
+ <xsl:apply-templates/>
2905
+ </fo:inline>
2833
2906
  </xsl:template><xsl:template match="*[local-name()='del']">
2834
2907
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2835
2908
  <xsl:apply-templates/>
2836
2909
  </fo:inline>
2910
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2911
+ <fo:inline background-color="yellow">
2912
+ <xsl:apply-templates/>
2913
+ </fo:inline>
2837
2914
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2838
2915
  <xsl:variable name="text" select="normalize-space(.)"/>
2839
2916
  <fo:inline font-size="75%">
@@ -2923,6 +3000,10 @@
2923
3000
  <xsl:param name="text" select="."/>
2924
3001
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2925
3002
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3003
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
3004
+ <xsl:param name="text" select="."/>
3005
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3006
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2926
3007
  </xsl:template><xsl:template name="add-zero-spaces">
2927
3008
  <xsl:param name="text" select="."/>
2928
3009
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3170,6 +3251,7 @@
3170
3251
  <xsl:apply-templates select="." mode="mathml"/>
3171
3252
  </xsl:variable>
3172
3253
  <fo:instream-foreign-object fox:alt-text="Math">
3254
+
3173
3255
  <!-- <xsl:copy-of select="."/> -->
3174
3256
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3175
3257
  </fo:instream-foreign-object>
@@ -3183,7 +3265,12 @@
3183
3265
  <!-- replace start and end spaces to non-break space -->
3184
3266
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3185
3267
  </xsl:copy>
3186
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3268
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3269
+ <xsl:copy>
3270
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3271
+ </xsl:copy>
3272
+ <mathml:mspace width="0.5ex"/>
3273
+ </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">
3187
3274
  <xsl:variable name="target">
3188
3275
  <xsl:choose>
3189
3276
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3204,7 +3291,10 @@
3204
3291
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3205
3292
  <xsl:choose>
3206
3293
  <xsl:when test="normalize-space(.) = ''">
3207
- <xsl:value-of select="$target"/>
3294
+ <!-- <xsl:value-of select="$target"/> -->
3295
+ <xsl:call-template name="add-zero-spaces-link-java">
3296
+ <xsl:with-param name="text" select="$target"/>
3297
+ </xsl:call-template>
3208
3298
  </xsl:when>
3209
3299
  <xsl:otherwise>
3210
3300
  <xsl:apply-templates/>
@@ -3214,8 +3304,6 @@
3214
3304
  </xsl:otherwise>
3215
3305
  </xsl:choose>
3216
3306
  </fo:inline>
3217
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3218
- <fo:inline id="{@id}"/>
3219
3307
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3220
3308
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3221
3309
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3410,7 +3498,7 @@
3410
3498
  </xsl:if> -->
3411
3499
  </fo:inline>
3412
3500
  </xsl:if>
3413
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3501
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3414
3502
  <fo:block-container id="{@id}">
3415
3503
 
3416
3504
  <fo:block>
@@ -3426,6 +3514,7 @@
3426
3514
  <fo:block id="{@id}">
3427
3515
  <xsl:apply-templates/>
3428
3516
  </fo:block>
3517
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3429
3518
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3430
3519
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3431
3520
  <xsl:apply-templates/>
@@ -3621,6 +3710,12 @@
3621
3710
  <!-- <xsl:text> </xsl:text> -->
3622
3711
  </xsl:template><xsl:template name="getSection">
3623
3712
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3713
+ <!--
3714
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3715
+ <xsl:value-of select="."/>
3716
+ </xsl:for-each>
3717
+ -->
3718
+
3624
3719
  </xsl:template><xsl:template name="getName">
3625
3720
  <xsl:choose>
3626
3721
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3673,6 +3768,12 @@
3673
3768
  <xsl:copy>
3674
3769
  <xsl:apply-templates mode="contents_item"/>
3675
3770
  </xsl:copy>
3771
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3772
+ <xsl:copy>
3773
+ <xsl:apply-templates mode="contents_item"/>
3774
+ </xsl:copy>
3775
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3776
+ <xsl:copy-of select="."/>
3676
3777
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3677
3778
  <xsl:text> </xsl:text>
3678
3779
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3698,6 +3799,7 @@
3698
3799
 
3699
3800
 
3700
3801
 
3802
+
3701
3803
 
3702
3804
 
3703
3805
  10
@@ -4000,10 +4102,11 @@
4000
4102
  </xsl:choose>
4001
4103
 
4002
4104
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4003
-
4105
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4004
4106
  <xsl:variable name="element">
4005
4107
  block
4006
4108
 
4109
+
4007
4110
  </xsl:variable>
4008
4111
  <xsl:choose>
4009
4112
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4070,11 +4173,13 @@
4070
4173
  </xsl:if>
4071
4174
  </xsl:if>
4072
4175
 
4176
+
4073
4177
  <fo:block-container margin-left="0mm">
4074
4178
 
4075
4179
  <fo:block xsl:use-attribute-sets="quote-style">
4076
4180
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4077
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4181
+
4182
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4078
4183
  </fo:block>
4079
4184
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4080
4185
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4097,31 +4202,49 @@
4097
4202
  <xsl:text>— </xsl:text>
4098
4203
  <xsl:apply-templates/>
4099
4204
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4100
- <fo:inline xsl:use-attribute-sets="eref-style">
4101
- <xsl:if test="@type = 'footnote'">
4102
-
4103
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4104
- <xsl:attribute name="font-size">80%</xsl:attribute>
4105
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4106
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4107
-
4108
-
4109
- </xsl:if>
4110
-
4111
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4112
-
4113
- <xsl:if test="@type = 'inline'">
4114
-
4115
-
4116
-
4117
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
4118
-
4119
- </xsl:if>
4120
-
4121
-
4122
- <xsl:apply-templates/>
4123
- </fo:basic-link>
4124
- </fo:inline>
4205
+
4206
+ <xsl:variable name="bibitemid">
4207
+ <xsl:choose>
4208
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4209
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4210
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4211
+ </xsl:choose>
4212
+ </xsl:variable>
4213
+
4214
+ <xsl:choose>
4215
+ <xsl:when test="normalize-space($bibitemid) != ''">
4216
+ <fo:inline xsl:use-attribute-sets="eref-style">
4217
+ <xsl:if test="@type = 'footnote'">
4218
+
4219
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4220
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4221
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4222
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4223
+
4224
+
4225
+ </xsl:if>
4226
+
4227
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4228
+ <xsl:if test="normalize-space(@citeas) = ''">
4229
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4230
+ </xsl:if>
4231
+ <xsl:if test="@type = 'inline'">
4232
+
4233
+
4234
+
4235
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4236
+
4237
+ </xsl:if>
4238
+
4239
+ <xsl:apply-templates/>
4240
+ </fo:basic-link>
4241
+
4242
+ </fo:inline>
4243
+ </xsl:when>
4244
+ <xsl:otherwise>
4245
+ <fo:inline><xsl:apply-templates/></fo:inline>
4246
+ </xsl:otherwise>
4247
+ </xsl:choose>
4125
4248
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4126
4249
  <!-- zero-space char -->
4127
4250
  <xsl:variable name="depth">
@@ -4227,6 +4350,7 @@
4227
4350
 
4228
4351
 
4229
4352
 
4353
+
4230
4354
 
4231
4355
 
4232
4356
 
@@ -4242,7 +4366,7 @@
4242
4366
  </xsl:if>
4243
4367
 
4244
4368
 
4245
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4369
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4246
4370
  <fo:block break-after="page"/>
4247
4371
  <fo:block>
4248
4372
  <xsl:call-template name="setId"/>
@@ -4250,7 +4374,8 @@
4250
4374
  </fo:block>
4251
4375
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4252
4376
  <fo:block>
4253
- <xsl:call-template name="setId"/>
4377
+ <xsl:call-template name="setId"/>
4378
+
4254
4379
 
4255
4380
  <xsl:apply-templates/>
4256
4381
  </fo:block>
@@ -4303,6 +4428,153 @@
4303
4428
  </fo:block>
4304
4429
  </xsl:otherwise>
4305
4430
  </xsl:choose>
4431
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4432
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4433
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4434
+ </xsl:for-each>
4435
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4436
+ <xsl:copy>
4437
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4438
+ </xsl:copy>
4439
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4440
+ <xsl:variable name="id">
4441
+ <xsl:call-template name="generateIndexXrefId"/>
4442
+ </xsl:variable>
4443
+ <xsl:copy> <!-- add id to xref -->
4444
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4445
+ <xsl:attribute name="id">
4446
+ <xsl:value-of select="$id"/>
4447
+ </xsl:attribute>
4448
+ <xsl:apply-templates mode="index_add_id"/>
4449
+ </xsl:copy>
4450
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4451
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4452
+ <xsl:if test="@to">
4453
+ <xsl:value-of select="$dash"/>
4454
+ <xsl:copy>
4455
+ <xsl:copy-of select="@*"/>
4456
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4457
+ <xsl:attribute name="id">
4458
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4459
+ </xsl:attribute>
4460
+ <xsl:apply-templates mode="index_add_id"/>
4461
+ </xsl:copy>
4462
+ </xsl:if>
4463
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4464
+ <xsl:copy>
4465
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4466
+ </xsl:copy>
4467
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4468
+ <xsl:copy>
4469
+ <xsl:apply-templates select="@*" mode="index_update"/>
4470
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4471
+ </xsl:copy>
4472
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4473
+ <xsl:param name="element"/>
4474
+ <xsl:param name="remove" select="'false'"/>
4475
+ <xsl:param name="target"/>
4476
+ <!-- <node></node> -->
4477
+ <xsl:choose>
4478
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4479
+ <!-- skip text (i.e. remove it) and process next element -->
4480
+ <!-- [removed_<xsl:value-of select="."/>] -->
4481
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4482
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4483
+ </xsl:apply-templates>
4484
+ </xsl:when>
4485
+ <xsl:when test="self::text()">
4486
+ <xsl:value-of select="."/>
4487
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4488
+ </xsl:when>
4489
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4490
+ <xsl:variable name="id" select="@id"/>
4491
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4492
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4493
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4494
+
4495
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4496
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4497
+
4498
+ <xsl:choose>
4499
+ <!-- 2nd pass -->
4500
+ <!-- if page is equal to page for next and page is not the end of range -->
4501
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4502
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4503
+ <!-- [removed_xref] -->
4504
+
4505
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4506
+ <xsl:with-param name="remove">true</xsl:with-param>
4507
+ <xsl:with-param name="target">
4508
+ <xsl:choose>
4509
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4510
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4511
+ </xsl:choose>
4512
+ </xsl:with-param>
4513
+ </xsl:apply-templates>
4514
+ </xsl:when>
4515
+
4516
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4517
+ <!-- remove xref -->
4518
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4519
+ <xsl:with-param name="remove">true</xsl:with-param>
4520
+ </xsl:apply-templates>
4521
+ </xsl:when>
4522
+
4523
+ <xsl:otherwise>
4524
+ <xsl:apply-templates select="." mode="xref_copy">
4525
+ <xsl:with-param name="target" select="$target"/>
4526
+ </xsl:apply-templates>
4527
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4528
+ </xsl:otherwise>
4529
+ </xsl:choose>
4530
+ </xsl:when>
4531
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4532
+ <!-- ul -->
4533
+ <xsl:apply-templates select="." mode="index_update"/>
4534
+ </xsl:when>
4535
+ <xsl:otherwise>
4536
+ <xsl:apply-templates select="." mode="xref_copy">
4537
+ <xsl:with-param name="target" select="$target"/>
4538
+ </xsl:apply-templates>
4539
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4540
+ </xsl:otherwise>
4541
+ </xsl:choose>
4542
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4543
+ <xsl:param name="target"/>
4544
+ <xsl:copy>
4545
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4546
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4547
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4548
+ </xsl:if>
4549
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4550
+ </xsl:copy>
4551
+ </xsl:template><xsl:template name="generateIndexXrefId">
4552
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4553
+
4554
+ <xsl:variable name="docid">
4555
+ <xsl:call-template name="getDocumentId"/>
4556
+ </xsl:variable>
4557
+ <xsl:variable name="item_number">
4558
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4559
+ </xsl:variable>
4560
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4561
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4562
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4563
+ <xsl:apply-templates/>
4564
+ <fo:block>
4565
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4566
+ <fo:block> </fo:block>
4567
+ </xsl:if>
4568
+ </fo:block>
4569
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4570
+ <xsl:apply-templates/>
4571
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4572
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4573
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4574
+ <xsl:apply-templates/>
4575
+ </fo:block>
4576
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
4577
+ <fo:inline id="{@id}"/>
4306
4578
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4307
4579
  <!-- <row>
4308
4580
  <date>05-07-2013</date>
@@ -4400,6 +4672,8 @@
4400
4672
  <xsl:value-of select="translate(.,'. ','')"/>
4401
4673
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4402
4674
  <xsl:value-of select="substring(.,1,1)"/>
4675
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4676
+ <fo:inline><xsl:apply-templates/></fo:inline>
4403
4677
  </xsl:template><xsl:template name="convertDate">
4404
4678
  <xsl:param name="date"/>
4405
4679
  <xsl:param name="format" select="'short'"/>
@@ -4424,6 +4698,57 @@
4424
4698
  </xsl:variable>
4425
4699
  <xsl:variable name="result">
4426
4700
  <xsl:choose>
4701
+ <xsl:when test="$format = 'ddMMyyyy'">
4702
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4703
+ <xsl:text> </xsl:text>
4704
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4705
+ </xsl:when>
4706
+ <xsl:when test="$format = 'ddMM'">
4707
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4708
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4709
+ </xsl:when>
4710
+ <xsl:when test="$format = 'short' or $day = ''">
4711
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4712
+ </xsl:when>
4713
+ <xsl:otherwise>
4714
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4715
+ </xsl:otherwise>
4716
+ </xsl:choose>
4717
+ </xsl:variable>
4718
+ <xsl:value-of select="$result"/>
4719
+ </xsl:template><xsl:template name="convertDateLocalized">
4720
+ <xsl:param name="date"/>
4721
+ <xsl:param name="format" select="'short'"/>
4722
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4723
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4724
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4725
+ <xsl:variable name="monthStr">
4726
+ <xsl:choose>
4727
+ <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>
4728
+ <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>
4729
+ <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>
4730
+ <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>
4731
+ <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>
4732
+ <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>
4733
+ <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>
4734
+ <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>
4735
+ <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>
4736
+ <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>
4737
+ <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>
4738
+ <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>
4739
+ </xsl:choose>
4740
+ </xsl:variable>
4741
+ <xsl:variable name="result">
4742
+ <xsl:choose>
4743
+ <xsl:when test="$format = 'ddMMyyyy'">
4744
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4745
+ <xsl:text> </xsl:text>
4746
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4747
+ </xsl:when>
4748
+ <xsl:when test="$format = 'ddMM'">
4749
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4750
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4751
+ </xsl:when>
4427
4752
  <xsl:when test="$format = 'short' or $day = ''">
4428
4753
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4429
4754
  </xsl:when>
@@ -4439,7 +4764,7 @@
4439
4764
  <xsl:param name="charDelim" select="', '"/>
4440
4765
  <xsl:choose>
4441
4766
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4442
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4767
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4443
4768
  <xsl:sort data-type="text" order="ascending"/>
4444
4769
  <xsl:call-template name="insertKeyword">
4445
4770
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4448,7 +4773,7 @@
4448
4773
  </xsl:for-each>
4449
4774
  </xsl:when>
4450
4775
  <xsl:otherwise>
4451
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4776
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4452
4777
  <xsl:call-template name="insertKeyword">
4453
4778
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4454
4779
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4465,68 +4790,71 @@
4465
4790
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4466
4791
  </xsl:choose>
4467
4792
  </xsl:template><xsl:template name="addPDFUAmeta">
4468
- <fo:declarations>
4469
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4470
- <pdf:dictionary type="normal" key="ViewerPreferences">
4471
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4472
- </pdf:dictionary>
4473
- </pdf:catalog>
4474
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4475
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4476
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4477
- <!-- Dublin Core properties go here -->
4478
- <dc:title>
4479
- <xsl:variable name="title">
4793
+ <xsl:variable name="lang">
4794
+ <xsl:call-template name="getLang"/>
4795
+ </xsl:variable>
4796
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4797
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4798
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4799
+ </pdf:dictionary>
4800
+ </pdf:catalog>
4801
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4802
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4803
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4804
+ <!-- Dublin Core properties go here -->
4805
+ <dc:title>
4806
+ <xsl:variable name="title">
4807
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4808
+
4809
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4480
4810
 
4481
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4482
4811
 
4483
4812
 
4484
4813
 
4485
4814
 
4486
4815
 
4487
- </xsl:variable>
4488
- <xsl:choose>
4489
- <xsl:when test="normalize-space($title) != ''">
4490
- <xsl:value-of select="$title"/>
4491
- </xsl:when>
4492
- <xsl:otherwise>
4493
- <xsl:text> </xsl:text>
4494
- </xsl:otherwise>
4495
- </xsl:choose>
4496
- </dc:title>
4497
- <dc:creator>
4816
+ </xsl:for-each>
4817
+ </xsl:variable>
4818
+ <xsl:choose>
4819
+ <xsl:when test="normalize-space($title) != ''">
4820
+ <xsl:value-of select="$title"/>
4821
+ </xsl:when>
4822
+ <xsl:otherwise>
4823
+ <xsl:text> </xsl:text>
4824
+ </xsl:otherwise>
4825
+ </xsl:choose>
4826
+ </dc:title>
4827
+ <dc:creator>
4828
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4498
4829
 
4499
4830
 
4500
4831
 
4501
- <xsl:for-each select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4832
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4502
4833
  <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
4503
4834
  <xsl:if test="position() != last()">; </xsl:if>
4504
4835
  </xsl:for-each>
4505
4836
 
4506
- </dc:creator>
4507
- <dc:description>
4508
- <xsl:variable name="abstract">
4509
-
4510
-
4511
-
4512
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4513
-
4514
-
4515
-
4516
- </xsl:variable>
4517
- <xsl:value-of select="normalize-space($abstract)"/>
4518
- </dc:description>
4519
- <pdf:Keywords>
4520
- <xsl:call-template name="insertKeywords"/>
4521
- </pdf:Keywords>
4522
- </rdf:Description>
4523
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4524
- <!-- XMP properties go here -->
4525
- <xmp:CreatorTool/>
4526
- </rdf:Description>
4527
- </rdf:RDF>
4528
- </x:xmpmeta>
4529
- </fo:declarations>
4837
+ </xsl:for-each>
4838
+ </dc:creator>
4839
+ <dc:description>
4840
+ <xsl:variable name="abstract">
4841
+
4842
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4843
+
4844
+
4845
+ </xsl:variable>
4846
+ <xsl:value-of select="normalize-space($abstract)"/>
4847
+ </dc:description>
4848
+ <pdf:Keywords>
4849
+ <xsl:call-template name="insertKeywords"/>
4850
+ </pdf:Keywords>
4851
+ </rdf:Description>
4852
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4853
+ <!-- XMP properties go here -->
4854
+ <xmp:CreatorTool/>
4855
+ </rdf:Description>
4856
+ </rdf:RDF>
4857
+ </x:xmpmeta>
4530
4858
  </xsl:template><xsl:template name="getId">
4531
4859
  <xsl:choose>
4532
4860
  <xsl:when test="../@id">
@@ -4623,6 +4951,7 @@
4623
4951
 
4624
4952
 
4625
4953
 
4954
+
4626
4955
  </xsl:variable>
4627
4956
  <xsl:if test="$documentNS != $XSLNS">
4628
4957
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4682,6 +5011,11 @@
4682
5011
  <xsl:call-template name="getLang"/>
4683
5012
  </xsl:variable>
4684
5013
 
4685
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5014
+ <xsl:choose>
5015
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5016
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5017
+ </xsl:when>
5018
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5019
+ </xsl:choose>
4686
5020
 
4687
5021
  </xsl:template></xsl:stylesheet>