metanorma-ribose 1.6.10 → 1.6.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
7
8
 
8
9
  <xsl:variable name="pageWidth" select="'210mm'"/>
@@ -89,7 +90,9 @@
89
90
  </fo:page-sequence-master>
90
91
  </fo:layout-master-set>
91
92
 
92
- <xsl:call-template name="addPDFUAmeta"/>
93
+ <fo:declarations>
94
+ <xsl:call-template name="addPDFUAmeta"/>
95
+ </fo:declarations>
93
96
 
94
97
  <xsl:call-template name="addBookmarks">
95
98
  <xsl:with-param name="contents" select="$contents"/>
@@ -1161,6 +1164,7 @@
1161
1164
 
1162
1165
 
1163
1166
 
1167
+
1164
1168
 
1165
1169
  <xsl:attribute name="margin-bottom">14pt</xsl:attribute>
1166
1170
 
@@ -1297,6 +1301,7 @@
1297
1301
 
1298
1302
 
1299
1303
 
1304
+
1300
1305
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1301
1306
 
1302
1307
  <xsl:attribute name="text-align">right</xsl:attribute>
@@ -1440,188 +1445,227 @@
1440
1445
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1441
1446
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1442
1447
  <xsl:call-template name="add-zero-spaces-java"/>
1443
- </xsl:template><xsl:template match="*[local-name()='table']">
1448
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1444
1449
 
1445
- <xsl:variable name="simple-table">
1446
- <xsl:call-template name="getSimpleTable"/>
1447
- </xsl:variable>
1450
+ <xsl:variable name="table">
1448
1451
 
1449
-
1450
-
1451
-
1452
-
1453
- <!-- <xsl:if test="$namespace = 'bipm'">
1454
- <fo:block>&#xA0;</fo:block>
1455
- </xsl:if> -->
1456
-
1457
- <!-- $namespace = 'iso' or -->
1458
-
1459
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1460
-
1461
-
1452
+ <xsl:variable name="simple-table">
1453
+ <xsl:call-template name="getSimpleTable"/>
1454
+ </xsl:variable>
1462
1455
 
1463
1456
 
1464
-
1465
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1466
-
1467
- <!-- <xsl:variable name="cols-count">
1468
- <xsl:choose>
1469
- <xsl:when test="*[local-name()='thead']">
1470
- <xsl:call-template name="calculate-columns-numbers">
1471
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1472
- </xsl:call-template>
1473
- </xsl:when>
1474
- <xsl:otherwise>
1475
- <xsl:call-template name="calculate-columns-numbers">
1476
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1477
- </xsl:call-template>
1478
- </xsl:otherwise>
1479
- </xsl:choose>
1480
- </xsl:variable> -->
1481
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1482
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1483
-
1484
-
1485
-
1486
- <xsl:variable name="colwidths">
1487
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1488
- <xsl:call-template name="calculate-column-widths">
1489
- <xsl:with-param name="cols-count" select="$cols-count"/>
1490
- <xsl:with-param name="table" select="$simple-table"/>
1491
- </xsl:call-template>
1492
- </xsl:if>
1493
- </xsl:variable>
1494
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1495
-
1496
- <!-- <xsl:variable name="colwidths2">
1497
- <xsl:call-template name="calculate-column-widths">
1498
- <xsl:with-param name="cols-count" select="$cols-count"/>
1499
- </xsl:call-template>
1500
- </xsl:variable> -->
1501
-
1502
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1503
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1504
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1505
-
1506
- <xsl:variable name="margin-left">
1507
- <xsl:choose>
1508
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1509
- <xsl:otherwise>0</xsl:otherwise>
1510
- </xsl:choose>
1511
- </xsl:variable>
1512
-
1513
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1514
1457
 
1515
1458
 
1516
-
1517
-
1518
-
1519
1459
 
1460
+ <!-- <xsl:if test="$namespace = 'bipm'">
1461
+ <fo:block>&#xA0;</fo:block>
1462
+ </xsl:if> -->
1463
+
1464
+ <!-- $namespace = 'iso' or -->
1520
1465
 
1521
-
1466
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1467
+
1468
+
1469
+
1470
+
1471
+
1472
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1522
1473
 
