metanorma-nist 1.2.7 → 1.2.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +7 -5
  3. data/README.adoc +23 -3
  4. data/lib/asciidoctor/nist/basicdoc.rng +52 -3
  5. data/lib/asciidoctor/nist/boilerplate.rb +5 -3
  6. data/lib/asciidoctor/nist/cleanup.rb +5 -3
  7. data/lib/asciidoctor/nist/converter.rb +7 -2
  8. data/lib/asciidoctor/nist/front.rb +37 -46
  9. data/lib/asciidoctor/nist/front_id.rb +18 -7
  10. data/lib/asciidoctor/nist/isodoc.rng +51 -3
  11. data/lib/asciidoctor/nist/nist.rng +1 -0
  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/fonts_manifest.yaml +4 -0
  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/htmlstyle.css +221 -221
  20. data/lib/isodoc/nist/html/htmlstyle.scss +5 -6
  21. data/lib/isodoc/nist/html/nist.css +49 -50
  22. data/lib/isodoc/nist/html/nist.scss +49 -50
  23. data/lib/isodoc/nist/html/nist_cswp.css +48 -49
  24. data/lib/isodoc/nist/html/nist_cswp.scss +48 -49
  25. data/lib/isodoc/nist/html/word_nist_titlepage.html +8 -8
  26. data/lib/isodoc/nist/html/word_nist_titlepage_cswp.html +2 -0
  27. data/lib/isodoc/nist/html/wordstyle.css +42 -42
  28. data/lib/isodoc/nist/html/wordstyle.scss +42 -42
  29. data/lib/isodoc/nist/html/wordstyle_cswp.css +52 -52
  30. data/lib/isodoc/nist/html/wordstyle_cswp.scss +52 -52
  31. data/lib/isodoc/nist/html_convert.rb +6 -5
  32. data/lib/isodoc/nist/metadata.rb +28 -40
  33. data/lib/isodoc/nist/metadata_id.rb +3 -7
  34. data/lib/isodoc/nist/nist.csts.xsl +4780 -0
  35. data/lib/isodoc/nist/nist.cswp.xsl +401 -159
  36. data/lib/isodoc/nist/nist.sp.xsl +387 -194
  37. data/lib/isodoc/nist/pdf_convert.rb +5 -1
  38. data/lib/isodoc/nist/presentation_xml_convert.rb +30 -10
  39. data/lib/isodoc/nist/refs.rb +6 -20
  40. data/lib/isodoc/nist/render.rb +42 -40
  41. data/lib/isodoc/nist/render_dates.rb +8 -9
  42. data/lib/isodoc/nist/word_convert.rb +11 -7
  43. data/lib/isodoc/nist/xref.rb +11 -5
  44. data/lib/metanorma/nist/processor.rb +12 -8
  45. data/lib/metanorma/nist/version.rb +1 -1
  46. data/metanorma-nist.gemspec +2 -2
  47. metadata +8 -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)"/>
@@ -1142,13 +1097,22 @@
1142
1097
  <title-part lang="en">
1143
1098
 
1144
1099
 
1100
+
1145
1101
  </title-part>
1146
1102
  <title-part lang="fr">
1147
1103
 
1148
1104
 
1105
+
1149
1106
  </title-part>
1150
1107
  <title-part lang="zh">第 # 部分:</title-part>
1151
1108
 
1109
+ <title-subpart lang="en">
1110
+
1111
+ </title-subpart>
1112
+ <title-subpart lang="fr">
1113
+
1114
+ </title-subpart>
1115
+
1152
1116
  <title-modified lang="en">modified</title-modified>
1153
1117
  <title-modified lang="fr">modifiée</title-modified>
1154
1118
 
@@ -1448,6 +1412,7 @@
1448
1412
 
1449
1413
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1450
1414
 
1415
+
1451
1416
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1452
1417
 
1453
1418
 
@@ -1455,6 +1420,7 @@
1455
1420
 
1456
1421
 
1457
1422
 
1423
+
1458
1424
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1459
1425
 
1460
1426
 
@@ -1472,6 +1438,7 @@
1472
1438
  </xsl:attribute-set><xsl:attribute-set name="term-style">
1473
1439
 
