metanorma-nist 1.2.11 → 1.2.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,7 @@
5
5
 
6
6
 
7
7
  <xsl:param name="svg_images"/>
8
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
8
9
  <xsl:variable name="images" select="document($svg_images)"/>
9
10
 
10
11
 
@@ -31,7 +32,17 @@
31
32
  </xsl:choose>
32
33
  </xsl:variable>
33
34
  <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"/>
35
+ <xsl:variable name="seriestitle">
36
+ <xsl:choose>
37
+ <xsl:when test="normalize-space(/nist:nist-standard/nist:bibdata/nist:series[@type = 'main']/nist:abbreviation) = 'NIST CSTS'">
38
+ <xsl:value-of select="/nist:nist-standard/nist:bibdata/nist:series[@type = 'secondary']/nist:title"/>
39
+ </xsl:when>
40
+ <xsl:otherwise>
41
+ <xsl:value-of select="/nist:nist-standard/nist:bibdata/nist:series[@type = 'main']/nist:title"/>
42
+ </xsl:otherwise>
43
+ </xsl:choose>
44
+ </xsl:variable>
45
+
35
46
  <!-- Example:
36
47
  <item level="1" id="Foreword" display="true">Foreword</item>
37
48
  <item id="term-script" display="false">3.2</item>
@@ -82,7 +93,9 @@
82
93
 
83
94
  </fo:layout-master-set>
84
95
 
85
- <xsl:call-template name="addPDFUAmeta"/>
96
+ <fo:declarations>
97
+ <xsl:call-template name="addPDFUAmeta"/>
98
+ </fo:declarations>
86
99
 
87
100
  <xsl:call-template name="addBookmarks">
88
101
  <xsl:with-param name="contents" select="$contents"/>
@@ -224,52 +237,28 @@
224
237
  <fo:block margin-top="18pt">
225
238
 
226
239
  <!-- Abstract -->
227
- <xsl:if test="/nist:nist-standard/nist:preface/nist:abstract">
228
- <xsl:variable name="title-abstract">
229
- <xsl:call-template name="getTitle">
230
- <xsl:with-param name="name" select="'title-abstract'"/>
231
- </xsl:call-template>
232
- </xsl:variable>
233
- <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-bottom="12pt"><xsl:value-of select="$title-abstract"/></fo:block>
234
- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:abstract"/>
235
- </xsl:if>
240
+ <!-- Keywords -->
241
+ <!-- Acknowledgements -->
242
+ <xsl:apply-templates select="/nist:nist-standard/nist:preface/*"/>
243
+
244
+ <!-- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:abstract"/> -->
236
245
 
246
+ <!-- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:acknowledgements"/> -->
247
+
237
248
  <!-- Keywords -->
238
- <xsl:if test="/nist:nist-standard/nist:bibdata/nist:keyword">
249
+ <!-- <xsl:if test="/nist:nist-standard/nist:bibdata/nist:keyword">
239
250
  <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-bottom="12pt">
240
- <xsl:variable name="title-keywords">
241
- <xsl:call-template name="getTitle">
242
- <xsl:with-param name="name" select="'title-keywords'"/>
243
- </xsl:call-template>
244
- </xsl:variable>
245
- <xsl:value-of select="$title-keywords"/>
251
+ <xsl:call-template name="getLocalizedString">
252
+ <xsl:with-param name="key">keywords</xsl:with-param>
253
+ </xsl:call-template>
246
254
  </fo:block>
247
255
  <fo:block margin-bottom="12pt" text-align="justify">
248
256
  <xsl:call-template name="insertKeywords">
249
- <xsl:with-param name="charAtEnd"/>
257
+ <xsl:with-param name="charAtEnd"></xsl:with-param>
250
258
  <xsl:with-param name="charDelim">; </xsl:with-param>
251
259
  </xsl:call-template>
252
- <!-- <xsl:for-each select="/nist:nist-standard/nist:bibdata//nist:keyword">
253
- <xsl:sort data-type="text" order="ascending"/>
254
- <xsl:apply-templates/>
255
- <xsl:choose>
256
- <xsl:when test="position() != last()">; </xsl:when>
257
- <xsl:otherwise></xsl:otherwise>
258
- </xsl:choose>
259
- </xsl:for-each> -->
260
260
  </fo:block>
261
- </xsl:if>
262
-
263
- <xsl:if test="/nist:nist-standard/nist:preface/nist:acknowledgements">
264
- <xsl:variable name="title-acknowledgements">
265
- <xsl:call-template name="getTitle">
266
- <xsl:with-param name="name" select="'title-acknowledgements'"/>
267
- </xsl:call-template>
268
- </xsl:variable>
269
- <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-top="18pt" margin-bottom="12pt"><xsl:value-of select="$title-acknowledgements"/></fo:block>
270
- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:acknowledgements"/>
271
- </xsl:if>
272
-
261
+ </xsl:if> -->
273
262
 
274
263
  <!-- Disclaimer -->
275
264
  <!-- Additional Information -->