1474
+ <!-- <xsl:variable name="cols-count">
1475
+ <xsl:choose>
1476
+ <xsl:when test="*[local-name()='thead']">
1477
+ <xsl:call-template name="calculate-columns-numbers">
1478
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1479
+ </xsl:call-template>
1480
+ </xsl:when>
1481
+ <xsl:otherwise>
1482
+ <xsl:call-template name="calculate-columns-numbers">
1483
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1484
+ </xsl:call-template>
1485
+ </xsl:otherwise>
1486
+ </xsl:choose>
1487
+ </xsl:variable> -->
1488
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1489
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1523
1490
 
1524
1491
 
1525
1492
 
1493
+ <xsl:variable name="colwidths">
1494
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1495
+ <xsl:call-template name="calculate-column-widths">
1496
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1497
+ <xsl:with-param name="table" select="$simple-table"/>
1498
+ </xsl:call-template>
1499
+ </xsl:if>
1500
+ </xsl:variable>
1501
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1526
1502
 
1503
+ <!-- <xsl:variable name="colwidths2">
1504
+ <xsl:call-template name="calculate-column-widths">
1505
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1506
+ </xsl:call-template>
1507
+ </xsl:variable> -->
1527
1508
 
1509
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1510
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1511
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1528
1512
 
1529
- <xsl:variable name="table_attributes">
1530
- <attribute name="table-layout">fixed</attribute>
1531
- <attribute name="width">100%</attribute>
1532
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1533
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1513
+ <xsl:variable name="margin-left">
1514
+ <xsl:choose>
1515
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1516
+ <xsl:otherwise>0</xsl:otherwise>
1517
+ </xsl:choose>
1518
+ </xsl:variable>
1519
+
1520
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1534
1521
 
1535
1522
 
1523
+
1524
+
1525
+
1536
1526
 
1537
1527
 
1538
-
1539
-
1540
-
1528
+
1541
1529
 
1542
-
1543
1530
 
1544
- </xsl:variable>
1545
-
1546
-
1547
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1548
1531
 
1549
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1550
- <xsl:attribute name="{@name}">
1551
- <xsl:value-of select="."/>
1552
- </xsl:attribute>
1553
- </xsl:for-each>
1554
1532
 
1555
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1556
- <xsl:if test="$isNoteOrFnExist = 'true'">
1557
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1558
- </xsl:if>
1559
1533
 
1560
- <xsl:choose>
1561
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1562
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1563
- <fo:table-column column-width="{@width}"/>
1564
- </xsl:for-each>
1565
- </xsl:when>
1566
- <xsl:otherwise>
1567
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1568
- <xsl:choose>
1569
- <xsl:when test=". = 1 or . = 0">
1570
- <fo:table-column column-width="proportional-column-width(2)"/>
1571
- </xsl:when>
1572
- <xsl:otherwise>
1573
- <fo:table-column column-width="proportional-column-width({.})"/>
1574
- </xsl:otherwise>
1575
- </xsl:choose>
1576
- </xsl:for-each>
1577
- </xsl:otherwise>
1578
- </xsl:choose>
1579
1534
 
1580
- <xsl:choose>
1581
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1582
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1583
- </xsl:when>
1584
- <xsl:otherwise>
1585
- <xsl:apply-templates/>
1586
- </xsl:otherwise>
1587
- </xsl:choose>
1535
+ <xsl:variable name="table_width">
1536
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1537
+ 100%
1538
+
1539
+
1540
+ </xsl:variable>
1588
1541
 
1589
- </fo:table>
1590
-
1591
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1592
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1593
- <xsl:call-template name="insertTableFooterInSeparateTable">
1594
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1595
- <xsl:with-param name="colwidths" select="$colwidths"/>
1596
- <xsl:with-param name="colgroup" select="$colgroup"/>
1597
- </xsl:call-template>
1598
- </xsl:for-each>
1599
-
1600
- <!-- insert footer as table -->
1601
- <!-- <fo:table>
1602
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1603
- <xsl:attribute name="{@name}">
1604
- <xsl:value-of select="."/>
1605
- </xsl:attribute>
1606
- </xsl:for-each>
1542
+ <xsl:variable name="table_attributes">
1543
+ <attribute name="table-layout">fixed</attribute>
1544
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1545
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1546
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1547
+
1548
+
1549
+
1550
+
1551
+
1552
+
1553
+
1554
+
1555
+
1556
+
1557
+ </xsl:variable>
1607
1558
 