1474
1440
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
1441
+
1475
1442
 
1476
1443
 
1477
1444
 
@@ -1580,7 +1547,7 @@
1580
1547
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1581
1548
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1582
1549
  <xsl:call-template name="add-zero-spaces-java"/>
1583
- </xsl:template><xsl:template match="*[local-name()='table']">
1550
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1584
1551
 
1585
1552
  <xsl:variable name="simple-table">
1586
1553
  <xsl:call-template name="getSimpleTable"/>
@@ -1590,7 +1557,9 @@
1590
1557
 
1591
1558
 
1592
1559
 
1593
-
1560
+ <!-- <xsl:if test="$namespace = 'bipm'">
1561
+ <fo:block>&#xA0;</fo:block>
1562
+ </xsl:if> -->
1594
1563
 
1595
1564
  <!-- $namespace = 'iso' or -->
1596
1565
 
@@ -1622,10 +1591,12 @@
1622
1591
 
1623
1592
 
1624
1593
  <xsl:variable name="colwidths">
1625
- <xsl:call-template name="calculate-column-widths">
1626
- <xsl:with-param name="cols-count" select="$cols-count"/>
1627
- <xsl:with-param name="table" select="$simple-table"/>
1628
- </xsl:call-template>
1594
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1595
+ <xsl:call-template name="calculate-column-widths">
1596
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1597
+ <xsl:with-param name="table" select="$simple-table"/>
1598
+ </xsl:call-template>
1599
+ </xsl:if>
1629
1600
  </xsl:variable>
1630
1601
  <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1631
1602
 
@@ -1676,7 +1647,12 @@
1676
1647
 
1677
1648
  <xsl:variable name="table_attributes">
1678
1649
  <attribute name="table-layout">fixed</attribute>
1679
- <attribute name="width">100%</attribute>
1650
+ <attribute name="width">
1651
+ <xsl:choose>
1652
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1653
+ <xsl:otherwise>100%</xsl:otherwise>
1654
+ </xsl:choose>
1655
+ </attribute>
1680
1656
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1681
1657
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1682
1658
 
@@ -1705,16 +1681,25 @@
1705
1681
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1706
1682
  </xsl:if>
1707
1683
 
1708
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1709
- <xsl:choose>
1710
- <xsl:when test=". = 1 or . = 0">
1711
- <fo:table-column column-width="proportional-column-width(2)"/>
1712
- </xsl:when>
1713
- <xsl:otherwise>
1714
- <fo:table-column column-width="proportional-column-width({.})"/>
1715
- </xsl:otherwise>
1716
- </xsl:choose>
1717
- </xsl:for-each>
1684
+ <xsl:choose>
1685
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1686
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1687
+ <fo:table-column column-width="{@width}"/>
1688
+ </xsl:for-each>
1689
+ </xsl:when>
1690
+ <xsl:otherwise>
1691
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1692
+ <xsl:choose>
1693
+ <xsl:when test=". = 1 or . = 0">
1694
+ <fo:table-column column-width="proportional-column-width(2)"/>
1695
+ </xsl:when>
1696
+ <xsl:otherwise>
1697
+ <fo:table-column column-width="proportional-column-width({.})"/>
1698
+ </xsl:otherwise>
1699
+ </xsl:choose>
1700
+ </xsl:for-each>
1701
+ </xsl:otherwise>
1702
+ </xsl:choose>
1718
1703
 
1719
1704
  <xsl:choose>
1720
1705
  <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
@@ -1727,10 +1712,12 @@
1727
1712
 
1728
1713
  </fo:table>
1729
1714
 
1715
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1730
1716
  <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1731
1717
  <xsl:call-template name="insertTableFooterInSeparateTable">
1732
1718
  <xsl:with-param name="table_attributes" select="$table_attributes"/>
1733
1719
  <xsl:with-param name="colwidths" select="$colwidths"/>
1720
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1734
1721
  </xsl:call-template>
1735
1722
  </xsl:for-each>
1736
1723
 
@@ -1763,6 +1750,7 @@
1763
1750
  <xsl:if test="normalize-space() != ''">
1764
1751
  <fo:block xsl:use-attribute-sets="table-name-style">
1765
1752
 
1753
+
1766
1754
  <xsl:apply-templates/>