@@ -281,8 +270,9 @@
281
270
  <fo:block font-family="Arial" text-align="center" font-weight="bold" color="{$color}" margin-bottom="12pt">Feedback</fo:block>
282
271
  <xsl:text>Feedback on this publication is welcome, and can be sent to: code-signing@nist.gov.</xsl:text>
283
272
 
284
- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:clause"/>
285
-
273
+ <!-- Keywords -->
274
+ <!-- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:clause"/> -->
275
+
286
276
  <fo:block break-after="page"/>
287
277
 
288
278
  <!-- <xsl:apply-templates select="/nist:nist-standard/nist:preface/nist:foreword"/> -->
@@ -412,7 +402,7 @@
412
402
  <xsl:apply-templates select="/nist:nist-standard/nist:annex"/>
413
403
 
414
404
  <!-- Bibliography -->
415
- <xsl:apply-templates select="/nist:nist-standard/nist:bibliography/nist:references"/>
405
+ <xsl:apply-templates select="/nist:nist-standard/nist:bibliography"/>
416
406
 
417
407
  </fo:block>
418
408
 
@@ -611,13 +601,13 @@
611
601
  <!-- ====== -->
612
602
 
613
603
  <xsl:template match="nist:legal-statement//nist:title">
614
- <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt" color="{$color}">
604
+ <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt" color="{$color}" keep-with-next="always">
615
605
  <xsl:apply-templates/>
616
606
  </fo:block>
617
607
  </xsl:template>
618
608
 
619
609
  <xsl:template match="nist:executivesummary//nist:title">
620
- <fo:block-container color="white" background-color="black" margin-bottom="12pt">
610
+ <fo:block-container color="white" background-color="black" margin-bottom="12pt" keep-with-next="always">
621
611
  <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="left" margin-left="4mm" padding-top="1mm">
622
612
  <xsl:apply-templates/>
623
613
  </fo:block>
@@ -625,11 +615,19 @@
625
615
  </xsl:template>
626
616
 
627
617
  <xsl:template match="nist:preface//nist:title" priority="3">
628
- <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" space-before="12pt" margin-bottom="12pt" color="{$color}">
618
+ <fo:block font-family="Arial" font-size="12pt" font-weight="bold" text-align="center" space-before="12pt" margin-bottom="12pt" color="{$color}" keep-with-next="always">
619
+ <xsl:if test="local-name(..) = 'acknowledgements'">
620
+ <xsl:attribute name="space-before">18pt</xsl:attribute>
621
+ </xsl:if>
629
622
  <xsl:apply-templates/>
630
623
  </fo:block>
631
624
  </xsl:template>
632
625
 
626
+ <xsl:template match="/nist:nist-standard/nist:bibliography">
627
+ <fo:block break-after="page"/>
628
+ <xsl:apply-templates/>
629
+ </xsl:template>
630
+
633
631
  <xsl:template match="nist:references">
634
632
  <fo:block id="{@id}">
635
633
  <xsl:apply-templates/>
@@ -1290,6 +1288,7 @@
1290
1288
 
1291
1289
 
1292
1290
 
1291
+
1293
1292
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1294
1293
 
1295
1294
 
@@ -1410,6 +1409,7 @@
1410
1409
 
1411
1410
 
1412
1411
 
1412
+
1413
1413
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1414
1414
 
1415
1415
 
@@ -1536,205 +1536,239 @@
1536
1536
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1537
1537
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1538
1538
  <xsl:call-template name="add-zero-spaces-java"/>
1539
- </xsl:template><xsl:template match="*[local-name()='table']">
1539
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1540
1540
 
1541
- <xsl:variable name="simple-table">
1542
- <xsl:call-template name="getSimpleTable"/>
1543
- </xsl:variable>
1541
+ <xsl:variable name="table">
1544
1542
 
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
-
1543
+ <xsl:variable name="simple-table">
1544
+ <xsl:call-template name="getSimpleTable"/>
1545
+ </xsl:variable>
1558
1546
 
1559
1547
 
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
1548
 
1611
1549
 
1612
- <xsl:attribute name="space-after">6pt</xsl:attribute>
1613
1550
 
1614
-
1615
-
1616
-
1551
+ <!-- <xsl:if test="$namespace = 'bipm'">
1552
+ <fo:block>&#xA0;</fo:block>
1553
+ </xsl:if> -->
1617
1554
 
1555
+ <!-- $namespace = 'iso' or -->
1618
1556
 
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>
1557
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1628
1558
 
1629
-
1559
+
1630
1560
 
1561
+
1631
1562
 
1563
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1632
1564
 
1565
+ <!-- <xsl:variable name="cols-count">
1566
+ <xsl:choose>
1567
+ <xsl:when test="*[local-name()='thead']">
1568
+ <xsl:call-template name="calculate-columns-numbers">
1569
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1570
+ </xsl:call-template>
1571
+ </xsl:when>
1572
+ <xsl:otherwise>
1573
+ <xsl:call-template name="calculate-columns-numbers">
1574
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1575
+ </xsl:call-template>
1576
+ </xsl:otherwise>
1577
+ </xsl:choose>
1578
+ </xsl:variable> -->
1579
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1580
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1633
1581
 