1608
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1559
+
1560
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1561
+
1562
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1563
+ <xsl:attribute name="{@name}">
1564
+ <xsl:value-of select="."/>
1565
+ </xsl:attribute>
1566
+ </xsl:for-each>
1567
+
1568
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1569
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1570
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1571
+ </xsl:if>
1572
+
1573
+ <xsl:choose>
1574
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1575
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1576
+ <fo:table-column column-width="{@width}"/>
1577
+ </xsl:for-each>
1578
+ </xsl:when>
1579
+ <xsl:otherwise>
1580
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1581
+ <xsl:choose>
1582
+ <xsl:when test=". = 1 or . = 0">
1583
+ <fo:table-column column-width="proportional-column-width(2)"/>
1584
+ </xsl:when>
1585
+ <xsl:otherwise>
1586
+ <fo:table-column column-width="proportional-column-width({.})"/>
1587
+ </xsl:otherwise>
1588
+ </xsl:choose>
1589
+ </xsl:for-each>
1590
+ </xsl:otherwise>
1591
+ </xsl:choose>
1592
+
1609
1593
  <xsl:choose>
1610
- <xsl:when test=". = 1 or . = 0">
1611
- <fo:table-column column-width="proportional-column-width(2)"/>
1594
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1595
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1612
1596
  </xsl:when>
1613
1597
  <xsl:otherwise>
1614
- <fo:table-column column-width="proportional-column-width({.})"/>
1598
+ <xsl:apply-templates/>
1615
1599
  </xsl:otherwise>
1616
1600
  </xsl:choose>
1601
+
1602
+ </fo:table>
1603
+
1604
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1605
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1606
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1607
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1608
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1609
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1610
+ </xsl:call-template>
1617
1611
  </xsl:for-each>
1618
- </fo:table>-->
1619
-
1620
-
1621
-
1622
-
1623
-
1624
- </fo:block-container>
1612
+
1613
+ <!-- insert footer as table -->
1614
+ <!-- <fo:table>
1615
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1616
+ <xsl:attribute name="{@name}">
1617
+ <xsl:value-of select="."/>
1618
+ </xsl:attribute>
1619
+ </xsl:for-each>
1620
+
1621
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1622
+ <xsl:choose>
1623
+ <xsl:when test=". = 1 or . = 0">
1624
+ <fo:table-column column-width="proportional-column-width(2)"/>
1625
+ </xsl:when>
1626
+ <xsl:otherwise>
1627
+ <fo:table-column column-width="proportional-column-width({.})"/>
1628
+ </xsl:otherwise>
1629
+ </xsl:choose>
1630
+ </xsl:for-each>
1631
+ </fo:table>-->
1632
+
1633
+
1634
+
1635
+
1636
+
1637
+ </fo:block-container>
1638
+ </xsl:variable>
1639
+
1640
+
1641
+
1642
+ <xsl:choose>
1643
+ <xsl:when test="@width">
1644
+
1645
+ <!-- centered table when table name is centered (see table-name-style) -->
1646
+
1647
+ <fo:table table-layout="fixed" width="100%">
1648
+ <fo:table-column column-width="proportional-column-width(1)"/>
1649
+ <fo:table-column column-width="{@width}"/>
1650
+ <fo:table-column column-width="proportional-column-width(1)"/>
1651
+ <fo:table-body>
1652
+ <fo:table-row>
1653
+ <fo:table-cell column-number="2">
1654
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
1655
+ </fo:table-cell>
1656
+ </fo:table-row>
1657
+ </fo:table-body>
1658
+ </fo:table>
1659
+
1660
+
1661
+
1662
+
1663
+ </xsl:when>
1664
+ <xsl:otherwise>
1665
+ <xsl:copy-of select="$table"/>
1666
+ </xsl:otherwise>
1667
+ </xsl:choose>
1668
+
1625
1669
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1626
1670
  <xsl:if test="normalize-space() != ''">
1627
1671
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1749,7 +1793,15 @@
1749
1793
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1750
1794
  <xsl:value-of select="@target"/>
1751
1795
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1752
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1796
+ <xsl:variable name="mathml">
1797
+ <xsl:for-each select="*">
1798
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1799
+ <xsl:copy-of select="."/>
1800
+ </xsl:if>
1801
+ </xsl:for-each>
1802
+ </xsl:variable>
1803
+
1804
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1753
1805
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1754
1806
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1755
1807
  <xsl:param name="cols-count"/>
@@ -2432,7 +2484,7 @@
2432
2484
  <xsl:with-param name="table" select="$html-table"/>
2433
2485
  </xsl:call-template>
2434
2486
  </xsl:variable>
2435
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2487
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2436
2488
  <xsl:variable name="maxlength_dt">
2437
2489
  <xsl:call-template name="getMaxLength_dt"/>
2438
2490
  </xsl:variable>