1767
1755
  </fo:block>
1768
1756
  </xsl:if>
@@ -1983,12 +1971,22 @@
1983
1971
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1984
1972
  <xsl:param name="table_attributes"/>
1985
1973
  <xsl:param name="colwidths"/>
1974
+ <xsl:param name="colgroup"/>
1986
1975
 
1987
1976
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1988
1977
 
1989
1978
  <xsl:if test="$isNoteOrFnExist = 'true'">
1990
1979
 
1991
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1980
+ <xsl:variable name="cols-count">
1981
+ <xsl:choose>
1982
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1983
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
1984
+ </xsl:when>
1985
+ <xsl:otherwise>
1986
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
1987
+ </xsl:otherwise>
1988
+ </xsl:choose>
1989
+ </xsl:variable>
1992
1990
 
1993
1991
  <fo:table keep-with-previous="always">
1994
1992
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -2006,16 +2004,25 @@
2006
2004
  </xsl:choose>
2007
2005
  </xsl:for-each>
2008
2006
 
2009
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2010
- <xsl:choose>
2011
- <xsl:when test=". = 1 or . = 0">
2012
- <fo:table-column column-width="proportional-column-width(2)"/>
2013
- </xsl:when>
2014
- <xsl:otherwise>
2015
- <fo:table-column column-width="proportional-column-width({.})"/>
2016
- </xsl:otherwise>
2017
- </xsl:choose>
2018
- </xsl:for-each>
2007
+ <xsl:choose>
2008
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2009
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
2010
+ <fo:table-column column-width="{@width}"/>
2011
+ </xsl:for-each>
2012
+ </xsl:when>
2013
+ <xsl:otherwise>
2014
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2015
+ <xsl:choose>
2016
+ <xsl:when test=". = 1 or . = 0">
2017
+ <fo:table-column column-width="proportional-column-width(2)"/>
2018
+ </xsl:when>
2019
+ <xsl:otherwise>
2020
+ <fo:table-column column-width="proportional-column-width({.})"/>
2021
+ </xsl:otherwise>
2022
+ </xsl:choose>
2023
+ </xsl:for-each>
2024
+ </xsl:otherwise>
2025
+ </xsl:choose>
2019
2026
 
2020
2027
  <fo:table-body>
2021
2028
  <fo:table-row>
@@ -2119,6 +2126,7 @@
2119
2126
 
2120
2127
 
2121
2128
 
2129
+
2122
2130
  <!-- <xsl:if test="$namespace = 'bipm'">
2123
2131
  <xsl:attribute name="height">8mm</xsl:attribute>
2124
2132
  </xsl:if> -->
@@ -2212,7 +2220,8 @@
2212
2220
  </xsl:attribute>
2213
2221
  </xsl:if>
2214
2222
  <xsl:call-template name="display-align"/>
2215
- <fo:block>
2223
+ <fo:block>
2224
+
2216
2225
  <xsl:apply-templates/>
2217
2226
  </fo:block>
2218
2227
  </fo:table-cell>
@@ -2433,7 +2442,13 @@
2433
2442
  <xsl:apply-templates/>
2434
2443
  </fo:inline>
2435
2444
  </xsl:template><xsl:template match="*[local-name()='dl']">
2436
- <fo:block-container margin-left="0mm">
2445
+ <fo:block-container>
2446
+
2447
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
2448
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2449
+ </xsl:if>
2450
+
2451
+
2437
2452
  <xsl:if test="parent::*[local-name() = 'note']">
2438
2453
  <xsl:attribute name="margin-left">
2439
2454
  <xsl:choose>
@@ -2443,8 +2458,12 @@
2443
2458
  </xsl:attribute>
2444
2459
 
2445
2460
  </xsl:if>
2446
- <fo:block-container margin-left="0mm">
2447
-
2461
+ <fo:block-container>
2462
+
2463
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2464
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2465
+
2466
+
2448
2467
  <xsl:variable name="parent" select="local-name(..)"/>
2449
2468
 
2450
2469
  <xsl:variable name="key_iso">
@@ -2458,9 +2477,12 @@
2458
2477
  <fo:block margin-bottom="12pt" text-align="left">
2459
2478
 