1634
1582
 
1635
1583
 
1584
+ <xsl:variable name="colwidths">
1585
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1586
+ <xsl:call-template name="calculate-column-widths">
1587
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1588
+ <xsl:with-param name="table" select="$simple-table"/>
1589
+ </xsl:call-template>
1590
+ </xsl:if>
1591
+ </xsl:variable>
1592
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1636
1593
 
1637
- <xsl:variable name="table_attributes">
1638
- <attribute name="table-layout">fixed</attribute>
1639
- <attribute name="width">
1640
- <xsl:choose>
1641
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1642
- <xsl:otherwise>100%</xsl:otherwise>
1643
- </xsl:choose>
1644
- </attribute>
1645
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1646
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1594
+ <!-- <xsl:variable name="colwidths2">
1595
+ <xsl:call-template name="calculate-column-widths">
1596
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1597
+ </xsl:call-template>
1598
+ </xsl:variable> -->
1599
+
1600
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1601
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1602
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1603
+
1604
+ <xsl:variable name="margin-left">
1605
+ <xsl:choose>
1606
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1607
+ <xsl:otherwise>0</xsl:otherwise>
1608
+ </xsl:choose>
1609
+ </xsl:variable>
1610
+
1611
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1647
1612
 
1648
1613
 
1614
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
1649
1615
 
1616
+
1617
+
1618
+
1650
1619
 
1651
-
1652
-
1653
-
1654
1620
 
1655
-
1621
+ <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
1622
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1623
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1624
+ </xsl:if>
1625
+ <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
1626
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1627
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
1628
+ </xsl:if>
1629
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1656
1630
 
1657
- </xsl:variable>
1658
-
1659
-
1660
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1631
+
1661
1632
 
1662
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1663
- <xsl:attribute name="{@name}">
1664
- <xsl:value-of select="."/>
1665
- </xsl:attribute>
1666
- </xsl:for-each>
1667
1633
 
1668
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1669
- <xsl:if test="$isNoteOrFnExist = 'true'">
1670
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1671
- </xsl:if>
1672
1634
 
1673
- <xsl:choose>
1674
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1675
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1676
- <fo:table-column column-width="{@width}"/>
1677
- </xsl:for-each>
1678
- </xsl:when>
1679
- <xsl:otherwise>
1680
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1681
- <xsl:choose>
1682
- <xsl:when test=". = 1 or . = 0">
1683
- <fo:table-column column-width="proportional-column-width(2)"/>
1684
- </xsl:when>
1685
- <xsl:otherwise>
1686
- <fo:table-column column-width="proportional-column-width({.})"/>
1687
- </xsl:otherwise>
1688
- </xsl:choose>
1689
- </xsl:for-each>
1690
- </xsl:otherwise>
1691
- </xsl:choose>
1692
1635
 
1693
- <xsl:choose>
1694
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1695
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1696
- </xsl:when>
1697
- <xsl:otherwise>
1698
- <xsl:apply-templates/>
1699
- </xsl:otherwise>
1700
- </xsl:choose>
1701
1636
 
1702
- </fo:table>
1703
-
1704
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1705
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1706
- <xsl:call-template name="insertTableFooterInSeparateTable">
1707
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1708
- <xsl:with-param name="colwidths" select="$colwidths"/>
1709
- <xsl:with-param name="colgroup" select="$colgroup"/>
1710
- </xsl:call-template>
1711
- </xsl:for-each>
1712
-
1713
- <!-- insert footer as table -->
1714
- <!-- <fo:table>
1715
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1716
- <xsl:attribute name="{@name}">
1717
- <xsl:value-of select="."/>
1718
- </xsl:attribute>
1719
- </xsl:for-each>
1720
1637
 
1721
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1638
+ <xsl:variable name="table_width">
1639
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1640
+ 100%
1641
+
1642
+
1643
+ </xsl:variable>
1644
+
1645
+ <xsl:variable name="table_attributes">
1646
+ <attribute name="table-layout">fixed</attribute>
1647
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1648
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1649
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1650
+
1651
+
1652
+
1653
+
1654
+
1655
+
1656
+
1657
+
1658
+
1659
+
1660
+ </xsl:variable>
1661
+
1662
+
1663
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1664
+
1665
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1666
+ <xsl:attribute name="{@name}">
1667
+ <xsl:value-of select="."/>
1668
+ </xsl:attribute>
1669
+ </xsl:for-each>
1670
+
1671
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1672
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1673
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1674
+ </xsl:if>
1675
+
1722
1676
  <xsl:choose>
1723
- <xsl:when test=". = 1 or . = 0">
1724
- <fo:table-column column-width="proportional-column-width(2)"/>
1677
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1678
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1679
+ <fo:table-column column-width="{@width}"/>
1680
+ </xsl:for-each>
1725
1681
  </xsl:when>