@@ -2461,13 +2513,22 @@
2461
2513
  </xsl:when>
2462
2514
  <xsl:otherwise>
2463
2515
  <xsl:choose>
2516
+ <!-- to set width check most wide chars like `W` -->
2464
2517
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2465
- <fo:table-column column-width="5%"/>
2466
- <fo:table-column column-width="95%"/>
2518
+ <fo:table-column column-width="7%"/>
2519
+ <fo:table-column column-width="93%"/>
2520
+ </xsl:when>
2521
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2522
+ <fo:table-column column-width="15%"/>
2523
+ <fo:table-column column-width="85%"/>
2524
+ </xsl:when>
2525
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2526
+ <fo:table-column column-width="20%"/>
2527
+ <fo:table-column column-width="80%"/>
2467
2528
  </xsl:when>
2468
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2469
- <fo:table-column column-width="10%"/>
2470
- <fo:table-column column-width="90%"/>
2529
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2530
+ <fo:table-column column-width="25%"/>
2531
+ <fo:table-column column-width="75%"/>
2471
2532
  </xsl:when>
2472
2533
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2473
2534
  <fo:table-column column-width="60%"/>
@@ -2664,6 +2725,7 @@
2664
2725
 
2665
2726
 
2666
2727
 
2728
+
2667
2729
  10
2668
2730
 
2669
2731
  </xsl:variable>
@@ -2678,10 +2740,18 @@
2678
2740
  </xsl:if>
2679
2741
  <xsl:apply-templates/>
2680
2742
  </fo:inline>
2743
+ </xsl:template><xsl:template match="*[local-name()='underline']">
2744
+ <fo:inline text-decoration="underline">
2745
+ <xsl:apply-templates/>
2746
+ </fo:inline>
2681
2747
  </xsl:template><xsl:template match="*[local-name()='del']">
2682
2748
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2683
2749
  <xsl:apply-templates/>
2684
2750
  </fo:inline>
2751
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2752
+ <fo:inline background-color="yellow">
2753
+ <xsl:apply-templates/>
2754
+ </fo:inline>
2685
2755
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2686
2756
  <xsl:variable name="text" select="normalize-space(.)"/>
2687
2757
  <fo:inline font-size="75%">
@@ -2771,6 +2841,10 @@
2771
2841
  <xsl:param name="text" select="."/>
2772
2842
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2773
2843
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2844
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
2845
+ <xsl:param name="text" select="."/>
2846
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2847
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2774
2848
  </xsl:template><xsl:template name="add-zero-spaces">
2775
2849
  <xsl:param name="text" select="."/>
2776
2850
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3018,6 +3092,7 @@
3018
3092
  <xsl:apply-templates select="." mode="mathml"/>
3019
3093
  </xsl:variable>
3020
3094
  <fo:instream-foreign-object fox:alt-text="Math">
3095
+
3021
3096
  <!-- <xsl:copy-of select="."/> -->
3022
3097
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3023
3098
  </fo:instream-foreign-object>
@@ -3031,7 +3106,12 @@
3031
3106
  <!-- replace start and end spaces to non-break space -->
3032
3107
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3033
3108
  </xsl:copy>
3034
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3109
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3110
+ <xsl:copy>
3111
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3112
+ </xsl:copy>
3113
+ <mathml:mspace width="0.5ex"/>
3114
+ </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">
3035
3115
  <xsl:variable name="target">
3036
3116
  <xsl:choose>
3037
3117
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3052,7 +3132,10 @@
3052
3132
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3053
3133
  <xsl:choose>
3054
3134
  <xsl:when test="normalize-space(.) = ''">
3055
- <xsl:value-of select="$target"/>
3135
+ <!-- <xsl:value-of select="$target"/> -->
3136
+ <xsl:call-template name="add-zero-spaces-link-java">
3137
+ <xsl:with-param name="text" select="$target"/>
3138
+ </xsl:call-template>
3056
3139
  </xsl:when>
3057
3140
  <xsl:otherwise>
3058
3141
  <xsl:apply-templates/>
@@ -3062,8 +3145,6 @@
3062
3145
  </xsl:otherwise>
3063
3146
  </xsl:choose>
3064
3147
  </fo:inline>
3065
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3066
- <fo:inline id="{@id}"/>
3067
3148
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3068
3149
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3069
3150
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3262,7 +3343,7 @@
3262
3343
  </xsl:if> -->
3263
3344
  </fo:inline>
3264
3345
  </xsl:if>