2460
2479
  <xsl:variable name="title-where">
2461
- <xsl:call-template name="getTitle">
2462
- <xsl:with-param name="name" select="'title-where'"/>
2463
- </xsl:call-template>
2480
+
2481
+
2482
+ <xsl:call-template name="getTitle">
2483
+ <xsl:with-param name="name" select="'title-where'"/>
2484
+ </xsl:call-template>
2485
+
2464
2486
  </xsl:variable>
2465
2487
  <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
2466
2488
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
@@ -2476,9 +2498,12 @@
2476
2498
 
2477
2499
 
2478
2500
  <xsl:variable name="title-where">
2479
- <xsl:call-template name="getTitle">
2480
- <xsl:with-param name="name" select="'title-where'"/>
2481
- </xsl:call-template>
2501
+
2502
+
2503
+ <xsl:call-template name="getTitle">
2504
+ <xsl:with-param name="name" select="'title-where'"/>
2505
+ </xsl:call-template>
2506
+
2482
2507
  </xsl:variable>
2483
2508
  <xsl:value-of select="$title-where"/>
2484
2509
  </fo:block>
@@ -2489,9 +2514,12 @@
2489
2514
 
2490
2515
 
2491
2516
  <xsl:variable name="title-key">
2492
- <xsl:call-template name="getTitle">
2493
- <xsl:with-param name="name" select="'title-key'"/>
2494
- </xsl:call-template>
2517
+
2518
+
2519
+ <xsl:call-template name="getTitle">
2520
+ <xsl:with-param name="name" select="'title-key'"/>
2521
+ </xsl:call-template>
2522
+
2495
2523
  </xsl:variable>
2496
2524
  <xsl:value-of select="$title-key"/>
2497
2525
  </fo:block>
@@ -2625,12 +2653,32 @@
2625
2653
  </xsl:otherwise>
2626
2654
  </xsl:choose>
2627
2655
  </xsl:template><xsl:template name="getMaxLength_dt">
2628
- <xsl:for-each select="*[local-name()='dt']">
2629
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2630
- <xsl:if test="position() = 1">
2631
- <xsl:value-of select="string-length(normalize-space(.))"/>
2632
- </xsl:if>
2633
- </xsl:for-each>
2656
+ <xsl:variable name="lengths">
2657
+ <xsl:for-each select="*[local-name()='dt']">
2658
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
2659
+ <xsl:variable name="attributes">
2660
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
2661
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
2662
+ </xsl:variable>
2663
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
2664
+ </xsl:for-each>
2665
+ </xsl:variable>
2666
+ <xsl:variable name="maxLength">
2667
+ <!-- <xsl:for-each select="*[local-name()='dt']">
2668
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2669
+ <xsl:if test="position() = 1">
2670
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2671
+ </xsl:if>
2672
+ </xsl:for-each> -->
2673
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
2674
+ <xsl:sort select="." data-type="number" order="descending"/>
2675
+ <xsl:if test="position() = 1">
2676
+ <xsl:value-of select="."/>
2677
+ </xsl:if>
2678
+ </xsl:for-each>
2679
+ </xsl:variable>
2680
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
2681
+ <xsl:value-of select="$maxLength"/>
2634
2682
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2635
2683
  <xsl:param name="key_iso"/>
2636
2684
 
@@ -2758,6 +2806,7 @@
2758
2806
  </fo:inline>
2759
2807
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
2760
2808
  <fo:inline font-weight="bold">
2809
+
2761
2810
  <xsl:apply-templates/>
2762
2811
  </fo:inline>
2763
2812
  </xsl:template><xsl:template match="*[local-name()='sup']">
@@ -2784,6 +2833,7 @@
2784
2833
 
2785
2834
 
2786
2835
 
2836
+
2787
2837
 
2788
2838
  </xsl:variable>
2789
2839
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2797,6 +2847,10 @@
2797
2847
  </xsl:if>
2798
2848
  <xsl:apply-templates/>
2799
2849
  </fo:inline>
2850
+ </xsl:template><xsl:template match="*[local-name()='underline']">
2851
+ <fo:inline text-decoration="underline">
2852
+ <xsl:apply-templates/>
2853
+ </fo:inline>
2800
2854
  </xsl:template><xsl:template match="*[local-name()='del']">
