metanorma-nist 1.2.8 → 1.2.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) 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 +52 -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 +114 -3
  12. data/lib/asciidoctor/nist/nist_intro.xml +9 -9
  13. data/lib/asciidoctor/nist/nist_intro_cswp.xml +9 -9
  14. data/lib/asciidoctor/nist/validate.rb +17 -6
  15. data/lib/isodoc/nist/base_convert.rb +2 -3
  16. data/lib/isodoc/nist/html/header_cswp.html +2 -3
  17. data/lib/isodoc/nist/html/html_nist_titlepage.html +5 -3
  18. data/lib/isodoc/nist/html/word_nist_titlepage.html +8 -8
  19. data/lib/isodoc/nist/html/word_nist_titlepage_cswp.html +2 -0
  20. data/lib/isodoc/nist/html_convert.rb +6 -8
  21. data/lib/isodoc/nist/metadata.rb +28 -40
  22. data/lib/isodoc/nist/metadata_id.rb +3 -7
  23. data/lib/isodoc/nist/nist.csts.xsl +4844 -0
  24. data/lib/isodoc/nist/nist.cswp.xsl +517 -292
  25. data/lib/isodoc/nist/nist.sp.xsl +503 -327
  26. data/lib/isodoc/nist/pdf_convert.rb +5 -1
  27. data/lib/isodoc/nist/presentation_xml_convert.rb +30 -10
  28. data/lib/isodoc/nist/refs.rb +4 -20
  29. data/lib/isodoc/nist/render.rb +42 -40
  30. data/lib/isodoc/nist/render_dates.rb +8 -9
  31. data/lib/isodoc/nist/word_convert.rb +5 -6
  32. data/lib/isodoc/nist/xref.rb +11 -5
  33. data/lib/metanorma/nist/processor.rb +12 -0
  34. data/lib/metanorma/nist/version.rb +1 -1
  35. data/metanorma-nist.gemspec +2 -2
  36. metadata +8 -8
  37. 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,19 +161,35 @@
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
-
157
- <xsl:for-each select="xalan:tokenize($org-name, ',')">
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)">
178
+ <!-- <xsl:for-each select="xalan:tokenize($org-name, ',')">
158
179
  <fo:block>
159
180
  <fo:inline font-style="italic">
160
181
  <xsl:value-of select="."/>
161
- <!-- <xsl:if test="normalize-space($org-address) != ''">
162
- <fo:inline>, <xsl:value-of select="$org-address"/></fo:inline>
163
- </xsl:if> -->
164
182
  </fo:inline>
165
183
  </fo:block>
166
- </xsl:for-each>
184
+ </xsl:for-each> -->
185
+ <fo:block font-style="italic">
186
+ <xsl:value-of select="$org-name"/>
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>
167
193
 
168
194
  <xsl:if test="normalize-space($org-address) != ''">
169
195
  <fo:block>
@@ -558,30 +584,23 @@
558
584
  <!-- Bibliography -->
559
585
  <!-- ============================= -->
560
586
 
561
-
562
- <!-- 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
+ -->
563
591
  <xsl:template match="nist:bibitem">
564
-
565
592
  <fo:list-block margin-bottom="12pt" provisional-distance-between-starts="12mm">
566
593
  <fo:list-item>
567
594
  <fo:list-item-label end-indent="label-end()">
568
595
  <fo:block>
569
596
  <fo:inline id="{@id}">
570
597
  <!-- <xsl:number format="[1]"/> -->
571
- <xsl:value-of select="nist:docidentifier"/>
598
+ <xsl:value-of select="nist:docidentifier[@display = 'true']"/>
572
599
  </fo:inline>
573
600
  </fo:block>
574
601
  </fo:list-item-label>
575
602
  <fo:list-item-body start-indent="body-start()">
576
603
  <fo:block>
577
- <xsl:choose>
578
- <xsl:when test="nist:title[@type = 'main' and @language = 'en']">
579
- <xsl:apply-templates select="nist:title[@type = 'main' and @language = 'en']"/>
580
- </xsl:when>
581
- <xsl:otherwise>
582
- <xsl:apply-templates select="nist:title"/>
583
- </xsl:otherwise>
584
- </xsl:choose>
585
604
  <xsl:apply-templates select="nist:formattedref"/>
586
605
  </fo:block>
