metanorma-nist 1.2.9 → 1.2.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -0
  3. data/.rubocop.yml +0 -4
  4. data/README.adoc +23 -3
  5. data/lib/asciidoctor/nist/basicdoc.rng +20 -3
  6. data/lib/asciidoctor/nist/boilerplate.rb +5 -3
  7. data/lib/asciidoctor/nist/cleanup.rb +4 -3
  8. data/lib/asciidoctor/nist/converter.rb +5 -2
  9. data/lib/asciidoctor/nist/front.rb +37 -46
  10. data/lib/asciidoctor/nist/front_id.rb +18 -7
  11. data/lib/asciidoctor/nist/isodoc.rng +118 -4
  12. data/lib/asciidoctor/nist/nist.rng +6 -0
  13. data/lib/asciidoctor/nist/nist_intro.xml +9 -9
  14. data/lib/asciidoctor/nist/nist_intro_cswp.xml +9 -9
  15. data/lib/asciidoctor/nist/validate.rb +17 -6
  16. data/lib/isodoc/nist/base_convert.rb +2 -3
  17. data/lib/isodoc/nist/html/header_cswp.html +2 -3
  18. data/lib/isodoc/nist/html/html_nist_titlepage.html +5 -3
  19. data/lib/isodoc/nist/html/word_nist_titlepage.html +8 -8
  20. data/lib/isodoc/nist/html/word_nist_titlepage_cswp.html +2 -0
  21. data/lib/isodoc/nist/html_convert.rb +6 -8
  22. data/lib/isodoc/nist/metadata.rb +28 -40
  23. data/lib/isodoc/nist/metadata_id.rb +3 -7
  24. data/lib/isodoc/nist/nist.csts.xsl +4844 -0
  25. data/lib/isodoc/nist/nist.cswp.xsl +477 -292
  26. data/lib/isodoc/nist/nist.sp.xsl +464 -327
  27. data/lib/isodoc/nist/pdf_convert.rb +5 -1
  28. data/lib/isodoc/nist/presentation_xml_convert.rb +30 -10
  29. data/lib/isodoc/nist/refs.rb +4 -20
  30. data/lib/isodoc/nist/render.rb +42 -40
  31. data/lib/isodoc/nist/render_dates.rb +8 -9
  32. data/lib/isodoc/nist/word_convert.rb +5 -6
  33. data/lib/isodoc/nist/xref.rb +11 -5
  34. data/lib/metanorma/nist/processor.rb +12 -0
  35. data/lib/metanorma/nist/version.rb +1 -1
  36. data/metanorma-nist.gemspec +2 -2
  37. metadata +8 -8
  38. data/lib/metanorma/nist/fonts_manifest.yaml +0 -6
@@ -31,7 +31,17 @@
31
31
  </xsl:choose>
32
32
  </xsl:variable>
33
33
  <xsl:variable name="color">rgb(36, 64, 97)</xsl:variable>
34
- <xsl:variable name="seriestitle" select="/nist:nist-standard/nist:bibdata/nist:series[@type = 'main']/nist:title"/>
34
+ <xsl:variable name="seriestitle">
35
+ <xsl:choose>
36
+ <xsl:when test="normalize-space(/nist:nist-standard/nist:bibdata/nist:series[@type = 'main']/nist:abbreviation) = 'NIST CSTS'">
37
+ <xsl:value-of select="/nist:nist-standard/nist:bibdata/nist:series[@type = 'secondary']/nist:title"/>
38
+ </xsl:when>
39
+ <xsl:otherwise>
40
+ <xsl:value-of select="/nist:nist-standard/nist:bibdata/nist:series[@type = 'main']/nist:title"/>
41
+ </xsl:otherwise>
42
+ </xsl:choose>
43
+ </xsl:variable>
44
+
35
45
  <!-- Example:
36
46
  <item level="1" id="Foreword" display="true">Foreword</item>
37
47
  <item id="term-script" display="false">3.2</item>
@@ -151,9 +161,20 @@
151
161
  <xsl:for-each select="/nist:nist-standard/nist:bibdata/nist:contributor[nist:role/@type = 'author']">
152
162
  <xsl:value-of select="nist:person/nist:name/nist:completename"/>
153
163
  <xsl:variable name="org-name" select="nist:person/nist:affiliation/nist:organization/nist:name"/>
164
+ <xsl:variable name="subdivision">
165
+ <xsl:for-each select="nist:person/nist:affiliation/nist:organization/nist:subdivision">
166
+ <xsl:value-of select="."/>
167
+ <xsl:if test="position() != last()">, </xsl:if>
168
+ </xsl:for-each>
169
+ </xsl:variable>
170
+ <xsl:variable name="following_subdivision">
171
+ <xsl:for-each select="following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:subdivision">
172
+ <xsl:value-of select="."/>
173
+ <xsl:if test="position() != last()">, </xsl:if>
174
+ </xsl:for-each>
175
+ </xsl:variable>
154
176
  <xsl:variable name="org-address" select="nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress"/>
155
- <xsl:if test="concat(following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:name, following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress) != concat($org-name, $org-address)">
156
-
177
+ <xsl:if test="concat(following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:name, $following_subdivision, following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress) != concat($org-name, $subdivision, $org-address)">
157
178
  <!-- <xsl:for-each select="xalan:tokenize($org-name, ',')">
158
179
  <fo:block>
159
180
  <fo:inline font-style="italic">
@@ -161,11 +182,15 @@
161
182
  </fo:inline>