2801
2855
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2802
2856
  <xsl:apply-templates/>
@@ -3086,7 +3140,18 @@
3086
3140
  <xsl:with-param name="previousRow" select="$newRow"/>
3087
3141
  </xsl:apply-templates>
3088
3142
  </xsl:template><xsl:template name="getLang">
3089
- <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3143
+ <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
3144
+ <xsl:variable name="language">
3145
+ <xsl:choose>
3146
+ <xsl:when test="$language_current != ''">
3147
+ <xsl:value-of select="$language_current"/>
3148
+ </xsl:when>
3149
+ <xsl:otherwise>
3150
+ <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3151
+ </xsl:otherwise>
3152
+ </xsl:choose>
3153
+ </xsl:variable>
3154
+
3090
3155
  <xsl:choose>
3091
3156
  <xsl:when test="$language = 'English'">en</xsl:when>
3092
3157
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
@@ -3121,6 +3186,7 @@
3121
3186
  <xsl:value-of select="substring($str, 2)"/>
3122
3187
  </xsl:template><xsl:template match="mathml:math">
3123
3188
  <fo:inline font-family="STIX Two Math"> <!-- -->
3189
+
3124
3190
  <xsl:variable name="mathml">
3125
3191
  <xsl:apply-templates select="." mode="mathml"/>
3126
3192
  </xsl:variable>
@@ -3150,6 +3216,7 @@
3150
3216
  </xsl:choose>
3151
3217
  </xsl:variable>
3152
3218
  <fo:inline xsl:use-attribute-sets="link-style">
3219
+
3153
3220
  <xsl:choose>
3154
3221
  <xsl:when test="$target = ''">
3155
3222
  <xsl:apply-templates/>
@@ -3203,10 +3270,14 @@
3203
3270
  </fo:inline>
3204
3271
  </xsl:template><xsl:template match="*[local-name() = 'modification']">
3205
3272
  <xsl:variable name="title-modified">
3206
- <xsl:call-template name="getTitle">
3207
- <xsl:with-param name="name" select="'title-modified'"/>
3208
- </xsl:call-template>
3273
+
3274
+
3275
+ <xsl:call-template name="getTitle">
3276
+ <xsl:with-param name="name" select="'title-modified'"/>
3277
+ </xsl:call-template>
3278
+
3209
3279
  </xsl:variable>
3280
+
3210
3281
  <xsl:choose>
3211
3282
  <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3212
3283
  <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
@@ -3360,8 +3431,9 @@
3360
3431
  </xsl:if> -->
3361
3432
  </fo:inline>
3362
3433
  </xsl:if>
3363
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3364
- <fo:block-container id="{@id}">
3434
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3435
+ <fo:block-container id="{@id}">
3436
+
3365
3437
  <fo:block>
3366
3438
  <xsl:apply-templates/>
3367
3439
  </fo:block>
@@ -3412,7 +3484,7 @@
3412
3484
  <xsl:apply-templates mode="bookmarks"/>
3413
3485
  </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3414
3486
  <xsl:apply-templates select="."/>
3415
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3487
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3416
3488
  <xsl:apply-templates mode="bookmarks"/>
3417
3489
  </xsl:template><xsl:template name="addBookmarks">
3418
3490
  <xsl:param name="contents"/>
@@ -3428,6 +3500,8 @@
3428
3500
  <xsl:variable name="bookmark-title_">
3429
3501
  <xsl:call-template name="getLangVersion">
3430
3502
  <xsl:with-param name="lang" select="@lang"/>
3503
+ <xsl:with-param name="doctype" select="@doctype"/>
3504
+ <xsl:with-param name="title" select="@title-part"/>
3431
3505
  </xsl:call-template>
3432
3506
  </xsl:variable>
3433
3507
  <xsl:choose>
@@ -3445,13 +3519,34 @@
3445
3519
  </xsl:choose>
3446
3520
  </fo:bookmark-title>