587
606
  </fo:list-item-body>
@@ -589,6 +608,9 @@
589
608
  </fo:list-block>
590
609
  </xsl:template>
591
610
 
611
+ <xsl:template match="nist:formattedref">
612
+ <xsl:apply-templates/>
613
+ </xsl:template>
592
614
  <!-- ============================= -->
593
615
  <!-- ============================= -->
594
616
 
@@ -618,6 +640,11 @@
618
640
  </fo:block>
619
641
  </xsl:template>
620
642
 
643
+ <xsl:template match="nist:references">
644
+ <fo:block id="{@id}">
645
+ <xsl:apply-templates/>
646
+ </fo:block>
647
+ </xsl:template>
621
648
  <xsl:template match="nist:references/nist:title">
622
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">
623
650
  <fo:block font-family="Arial" font-size="12pt" font-weight="bold" margin-left="1mm" padding-top="0.3mm">
@@ -685,14 +712,14 @@
685
712
  </xsl:variable>
686
713
  <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
687
714
  <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
688
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
715
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
689
716
  </fo:basic-link>
690
717
  </fo:inline>
691
718
  <fo:footnote-body>
692
719
  <fo:block-container margin-left="3mm">
693
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">
694
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" -->
695
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
722
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
696
723
  </fo:inline>
697
724
  <xsl:for-each select="nist:p">
698
725
  <xsl:apply-templates/>
@@ -725,78 +752,6 @@
725
752
  </xsl:template>
726
753
 
727
754
 