3265
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3346
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3266
3347
  <fo:block-container id="{@id}">
3267
3348
 
3268
3349
  <fo:block>
@@ -3278,6 +3359,7 @@
3278
3359
  <fo:block id="{@id}">
3279
3360
  <xsl:apply-templates/>
3280
3361
  </fo:block>
3362
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3281
3363
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3282
3364
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3283
3365
  <xsl:apply-templates/>
@@ -3469,6 +3551,12 @@
3469
3551
  <!-- <xsl:text> </xsl:text> -->
3470
3552
  </xsl:template><xsl:template name="getSection">
3471
3553
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3554
+ <!--
3555
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3556
+ <xsl:value-of select="."/>
3557
+ </xsl:for-each>
3558
+ -->
3559
+
3472
3560
  </xsl:template><xsl:template name="getName">
3473
3561
  <xsl:choose>
3474
3562
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3521,6 +3609,12 @@
3521
3609
  <xsl:copy>
3522
3610
  <xsl:apply-templates mode="contents_item"/>
3523
3611
  </xsl:copy>
3612
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3613
+ <xsl:copy>
3614
+ <xsl:apply-templates mode="contents_item"/>
3615
+ </xsl:copy>
3616
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3617
+ <xsl:copy-of select="."/>
3524
3618
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3525
3619
  <xsl:text> </xsl:text>
3526
3620
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3546,6 +3640,7 @@
3546
3640
 
3547
3641
 
3548
3642
 
3643
+
3549
3644
 
3550
3645
 
3551
3646
 
@@ -3848,10 +3943,11 @@
3848
3943
  </xsl:choose>
3849
3944
 
3850
3945
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3851
-
3946
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3852
3947
  <xsl:variable name="element">
3853
3948
  block
3854
3949
 
3950
+
3855
3951
  </xsl:variable>
3856
3952
  <xsl:choose>
3857
3953
  <xsl:when test="normalize-space($element) = 'block'">
@@ -3926,11 +4022,13 @@
3926
4022
  </xsl:if>
3927
4023
  </xsl:if>
3928
4024
 
4025
+
3929
4026
  <fo:block-container margin-left="0mm">
3930
4027
 
3931
4028
  <fo:block xsl:use-attribute-sets="quote-style">
3932
4029
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
3933
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4030
+
4031
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3934
4032
  </fo:block>
3935
4033
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3936
4034
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -3953,29 +4051,47 @@
3953
4051
  <xsl:text>— </xsl:text>
3954
4052
  <xsl:apply-templates/>
3955
4053
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
3956
- <fo:inline xsl:use-attribute-sets="eref-style">
3957
- <xsl:if test="@type = 'footnote'">
3958
-
3959
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3960
- <xsl:attribute name="font-size">80%</xsl:attribute>
3961
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3962
- <xsl:attribute name="vertical-align">super</xsl:attribute>
3963
-
3964
-
3965
- </xsl:if>
3966
-
3967
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3968
-
3969
- <xsl:if test="@type = 'inline'">
3970
-
3971
-
3972
-
3973
- </xsl:if>
3974
-
3975
-
3976
- <xsl:apply-templates/>
3977
- </fo:basic-link>
3978
- </fo:inline>
4054
+
4055
+ <xsl:variable name="bibitemid">
4056
+ <xsl:choose>
4057
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4058
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4059
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4060
+ </xsl:choose>
4061
+ </xsl:variable>
4062
+
4063
+ <xsl:choose>
4064
+ <xsl:when test="normalize-space($bibitemid) != ''">
4065
+ <fo:inline xsl:use-attribute-sets="eref-style">
4066
+ <xsl:if test="@type = 'footnote'">
4067
+
4068
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4069
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4070
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4071
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4072
+
4073
+
4074
+ </xsl:if>
4075
+
4076
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4077
+ <xsl:if test="normalize-space(@citeas) = ''">
4078
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4079
+ </xsl:if>
4080
+ <xsl:if test="@type = 'inline'">
4081
+
4082
+
4083
+
4084
+ </xsl:if>
4085
+
4086
+ <xsl:apply-templates/>
4087
+ </fo:basic-link>
4088
+
4089
+ </fo:inline>
4090
+ </xsl:when>
4091
+ <xsl:otherwise>
4092
+ <fo:inline><xsl:apply-templates/></fo:inline>
4093
+ </xsl:otherwise>
4094
+ </xsl:choose>
3979
4095
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
3980
4096
  <!-- zero-space char -->
3981
4097
  <xsl:variable name="depth">