1726
1682
  <xsl:otherwise>
1727
- <fo:table-column column-width="proportional-column-width({.})"/>
1683
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1684
+ <xsl:choose>
1685
+ <xsl:when test=". = 1 or . = 0">
1686
+ <fo:table-column column-width="proportional-column-width(2)"/>
1687
+ </xsl:when>
1688
+ <xsl:otherwise>
1689
+ <fo:table-column column-width="proportional-column-width({.})"/>
1690
+ </xsl:otherwise>
1691
+ </xsl:choose>
1692
+ </xsl:for-each>
1728
1693
  </xsl:otherwise>
1729
1694
  </xsl:choose>
1695
+
1696
+ <xsl:choose>
1697
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1698
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1699
+ </xsl:when>
1700
+ <xsl:otherwise>
1701
+ <xsl:apply-templates/>
1702
+ </xsl:otherwise>
1703
+ </xsl:choose>
1704
+
1705
+ </fo:table>
1706
+
1707
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1708
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1709
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1710
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1711
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1712
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1713
+ </xsl:call-template>
1730
1714
  </xsl:for-each>
1731
- </fo:table>-->
1732
-
1733
-
1734
-
1735
-
1736
-
1737
- </fo:block-container>
1715
+
1716
+ <!-- insert footer as table -->
1717
+ <!-- <fo:table>
1718
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1719
+ <xsl:attribute name="{@name}">
1720
+ <xsl:value-of select="."/>
1721
+ </xsl:attribute>
1722
+ </xsl:for-each>
1723
+
1724
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1725
+ <xsl:choose>
1726
+ <xsl:when test=". = 1 or . = 0">
1727
+ <fo:table-column column-width="proportional-column-width(2)"/>
1728
+ </xsl:when>
1729
+ <xsl:otherwise>
1730
+ <fo:table-column column-width="proportional-column-width({.})"/>
1731
+ </xsl:otherwise>
1732
+ </xsl:choose>
1733
+ </xsl:for-each>
1734
+ </fo:table>-->
1735
+
1736
+
1737
+
1738
+
1739
+
1740
+ </fo:block-container>
1741
+ </xsl:variable>
1742
+
1743
+
1744
+
1745
+ <xsl:choose>
1746
+ <xsl:when test="@width">
1747
+
1748
+ <!-- centered table when table name is centered (see table-name-style) -->
1749
+
1750
+ <fo:table table-layout="fixed" width="100%">
1751
+ <fo:table-column column-width="proportional-column-width(1)"/>
1752
+ <fo:table-column column-width="{@width}"/>
1753
+ <fo:table-column column-width="proportional-column-width(1)"/>
1754
+ <fo:table-body>
1755
+ <fo:table-row>
1756
+ <fo:table-cell column-number="2">
1757
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
1758
+ </fo:table-cell>
1759
+ </fo:table-row>
1760
+ </fo:table-body>
1761
+ </fo:table>
1762
+
1763
+
1764
+
1765
+
1766
+ </xsl:when>
1767
+ <xsl:otherwise>
1768
+ <xsl:copy-of select="$table"/>
1769
+ </xsl:otherwise>
1770
+ </xsl:choose>
1771
+
1738
1772
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1739
1773
  <xsl:if test="normalize-space() != ''">
1740
1774
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1862,7 +1896,15 @@
1862
1896
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1863
1897
  <xsl:value-of select="@target"/>
1864
1898
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1865
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1899
+ <xsl:variable name="mathml">
1900
+ <xsl:for-each select="*">
1901
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1902
+ <xsl:copy-of select="."/>
1903
+ </xsl:if>
1904
+ </xsl:for-each>
1905
+ </xsl:variable>
1906
+
1907
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1866
1908
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1867
1909
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1868
1910
  <xsl:param name="cols-count"/>
@@ -2575,7 +2617,7 @@
2575
2617
  <xsl:with-param name="table" select="$html-table"/>
2576
2618
  </xsl:call-template>
2577
2619
  </xsl:variable>
2578
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2620
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2579
2621
  <xsl:variable name="maxlength_dt">
2580
2622
  <xsl:call-template name="getMaxLength_dt"/>
2581
2623
  </xsl:variable>
@@ -2604,13 +2646,22 @@
2604
2646
  </xsl:when>
2605
2647
  <xsl:otherwise>
2606
2648
  <xsl:choose>
2649
+ <!-- to set width check most wide chars like `W` -->
2607
2650
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2608
- <fo:table-column column-width="5%"/>
2609
- <fo:table-column column-width="95%"/>
2651
+ <fo:table-column column-width="7%"/>
2652
+ <fo:table-column column-width="93%"/>
2610
2653
  </xsl:when>