728
- <!-- Examples:
729
- [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
730
- [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.
731
- -->
732
- <xsl:template match="nist:annex//nist:bibitem">
733
- <fo:block id="{@id}" margin-top="6pt" margin-left="12mm" text-indent="-12mm">
734
- <xsl:if test="nist:formattedref">
735
- <xsl:choose>
736
- <xsl:when test="nist:docidentifier[@type = 'metanorma']">
737
- <xsl:attribute name="margin-left">0</xsl:attribute>
738
- <xsl:attribute name="text-indent">0</xsl:attribute>
739
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
740
- <!-- create list -->
741
- <fo:list-block>
742
- <fo:list-item>
743
- <fo:list-item-label end-indent="label-end()">
744
- <fo:block>
745
- <xsl:apply-templates select="nist:docidentifier[@type = 'metanorma']" mode="process"/>
746
- </fo:block>
747
- </fo:list-item-label>
748
- <fo:list-item-body start-indent="body-start()">
749
- <fo:block margin-left="3mm">
750
- <xsl:apply-templates select="nist:formattedref"/>
751
- </fo:block>
752
- </fo:list-item-body>
753
- </fo:list-item>
754
- </fo:list-block>
755
- </xsl:when>
756
- <xsl:otherwise>
757
- <xsl:apply-templates select="nist:formattedref"/>
758
- <xsl:apply-templates select="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process"/>
759
- </xsl:otherwise>
760
- </xsl:choose>
761
-
762
-
763
- </xsl:if>
764
- <xsl:if test="nist:title">
765
- <xsl:for-each select="nist:contributor">
766
- <xsl:value-of select="nist:organization/nist:name"/>
767
- <xsl:if test="position() != last()">, </xsl:if>
768
- </xsl:for-each>
769
- <xsl:text> (</xsl:text>
770
-
771
- <xsl:value-of select="$date"/>
772
- <xsl:text>) </xsl:text>
773
- <fo:inline font-style="italic"><xsl:value-of select="nist:title"/></fo:inline>
774
- <xsl:if test="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name">
775
- <xsl:text> (</xsl:text><xsl:value-of select="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name"/><xsl:text>)</xsl:text>
776
- </xsl:if>
777
- <xsl:text>, </xsl:text>
778
- <xsl:value-of select="$date"/>
779
- <xsl:text>. </xsl:text>
780
- <xsl:value-of select="nist:docidentifier"/>
781
- <xsl:value-of select="$linebreak"/>
782
- <xsl:value-of select="nist:uri"/>
783
- </xsl:if>
784
- </fo:block>
785
- </xsl:template>
786
-
787
- <xsl:template match="nist:annex//nist:bibitem//nist:formattedref">
788
- <xsl:apply-templates/>
789
- </xsl:template>
790
-
791
- <xsl:template match="nist:docidentifier[@type = 'metanorma']" mode="process">
792
- <xsl:apply-templates/>
793
- </xsl:template>
794
- <xsl:template match="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process">
795
- <xsl:text> [</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text>
796
- </xsl:template>
797
- <xsl:template match="nist:docidentifier"/>
798
-
799
-
800
755
  <xsl:template match="nist:ul | nist:ol" mode="ul_ol">
801
756
  <fo:list-block>
802
757
  <xsl:apply-templates/>
@@ -849,7 +804,7 @@
849
804
  <xsl:number format="1."/>
850
805
  </xsl:when>
851
806
  <xsl:when test="../@type = 'arabic'">
852
- <xsl:number format="a)"/>
807
+ <xsl:number format="a)" lang="en"/>
853
808
  </xsl:when>
854
809
  <xsl:when test="../@type = 'alphabet'">
855
810
  <xsl:number format="1)"/>
@@ -857,7 +812,7 @@
857
812
  <xsl:when test="ancestor::*[nist:annex]">
858
813
  <xsl:choose>
859
814
  <xsl:when test="$level = 1">
860
- <xsl:number format="a)"/>
815
+ <xsl:number format="a)" lang="en"/>
861
816
  </xsl:when>
862
817
  <xsl:when test="$level = 2">
863
818
  <xsl:number format="i)"/>
@@ -1457,6 +1412,7 @@
1457
1412
 
1458
1413
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1459
1414
 
1415
+
1460
1416
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1461
1417
 
1462
1418
 
@@ -1464,6 +1420,7 @@
1464
1420
 
1465
1421
 
1466
1422
 
1423
+
1467
1424
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1468
1425
 
1469
1426
 
@@ -1590,187 +1547,239 @@
1590
1547
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1591
1548
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1592
1549
  <xsl:call-template name="add-zero-spaces-java"/>
1593
- </xsl:template><xsl:template match="*[local-name()='table']">
1550
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1594
1551
 
1595
- <xsl:variable name="simple-table">
1596
- <xsl:call-template name="getSimpleTable"/>
1597
- </xsl:variable>
1552
+ <xsl:variable name="table">
1598
1553
 
1599
-
1600
-
1601
-
1602
-
1603
- <!-- <xsl:if test="$namespace = 'bipm'">
1604
- <fo:block>&#xA0;</fo:block>
1605
- </xsl:if> -->
1606
-
1607
- <!-- $namespace = 'iso' or -->
1608
-
1609
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1610
-
1611
-
1554
+ <xsl:variable name="simple-table">
1555
+ <xsl:call-template name="getSimpleTable"/>
1556
+ </xsl:variable>
1612
1557
 
1613
1558
 
1614
-
1615
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1616
-
1617
- <!-- <xsl:variable name="cols-count">
1618
- <xsl:choose>
1619
- <xsl:when test="*[local-name()='thead']">
1620
- <xsl:call-template name="calculate-columns-numbers">
1621
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1622
- </xsl:call-template>
1623
- </xsl:when>
1624
- <xsl:otherwise>
1625
- <xsl:call-template name="calculate-columns-numbers">
1626
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1627
- </xsl:call-template>
1628
- </xsl:otherwise>
1629
- </xsl:choose>
1630
- </xsl:variable> -->
1631
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1632
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1633
-
1634
-
1635
-
1636
- <xsl:variable name="colwidths">
1637
- <xsl:call-template name="calculate-column-widths">
1638
- <xsl:with-param name="cols-count" select="$cols-count"/>
1639
- <xsl:with-param name="table" select="$simple-table"/>
1640
- </xsl:call-template>
1641
- </xsl:variable>
1642
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1643
-
1644
- <!-- <xsl:variable name="colwidths2">
1645
- <xsl:call-template name="calculate-column-widths">
1646
- <xsl:with-param name="cols-count" select="$cols-count"/>
1647
- </xsl:call-template>
1648
- </xsl:variable> -->
1649
-
1650
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1651
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1652
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1653
-
1654
- <xsl:variable name="margin-left">
1655
- <xsl:choose>
1656
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1657
- <xsl:otherwise>0</xsl:otherwise>
1658
- </xsl:choose>
1659
- </xsl:variable>
1660
-
1661
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1662
1559
 
1663
1560
 
1664
- <xsl:attribute name="space-after">6pt</xsl:attribute>
1665
1561
 
1666
-
1667
-
1668
-
1562
+ <!-- <xsl:if test="$namespace = 'bipm'">
1563
+ <fo:block>&#xA0;</fo:block>
1564
+ </xsl:if> -->
1669
1565
 
1566
+ <!-- $namespace = 'iso' or -->
1670
1567
 
1671
- <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
1672
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1673
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1674
- </xsl:if>
1675
- <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
1676
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
1677
- <xsl:attribute name="font-size">12pt</xsl:attribute>
1678
- </xsl:if>
1679
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1568
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1680
1569
 
1681
-
1570
+
1682
1571
 
1572
+
1683
1573
 
1574
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1684
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"/> -->
1592
+
1593
+
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"/> -->
1685
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> -->
1686
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 -->
1687
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>
1688
1621
 
1689
- <xsl:variable name="table_attributes">
1690
- <attribute name="table-layout">fixed</attribute>
1691
- <attribute name="width">100%</attribute>
1692
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1693
- <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">
1694
1623
 
1695
1624
 
1625
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
1696
1626
 
1627
+
1628
+
1629
+
1697
1630
 
1698
-
1699
-
1700
-
1701
1631
 
1702
-
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>
1703
1641
 
1704
- </xsl:variable>
1705
-
1706
-
1707
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1642
+
1708
1643
 
1709
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1710
- <xsl:attribute name="{@name}">
1711
- <xsl:value-of select="."/>
1712
- </xsl:attribute>
1713
- </xsl:for-each>
1714
1644
 
1715
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1716
- <xsl:if test="$isNoteOrFnExist = 'true'">
1717
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1718
- </xsl:if>
1719
1645
 
1720
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1646
+
1647
+
1648
+
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
+
1721
1687
  <xsl:choose>
1722
- <xsl:when test=". = 1 or . = 0">
1723
- <fo:table-column column-width="proportional-column-width(2)"/>
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>
1724
1692
  </xsl:when>
1725
1693
  <xsl:otherwise>
1726
- <fo:table-column column-width="proportional-column-width({.})"/>
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>
1727
1704
  </xsl:otherwise>
1728
1705
  </xsl:choose>
1729
- </xsl:for-each>
1730
-
1731
- <xsl:choose>
1732
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1733
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1734
- </xsl:when>
1735
- <xsl:otherwise>
1736
- <xsl:apply-templates/>
1737
- </xsl:otherwise>
1738
- </xsl:choose>
1739
-
1740
- </fo:table>
1741
-
1742
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1743
- <xsl:call-template name="insertTableFooterInSeparateTable">
1744
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1745
- <xsl:with-param name="colwidths" select="$colwidths"/>
1746
- </xsl:call-template>
1747
- </xsl:for-each>
1748
-
1749
- <!-- insert footer as table -->
1750
- <!-- <fo:table>
1751
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1752
- <xsl:attribute name="{@name}">
1753
- <xsl:value-of select="."/>
1754
- </xsl:attribute>
1755
- </xsl:for-each>
1756
-
1757
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1706
+
1758
1707
  <xsl:choose>
1759
- <xsl:when test=". = 1 or . = 0">
1760
- <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"/>
1761
1710
  </xsl:when>
1762
1711
  <xsl:otherwise>
1763
- <fo:table-column column-width="proportional-column-width({.})"/>
1712
+ <xsl:apply-templates/>
1764
1713
  </xsl:otherwise>
1765
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>
1766
1725
  </xsl:for-each>
1767
- </fo:table>-->
1768
-
1769
-
1770
-
1771
-
1772
-
1773
- </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
+
1774
1783
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1775
1784
  <xsl:if test="normalize-space() != ''">
1776
1785
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1996,12 +2005,22 @@
1996
2005
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1997
2006
  <xsl:param name="table_attributes"/>
1998
2007
  <xsl:param name="colwidths"/>
2008
+ <xsl:param name="colgroup"/>
1999
2009
 
2000
2010
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2001
2011
 
2002
2012
  <xsl:if test="$isNoteOrFnExist = 'true'">
2003
2013
 
2004
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
2014
+ <xsl:variable name="cols-count">
2015
+ <xsl:choose>
2016
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2017
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
2018
+ </xsl:when>
2019
+ <xsl:otherwise>
2020
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
2021
+ </xsl:otherwise>
2022
+ </xsl:choose>
2023
+ </xsl:variable>
2005
2024
 
2006
2025
  <fo:table keep-with-previous="always">
2007
2026
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -2019,16 +2038,25 @@
2019
2038
  </xsl:choose>
2020
2039
  </xsl:for-each>
2021
2040
 
2022
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2023
- <xsl:choose>
2024
- <xsl:when test=". = 1 or . = 0">
2025
- <fo:table-column column-width="proportional-column-width(2)"/>
2026
- </xsl:when>
2027
- <xsl:otherwise>
2028
- <fo:table-column column-width="proportional-column-width({.})"/>
2029
- </xsl:otherwise>
2030
- </xsl:choose>
2031
- </xsl:for-each>
2041
+ <xsl:choose>
2042
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2043
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
2044
+ <fo:table-column column-width="{@width}"/>
2045
+ </xsl:for-each>
2046
+ </xsl:when>
2047
+ <xsl:otherwise>
2048
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2049
+ <xsl:choose>
2050
+ <xsl:when test=". = 1 or . = 0">
2051
+ <fo:table-column column-width="proportional-column-width(2)"/>
2052
+ </xsl:when>
2053
+ <xsl:otherwise>
2054
+ <fo:table-column column-width="proportional-column-width({.})"/>
2055
+ </xsl:otherwise>
2056
+ </xsl:choose>
2057
+ </xsl:for-each>
2058
+ </xsl:otherwise>
2059
+ </xsl:choose>
2032
2060
 
2033
2061
  <fo:table-body>
2034
2062
  <fo:table-row>
@@ -2450,7 +2478,9 @@
2450
2478
  </xsl:template><xsl:template match="*[local-name()='dl']">
2451
2479
  <fo:block-container>
2452
2480
 
2453
- <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>
2454
2484
 
2455
2485
 
2456
2486
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -2465,6 +2495,7 @@
2465
2495
  <fo:block-container>
2466
2496
 
2467
2497
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2498
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2468
2499
 
2469
2500
 
2470
2501
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -2589,7 +2620,7 @@
2589
2620
  <xsl:with-param name="table" select="$html-table"/>
2590
2621
  </xsl:call-template>
2591
2622
  </xsl:variable>
2592
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2623
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2593
2624
  <xsl:variable name="maxlength_dt">
2594
2625
  <xsl:call-template name="getMaxLength_dt"/>
2595
2626
  </xsl:variable>
@@ -2618,13 +2649,22 @@
2618
2649
  </xsl:when>
2619
2650
  <xsl:otherwise>
2620
2651
  <xsl:choose>
2652
+ <!-- to set width check most wide chars like `W` -->
2621
2653
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2622
- <fo:table-column column-width="5%"/>
2623
- <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%"/>
2660
+ </xsl:when>
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%"/>
2624
2664
  </xsl:when>
2625
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2626
- <fo:table-column column-width="10%"/>
2627
- <fo:table-column column-width="90%"/>
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%"/>
2628
2668
  </xsl:when>
2629
2669
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2630
2670
  <fo:table-column column-width="60%"/>
@@ -2656,12 +2696,32 @@
2656
2696
  </xsl:otherwise>
2657
2697
  </xsl:choose>
2658
2698
  </xsl:template><xsl:template name="getMaxLength_dt">
2659
- <xsl:for-each select="*[local-name()='dt']">
2660
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2661
- <xsl:if test="position() = 1">
2662
- <xsl:value-of select="string-length(normalize-space(.))"/>
2663
- </xsl:if>
2664
- </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"/>
2665
2725
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2666
2726
  <xsl:param name="key_iso"/>
2667
2727
 
@@ -2816,6 +2876,7 @@
2816
2876
 
2817
2877
 
2818
2878
 
2879
+
2819
2880
 
2820
2881
  </xsl:variable>
2821
2882
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2829,6 +2890,10 @@
2829
2890
  </xsl:if>
2830
2891
  <xsl:apply-templates/>
2831
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>
2832
2897
  </xsl:template><xsl:template match="*[local-name()='del']">
2833
2898
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2834
2899
  <xsl:apply-templates/>
@@ -2922,6 +2987,10 @@
2922
2987
  <xsl:param name="text" select="."/>
2923
2988
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2924
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​')"/>
2925
2994
  </xsl:template><xsl:template name="add-zero-spaces">
2926
2995
  <xsl:param name="text" select="."/>
2927
2996
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3182,6 +3251,11 @@
3182
3251
  <!-- replace start and end spaces to non-break space -->
3183
3252
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3184
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"/>
3185
3259
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3186
3260
  <xsl:variable name="target">
3187
3261
  <xsl:choose>
@@ -3203,7 +3277,10 @@
3203
3277
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3204
3278
  <xsl:choose>
3205
3279
  <xsl:when test="normalize-space(.) = ''">
3206
- <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>
3207
3284
  </xsl:when>
3208
3285
  <xsl:otherwise>
3209
3286
  <xsl:apply-templates/>
@@ -3409,7 +3486,7 @@
3409
3486
  </xsl:if> -->
3410
3487
  </fo:inline>
3411
3488
  </xsl:if>
3412
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3489
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3413
3490
  <fo:block-container id="{@id}">
3414
3491
 
3415
3492
  <fo:block>
@@ -3478,6 +3555,8 @@
3478
3555
  <xsl:variable name="bookmark-title_">
3479
3556
  <xsl:call-template name="getLangVersion">
3480
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"/>
3481
3560
  </xsl:call-template>
3482
3561
  </xsl:variable>
3483
3562
  <xsl:choose>
@@ -3495,13 +3574,34 @@
3495
3574
  </xsl:choose>
3496
3575
  </fo:bookmark-title>
3497
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
+
3498
3587
  </fo:bookmark>
3499
3588
 
3500
3589
  </xsl:for-each>
3501
3590
  </xsl:when>
3502
3591
  <xsl:otherwise>
3503
3592
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3593
+
3504
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
+
3505
3605
  </xsl:for-each>
3506
3606
  </xsl:otherwise>
3507
3607
  </xsl:choose>
@@ -3520,8 +3620,44 @@
3520
3620
 
3521
3621
  </fo:bookmark-tree>
3522
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>
3523
3657
  </xsl:template><xsl:template name="getLangVersion">
3524
3658
  <xsl:param name="lang"/>
3659
+ <xsl:param name="doctype" select="''"/>
3660
+ <xsl:param name="title" select="''"/>
3525
3661
  <xsl:choose>
3526
3662
  <xsl:when test="$lang = 'en'">
3527
3663
 
@@ -3561,6 +3697,12 @@
3561
3697
  <!-- <xsl:text> </xsl:text> -->
3562
3698
  </xsl:template><xsl:template name="getSection">
3563
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
+
3564
3706
  </xsl:template><xsl:template name="getName">
3565
3707
  <xsl:choose>
3566
3708
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3613,6 +3755,12 @@
3613
3755
  <xsl:copy>
3614
3756
  <xsl:apply-templates mode="contents_item"/>
3615
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="."/>
3616
3764
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3617
3765
  <xsl:text> </xsl:text>
3618
3766
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3638,6 +3786,7 @@
3638
3786
 
3639
3787
 
3640
3788
 
3789
+
3641
3790
 
3642
3791
 
3643
3792
  10
@@ -4010,10 +4159,13 @@
4010
4159
  </xsl:if>
4011
4160
  </xsl:if>
4012
4161
 
4162
+
4013
4163
  <fo:block-container margin-left="0mm">
4014
4164
 
4015
4165
  <fo:block xsl:use-attribute-sets="quote-style">
4016
- <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 -->
4017
4169
  </fo:block>
4018
4170
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4019
4171
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4166,6 +4318,7 @@
4166
4318
 
4167
4319
 
4168
4320
 
4321
+
4169
4322
 
4170
4323
 
4171
4324
 
@@ -4181,7 +4334,7 @@
4181
4334
  </xsl:if>
4182
4335
 
4183
4336
 
4184
- </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']/* -->
4185
4338
  <fo:block break-after="page"/>
4186
4339
  <fo:block>
4187
4340
  <xsl:call-template name="setId"/>
@@ -4189,7 +4342,8 @@
4189
4342
  </fo:block>
4190
4343
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4191
4344
  <fo:block>
4192
- <xsl:call-template name="setId"/>
4345
+ <xsl:call-template name="setId"/>
4346
+
4193
4347
 
4194
4348
  <xsl:apply-templates/>
4195
4349
  </fo:block>
@@ -4256,7 +4410,10 @@
4256
4410
  <fo:table-column column-width="107mm"/>
4257
4411
  <fo:table-column column-width="15mm"/>
4258
4412
  <fo:table-body>
4259
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
4413
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
4414
+
4415
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
4416
+
4260
4417
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
4261
4418
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
4262
4419
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -4274,6 +4431,10 @@
4274
4431
  <fo:block><xsl:apply-templates/></fo:block>
4275
4432
  </fo:table-cell>
4276
4433
  </xsl:template><xsl:template name="processBibitem">
4434
+
4435
+
4436
+ <!-- end BIPM bibitem processing-->
4437
+
4277
4438
 
4278
4439
 
4279
4440
 
@@ -4332,6 +4493,8 @@
4332
4493
  <xsl:value-of select="translate(.,'. ','')"/>
4333
4494
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4334
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>
4335
4498
  </xsl:template><xsl:template name="convertDate">
4336
4499
  <xsl:param name="date"/>
4337
4500
  <xsl:param name="format" select="'short'"/>
@@ -4356,6 +4519,57 @@
4356
4519
  </xsl:variable>
4357
4520
  <xsl:variable name="result">
4358
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>
4359
4573
  <xsl:when test="$format = 'short' or $day = ''">
4360
4574
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4361
4575
  </xsl:when>
@@ -4371,7 +4585,7 @@
4371
4585
  <xsl:param name="charDelim" select="', '"/>
4372
4586
  <xsl:choose>
4373
4587
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4374
- <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']">
4375
4589
  <xsl:sort data-type="text" order="ascending"/>
4376
4590
  <xsl:call-template name="insertKeyword">
4377
4591
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4380,7 +4594,7 @@
4380
4594
  </xsl:for-each>
4381
4595
  </xsl:when>
4382
4596
  <xsl:otherwise>
4383
- <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']">
4384
4598
  <xsl:call-template name="insertKeyword">
4385
4599
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4386
4600
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4397,6 +4611,9 @@
4397
4611
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4398
4612
  </xsl:choose>
4399
4613
  </xsl:template><xsl:template name="addPDFUAmeta">
4614
+ <xsl:variable name="lang">
4615
+ <xsl:call-template name="getLang"/>
4616
+ </xsl:variable>
4400
4617
  <fo:declarations>
4401
4618
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4402
4619
  <pdf:dictionary type="normal" key="ViewerPreferences">
@@ -4409,13 +4626,16 @@
4409
4626
  <!-- Dublin Core properties go here -->
4410
4627
  <dc:title>
4411
4628
  <xsl:variable name="title">
4412
-
4413
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4414
-
4415
-
4416
-
4417
-
4418
-
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>
4419
4639
  </xsl:variable>
4420
4640
  <xsl:choose>
4421
4641
  <xsl:when test="normalize-space($title) != ''">
@@ -4427,22 +4647,21 @@
4427
4647
  </xsl:choose>
4428
4648
  </dc:title>
4429
4649
  <dc:creator>
4430
-
4431
-
4432
-
4433
- <xsl:for-each select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4434
- <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
4435
- <xsl:if test="position() != last()">; </xsl:if>
4436
- </xsl:for-each>
4437
-
4438
- </dc:creator>
4439
- <dc:description>
4440
- <xsl:variable name="abstract">
4650
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4651
+
4441
4652
 
4442
4653
 
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>
4443
4658
 
4444
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4659
+ </xsl:for-each>
4660
+ </dc:creator>
4661
+ <dc:description>
4662
+ <xsl:variable name="abstract">
4445
4663
 
4664
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4446
4665
 
4447
4666
 
4448
4667
  </xsl:variable>
@@ -4555,6 +4774,7 @@
4555
4774
 
4556
4775
 
4557
4776
 
4777
+
4558
4778
  </xsl:variable>
4559
4779
  <xsl:if test="$documentNS != $XSLNS">
4560
4780
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4614,6 +4834,11 @@
4614
4834
  <xsl:call-template name="getLang"/>
4615
4835
  </xsl:variable>
4616
4836
 
4617
- <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>
4618
4843
 
4619
4844
  </xsl:template></xsl:stylesheet>