@@ -4076,6 +4192,7 @@
4076
4192
 
4077
4193
 
4078
4194
 
4195
+
4079
4196
 
4080
4197
 
4081
4198
  <xsl:variable name="pos"><xsl:number count="rsd:sections/rsd:clause[not(@type='scope') and not(@type='conformance')]"/></xsl:variable> <!-- | rsd:sections/rsd:terms -->
@@ -4092,7 +4209,7 @@
4092
4209
 
4093
4210
 
4094
4211
 
4095
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4212
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4096
4213
  <fo:block break-after="page"/>
4097
4214
  <fo:block>
4098
4215
  <xsl:call-template name="setId"/>
@@ -4100,7 +4217,8 @@
4100
4217
  </fo:block>
4101
4218
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4102
4219
  <fo:block>
4103
- <xsl:call-template name="setId"/>
4220
+ <xsl:call-template name="setId"/>
4221
+
4104
4222
 
4105
4223
  <xsl:apply-templates/>
4106
4224
  </fo:block>
@@ -4151,6 +4269,153 @@
4151
4269
  </fo:block>
4152
4270
  </xsl:otherwise>
4153
4271
  </xsl:choose>
4272
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4273
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4274
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4275
+ </xsl:for-each>
4276
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4277
+ <xsl:copy>
4278
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4279
+ </xsl:copy>
4280
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4281
+ <xsl:variable name="id">
4282
+ <xsl:call-template name="generateIndexXrefId"/>
4283
+ </xsl:variable>
4284
+ <xsl:copy> <!-- add id to xref -->
4285
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4286
+ <xsl:attribute name="id">
4287
+ <xsl:value-of select="$id"/>
4288
+ </xsl:attribute>
4289
+ <xsl:apply-templates mode="index_add_id"/>
4290
+ </xsl:copy>
4291
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4292
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4293
+ <xsl:if test="@to">
4294
+ <xsl:value-of select="$dash"/>
4295
+ <xsl:copy>
4296
+ <xsl:copy-of select="@*"/>
4297
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4298
+ <xsl:attribute name="id">
4299
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4300
+ </xsl:attribute>
4301
+ <xsl:apply-templates mode="index_add_id"/>
4302
+ </xsl:copy>
4303
+ </xsl:if>
4304
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4305
+ <xsl:copy>
4306
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4307
+ </xsl:copy>
4308
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4309
+ <xsl:copy>
4310
+ <xsl:apply-templates select="@*" mode="index_update"/>
4311
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4312
+ </xsl:copy>
4313
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4314
+ <xsl:param name="element"/>
4315
+ <xsl:param name="remove" select="'false'"/>
4316
+ <xsl:param name="target"/>
4317
+ <!-- <node></node> -->
4318
+ <xsl:choose>
4319
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4320
+ <!-- skip text (i.e. remove it) and process next element -->
4321
+ <!-- [removed_<xsl:value-of select="."/>] -->
4322
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4323
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4324
+ </xsl:apply-templates>
4325
+ </xsl:when>
4326
+ <xsl:when test="self::text()">
4327
+ <xsl:value-of select="."/>
4328
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4329
+ </xsl:when>
4330
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4331
+ <xsl:variable name="id" select="@id"/>
4332
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4333
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4334
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4335
+
4336
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4337
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4338
+
4339
+ <xsl:choose>
4340
+ <!-- 2nd pass -->
4341
+ <!-- if page is equal to page for next and page is not the end of range -->
4342
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4343
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4344
+ <!-- [removed_xref] -->
4345
+
4346
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4347
+ <xsl:with-param name="remove">true</xsl:with-param>
4348
+ <xsl:with-param name="target">
4349
+ <xsl:choose>
4350
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4351
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4352
+ </xsl:choose>
4353
+ </xsl:with-param>
4354
+ </xsl:apply-templates>
4355
+ </xsl:when>
4356
+
4357
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4358
+ <!-- remove xref -->
4359
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4360
+ <xsl:with-param name="remove">true</xsl:with-param>
4361
+ </xsl:apply-templates>
4362
+ </xsl:when>
4363
+
4364
+ <xsl:otherwise>
4365
+ <xsl:apply-templates select="." mode="xref_copy">
4366
+ <xsl:with-param name="target" select="$target"/>
4367
+ </xsl:apply-templates>
4368
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4369
+ </xsl:otherwise>
4370
+ </xsl:choose>
4371
+ </xsl:when>
4372
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4373
+ <!-- ul -->
4374
+ <xsl:apply-templates select="." mode="index_update"/>
4375
+ </xsl:when>
4376
+ <xsl:otherwise>
4377
+ <xsl:apply-templates select="." mode="xref_copy">
4378
+ <xsl:with-param name="target" select="$target"/>
4379
+ </xsl:apply-templates>
4380
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4381
+ </xsl:otherwise>
4382
+ </xsl:choose>
4383
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4384
+ <xsl:param name="target"/>
4385
+ <xsl:copy>
4386
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4387
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4388
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4389
+ </xsl:if>
4390
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4391
+ </xsl:copy>
4392
+ </xsl:template><xsl:template name="generateIndexXrefId">
4393
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4394
+
4395
+ <xsl:variable name="docid">
4396
+ <xsl:call-template name="getDocumentId"/>
4397
+ </xsl:variable>
4398
+ <xsl:variable name="item_number">
4399
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4400
+ </xsl:variable>
4401
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4402
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4403
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4404
+ <xsl:apply-templates/>
4405
+ <fo:block>
4406
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4407
+ <fo:block> </fo:block>
4408
+ </xsl:if>
4409
+ </fo:block>
4410
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4411
+ <xsl:apply-templates/>
4412
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4413
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4414
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4415
+ <xsl:apply-templates/>
4416
+ </fo:block>
4417
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
4418
+ <fo:inline id="{@id}"/>
4154
4419
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4155
4420
  <!-- <row>