3447
3521
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3522
+
3523
+ <xsl:call-template name="insertFigureBookmarks">
3524
+ <xsl:with-param name="contents" select="contents"/>
3525
+ </xsl:call-template>
3526
+
3527
+ <xsl:call-template name="insertTableBookmarks">
3528
+ <xsl:with-param name="contents" select="contents"/>
3529
+ <xsl:with-param name="lang" select="@lang"/>
3530
+ </xsl:call-template>
3531
+
3448
3532
  </fo:bookmark>
3449
3533
 
3450
3534
  </xsl:for-each>
3451
3535
  </xsl:when>
3452
3536
  <xsl:otherwise>
3453
3537
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3538
+
3454
3539
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3540
+
3541
+ <xsl:call-template name="insertFigureBookmarks">
3542
+ <xsl:with-param name="contents" select="contents"/>
3543
+ </xsl:call-template>
3544
+
3545
+ <xsl:call-template name="insertTableBookmarks">
3546
+ <xsl:with-param name="contents" select="contents"/>
3547
+ <xsl:with-param name="lang" select="@lang"/>
3548
+ </xsl:call-template>
3549
+
3455
3550
  </xsl:for-each>
3456
3551
  </xsl:otherwise>
3457
3552
  </xsl:choose>
@@ -3470,8 +3565,44 @@
3470
3565
 
3471
3566
  </fo:bookmark-tree>
3472
3567
  </xsl:if>
3568
+ </xsl:template><xsl:template name="insertFigureBookmarks">
3569
+ <xsl:param name="contents"/>
3570
+ <xsl:if test="xalan:nodeset($contents)/figure">
3571
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
3572
+ <fo:bookmark-title>Figures</fo:bookmark-title>
3573
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
3574
+ <fo:bookmark internal-destination="{@id}">
3575
+ <fo:bookmark-title>
3576
+ <xsl:value-of select="normalize-space(title)"/>
3577
+ </fo:bookmark-title>
3578
+ </fo:bookmark>
3579
+ </xsl:for-each>
3580
+ </fo:bookmark>
3581
+ </xsl:if>
3582
+ </xsl:template><xsl:template name="insertTableBookmarks">
3583
+ <xsl:param name="contents"/>
3584
+ <xsl:param name="lang"/>
3585
+ <xsl:if test="xalan:nodeset($contents)/table">
3586
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
3587
+ <fo:bookmark-title>
3588
+ <xsl:choose>
3589
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
3590
+ <xsl:otherwise>Tables</xsl:otherwise>
3591
+ </xsl:choose>
3592
+ </fo:bookmark-title>
3593
+ <xsl:for-each select="xalan:nodeset($contents)/table">
3594
+ <fo:bookmark internal-destination="{@id}">
3595
+ <fo:bookmark-title>
3596
+ <xsl:value-of select="normalize-space(title)"/>
3597
+ </fo:bookmark-title>
3598
+ </fo:bookmark>
3599
+ </xsl:for-each>
3600
+ </fo:bookmark>
3601
+ </xsl:if>
3473
3602
  </xsl:template><xsl:template name="getLangVersion">
3474
3603
  <xsl:param name="lang"/>
3604
+ <xsl:param name="doctype" select="''"/>
3605
+ <xsl:param name="title" select="''"/>
3475
3606
  <xsl:choose>
3476
3607
  <xsl:when test="$lang = 'en'">
3477
3608
 
@@ -3511,6 +3642,12 @@
3511
3642
  <!-- <xsl:text> </xsl:text> -->
3512
3643
  </xsl:template><xsl:template name="getSection">
3513
3644
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3645
+ <!--
3646
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3647
+ <xsl:value-of select="."/>
3648
+ </xsl:for-each>
3649
+ -->
3650
+
3514
3651
  </xsl:template><xsl:template name="getName">
3515
3652
  <xsl:choose>
3516
3653
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3563,6 +3700,10 @@
3563
3700
  <xsl:copy>
3564
3701
  <xsl:apply-templates mode="contents_item"/>
3565
3702
  </xsl:copy>
3703
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3704
+ <xsl:copy>
3705
+ <xsl:apply-templates mode="contents_item"/>
3706
+ </xsl:copy>
3566
3707
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3567
3708
  <xsl:text> </xsl:text>
3568
3709
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3588,6 +3729,7 @@
3588
3729
 
3589
3730
 
3590
3731
 
3732
+
3591
3733
 