2611
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2612
- <fo:table-column column-width="10%"/>
2613
- <fo:table-column column-width="90%"/>
2654
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2655
+ <fo:table-column column-width="15%"/>
2656
+ <fo:table-column column-width="85%"/>
2657
+ </xsl:when>
2658
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2659
+ <fo:table-column column-width="20%"/>
2660
+ <fo:table-column column-width="80%"/>
2661
+ </xsl:when>
2662
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2663
+ <fo:table-column column-width="25%"/>
2664
+ <fo:table-column column-width="75%"/>
2614
2665
  </xsl:when>
2615
2666
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2616
2667
  <fo:table-column column-width="60%"/>
@@ -2822,6 +2873,7 @@
2822
2873
 
2823
2874
 
2824
2875
 
2876
+
2825
2877
 
2826
2878
  </xsl:variable>
2827
2879
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2843,6 +2895,10 @@
2843
2895
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2844
2896
  <xsl:apply-templates/>
2845
2897
  </fo:inline>
2898
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2899
+ <fo:inline background-color="yellow">
2900
+ <xsl:apply-templates/>
2901
+ </fo:inline>
2846
2902
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2847
2903
  <xsl:variable name="text" select="normalize-space(.)"/>
2848
2904
  <fo:inline font-size="75%">
@@ -2932,6 +2988,10 @@
2932
2988
  <xsl:param name="text" select="."/>
2933
2989
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2934
2990
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2991
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
2992
+ <xsl:param name="text" select="."/>
2993
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2994
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2935
2995
  </xsl:template><xsl:template name="add-zero-spaces">
2936
2996
  <xsl:param name="text" select="."/>
2937
2997
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3179,6 +3239,7 @@
3179
3239
  <xsl:apply-templates select="." mode="mathml"/>
3180
3240
  </xsl:variable>
3181
3241
  <fo:instream-foreign-object fox:alt-text="Math">
3242
+
3182
3243
  <!-- <xsl:copy-of select="."/> -->
3183
3244
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3184
3245
  </fo:instream-foreign-object>
@@ -3192,7 +3253,12 @@
3192
3253
  <!-- replace start and end spaces to non-break space -->
3193
3254
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3194
3255
  </xsl:copy>
3195
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3256
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3257
+ <xsl:copy>
3258
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3259
+ </xsl:copy>
3260
+ <mathml:mspace width="0.5ex"/>
3261
+ </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3196
3262
  <xsl:variable name="target">
3197
3263
  <xsl:choose>
3198
3264
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3213,7 +3279,10 @@
3213
3279
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3214
3280
  <xsl:choose>
3215
3281
  <xsl:when test="normalize-space(.) = ''">
3216
- <xsl:value-of select="$target"/>
3282
+ <!-- <xsl:value-of select="$target"/> -->
3283
+ <xsl:call-template name="add-zero-spaces-link-java">
3284
+ <xsl:with-param name="text" select="$target"/>
3285
+ </xsl:call-template>
3217
3286
  </xsl:when>
3218
3287
  <xsl:otherwise>
3219
3288
  <xsl:apply-templates/>
@@ -3223,8 +3292,6 @@
3223
3292
  </xsl:otherwise>
3224
3293
  </xsl:choose>
3225
3294
  </fo:inline>
3226
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3227
- <fo:inline id="{@id}"/>
3228
3295
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3229
3296
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3230
3297
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3419,7 +3486,7 @@
3419
3486
  </xsl:if> -->
3420
3487
  </fo:inline>
3421
3488
  </xsl:if>
3422
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3489
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3423
3490
  <fo:block-container id="{@id}">
3424
3491
 
3425
3492
  <fo:block>
@@ -3435,6 +3502,7 @@
3435
3502
  <fo:block id="{@id}">
3436
3503
  <xsl:apply-templates/>
3437
3504
  </fo:block>
3505
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3438
3506
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3439
3507
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3440
3508
  <xsl:apply-templates/>
@@ -3630,6 +3698,12 @@
3630
3698
  <!-- <xsl:text> </xsl:text> -->
3631
3699
  </xsl:template><xsl:template name="getSection">
3632
3700
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3701
+ <!--
3702
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3703
+ <xsl:value-of select="."/>
3704
+ </xsl:for-each>
3705
+ -->
3706
+
3633
3707
  </xsl:template><xsl:template name="getName">
3634
3708
  <xsl:choose>
3635
3709
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3682,6 +3756,12 @@
3682
3756
  <xsl:copy>
3683
3757
  <xsl:apply-templates mode="contents_item"/>
3684
3758
  </xsl:copy>
3759
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3760
+ <xsl:copy>
3761
+ <xsl:apply-templates mode="contents_item"/>
3762
+ </xsl:copy>
3763
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3764
+ <xsl:copy-of select="."/>
3685
3765
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3686
3766
  <xsl:text> </xsl:text>
3687
3767
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3707,6 +3787,7 @@
3707
3787
 
3708
3788
 
3709
3789
 
3790
+
3710
3791
 
3711
3792
 
3712
3793
  10
@@ -4009,10 +4090,11 @@
4009
4090
  </xsl:choose>
4010
4091
 
4011
4092
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4012
-
4093
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4013
4094
  <xsl:variable name="element">