162
183
  </fo:block>
163
184
  </xsl:for-each> -->
164
- <fo:block>
165
- <fo:inline font-style="italic">
166
- <xsl:value-of select="$org-name"/>
167
- </fo:inline>
185
+ <fo:block font-style="italic">
186
+ <xsl:value-of select="$org-name"/>
168
187
  </fo:block>
188
+ <xsl:if test="normalize-space($subdivision) != ''">
189
+ <fo:block font-style="italic">
190
+ <xsl:value-of select="$subdivision"/>
191
+ </fo:block>
192
+ </xsl:if>
193
+
169
194
  <xsl:if test="normalize-space($org-address) != ''">
170
195
  <fo:block>
171
196
  <fo:inline font-style="italic">
@@ -559,30 +584,23 @@
559
584
  <!-- Bibliography -->
560
585
  <!-- ============================= -->
561
586
 
562
-
563
- <!-- Example: [ITU-T A.23] ITU-T A.23, Recommendation ITU-T A.23, Annex A (2014), Guide for ITU-T and ISO/IEC JTC 1 cooperation. -->
587
+ <!-- Examples:
588
+ [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
589
+ [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag.
590
+ -->
564
591
  <xsl:template match="nist:bibitem">
565
-
566
592
  <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
567
593
  <fo:list-item>
568
594
  <fo:list-item-label end-indent="label-end()">
569
595
  <fo:block>
570
596
  <fo:inline id="{@id}">
571
597
  <!-- <xsl:number format="[1]"/> -->
572
- <xsl:value-of select="nist:docidentifier"/>
598
+ <xsl:value-of select="nist:docidentifier[@display = 'true']"/>
573
599
  </fo:inline>
574
600
  </fo:block>
575
601
  </fo:list-item-label>
576
602
  <fo:list-item-body start-indent="body-start()">
577
603
  <fo:block>
578
- <xsl:choose>
579
- <xsl:when test="nist:title[@type = 'main' and @language = 'en']">
580
- <xsl:apply-templates select="nist:title[@type = 'main' and @language = 'en']"/>
581
- </xsl:when>
582
- <xsl:otherwise>
583
- <xsl:apply-templates select="nist:title"/>
584
- </xsl:otherwise>
585
- </xsl:choose>
586
604
  <xsl:apply-templates select="nist:formattedref"/>
587
605
  </fo:block>
588
606
  </fo:list-item-body>
@@ -590,6 +608,9 @@
590
608
  </fo:list-block>
591
609
  </xsl:template>
592
610
 
611
+ <xsl:template match="nist:formattedref">
612
+ <xsl:apply-templates/>
613
+ </xsl:template>
593
614
  <!-- ============================= -->
594
615
  <!-- ============================= -->
595
616
 
@@ -619,6 +640,11 @@
619
640
  </fo:block>
620
641
  </xsl:template>
621
642
 
643
+ <xsl:template match="nist:references">
644
+ <fo:block id="{@id}">
645
+ <xsl:apply-templates/>
646
+ </fo:block>
647
+ </xsl:template>
622
648
  <xsl:template match="nist:references/nist:title">
623
649
  <fo:block-container color="white" background-color="{$color}" margin-bottom="12pt" keep-with-next="always" height="5mm" margin-left="-0.5mm" margin-right="-0.5mm">
624
650
  <fo:block font-family="Arial" font-size="12pt" font-weight="bold" margin-left="1mm" padding-top="0.3mm">
@@ -686,14 +712,14 @@
686
712
  </xsl:variable>
687
713
  <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
688
714
  <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
689
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
715
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
690
716
  </fo:basic-link>
691
717
  </fo:inline>
692
718
  <fo:footnote-body>
693
719
  <fo:block-container margin-left="3mm">
694
720
  <fo:block font-size="9pt" font-family="Times New Roman" font-style="normal" font-weight="normal" margin-left="-3mm" margin-top="6pt" margin-bottom="12pt" start-indent="0mm" text-indent="-2mm" line-height="10pt" page-break-inside="avoid">
695
721
  <fo:inline id="footnote_{@reference}_{$number}" font-size="75%" keep-with-next.within-line="always" vertical-align="super" padding-right="1mm"> <!-- alignment-baseline="hanging" -->
696
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
722
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
697
723
  </fo:inline>
698
724
  <xsl:for-each select="nist:p">
699
725
  <xsl:apply-templates/>
@@ -726,78 +752,6 @@
726
752
  </xsl:template>
727
753
 
728
754
 
729
- <!-- Examples:
730
- [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
731
- [b-Börger & Stärk] b-Börger & Stärk, Börger, E., and Stärk, R. S. (2003), Abstract State Machines: A Method for High-Level System Design and Analysis, Springer-Verlag.
732
- -->
733
- <xsl:template match="nist:annex//nist:bibitem">
734
- <fo:block id="{@id}" margin-top="6pt" margin-left="12mm" text-indent="-12mm">
735
- <xsl:if test="nist:formattedref">
736
- <xsl:choose>
737
- <xsl:when test="nist:docidentifier[@type = 'metanorma']">
738
- <xsl:attribute name="margin-left">0</xsl:attribute>
739
- <xsl:attribute name="text-indent">0</xsl:attribute>
740
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
741
- <!-- create list -->
742
- <fo:list-block>
743
- <fo:list-item>
744
- <fo:list-item-label end-indent="label-end()">
745
- <fo:block>
746
- <xsl:apply-templates select="nist:docidentifier[@type = 'metanorma']" mode="process"/>
747
- </fo:block>
748
- </fo:list-item-label>
749
- <fo:list-item-body start-indent="body-start()">
750
- <fo:block margin-left="3mm">
751
- <xsl:apply-templates select="nist:formattedref"/>
752
- </fo:block>
753
- </fo:list-item-body>
754
- </fo:list-item>
755
- </fo:list-block>
756
- </xsl:when>
757
- <xsl:otherwise>
758
- <xsl:apply-templates select="nist:formattedref"/>
759
- <xsl:apply-templates select="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process"/>
760
- </xsl:otherwise>
761
- </xsl:choose>
762
-
763
-
764
- </xsl:if>
765
- <xsl:if test="nist:title">
766
- <xsl:for-each select="nist:contributor">
767
- <xsl:value-of select="nist:organization/nist:name"/>
768
- <xsl:if test="position() != last()">, </xsl:if>
769
- </xsl:for-each>
770
- <xsl:text> (</xsl:text>
771
-
772
- <xsl:value-of select="$date"/>
773
- <xsl:text>) </xsl:text>
774
- <fo:inline font-style="italic"><xsl:value-of select="nist:title"/></fo:inline>
775
- <xsl:if test="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name">
776
- <xsl:text> (</xsl:text><xsl:value-of select="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name"/><xsl:text>)</xsl:text>
777
- </xsl:if>
778
- <xsl:text>, </xsl:text>
779
- <xsl:value-of select="$date"/>
780
- <xsl:text>. </xsl:text>
781
- <xsl:value-of select="nist:docidentifier"/>
782
- <xsl:value-of select="$linebreak"/>
783
- <xsl:value-of select="nist:uri"/>
784
- </xsl:if>
785
- </fo:block>
786
- </xsl:template>
787
-
788
- <xsl:template match="nist:annex//nist:bibitem//nist:formattedref">
789
- <xsl:apply-templates/>
790
- </xsl:template>
791
-
792
- <xsl:template match="nist:docidentifier[@type = 'metanorma']" mode="process">
793
- <xsl:apply-templates/>
794
- </xsl:template>
795
- <xsl:template match="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process">
796
- <xsl:text> [</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text>
797
- </xsl:template>
798
- <xsl:template match="nist:docidentifier"/>
799
-
800
-
801
755
  <xsl:template match="nist:ul | nist:ol" mode="ul_ol">
802
756
  <fo:list-block>
803
757
  <xsl:apply-templates/>
@@ -1458,6 +1412,7 @@
1458
1412
 
1459
1413
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1460
1414
 
1415
+
1461
1416
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1462
1417
 
1463
1418
 
@@ -1465,6 +1420,7 @@
1465
1420
 
1466
1421
 
1467
1422
 
1423
+
1468
1424
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1469
1425
 
1470
1426
 
@@ -1591,200 +1547,239 @@
1591
1547
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1592
1548
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1593
1549
  <xsl:call-template name="add-zero-spaces-java"/>
1594
- </xsl:template><xsl:template match="*[local-name()='table']">
1550
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1595
1551
 
1596
- <xsl:variable name="simple-table">
1597
- <xsl:call-template name="getSimpleTable"/>
1598
- </xsl:variable>
1552
+ <xsl:variable name="table">
1599
1553
 
1600
-
1601
-
1602
-
1603
-
1604
- <!-- <xsl:if test="$namespace = 'bipm'">
1605
- <fo:block>&#xA0;</fo:block>
1606
- </xsl:if> -->
1607
-
1608
- <!-- $namespace = 'iso' or -->
1609
-
1610
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1611
-
1612
-
1554
+ <xsl:variable name="simple-table">
1555
+ <xsl:call-template name="getSimpleTable"/>
1556
+ </xsl:variable>
1613
1557
 
1614
1558
 
1615
-
1616
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1617
-
1618
- <!-- <xsl:variable name="cols-count">
1619
- <xsl:choose>
1620
- <xsl:when test="*[local-name()='thead']">
1621
- <xsl:call-template name="calculate-columns-numbers">
1622
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1623
- </xsl:call-template>
1624
- </xsl:when>
1625
- <xsl:otherwise>
1626
- <xsl:call-template name="calculate-columns-numbers">
1627
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1628
- </xsl:call-template>
1629
- </xsl:otherwise>
1630
- </xsl:choose>
1631
- </xsl:variable> -->
1632
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1633
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1634
-
1635
-
1636
-
1637
- <xsl:variable name="colwidths">
1638
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1639
- <xsl:call-template name="calculate-column-widths">
1640
- <xsl:with-param name="cols-count" select="$cols-count"/>
1641
- <xsl:with-param name="table" select="$simple-table"/>
1642
- </xsl:call-template>
1643
- </xsl:if>
1644
- </xsl:variable>
1645
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1646
-
1647
- <!-- <xsl:variable name="colwidths2">
1648
- <xsl:call-template name="calculate-column-widths">
1649
- <xsl:with-param name="cols-count" select="$cols-count"/>
1650
- </xsl:call-template>
1651
- </xsl:variable> -->
1652
-
1653
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1654
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1655
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1656
-
1657
- <xsl:variable name="margin-left">
1658
- <xsl:choose>
1659
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1660
- <xsl:otherwise>0</xsl:otherwise>
1661
- </xsl:choose>
1662
- </xsl:variable>
1663
-
1664
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1665
1559
 
1666
1560
 
1667
- <xsl:attribute name="space-after">6pt</xsl:attribute>
1668
1561
 
1669
-
1670
-
1671
-
1562
+ <!-- <xsl:if test="$namespace = 'bipm'">
1563
+ <fo:block>&#xA0;</fo:block>
1564
+ </xsl:if> -->
1672
1565
 
1566
+ <!-- $namespace = 'iso' or -->
1673
1567
 
1674
- <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
1675
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1676
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1677
- </xsl:if>
1678
- <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
1679
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1680
- <xsl:attribute name="font-size">12pt</xsl:attribute>
1681
- </xsl:if>
1682
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1568
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1683
1569
 
1684
-
1570
+
1571
+
1572
+
1573
+
1574
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1575
+
1576
+ <!-- <xsl:variable name="cols-count">
1577
+ <xsl:choose>
1578
+ <xsl:when test="*[local-name()='thead']">
1579
+ <xsl:call-template name="calculate-columns-numbers">
1580
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1581
+ </xsl:call-template>
1582
+ </xsl:when>
1583
+ <xsl:otherwise>
1584
+ <xsl:call-template name="calculate-columns-numbers">
1585
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1586
+ </xsl:call-template>
1587
+ </xsl:otherwise>
1588
+ </xsl:choose>
1589
+ </xsl:variable> -->
1590
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1591
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1685
1592
 
1686
1593
 
1687
1594
 
1595
+ <xsl:variable name="colwidths">
1596
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1597
+ <xsl:call-template name="calculate-column-widths">
1598
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1599
+ <xsl:with-param name="table" select="$simple-table"/>
1600
+ </xsl:call-template>
1601
+ </xsl:if>
1602
+ </xsl:variable>
1603
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1688
1604
 
1605
+ <!-- <xsl:variable name="colwidths2">
1606
+ <xsl:call-template name="calculate-column-widths">
1607
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1608
+ </xsl:call-template>
1609
+ </xsl:variable> -->
1689
1610
 
1611
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1612
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1613
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1690
1614
 
1615
+ <xsl:variable name="margin-left">
1616
+ <xsl:choose>
1617
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1618
+ <xsl:otherwise>0</xsl:otherwise>
1619
+ </xsl:choose>
1620
+ </xsl:variable>
1691
1621
 
1692
- <xsl:variable name="table_attributes">
1693
- <attribute name="table-layout">fixed</attribute>
1694
- <attribute name="width">100%</attribute>
1695
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1696
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1622
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1697
1623
 
1698
1624
 
1625
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
1699
1626
 
1627
+
1628
+
1629
+
1700
1630
 
1701
-
1702
-
1703
-
1704
1631
 
1705
-
1632
+ <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
1633
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1634
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1635
+ </xsl:if>
1636
+ <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
1637
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1638
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
1639
+ </xsl:if>
1640
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1706
1641
 
1707
- </xsl:variable>
1708
-
1709
-
1710
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1642
+
1711
1643
 
1712
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1713
- <xsl:attribute name="{@name}">
1714
- <xsl:value-of select="."/>
1715
- </xsl:attribute>
1716
- </xsl:for-each>
1717
1644
 
1718
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1719
- <xsl:if test="$isNoteOrFnExist = 'true'">
1720
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1721
- </xsl:if>
1722
1645
 
1723
- <xsl:choose>
1724
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1725
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1726
- <fo:table-column column-width="{@width}"/>
1727
- </xsl:for-each>
1728
- </xsl:when>
1729
- <xsl:otherwise>
1730
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1731
- <xsl:choose>
1732
- <xsl:when test=". = 1 or . = 0">
1733
- <fo:table-column column-width="proportional-column-width(2)"/>
1734
- </xsl:when>
1735
- <xsl:otherwise>
1736
- <fo:table-column column-width="proportional-column-width({.})"/>
1737
- </xsl:otherwise>
1738
- </xsl:choose>
1739
- </xsl:for-each>
1740
- </xsl:otherwise>
1741
- </xsl:choose>
1742
1646
 
1743
- <xsl:choose>
1744
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1745
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1746
- </xsl:when>
1747
- <xsl:otherwise>
1748
- <xsl:apply-templates/>
1749
- </xsl:otherwise>
1750
- </xsl:choose>
1751
1647
 
1752
- </fo:table>
1753
-
1754
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1755
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1756
- <xsl:call-template name="insertTableFooterInSeparateTable">
1757
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1758
- <xsl:with-param name="colwidths" select="$colwidths"/>
1759
- <xsl:with-param name="colgroup" select="$colgroup"/>
1760
- </xsl:call-template>
1761
- </xsl:for-each>
1762
-
1763
- <!-- insert footer as table -->
1764
- <!-- <fo:table>
1765
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1766
- <xsl:attribute name="{@name}">
1767
- <xsl:value-of select="."/>
1768
- </xsl:attribute>
1769
- </xsl:for-each>
1770
1648
 
1771
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1649
+ <xsl:variable name="table_width">
1650
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1651
+ 100%
1652
+
1653
+
1654
+ </xsl:variable>
1655
+
1656
+ <xsl:variable name="table_attributes">
1657
+ <attribute name="table-layout">fixed</attribute>
1658
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1659
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1660
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1661
+
1662
+
1663
+
1664
+
1665
+
1666
+
1667
+
1668
+
1669
+
1670
+
1671
+ </xsl:variable>
1672
+
1673
+
1674
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1675
+
1676
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1677
+ <xsl:attribute name="{@name}">
1678
+ <xsl:value-of select="."/>
1679
+ </xsl:attribute>
1680
+ </xsl:for-each>
1681
+
1682
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1683
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1684
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1685
+ </xsl:if>
1686
+
1687
+ <xsl:choose>
1688
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1689
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1690
+ <fo:table-column column-width="{@width}"/>
1691
+ </xsl:for-each>
1692
+ </xsl:when>
1693
+ <xsl:otherwise>
1694
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1695
+ <xsl:choose>
1696
+ <xsl:when test=". = 1 or . = 0">
1697
+ <fo:table-column column-width="proportional-column-width(2)"/>
1698
+ </xsl:when>
1699
+ <xsl:otherwise>
1700
+ <fo:table-column column-width="proportional-column-width({.})"/>
1701
+ </xsl:otherwise>
1702
+ </xsl:choose>
1703
+ </xsl:for-each>
1704
+ </xsl:otherwise>
1705
+ </xsl:choose>
1706
+
1772
1707
  <xsl:choose>
1773
- <xsl:when test=". = 1 or . = 0">
1774
- <fo:table-column column-width="proportional-column-width(2)"/>
1708
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1709
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1775
1710
  </xsl:when>
1776
1711
  <xsl:otherwise>
1777
- <fo:table-column column-width="proportional-column-width({.})"/>
1712
+ <xsl:apply-templates/>
1778
1713
  </xsl:otherwise>
1779
1714
  </xsl:choose>
1715
+
1716
+ </fo:table>
1717
+
1718
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1719
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1720
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1721
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1722
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1723
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1724
+ </xsl:call-template>
1780
1725
  </xsl:for-each>
1781
- </fo:table>-->
1782
-
1783
-
1784
-
1785
-
1786
-
1787
- </fo:block-container>
1726
+
1727
+ <!-- insert footer as table -->
1728
+ <!-- <fo:table>
1729
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1730
+ <xsl:attribute name="{@name}">
1731
+ <xsl:value-of select="."/>
1732
+ </xsl:attribute>
1733
+ </xsl:for-each>
1734
+
1735
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1736
+ <xsl:choose>
1737
+ <xsl:when test=". = 1 or . = 0">
1738
+ <fo:table-column column-width="proportional-column-width(2)"/>
1739
+ </xsl:when>
1740
+ <xsl:otherwise>
1741
+ <fo:table-column column-width="proportional-column-width({.})"/>
1742
+ </xsl:otherwise>
1743
+ </xsl:choose>
1744
+ </xsl:for-each>
1745
+ </fo:table>-->
1746
+
1747
+
1748
+
1749
+
1750
+
1751
+ </fo:block-container>
1752
+ </xsl:variable>
1753
+
1754
+
1755
+
1756
+ <xsl:choose>
1757
+ <xsl:when test="@width">
1758
+
1759
+ <!-- centered table when table name is centered (see table-name-style) -->
1760
+
1761
+ <fo:table table-layout="fixed" width="100%">
1762
+ <fo:table-column column-width="proportional-column-width(1)"/>
1763
+ <fo:table-column column-width="{@width}"/>
1764
+ <fo:table-column column-width="proportional-column-width(1)"/>
1765
+ <fo:table-body>
1766
+ <fo:table-row>
1767
+ <fo:table-cell column-number="2">
1768
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
1769
+ </fo:table-cell>
1770
+ </fo:table-row>
1771
+ </fo:table-body>
1772
+ </fo:table>
1773
+
1774
+
1775
+
1776
+
1777
+ </xsl:when>
1778
+ <xsl:otherwise>
1779
+ <xsl:copy-of select="$table"/>
1780
+ </xsl:otherwise>
1781
+ </xsl:choose>
1782
+
1788
1783
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1789
1784
  <xsl:if test="normalize-space() != ''">
1790
1785
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -2483,7 +2478,9 @@
2483
2478
  </xsl:template><xsl:template match="*[local-name()='dl']">
2484
2479
  <fo:block-container>
2485
2480
 
2486
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2481
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
2482
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2483
+ </xsl:if>
2487
2484
 
2488
2485
 
2489
2486
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -2498,6 +2495,7 @@
2498
2495
  <fo:block-container>
2499
2496
 
2500
2497
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2498
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2501
2499
 
2502
2500
 
2503
2501
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -2622,7 +2620,7 @@
2622
2620
  <xsl:with-param name="table" select="$html-table"/>
2623
2621
  </xsl:call-template>
2624
2622
  </xsl:variable>
2625
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2623
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2626
2624
  <xsl:variable name="maxlength_dt">
2627
2625
  <xsl:call-template name="getMaxLength_dt"/>
2628
2626
  </xsl:variable>
@@ -2651,13 +2649,22 @@
2651
2649
  </xsl:when>
2652
2650
  <xsl:otherwise>
2653
2651
  <xsl:choose>
2652
+ <!-- to set width check most wide chars like `W` -->
2654
2653
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2655
- <fo:table-column column-width="5%"/>
2656
- <fo:table-column column-width="95%"/>
2654
+ <fo:table-column column-width="7%"/>
2655
+ <fo:table-column column-width="93%"/>
2656
+ </xsl:when>
2657
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2658
+ <fo:table-column column-width="15%"/>
2659
+ <fo:table-column column-width="85%"/>
2657
2660
  </xsl:when>
2658
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2659
- <fo:table-column column-width="10%"/>
2660
- <fo:table-column column-width="90%"/>
2661
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2662
+ <fo:table-column column-width="20%"/>
2663
+ <fo:table-column column-width="80%"/>
2664
+ </xsl:when>
2665
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2666
+ <fo:table-column column-width="25%"/>
2667
+ <fo:table-column column-width="75%"/>
2661
2668
  </xsl:when>
2662
2669
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2663
2670
  <fo:table-column column-width="60%"/>
@@ -2689,12 +2696,32 @@
2689
2696
  </xsl:otherwise>
2690
2697
  </xsl:choose>
2691
2698
  </xsl:template><xsl:template name="getMaxLength_dt">
2692
- <xsl:for-each select="*[local-name()='dt']">
2693
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2694
- <xsl:if test="position() = 1">
2695
- <xsl:value-of select="string-length(normalize-space(.))"/>
2696
- </xsl:if>
2697
- </xsl:for-each>
2699
+ <xsl:variable name="lengths">
2700
+ <xsl:for-each select="*[local-name()='dt']">
2701
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
2702
+ <xsl:variable name="attributes">
2703
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
2704
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
2705
+ </xsl:variable>
2706
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
2707
+ </xsl:for-each>
2708
+ </xsl:variable>
2709
+ <xsl:variable name="maxLength">
2710
+ <!-- <xsl:for-each select="*[local-name()='dt']">
2711
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2712
+ <xsl:if test="position() = 1">
2713
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2714
+ </xsl:if>
2715
+ </xsl:for-each> -->
2716
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
2717
+ <xsl:sort select="." data-type="number" order="descending"/>
2718
+ <xsl:if test="position() = 1">
2719
+ <xsl:value-of select="."/>
2720
+ </xsl:if>
2721
+ </xsl:for-each>
2722
+ </xsl:variable>
2723
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
2724
+ <xsl:value-of select="$maxLength"/>
2698
2725
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2699
2726
  <xsl:param name="key_iso"/>
2700
2727
 
@@ -2849,6 +2876,7 @@
2849
2876
 
2850
2877
 
2851
2878
 
2879
+
2852
2880
 
2853
2881
  </xsl:variable>
2854
2882
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2862,6 +2890,10 @@
2862
2890
  </xsl:if>
2863
2891
  <xsl:apply-templates/>
2864
2892
  </fo:inline>
2893
+ </xsl:template><xsl:template match="*[local-name()='underline']">
2894
+ <fo:inline text-decoration="underline">
2895
+ <xsl:apply-templates/>
2896
+ </fo:inline>
2865
2897
  </xsl:template><xsl:template match="*[local-name()='del']">
2866
2898
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2867
2899
  <xsl:apply-templates/>
@@ -2955,6 +2987,10 @@
2955
2987
  <xsl:param name="text" select="."/>
2956
2988
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2957
2989
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2990
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
2991
+ <xsl:param name="text" select="."/>
2992
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2993
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2958
2994
  </xsl:template><xsl:template name="add-zero-spaces">
2959
2995
  <xsl:param name="text" select="."/>
2960
2996
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3215,6 +3251,11 @@
3215
3251
  <!-- replace start and end spaces to non-break space -->
3216
3252
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3217
3253
  </xsl:copy>
3254
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3255
+ <xsl:copy>
3256
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3257
+ </xsl:copy>
3258
+ <mathml:mspace width="0.5ex"/>
3218
3259
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3219
3260
  <xsl:variable name="target">
3220
3261
  <xsl:choose>
@@ -3236,7 +3277,10 @@
3236
3277
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3237
3278
  <xsl:choose>
3238
3279
  <xsl:when test="normalize-space(.) = ''">
3239
- <xsl:value-of select="$target"/>
3280
+ <!-- <xsl:value-of select="$target"/> -->
3281
+ <xsl:call-template name="add-zero-spaces-link-java">
3282
+ <xsl:with-param name="text" select="$target"/>
3283
+ </xsl:call-template>
3240
3284
  </xsl:when>
3241
3285
  <xsl:otherwise>
3242
3286
  <xsl:apply-templates/>
@@ -3442,7 +3486,7 @@
3442
3486
  </xsl:if> -->
3443
3487
  </fo:inline>
3444
3488
  </xsl:if>
3445
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3489
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3446
3490
  <fo:block-container id="{@id}">
3447
3491
 
3448
3492
  <fo:block>
@@ -3511,6 +3555,8 @@
3511
3555
  <xsl:variable name="bookmark-title_">
3512
3556
  <xsl:call-template name="getLangVersion">
3513
3557
  <xsl:with-param name="lang" select="@lang"/>
3558
+ <xsl:with-param name="doctype" select="@doctype"/>
3559
+ <xsl:with-param name="title" select="@title-part"/>
3514
3560
  </xsl:call-template>
3515
3561
  </xsl:variable>
3516
3562
  <xsl:choose>
@@ -3528,13 +3574,34 @@
3528
3574
  </xsl:choose>
3529
3575
  </fo:bookmark-title>
3530
3576
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3577
+
3578
+ <xsl:call-template name="insertFigureBookmarks">
3579
+ <xsl:with-param name="contents" select="contents"/>
3580
+ </xsl:call-template>
3581
+
3582
+ <xsl:call-template name="insertTableBookmarks">
3583
+ <xsl:with-param name="contents" select="contents"/>
3584
+ <xsl:with-param name="lang" select="@lang"/>
3585
+ </xsl:call-template>
3586
+
3531
3587
  </fo:bookmark>
3532
3588
 
3533
3589
  </xsl:for-each>
3534
3590
  </xsl:when>
3535
3591
  <xsl:otherwise>
3536
3592
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3593
+
3537
3594
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3595
+
3596
+ <xsl:call-template name="insertFigureBookmarks">
3597
+ <xsl:with-param name="contents" select="contents"/>
3598
+ </xsl:call-template>
3599
+
3600
+ <xsl:call-template name="insertTableBookmarks">
3601
+ <xsl:with-param name="contents" select="contents"/>
3602
+ <xsl:with-param name="lang" select="@lang"/>
3603
+ </xsl:call-template>
3604
+
3538
3605
  </xsl:for-each>
3539
3606
  </xsl:otherwise>
3540
3607
  </xsl:choose>
@@ -3553,8 +3620,44 @@
3553
3620
 
3554
3621
  </fo:bookmark-tree>
3555
3622
  </xsl:if>
3623
+ </xsl:template><xsl:template name="insertFigureBookmarks">
3624
+ <xsl:param name="contents"/>
3625
+ <xsl:if test="xalan:nodeset($contents)/figure">
3626
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
3627
+ <fo:bookmark-title>Figures</fo:bookmark-title>
3628
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
3629
+ <fo:bookmark internal-destination="{@id}">
3630
+ <fo:bookmark-title>
3631
+ <xsl:value-of select="normalize-space(title)"/>
3632
+ </fo:bookmark-title>
3633
+ </fo:bookmark>
3634
+ </xsl:for-each>
3635
+ </fo:bookmark>
3636
+ </xsl:if>
3637
+ </xsl:template><xsl:template name="insertTableBookmarks">
3638
+ <xsl:param name="contents"/>
3639
+ <xsl:param name="lang"/>
3640
+ <xsl:if test="xalan:nodeset($contents)/table">
3641
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
3642
+ <fo:bookmark-title>
3643
+ <xsl:choose>
3644
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
3645
+ <xsl:otherwise>Tables</xsl:otherwise>
3646
+ </xsl:choose>
3647
+ </fo:bookmark-title>
3648
+ <xsl:for-each select="xalan:nodeset($contents)/table">
3649
+ <fo:bookmark internal-destination="{@id}">
3650
+ <fo:bookmark-title>
3651
+ <xsl:value-of select="normalize-space(title)"/>
3652
+ </fo:bookmark-title>
3653
+ </fo:bookmark>
3654
+ </xsl:for-each>
3655
+ </fo:bookmark>
3656
+ </xsl:if>
3556
3657
  </xsl:template><xsl:template name="getLangVersion">
3557
3658
  <xsl:param name="lang"/>
3659
+ <xsl:param name="doctype" select="''"/>
3660
+ <xsl:param name="title" select="''"/>
3558
3661
  <xsl:choose>
3559
3662
  <xsl:when test="$lang = 'en'">
3560
3663
 
@@ -3594,6 +3697,12 @@
3594
3697
  <!-- <xsl:text> </xsl:text> -->
3595
3698
  </xsl:template><xsl:template name="getSection">
3596
3699
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3700
+ <!--
3701
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3702
+ <xsl:value-of select="."/>
3703
+ </xsl:for-each>
3704
+ -->
3705
+
3597
3706
  </xsl:template><xsl:template name="getName">
3598
3707
  <xsl:choose>
3599
3708
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3646,6 +3755,12 @@
3646
3755
  <xsl:copy>
3647
3756
  <xsl:apply-templates mode="contents_item"/>
3648
3757
  </xsl:copy>
3758
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3759
+ <xsl:copy>
3760
+ <xsl:apply-templates mode="contents_item"/>
3761
+ </xsl:copy>
3762
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3763
+ <xsl:copy-of select="."/>
3649
3764
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3650
3765
  <xsl:text> </xsl:text>
3651
3766
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3671,6 +3786,7 @@
3671
3786
 
3672
3787
 
3673
3788
 
3789
+
3674
3790
 
3675
3791
 
3676
3792
  10
@@ -4043,10 +4159,13 @@
4043
4159
  </xsl:if>
4044
4160
  </xsl:if>
4045
4161
 
4162
+
4046
4163
  <fo:block-container margin-left="0mm">
4047
4164
 
4048
4165
  <fo:block xsl:use-attribute-sets="quote-style">
4049
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
4166
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4167
+
4168
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4050
4169
  </fo:block>
4051
4170
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4052
4171
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4199,6 +4318,7 @@
4199
4318
 
4200
4319
 
4201
4320
 
4321
+
4202
4322
 
4203
4323
 
4204
4324
 
@@ -4214,7 +4334,7 @@
4214
4334
  </xsl:if>
4215
4335
 
4216
4336
 
4217
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4337
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4218
4338
  <fo:block break-after="page"/>
4219
4339
  <fo:block>
4220
4340
  <xsl:call-template name="setId"/>
@@ -4222,7 +4342,8 @@
4222
4342
  </fo:block>
4223
4343
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4224
4344
  <fo:block>
4225
- <xsl:call-template name="setId"/>
4345
+ <xsl:call-template name="setId"/>
4346
+
4226
4347
 
4227
4348
  <xsl:apply-templates/>
4228
4349
  </fo:block>
@@ -4372,6 +4493,8 @@
4372
4493
  <xsl:value-of select="translate(.,'. ','')"/>
4373
4494
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4374
4495
  <xsl:value-of select="substring(.,1,1)"/>
4496
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4497
+ <fo:inline><xsl:apply-templates/></fo:inline>
4375
4498
  </xsl:template><xsl:template name="convertDate">
4376
4499
  <xsl:param name="date"/>
4377
4500
  <xsl:param name="format" select="'short'"/>
@@ -4396,6 +4519,57 @@
4396
4519
  </xsl:variable>
4397
4520
  <xsl:variable name="result">
4398
4521
  <xsl:choose>
4522
+ <xsl:when test="$format = 'ddMMyyyy'">
4523
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4524
+ <xsl:text> </xsl:text>
4525
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4526
+ </xsl:when>
4527
+ <xsl:when test="$format = 'ddMM'">
4528
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4529
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4530
+ </xsl:when>
4531
+ <xsl:when test="$format = 'short' or $day = ''">
4532
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4533
+ </xsl:when>
4534
+ <xsl:otherwise>
4535
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4536
+ </xsl:otherwise>
4537
+ </xsl:choose>
4538
+ </xsl:variable>
4539
+ <xsl:value-of select="$result"/>
4540
+ </xsl:template><xsl:template name="convertDateLocalized">
4541
+ <xsl:param name="date"/>
4542
+ <xsl:param name="format" select="'short'"/>
4543
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4544
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4545
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4546
+ <xsl:variable name="monthStr">
4547
+ <xsl:choose>
4548
+ <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>
4549
+ <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>
4550
+ <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>
4551
+ <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>
4552
+ <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>
4553
+ <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>
4554
+ <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>
4555
+ <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>
4556
+ <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>
4557
+ <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>
4558
+ <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>
4559
+ <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>
4560
+ </xsl:choose>
4561
+ </xsl:variable>
4562
+ <xsl:variable name="result">
4563
+ <xsl:choose>
4564
+ <xsl:when test="$format = 'ddMMyyyy'">
4565
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4566
+ <xsl:text> </xsl:text>
4567
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4568
+ </xsl:when>
4569
+ <xsl:when test="$format = 'ddMM'">
4570
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4571
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4572
+ </xsl:when>
4399
4573
  <xsl:when test="$format = 'short' or $day = ''">
4400
4574
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4401
4575
  </xsl:when>
@@ -4411,7 +4585,7 @@
4411
4585
  <xsl:param name="charDelim" select="', '"/>
4412
4586
  <xsl:choose>
4413
4587
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4414
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4588
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4415
4589
  <xsl:sort data-type="text" order="ascending"/>
4416
4590
  <xsl:call-template name="insertKeyword">
4417
4591
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4420,7 +4594,7 @@
4420
4594
  </xsl:for-each>
4421
4595
  </xsl:when>
4422
4596
  <xsl:otherwise>
4423
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4597
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4424
4598
  <xsl:call-template name="insertKeyword">
4425
4599
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4426
4600
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4437,6 +4611,9 @@
4437
4611
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4438
4612
  </xsl:choose>
4439
4613
  </xsl:template><xsl:template name="addPDFUAmeta">
4614
+ <xsl:variable name="lang">
4615
+ <xsl:call-template name="getLang"/>
4616
+ </xsl:variable>
4440
4617
  <fo:declarations>
4441
4618
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4442
4619
  <pdf:dictionary type="normal" key="ViewerPreferences">
@@ -4449,13 +4626,16 @@
4449
4626
  <!-- Dublin Core properties go here -->
4450
4627
  <dc:title>
4451
4628
  <xsl:variable name="title">
4452
-
4453
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4454
-
4455
-
4456
-
4457
-
4458
-
4629
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4630
+
4631
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4632
+
4633
+
4634
+
4635
+
4636
+
4637
+
4638
+ </xsl:for-each>
4459
4639
  </xsl:variable>
4460
4640
  <xsl:choose>
4461
4641
  <xsl:when test="normalize-space($title) != ''">
@@ -4467,22 +4647,21 @@
4467
4647
  </xsl:choose>
4468
4648
  </dc:title>
4469
4649
  <dc:creator>
4470
-
4471
-
4472
-
4473
- <xsl:for-each select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4474
- <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
4475
- <xsl:if test="position() != last()">; </xsl:if>
4476
- </xsl:for-each>
4477
-
4478
- </dc:creator>
4479
- <dc:description>
4480
- <xsl:variable name="abstract">
4650
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4481
4651
 
4482
4652
 
4483
4653
 
4484
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4654
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4655
+ <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
4656
+ <xsl:if test="position() != last()">; </xsl:if>
4657
+ </xsl:for-each>
4485
4658
 
4659
+ </xsl:for-each>
4660
+ </dc:creator>
4661
+ <dc:description>
4662
+ <xsl:variable name="abstract">
4663
+
4664
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4486
4665
 
4487
4666
 
4488
4667
  </xsl:variable>
@@ -4595,6 +4774,7 @@
4595
4774
 
4596
4775
 
4597
4776
 
4777
+
4598
4778
  </xsl:variable>
4599
4779
  <xsl:if test="$documentNS != $XSLNS">
4600
4780
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4654,6 +4834,11 @@
4654
4834
  <xsl:call-template name="getLang"/>
4655
4835
  </xsl:variable>
4656
4836
 
4657
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4837
+ <xsl:choose>
4838
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4839
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4840
+ </xsl:when>
4841
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4842
+ </xsl:choose>
4658
4843
 
4659
4844
  </xsl:template></xsl:stylesheet>