4156
4421
  <date>05-07-2013</date>
@@ -4246,6 +4511,8 @@
4246
4511
  <xsl:value-of select="translate(.,'. ','')"/>
4247
4512
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4248
4513
  <xsl:value-of select="substring(.,1,1)"/>
4514
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4515
+ <fo:inline><xsl:apply-templates/></fo:inline>
4249
4516
  </xsl:template><xsl:template name="convertDate">
4250
4517
  <xsl:param name="date"/>
4251
4518
  <xsl:param name="format" select="'short'"/>
@@ -4270,6 +4537,57 @@
4270
4537
  </xsl:variable>
4271
4538
  <xsl:variable name="result">
4272
4539
  <xsl:choose>
4540
+ <xsl:when test="$format = 'ddMMyyyy'">
4541
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4542
+ <xsl:text> </xsl:text>
4543
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4544
+ </xsl:when>
4545
+ <xsl:when test="$format = 'ddMM'">
4546
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4547
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4548
+ </xsl:when>
4549
+ <xsl:when test="$format = 'short' or $day = ''">
4550
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4551
+ </xsl:when>
4552
+ <xsl:otherwise>
4553
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4554
+ </xsl:otherwise>
4555
+ </xsl:choose>
4556
+ </xsl:variable>
4557
+ <xsl:value-of select="$result"/>
4558
+ </xsl:template><xsl:template name="convertDateLocalized">
4559
+ <xsl:param name="date"/>
4560
+ <xsl:param name="format" select="'short'"/>
4561
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4562
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4563
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4564
+ <xsl:variable name="monthStr">
4565
+ <xsl:choose>
4566
+ <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>
4567
+ <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>
4568
+ <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>
4569
+ <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>
4570
+ <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>
4571
+ <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>
4572
+ <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>
4573
+ <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>
4574
+ <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>
4575
+ <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>
4576
+ <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>
4577
+ <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>
4578
+ </xsl:choose>
4579
+ </xsl:variable>
4580
+ <xsl:variable name="result">
4581
+ <xsl:choose>
4582
+ <xsl:when test="$format = 'ddMMyyyy'">
4583
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4584
+ <xsl:text> </xsl:text>
4585
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4586
+ </xsl:when>
4587
+ <xsl:when test="$format = 'ddMM'">
4588
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4589
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4590
+ </xsl:when>
4273
4591
  <xsl:when test="$format = 'short' or $day = ''">
4274
4592
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4275
4593
  </xsl:when>
@@ -4285,7 +4603,7 @@
4285
4603
  <xsl:param name="charDelim" select="', '"/>
4286
4604
  <xsl:choose>
4287
4605
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4288
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4606
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4289
4607
  <xsl:sort data-type="text" order="ascending"/>
4290
4608
  <xsl:call-template name="insertKeyword">
4291
4609
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4294,7 +4612,7 @@
4294
4612
  </xsl:for-each>
4295
4613
  </xsl:when>
4296
4614
  <xsl:otherwise>
4297
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4615
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4298
4616
  <xsl:call-template name="insertKeyword">