4014
4095
  block
4015
4096
 
4097
+
4016
4098
  </xsl:variable>
4017
4099
  <xsl:choose>
4018
4100
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4079,11 +4161,13 @@
4079
4161
  </xsl:if>
4080
4162
  </xsl:if>
4081
4163
 
4164
+
4082
4165
  <fo:block-container margin-left="0mm">
4083
4166
 
4084
4167
  <fo:block xsl:use-attribute-sets="quote-style">
4085
4168
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4086
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4169
+
4170
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4087
4171
  </fo:block>
4088
4172
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4089
4173
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4106,31 +4190,49 @@
4106
4190
  <xsl:text>— </xsl:text>
4107
4191
  <xsl:apply-templates/>
4108
4192
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4109
- <fo:inline xsl:use-attribute-sets="eref-style">
4110
- <xsl:if test="@type = 'footnote'">
4111
-
4112
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4113
- <xsl:attribute name="font-size">80%</xsl:attribute>
4114
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4115
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4116
-
4117
-
4118
- </xsl:if>
4119
-
4120
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4121
-
4122
- <xsl:if test="@type = 'inline'">
4123
-
4124
-
4125
-
4126
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
4127
-
4128
- </xsl:if>
4129
-
4130
-
4131
- <xsl:apply-templates/>
4132
- </fo:basic-link>
4133
- </fo:inline>
4193
+
4194
+ <xsl:variable name="bibitemid">
4195
+ <xsl:choose>
4196
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4197
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4198
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4199
+ </xsl:choose>
4200
+ </xsl:variable>
4201
+
4202
+ <xsl:choose>
4203
+ <xsl:when test="normalize-space($bibitemid) != ''">
4204
+ <fo:inline xsl:use-attribute-sets="eref-style">
4205
+ <xsl:if test="@type = 'footnote'">
4206
+
4207
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4208
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4209
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4210
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4211
+
4212
+
4213
+ </xsl:if>
4214
+
4215
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4216
+ <xsl:if test="normalize-space(@citeas) = ''">
4217
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4218
+ </xsl:if>
4219
+ <xsl:if test="@type = 'inline'">
4220
+
4221
+
4222
+
4223
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4224
+
4225
+ </xsl:if>
4226
+
4227
+ <xsl:apply-templates/>
4228
+ </fo:basic-link>
4229
+
4230
+ </fo:inline>
4231
+ </xsl:when>
4232
+ <xsl:otherwise>
4233
+ <fo:inline><xsl:apply-templates/></fo:inline>
4234
+ </xsl:otherwise>
4235
+ </xsl:choose>
4134
4236
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4135
4237
  <!-- zero-space char -->
4136
4238
  <xsl:variable name="depth">
@@ -4236,6 +4338,7 @@
4236
4338
 
4237
4339
 
4238
4340
 
4341
+
4239
4342
 
4240
4343
 
4241
4344
 
@@ -4251,7 +4354,7 @@
4251
4354
  </xsl:if>
4252
4355
 
4253
4356
 
4254
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4357
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4255
4358
  <fo:block break-after="page"/>
4256
4359
  <fo:block>
4257
4360
  <xsl:call-template name="setId"/>
@@ -4259,7 +4362,8 @@
4259
4362
  </fo:block>
4260
4363
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4261
4364
  <fo:block>
4262
- <xsl:call-template name="setId"/>
4365
+ <xsl:call-template name="setId"/>
4366
+
4263
4367
 
4264
4368
  <xsl:apply-templates/>
4265
4369
  </fo:block>
@@ -4312,6 +4416,153 @@
4312
4416
  </fo:block>
4313
4417
  </xsl:otherwise>
4314
4418
  </xsl:choose>