3592
3734
 
3593
3735
  10
@@ -3963,7 +4105,8 @@
3963
4105
  <fo:block-container margin-left="0mm">
3964
4106
 
3965
4107
  <fo:block xsl:use-attribute-sets="quote-style">
3966
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
4108
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4109
+ <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3967
4110
  </fo:block>
3968
4111
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3969
4112
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4089,9 +4232,12 @@
4089
4232
  </fo:block>
4090
4233
  </xsl:template><xsl:template match="*[local-name() = 'deprecates']">
4091
4234
  <xsl:variable name="title-deprecated">
4092
- <xsl:call-template name="getTitle">
4093
- <xsl:with-param name="name" select="'title-deprecated'"/>
4094
- </xsl:call-template>
4235
+
4236
+
4237
+ <xsl:call-template name="getTitle">
4238
+ <xsl:with-param name="name" select="'title-deprecated'"/>
4239
+ </xsl:call-template>
4240
+
4095
4241
  </xsl:variable>
4096
4242
  <fo:block xsl:use-attribute-sets="deprecates-style">
4097
4243
  <xsl:value-of select="$title-deprecated"/>: <xsl:apply-templates/>
@@ -4113,6 +4259,7 @@
4113
4259
 
4114
4260
 
4115
4261
 
4262
+
4116
4263
 
4117
4264
 
4118
4265
 
@@ -4128,7 +4275,7 @@
4128
4275
  </xsl:if>
4129
4276
 
4130
4277
 
4131
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4278
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4132
4279
  <fo:block break-after="page"/>
4133
4280
  <fo:block>
4134
4281
  <xsl:call-template name="setId"/>
@@ -4136,7 +4283,8 @@
4136
4283
  </fo:block>
4137
4284
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4138
4285
  <fo:block>
4139
- <xsl:call-template name="setId"/>
4286
+ <xsl:call-template name="setId"/>
4287
+
4140
4288
 
4141
4289
  <xsl:apply-templates/>
4142
4290
  </fo:block>
@@ -4144,7 +4292,7 @@
4144
4292
  <fo:block id="{@id}">
4145
4293
  <xsl:apply-templates/>
4146
4294
  </fo:block>
4147
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
4295
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" priority="3"/><xsl:template match="*[local-name() = 'bibitem'][@hidden='true']" priority="3"/><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
4148
4296
 
4149
4297
  <fo:block break-after="page"/>
4150
4298
 
@@ -4203,7 +4351,10 @@
4203
4351
  <fo:table-column column-width="107mm"/>
4204
4352
  <fo:table-column column-width="15mm"/>
4205
4353
  <fo:table-body>
4206
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
4354
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
4355
+
4356
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
4357
+
4207
4358
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
4208
4359
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
4209
4360
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -4221,6 +4372,10 @@
4221
4372
  <fo:block><xsl:apply-templates/></fo:block>
4222
4373
  </fo:table-cell>
4223
4374
  </xsl:template><xsl:template name="processBibitem">
4375
+
4376
+
4377
+ <!-- end BIPM bibitem processing-->
4378
+
4224
4379
 
4225
4380
 
4226
4381
 
@@ -4279,6 +4434,8 @@
4279
4434
  <xsl:value-of select="translate(.,'. ','')"/>
4280
4435
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4281
4436
  <xsl:value-of select="substring(.,1,1)"/>
4437
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4438
+ <fo:inline><xsl:apply-templates/></fo:inline>
4282
4439
  </xsl:template><xsl:template name="convertDate">
4283
4440
  <xsl:param name="date"/>
4284
4441
  <xsl:param name="format" select="'short'"/>
@@ -4303,6 +4460,57 @@
4303
4460
  </xsl:variable>
4304
4461
  <xsl:variable name="result">
4305
4462
  <xsl:choose>