4299
4617
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4300
4618
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4311,63 +4629,71 @@
4311
4629
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4312
4630
  </xsl:choose>
4313
4631
  </xsl:template><xsl:template name="addPDFUAmeta">
4314
- <fo:declarations>
4315
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4316
- <pdf:dictionary type="normal" key="ViewerPreferences">
4317
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4318
- </pdf:dictionary>
4319
- </pdf:catalog>
4320
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4321
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4322
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4323
- <!-- Dublin Core properties go here -->
4324
- <dc:title>
4325
- <xsl:variable name="title">
4632
+ <xsl:variable name="lang">
4633
+ <xsl:call-template name="getLang"/>
4634
+ </xsl:variable>
4635
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4636
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4637
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4638
+ </pdf:dictionary>
4639
+ </pdf:catalog>
4640
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4641
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4642
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4643
+ <!-- Dublin Core properties go here -->
4644
+ <dc:title>
4645
+ <xsl:variable name="title">
4646
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4647
+
4326
4648
 
4327
4649
 
4328
4650
 
4329
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
4651
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4330
4652
 
4331
4653
 
4332
4654
 
4333
- </xsl:variable>
4334
- <xsl:choose>
4335
- <xsl:when test="normalize-space($title) != ''">
4336
- <xsl:value-of select="$title"/>
4337
- </xsl:when>
4338
- <xsl:otherwise>
4339
- <xsl:text> </xsl:text>
4340
- </xsl:otherwise>
4341
- </xsl:choose>
4342
- </dc:title>
4343
- <dc:creator>
4655
+ </xsl:for-each>
4656
+ </xsl:variable>
4657
+ <xsl:choose>
4658
+ <xsl:when test="normalize-space($title) != ''">
4659
+ <xsl:value-of select="$title"/>
4660
+ </xsl:when>
4661
+ <xsl:otherwise>
4662
+ <xsl:text> </xsl:text>
4663
+ </xsl:otherwise>
4664
+ </xsl:choose>
4665
+ </dc:title>
4666
+ <dc:creator>
4667
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4344
4668
 
4669
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4670
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4671
+ <xsl:if test="position() != last()">; </xsl:if>
4672
+ </xsl:for-each>
4345
4673
 
4346
4674
 
4347
- </dc:creator>
4348
- <dc:description>
4349
- <xsl:variable name="abstract">
4350
-
4351
-
4352
-
4353
-
4354
- <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
4355
-
4356
-
4357
- </xsl:variable>
4358
- <xsl:value-of select="normalize-space($abstract)"/>
4359
- </dc:description>
4360
- <pdf:Keywords>
4361
- <xsl:call-template name="insertKeywords"/>
4362
- </pdf:Keywords>
4363
- </rdf:Description>
4364
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4365
- <!-- XMP properties go here -->
4366
- <xmp:CreatorTool/>
4367
- </rdf:Description>
4368
- </rdf:RDF>
4369
- </x:xmpmeta>
4370
- </fo:declarations>
4675
+
4676
+ </xsl:for-each>
4677
+ </dc:creator>
4678
+ <dc:description>
4679
+ <xsl:variable name="abstract">
4680
+
4681
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4682
+
4683
+
4684
+ </xsl:variable>
4685
+ <xsl:value-of select="normalize-space($abstract)"/>
4686
+ </dc:description>
4687
+ <pdf:Keywords>
4688
+ <xsl:call-template name="insertKeywords"/>
4689
+ </pdf:Keywords>
4690
+ </rdf:Description>
4691
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4692
+ <!-- XMP properties go here -->
4693
+ <xmp:CreatorTool/>
4694
+ </rdf:Description>
4695
+ </rdf:RDF>
4696
+ </x:xmpmeta>
4371
4697
  </xsl:template><xsl:template name="getId">
4372
4698
  <xsl:choose>
4373
4699
  <xsl:when test="../@id">
@@ -4464,6 +4790,7 @@
4464
4790
 
4465
4791
 
4466
4792
 
4793
+
4467
4794
  </xsl:variable>
4468
4795
  <xsl:if test="$documentNS != $XSLNS">
4469
4796
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4523,6 +4850,11 @@
4523
4850
  <xsl:call-template name="getLang"/>
4524
4851
  </xsl:variable>
4525
4852
 
4526
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4853
+ <xsl:choose>
4854
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4855
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4856
+ </xsl:when>
4857
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4858
+ </xsl:choose>
4527
4859
 
4528
4860
  </xsl:template></xsl:stylesheet>