4419
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4420
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4421
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4422
+ </xsl:for-each>
4423
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4424
+ <xsl:copy>
4425
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4426
+ </xsl:copy>
4427
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4428
+ <xsl:variable name="id">
4429
+ <xsl:call-template name="generateIndexXrefId"/>
4430
+ </xsl:variable>
4431
+ <xsl:copy> <!-- add id to xref -->
4432
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4433
+ <xsl:attribute name="id">
4434
+ <xsl:value-of select="$id"/>
4435
+ </xsl:attribute>
4436
+ <xsl:apply-templates mode="index_add_id"/>
4437
+ </xsl:copy>
4438
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4439
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4440
+ <xsl:if test="@to">
4441
+ <xsl:value-of select="$dash"/>
4442
+ <xsl:copy>
4443
+ <xsl:copy-of select="@*"/>
4444
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4445
+ <xsl:attribute name="id">
4446
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4447
+ </xsl:attribute>
4448
+ <xsl:apply-templates mode="index_add_id"/>
4449
+ </xsl:copy>
4450
+ </xsl:if>
4451
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4452
+ <xsl:copy>
4453
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4454
+ </xsl:copy>
4455
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4456
+ <xsl:copy>
4457
+ <xsl:apply-templates select="@*" mode="index_update"/>
4458
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4459
+ </xsl:copy>
4460
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4461
+ <xsl:param name="element"/>
4462
+ <xsl:param name="remove" select="'false'"/>
4463
+ <xsl:param name="target"/>
4464
+ <!-- <node></node> -->
4465
+ <xsl:choose>
4466
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4467
+ <!-- skip text (i.e. remove it) and process next element -->
4468
+ <!-- [removed_<xsl:value-of select="."/>] -->
4469
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4470
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4471
+ </xsl:apply-templates>
4472
+ </xsl:when>
4473
+ <xsl:when test="self::text()">
4474
+ <xsl:value-of select="."/>
4475
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4476
+ </xsl:when>
4477
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4478
+ <xsl:variable name="id" select="@id"/>
4479
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4480
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4481
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4482
+
4483
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4484
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4485
+
4486
+ <xsl:choose>
4487
+ <!-- 2nd pass -->
4488
+ <!-- if page is equal to page for next and page is not the end of range -->
4489
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4490
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4491
+ <!-- [removed_xref] -->
4492
+
4493
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4494
+ <xsl:with-param name="remove">true</xsl:with-param>
4495
+ <xsl:with-param name="target">
4496
+ <xsl:choose>
4497
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4498
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4499
+ </xsl:choose>
4500
+ </xsl:with-param>
4501
+ </xsl:apply-templates>
4502
+ </xsl:when>
4503
+
4504
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4505
+ <!-- remove xref -->
4506
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4507
+ <xsl:with-param name="remove">true</xsl:with-param>
4508
+ </xsl:apply-templates>
4509
+ </xsl:when>
4510
+
4511
+ <xsl:otherwise>
4512
+ <xsl:apply-templates select="." mode="xref_copy">
4513
+ <xsl:with-param name="target" select="$target"/>
4514
+ </xsl:apply-templates>
4515
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4516
+ </xsl:otherwise>
4517
+ </xsl:choose>
4518
+ </xsl:when>
4519
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4520
+ <!-- ul -->
4521
+ <xsl:apply-templates select="." mode="index_update"/>
4522
+ </xsl:when>
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:template><xsl:template match="@*|node()" mode="xref_copy">
4531
+ <xsl:param name="target"/>
4532
+ <xsl:copy>
4533
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4534
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4535
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4536
+ </xsl:if>
4537
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4538
+ </xsl:copy>
4539
+ </xsl:template><xsl:template name="generateIndexXrefId">
4540
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4541
+
4542
+ <xsl:variable name="docid">
4543
+ <xsl:call-template name="getDocumentId"/>
4544
+ </xsl:variable>
4545
+ <xsl:variable name="item_number">
4546
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4547
+ </xsl:variable>
4548
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4549
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4550
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4551
+ <xsl:apply-templates/>
4552
+ <fo:block>
4553
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4554
+ <fo:block> </fo:block>
4555
+ </xsl:if>
4556
+ </fo:block>
4557
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4558
+ <xsl:apply-templates/>
4559
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4560
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4561
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4562
+ <xsl:apply-templates/>
4563
+ </fo:block>
4564
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4565
+ <fo:inline id="{@id}" font-size="1pt"/>
4315
4566
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4316
4567
  <!-- <row>
4317
4568
  <date>05-07-2013</date>
@@ -4435,6 +4686,57 @@
4435
4686
  </xsl:variable>
4436
4687
  <xsl:variable name="result">
4437
4688
  <xsl:choose>
4689
+ <xsl:when test="$format = 'ddMMyyyy'">
4690
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4691
+ <xsl:text> </xsl:text>
4692
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4693
+ </xsl:when>
4694
+ <xsl:when test="$format = 'ddMM'">
4695
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4696
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4697
+ </xsl:when>
4698
+ <xsl:when test="$format = 'short' or $day = ''">
4699
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4700
+ </xsl:when>
4701
+ <xsl:otherwise>
4702
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4703
+ </xsl:otherwise>
4704
+ </xsl:choose>
4705
+ </xsl:variable>
4706
+ <xsl:value-of select="$result"/>
4707
+ </xsl:template><xsl:template name="convertDateLocalized">
4708
+ <xsl:param name="date"/>
4709
+ <xsl:param name="format" select="'short'"/>
4710
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4711
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4712
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4713
+ <xsl:variable name="monthStr">
4714
+ <xsl:choose>
4715
+ <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>
4716
+ <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>
4717
+ <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>
4718
+ <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>
4719
+ <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>
4720
+ <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>
4721
+ <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>
4722
+ <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>
4723
+ <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>
4724
+ <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>
4725
+ <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>
4726
+ <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>
4727
+ </xsl:choose>
4728
+ </xsl:variable>
4729
+ <xsl:variable name="result">
4730
+ <xsl:choose>
4731
+ <xsl:when test="$format = 'ddMMyyyy'">
4732
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4733
+ <xsl:text> </xsl:text>
4734
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4735
+ </xsl:when>
4736
+ <xsl:when test="$format = 'ddMM'">
4737
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4738
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4739
+ </xsl:when>
4438
4740
  <xsl:when test="$format = 'short' or $day = ''">