4463
+ <xsl:when test="$format = 'ddMMyyyy'">
4464
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4465
+ <xsl:text> </xsl:text>
4466
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4467
+ </xsl:when>
4468
+ <xsl:when test="$format = 'ddMM'">
4469
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4470
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4471
+ </xsl:when>
4472
+ <xsl:when test="$format = 'short' or $day = ''">
4473
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4474
+ </xsl:when>
4475
+ <xsl:otherwise>
4476
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4477
+ </xsl:otherwise>
4478
+ </xsl:choose>
4479
+ </xsl:variable>
4480
+ <xsl:value-of select="$result"/>
4481
+ </xsl:template><xsl:template name="convertDateLocalized">
4482
+ <xsl:param name="date"/>
4483
+ <xsl:param name="format" select="'short'"/>
4484
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4485
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4486
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4487
+ <xsl:variable name="monthStr">
4488
+ <xsl:choose>
4489
+ <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>
4490
+ <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>
4491
+ <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>
4492
+ <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>
4493
+ <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>
4494
+ <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>
4495
+ <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>
4496
+ <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>
4497
+ <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>
4498
+ <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>
4499
+ <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>
4500
+ <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>
4501
+ </xsl:choose>
4502
+ </xsl:variable>
4503
+ <xsl:variable name="result">
4504
+ <xsl:choose>
4505
+ <xsl:when test="$format = 'ddMMyyyy'">
4506
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4507
+ <xsl:text> </xsl:text>
4508
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4509
+ </xsl:when>
4510
+ <xsl:when test="$format = 'ddMM'">
4511
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4512
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4513
+ </xsl:when>
4306
4514
  <xsl:when test="$format = 'short' or $day = ''">
4307
4515
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4308
4516
  </xsl:when>
@@ -4463,13 +4671,22 @@
4463
4671
  </xsl:template><xsl:template name="split">
4464
4672
  <xsl:param name="pText" select="."/>
4465
4673
  <xsl:param name="sep" select="','"/>
4674
+ <xsl:param name="normalize-space" select="'true'"/>
4466
4675
  <xsl:if test="string-length($pText) &gt;0">
4467
4676
  <item>
4468
- <xsl:value-of select="normalize-space(substring-before(concat($pText, ','), $sep))"/>
4677
+ <xsl:choose>
4678
+ <xsl:when test="$normalize-space = 'true'">
4679
+ <xsl:value-of select="normalize-space(substring-before(concat($pText, $sep), $sep))"/>
4680
+ </xsl:when>
4681
+ <xsl:otherwise>
4682
+ <xsl:value-of select="substring-before(concat($pText, $sep), $sep)"/>
4683
+ </xsl:otherwise>
4684
+ </xsl:choose>
4469
4685
  </item>
4470
4686
  <xsl:call-template name="split">
4471
4687
  <xsl:with-param name="pText" select="substring-after($pText, $sep)"/>
4472
4688
  <xsl:with-param name="sep" select="$sep"/>
4689
+ <xsl:with-param name="normalize-space" select="$normalize-space"/>
4473
4690
  </xsl:call-template>
4474
4691
  </xsl:if>
4475
4692
  </xsl:template><xsl:template name="getDocumentId">
@@ -4493,6 +4710,7 @@
4493
4710
 
4494
4711
 
4495
4712
 
4713
+
4496
4714
  </xsl:variable>
4497
4715
  <xsl:if test="$documentNS != $XSLNS">
4498
4716
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4535,4 +4753,28 @@
4535
4753
  <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4536
4754
  </xsl:call-template>
4537
4755
  </xsl:if>
4756
+ </xsl:template><xsl:template name="repeat">
4757
+ <xsl:param name="char" select="'*'"/>
4758
+ <xsl:param name="count"/>
4759
+ <xsl:if test="$count &gt; 0">
4760
+ <xsl:value-of select="$char"/>
4761
+ <xsl:call-template name="repeat">
4762
+ <xsl:with-param name="char" select="$char"/>
4763
+ <xsl:with-param name="count" select="$count - 1"/>
4764
+ </xsl:call-template>
4765
+ </xsl:if>
4766
+ </xsl:template><xsl:template name="getLocalizedString">
4767
+ <xsl:param name="key"/>
4768
+
4769
+ <xsl:variable name="curr_lang">
4770
+ <xsl:call-template name="getLang"/>
4771
+ </xsl:variable>
4772
+
4773
+ <xsl:choose>
4774
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4775
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4776
+ </xsl:when>
4777
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4778
+ </xsl:choose>
4779
+
4538
4780
  </xsl:template></xsl:stylesheet>