4439
4741
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4440
4742
  </xsl:when>
@@ -4450,7 +4752,7 @@
4450
4752
  <xsl:param name="charDelim" select="', '"/>
4451
4753
  <xsl:choose>
4452
4754
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4453
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4755
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4454
4756
  <xsl:sort data-type="text" order="ascending"/>
4455
4757
  <xsl:call-template name="insertKeyword">
4456
4758
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4459,7 +4761,7 @@
4459
4761
  </xsl:for-each>
4460
4762
  </xsl:when>
4461
4763
  <xsl:otherwise>
4462
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4764
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4463
4765
  <xsl:call-template name="insertKeyword">
4464
4766
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4465
4767
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4476,68 +4778,71 @@
4476
4778
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4477
4779
  </xsl:choose>
4478
4780
  </xsl:template><xsl:template name="addPDFUAmeta">
4479
- <fo:declarations>
4480
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4481
- <pdf:dictionary type="normal" key="ViewerPreferences">
4482
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4483
- </pdf:dictionary>
4484
- </pdf:catalog>
4485
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4486
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4487
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4488
- <!-- Dublin Core properties go here -->
4489
- <dc:title>
4490
- <xsl:variable name="title">
4781
+ <xsl:variable name="lang">
4782
+ <xsl:call-template name="getLang"/>
4783
+ </xsl:variable>
4784
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4785
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4786
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4787
+ </pdf:dictionary>
4788
+ </pdf:catalog>
4789
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4790
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4791
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4792
+ <!-- Dublin Core properties go here -->
4793
+ <dc:title>
4794
+ <xsl:variable name="title">
4795
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4796
+
4797
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4491
4798
 
4492
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4493
4799
 
4494
4800
 
4495
4801
 
4496
4802
 
4497
4803
 
4498
- </xsl:variable>
4499
- <xsl:choose>
4500
- <xsl:when test="normalize-space($title) != ''">
4501
- <xsl:value-of select="$title"/>
4502
- </xsl:when>
4503
- <xsl:otherwise>
4504
- <xsl:text> </xsl:text>
4505
- </xsl:otherwise>
4506
- </xsl:choose>
4507
- </dc:title>
4508
- <dc:creator>
4804
+ </xsl:for-each>
4805
+ </xsl:variable>
4806
+ <xsl:choose>
4807
+ <xsl:when test="normalize-space($title) != ''">
4808
+ <xsl:value-of select="$title"/>
4809
+ </xsl:when>
4810
+ <xsl:otherwise>
4811
+ <xsl:text> </xsl:text>
4812
+ </xsl:otherwise>
4813
+ </xsl:choose>
4814
+ </dc:title>
4815
+ <dc:creator>
4816
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4509
4817
 
4510
4818
 
4511
4819
 
4512
- <xsl:for-each select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4820
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4513
4821
  <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
4514
4822
  <xsl:if test="position() != last()">; </xsl:if>
4515
4823
  </xsl:for-each>
4516
4824
 
4517
- </dc:creator>
4518
- <dc:description>
4519
- <xsl:variable name="abstract">
4520
-
4521
-
4522
-
4523
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4524
-
4525
-
4526
-
4527
- </xsl:variable>
4528
- <xsl:value-of select="normalize-space($abstract)"/>
4529
- </dc:description>
4530
- <pdf:Keywords>
4531
- <xsl:call-template name="insertKeywords"/>
4532
- </pdf:Keywords>
4533
- </rdf:Description>
4534
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4535
- <!-- XMP properties go here -->
4536
- <xmp:CreatorTool/>
4537
- </rdf:Description>
4538
- </rdf:RDF>
4539
- </x:xmpmeta>
4540
- </fo:declarations>
4825
+ </xsl:for-each>
4826
+ </dc:creator>
4827
+ <dc:description>
4828
+ <xsl:variable name="abstract">
4829
+
4830
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4831
+
4832
+
4833
+ </xsl:variable>
4834
+ <xsl:value-of select="normalize-space($abstract)"/>
4835
+ </dc:description>
4836
+ <pdf:Keywords>
4837
+ <xsl:call-template name="insertKeywords"/>
4838
+ </pdf:Keywords>
4839
+ </rdf:Description>
4840
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4841
+ <!-- XMP properties go here -->
4842
+ <xmp:CreatorTool/>
4843
+ </rdf:Description>
4844
+ </rdf:RDF>
4845
+ </x:xmpmeta>
4541
4846
  </xsl:template><xsl:template name="getId">
4542
4847
  <xsl:choose>
4543
4848
  <xsl:when test="../@id">
@@ -4634,6 +4939,7 @@
4634
4939
 
4635
4940
 
4636
4941
 
4942
+
4637
4943
  </xsl:variable>
4638
4944
  <xsl:if test="$documentNS != $XSLNS">
4639
4945
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>