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
@@ -808,10 +808,25 @@
808
808
  <fo:block>
809
809
  <fo:block><xsl:value-of select="nist:person/nist:name/nist:completename"/></fo:block>
810
810
  <xsl:variable name="org-name" select="nist:person/nist:affiliation/nist:organization/nist:name"/>
811
+ <xsl:variable name="subdivision">
812
+ <xsl:for-each select="nist:person/nist:affiliation/nist:organization/nist:subdivision">
813
+ <xsl:value-of select="."/>
814
+ <xsl:if test="position() != last()">, </xsl:if>
815
+ </xsl:for-each>
816
+ </xsl:variable>
817
+ <xsl:variable name="following_subdivision">
818
+ <xsl:for-each select="following-sibling::nist:contributor[nist:role/@type = 'author'][1]/nist:person/nist:affiliation/nist:organization/nist:subdivision">
819
+ <xsl:value-of select="."/>
820
+ <xsl:if test="position() != last()">, </xsl:if>
821
+ </xsl:for-each>
822
+ </xsl:variable>
811
823
  <xsl:variable name="org-address" select="nist:person/nist:affiliation/nist:organization/nist:address/nist:formattedAddress"/>
812
- <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)">
824
+ <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)">
813
825
  <fo:block font-style="italic" margin-bottom="12pt">
814
826
  <xsl:value-of select="$org-name"/>
827
+ <xsl:if test="normalize-space($subdivision) != ''">
828
+ <fo:inline>, <xsl:value-of select="$subdivision"/></fo:inline>
829
+ </xsl:if>
815
830
  <xsl:if test="normalize-space($org-address) != ''">
816
831
  <fo:inline>, <xsl:value-of select="$org-address"/></fo:inline>
817
832
  </xsl:if>
@@ -915,7 +930,7 @@
915
930
  <fo:block font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt"><xsl:value-of select="$title-list-figures"/></fo:block>
916
931
  <xsl:for-each select="//nist:figure[@id and nist:name]">
917
932
  <fo:block text-align-last="justify" margin-top="6pt" margin-bottom="6pt">
918
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
933
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{nist:name}">
919
934
  <xsl:apply-templates select="nist:name" mode="contents"/>
920
935
  <fo:inline keep-together.within-line="always">
921
936
  <fo:leader leader-pattern="dots"/>
@@ -941,7 +956,7 @@
941
956
  <fo:block font-size="12pt" font-weight="bold" text-align="center" margin-bottom="12pt"><xsl:value-of select="$title-list-tables"/></fo:block>
942
957
  <xsl:for-each select="//nist:table[@id and nist:name]">
943
958
  <fo:block text-align-last="justify" margin-top="6pt" margin-bottom="6pt">
944
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
959
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{nist:name}">
945
960
  <xsl:apply-templates select="nist:name" mode="contents"/>
946
961
  <fo:inline keep-together.within-line="always">
947
962
  <fo:leader leader-pattern="dots"/>
@@ -1340,35 +1355,24 @@
1340
1355
  <!-- Bibliography -->
1341
1356
  <!-- ============================= -->
1342
1357
 
1343
- <!-- 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. -->
1358
+ <!-- Examples:
1359
+ [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
1360
+ [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.
1361
+ -->
1344
1362
  <xsl:template match="nist:bibitem">
1345
- <fo:block id="{@id}" margin-top="6pt" margin-left="14mm" text-indent="-14mm">
1346
- <fo:inline padding-right="5mm">[<xsl:value-of select="nist:docidentifier"/>]</fo:inline><xsl:value-of select="nist:docidentifier"/>
1347
- <xsl:if test="nist:title">
1348
- <fo:inline font-style="italic">
1349
- <xsl:text>, </xsl:text>
1350
- <xsl:choose>
1351
- <xsl:when test="nist:title[@type = 'main' and @language = 'en']">
1352
- <xsl:value-of select="nist:title[@type = 'main' and @language = 'en']"/>
1353
- </xsl:when>
1354
- <xsl:otherwise>
1355
- <xsl:value-of select="nist:title"/>
1356
- </xsl:otherwise>
1357
- </xsl:choose>
1358
- </fo:inline>
1359
- </xsl:if>
1360
- <xsl:apply-templates select="nist:formattedref"/>
1361
- </fo:block>
1363
+ <fo:block id="{@id}" margin-top="6pt" margin-left="12mm" text-indent="-12mm">
1364
+ <xsl:variable name="docidentifier" select="normalize-space(nist:docidentifier[@display = 'true'])"/>
1365
+ <xsl:if test="$docidentifier != ''">
1366
+ <fo:inline padding-right="5mm"><xsl:value-of select="$docidentifier"/></fo:inline>
1367
+ </xsl:if>
1368
+ <xsl:apply-templates select="nist:formattedref"/>
1369
+ </fo:block>
1362
1370
  </xsl:template>
1363
- <xsl:template match="nist:bibitem/nist:docidentifier"/>
1364
-
1365
- <xsl:template match="nist:bibitem/nist:title"/>
1366
1371
 
1367
1372
  <xsl:template match="nist:formattedref">
1368
- <xsl:text>, </xsl:text><xsl:apply-templates/>
1373
+ <xsl:apply-templates/>
1369
1374
  </xsl:template>
1370
1375
 
1371
-
1372
1376
  <!-- ============================= -->
1373
1377
  <!-- ============================= -->
1374
1378
 
@@ -1488,21 +1492,21 @@
1488
1492
  <!-- ====== -->
1489
1493
 
1490
1494
 
1491
- <xsl:template match="nist:p/nist:fn[not(ancestor::nist:table)] | nist:title/nist:fn | nist:table/nist:name/nist:fn" priority="2">
1495
+ <xsl:template match="nist:p//nist:fn[not(ancestor::nist:table)] | nist:title/nist:fn | nist:table/nist:name/nist:fn" priority="2">
1492
1496
  <fo:footnote>
1493
1497
  <xsl:variable name="number">
1494
- <xsl:number level="any" count="nist:p/nist:fn[not(ancestor::nist:table)] | nist:title/nist:fn | nist:table/nist:name/nist:fn"/>
1498
+ <xsl:number level="any" count="nist:p//nist:fn[not(ancestor::nist:table)] | nist:title/nist:fn | nist:table/nist:name/nist:fn"/>
1495
1499
  </xsl:variable>
1496
1500
  <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1497
1501
  <fo:basic-link internal-destination="footnote_{@reference}_{$number}" fox:alt-text="footnote {@reference} {$number}">
1498
1502
  <!-- <xsl:value-of select="@reference"/> -->
1499
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
1503
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
1500
1504
  </fo:basic-link>
1501
1505
  </fo:inline>
1502
1506
  <fo:footnote-body>
1503
1507
  <fo:block font-size="10pt" font-family="Times New Roman" font-style="normal" font-weight="normal" text-align="justify" margin-bottom="12pt" start-indent="0">
1504
1508
  <fo:inline id="footnote_{@reference}_{$number}" font-size="75%" keep-with-next.within-line="always" vertical-align="super"> <!-- alignment-baseline="hanging" -->
1505
- <xsl:value-of select="$number + count(//nist:bibitem/nist:note)"/>
1509
+ <xsl:value-of select="$number + count(//nist:bibitem//nist:note)"/>
1506
1510
  </fo:inline>
1507
1511
  <xsl:for-each select="nist:p">
1508
1512
  <xsl:apply-templates/>
@@ -1536,104 +1540,6 @@
1536
1540
  </xsl:element>
1537
1541
  </xsl:template>
1538
1542
 
1539
-
1540
-
1541
- <!-- Examples:
1542
- [b-ASM] b-ASM, http://www.eecs.umich.edu/gasm/ (accessed 20 March 2018).
1543
- [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.
1544
- -->
1545
- <xsl:template match="nist:annex//nist:bibitem">
1546
- <fo:block id="{@id}" margin-top="6pt" margin-left="12mm" text-indent="-12mm">
1547
- <xsl:if test="nist:formattedref">
1548
- <xsl:choose>
1549
- <xsl:when test="nist:docidentifier[@type = 'metanorma']">
1550
- <xsl:attribute name="margin-left">0</xsl:attribute>
1551
- <xsl:attribute name="text-indent">0</xsl:attribute>
1552
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
1553
- <!-- create list -->
1554
- <fo:list-block>
1555
- <fo:list-item>
1556
- <fo:list-item-label end-indent="label-end()">
1557
- <fo:block>
1558
- <xsl:apply-templates select="nist:docidentifier[@type = 'metanorma']" mode="process"/>
1559
- </fo:block>
1560
- </fo:list-item-label>
1561
- <fo:list-item-body start-indent="body-start()">
1562
- <fo:block margin-left="3mm">
1563
- <xsl:apply-templates select="nist:formattedref"/>
1564
- </fo:block>
1565
- </fo:list-item-body>
1566
- </fo:list-item>
1567
- </fo:list-block>
1568
- </xsl:when>
1569
- <xsl:otherwise>
1570
- <xsl:apply-templates select="nist:formattedref"/>
1571
- <xsl:apply-templates select="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process"/>
1572
- </xsl:otherwise>
1573
- </xsl:choose>
1574
-
1575
-
1576
- </xsl:if>
1577
- <xsl:if test="nist:title">
1578
- <xsl:for-each select="nist:contributor">
1579
- <xsl:choose>
1580
- <xsl:when test="nist:person/nist:name/nist:completename">
1581
- <xsl:apply-templates select="nist:person/nist:name/nist:completename"/>
1582
- </xsl:when>
1583
- <xsl:otherwise>
1584
- <xsl:apply-templates select="nist:organization/nist:name"/>
1585
- </xsl:otherwise>
1586
- </xsl:choose>
1587
- <xsl:if test="position() != last()">, </xsl:if>
1588
- </xsl:for-each>
1589
- <xsl:text> (</xsl:text>
1590
- <xsl:variable name="date">
1591
- <xsl:choose>
1592
- <xsl:when test="nist:date[@type='issued']">
1593
- <xsl:call-template name="formatDate">
1594
- <xsl:with-param name="date" select="nist:date[@type='issued']/nist:on"/>
1595
- </xsl:call-template>
1596
- </xsl:when>
1597
- <xsl:otherwise>
1598
- <xsl:call-template name="formatDate">
1599
- <xsl:with-param name="date" select="nist:date/nist:on"/>
1600
- </xsl:call-template>
1601
- </xsl:otherwise>
1602
- </xsl:choose>
1603
- </xsl:variable>
1604
- <xsl:value-of select="$date"/>
1605
- <xsl:text>) </xsl:text>
1606
- <fo:inline font-style="italic"><xsl:value-of select="nist:title"/></fo:inline>
1607
- <xsl:if test="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name">
1608
- <xsl:text> (</xsl:text><xsl:value-of select="nist:contributor[nist:role/@type='publisher']/nist:organization/nist:name"/><xsl:text>)</xsl:text>
1609
- </xsl:if>
1610
- <xsl:if test="nist:place">
1611
- <xsl:text> (</xsl:text><xsl:value-of select="nist:place"/><xsl:text>)</xsl:text>
1612
- </xsl:if>
1613
- <xsl:text>, </xsl:text>
1614
- <xsl:value-of select="$date"/>
1615
- <xsl:text>. </xsl:text>
1616
- <xsl:value-of select="nist:docidentifier"/>
1617
- <xsl:value-of select="$linebreak"/>
1618
- <xsl:value-of select="nist:uri"/>
1619
- </xsl:if>
1620
- </fo:block>
1621
- </xsl:template>
1622
-
1623
- <xsl:template match="nist:annex//nist:bibitem//nist:formattedref">
1624
- <xsl:apply-templates/>
1625
- </xsl:template>
1626
-
1627
- <xsl:template match="nist:docidentifier[@type = 'metanorma']" mode="process">
1628
- <xsl:apply-templates/>
1629
- </xsl:template>
1630
- <xsl:template match="nist:docidentifier[@type != 'metanorma' or not(@type)]" mode="process">
1631
- <xsl:text> [</xsl:text><xsl:apply-templates/><xsl:text>]</xsl:text>
1632
- </xsl:template>
1633
- <xsl:template match="nist:docidentifier"/>
1634
-
1635
-
1636
-
1637
1543
  <xsl:template match="nist:ul | nist:ol" mode="ul_ol">
1638
1544
  <xsl:param name="margin"/>
1639
1545
  <fo:list-block>
@@ -1693,7 +1599,7 @@
1693
1599
  <xsl:number format="1."/>
1694
1600
  </xsl:when>
1695
1601
  <xsl:when test="../@type = 'arabic'">
1696
- <xsl:number format="a)"/>
1602
+ <xsl:number format="a)" lang="en"/>
1697
1603
  </xsl:when>
1698
1604
  <xsl:when test="../@type = 'alphabet'">
1699
1605
  <xsl:number format="1)"/>
@@ -1702,7 +1608,7 @@
1702
1608
  <xsl:number format="i)"/>
1703
1609
  </xsl:when>
1704
1610
  <xsl:when test="../@type = 'alphabet_upper'">
1705
- <xsl:number format="A)"/>
1611
+ <xsl:number format="A)" lang="en"/>
1706
1612
  </xsl:when>
1707
1613
  <xsl:when test="ancestor::*[nist:annex]">
1708
1614
  <!-- <xsl:variable name="level">
@@ -1710,7 +1616,7 @@
1710
1616
  </xsl:variable> -->
1711
1617
  <xsl:choose>
1712
1618
  <xsl:when test="$level = 1">
1713
- <xsl:number format="a)"/>
1619
+ <xsl:number format="a)" lang="en"/>
1714
1620
  </xsl:when>
1715
1621
  <xsl:when test="$level = 2">
1716
1622
  <xsl:number format="i)"/>
@@ -2543,6 +2449,7 @@
2543
2449
 
2544
2450
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2545
2451
 
2452
+
2546
2453
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2547
2454
 
2548
2455
 
@@ -2550,6 +2457,7 @@
2550
2457
 
2551
2458
 
2552
2459
 
2460
+
2553
2461
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2554
2462
 
2555
2463
 
@@ -2677,187 +2585,239 @@
2677
2585
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2678
2586
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2679
2587
  <xsl:call-template name="add-zero-spaces-java"/>
2680
- </xsl:template><xsl:template match="*[local-name()='table']">
2588
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2681
2589
 
2682
- <xsl:variable name="simple-table">
2683
- <xsl:call-template name="getSimpleTable"/>
2684
- </xsl:variable>
2590
+ <xsl:variable name="table">
2685
2591
 
2686
-
2687
-
2688
-
2689
-
2690
- <!-- <xsl:if test="$namespace = 'bipm'">
2691
- <fo:block>&#xA0;</fo:block>
2692
- </xsl:if> -->
2693
-
2694
- <!-- $namespace = 'iso' or -->
2695
-
2696
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2697
-
2698
-
2592
+ <xsl:variable name="simple-table">
2593
+ <xsl:call-template name="getSimpleTable"/>
2594
+ </xsl:variable>
2699
2595
 
2700
2596
 
2701
-
2702
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2703
-
2704
- <!-- <xsl:variable name="cols-count">
2705
- <xsl:choose>
2706
- <xsl:when test="*[local-name()='thead']">
2707
- <xsl:call-template name="calculate-columns-numbers">
2708
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2709
- </xsl:call-template>
2710
- </xsl:when>
2711
- <xsl:otherwise>
2712
- <xsl:call-template name="calculate-columns-numbers">
2713
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2714
- </xsl:call-template>
2715
- </xsl:otherwise>
2716
- </xsl:choose>
2717
- </xsl:variable> -->
2718
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2719
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2720
-
2721
-
2722
-
2723
- <xsl:variable name="colwidths">
2724
- <xsl:call-template name="calculate-column-widths">
2725
- <xsl:with-param name="cols-count" select="$cols-count"/>
2726
- <xsl:with-param name="table" select="$simple-table"/>
2727
- </xsl:call-template>
2728
- </xsl:variable>
2729
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2730
-
2731
- <!-- <xsl:variable name="colwidths2">
2732
- <xsl:call-template name="calculate-column-widths">
2733
- <xsl:with-param name="cols-count" select="$cols-count"/>
2734
- </xsl:call-template>
2735
- </xsl:variable> -->
2736
-
2737
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2738
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
2739
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2740
-
2741
- <xsl:variable name="margin-left">
2742
- <xsl:choose>
2743
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2744
- <xsl:otherwise>0</xsl:otherwise>
2745
- </xsl:choose>
2746
- </xsl:variable>
2747
-
2748
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2749
2597
 
2750
2598
 
2751
- <xsl:attribute name="space-after">6pt</xsl:attribute>
2752
2599
 
2753
-
2754
-
2755
-
2600
+ <!-- <xsl:if test="$namespace = 'bipm'">
2601
+ <fo:block>&#xA0;</fo:block>
2602
+ </xsl:if> -->
2756
2603
 
2604
+ <!-- $namespace = 'iso' or -->
2757
2605
 
2758
- <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
2759
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2760
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2761
- </xsl:if>
2762
- <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
2763
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2764
- <xsl:attribute name="font-size">12pt</xsl:attribute>
2765
- </xsl:if>
2766
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2606
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2767
2607
 
2768
-
2608
+
2609
+
2610
+
2611
+
2612
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2613
+
2614
+ <!-- <xsl:variable name="cols-count">
2615
+ <xsl:choose>
2616
+ <xsl:when test="*[local-name()='thead']">
2617
+ <xsl:call-template name="calculate-columns-numbers">
2618
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2619
+ </xsl:call-template>
2620
+ </xsl:when>
2621
+ <xsl:otherwise>
2622
+ <xsl:call-template name="calculate-columns-numbers">
2623
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2624
+ </xsl:call-template>
2625
+ </xsl:otherwise>
2626
+ </xsl:choose>
2627
+ </xsl:variable> -->
2628
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2629
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2769
2630
 
2770
2631
 
2771
2632
 
2633
+ <xsl:variable name="colwidths">
2634
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2635
+ <xsl:call-template name="calculate-column-widths">
2636
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2637
+ <xsl:with-param name="table" select="$simple-table"/>
2638
+ </xsl:call-template>
2639
+ </xsl:if>
2640
+ </xsl:variable>
2641
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2772
2642
 
2643
+ <!-- <xsl:variable name="colwidths2">
2644
+ <xsl:call-template name="calculate-column-widths">
2645
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2646
+ </xsl:call-template>
2647
+ </xsl:variable> -->
2773
2648
 
2649
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2650
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
2651
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2774
2652
 
2653
+ <xsl:variable name="margin-left">
2654
+ <xsl:choose>
2655
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2656
+ <xsl:otherwise>0</xsl:otherwise>
2657
+ </xsl:choose>
2658
+ </xsl:variable>
2775
2659
 
2776
- <xsl:variable name="table_attributes">
2777
- <attribute name="table-layout">fixed</attribute>
2778
- <attribute name="width">100%</attribute>
2779
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2780
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2660
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2781
2661
 
2782
2662
 
2663
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
2783
2664
 
2665
+
2666
+
2667
+
2784
2668
 
2785
-
2786
-
2787
-
2788
2669
 
2789
-
2670
+ <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
2671
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2672
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2673
+ </xsl:if>
2674
+ <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
2675
+ <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2676
+ <xsl:attribute name="font-size">12pt</xsl:attribute>
2677
+ </xsl:if>
2678
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2790
2679
 
2791
- </xsl:variable>
2792
-
2793
-
2794
- <fo:table id="{@id}" table-omit-footer-at-break="true">
2680
+
2795
2681
 
2796
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2797
- <xsl:attribute name="{@name}">
2798
- <xsl:value-of select="."/>
2799
- </xsl:attribute>
2800
- </xsl:for-each>
2801
2682
 
2802
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2803
- <xsl:if test="$isNoteOrFnExist = 'true'">
2804
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2805
- </xsl:if>
2806
2683
 
2807
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2684
+
2685
+
2686
+
2687
+ <xsl:variable name="table_width">
2688
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2689
+ 100%
2690
+
2691
+
2692
+ </xsl:variable>
2693
+
2694
+ <xsl:variable name="table_attributes">
2695
+ <attribute name="table-layout">fixed</attribute>
2696
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
2697
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2698
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2699
+
2700
+
2701
+
2702
+
2703
+
2704
+
2705
+
2706
+
2707
+
2708
+
2709
+ </xsl:variable>
2710
+
2711
+
2712
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
2713
+
2714
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2715
+ <xsl:attribute name="{@name}">
2716
+ <xsl:value-of select="."/>
2717
+ </xsl:attribute>
2718
+ </xsl:for-each>
2719
+
2720
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2721
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2722
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2723
+ </xsl:if>
2724
+
2808
2725
  <xsl:choose>
2809
- <xsl:when test=". = 1 or . = 0">
2810
- <fo:table-column column-width="proportional-column-width(2)"/>
2726
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2727
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2728
+ <fo:table-column column-width="{@width}"/>
2729
+ </xsl:for-each>
2811
2730
  </xsl:when>
2812
2731
  <xsl:otherwise>
2813
- <fo:table-column column-width="proportional-column-width({.})"/>
2732
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2733
+ <xsl:choose>
2734
+ <xsl:when test=". = 1 or . = 0">
2735
+ <fo:table-column column-width="proportional-column-width(2)"/>
2736
+ </xsl:when>
2737
+ <xsl:otherwise>
2738
+ <fo:table-column column-width="proportional-column-width({.})"/>
2739
+ </xsl:otherwise>
2740
+ </xsl:choose>
2741
+ </xsl:for-each>
2814
2742
  </xsl:otherwise>
2815
2743
  </xsl:choose>
2816
- </xsl:for-each>
2817
-
2818
- <xsl:choose>
2819
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2820
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2821
- </xsl:when>
2822
- <xsl:otherwise>
2823
- <xsl:apply-templates/>
2824
- </xsl:otherwise>
2825
- </xsl:choose>
2826
-
2827
- </fo:table>
2828
-
2829
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2830
- <xsl:call-template name="insertTableFooterInSeparateTable">
2831
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
2832
- <xsl:with-param name="colwidths" select="$colwidths"/>
2833
- </xsl:call-template>
2834
- </xsl:for-each>
2835
-
2836
- <!-- insert footer as table -->
2837
- <!-- <fo:table>
2838
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2839
- <xsl:attribute name="{@name}">
2840
- <xsl:value-of select="."/>
2841
- </xsl:attribute>
2842
- </xsl:for-each>
2843
-
2844
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2744
+
2845
2745
  <xsl:choose>
2846
- <xsl:when test=". = 1 or . = 0">
2847
- <fo:table-column column-width="proportional-column-width(2)"/>
2746
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2747
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2848
2748
  </xsl:when>
2849
2749
  <xsl:otherwise>
2850
- <fo:table-column column-width="proportional-column-width({.})"/>
2750
+ <xsl:apply-templates/>
2851
2751
  </xsl:otherwise>
2852
2752
  </xsl:choose>
2753
+
2754
+ </fo:table>
2755
+
2756
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2757
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2758
+ <xsl:call-template name="insertTableFooterInSeparateTable">
2759
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
2760
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2761
+ <xsl:with-param name="colgroup" select="$colgroup"/>
2762
+ </xsl:call-template>
2853
2763
  </xsl:for-each>
2854
- </fo:table>-->
2855
-
2856
-
2857
-
2858
-
2859
-
2860
- </fo:block-container>
2764
+
2765
+ <!-- insert footer as table -->
2766
+ <!-- <fo:table>
2767
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2768
+ <xsl:attribute name="{@name}">
2769
+ <xsl:value-of select="."/>
2770
+ </xsl:attribute>
2771
+ </xsl:for-each>
2772
+
2773
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2774
+ <xsl:choose>
2775
+ <xsl:when test=". = 1 or . = 0">
2776
+ <fo:table-column column-width="proportional-column-width(2)"/>
2777
+ </xsl:when>
2778
+ <xsl:otherwise>
2779
+ <fo:table-column column-width="proportional-column-width({.})"/>
2780
+ </xsl:otherwise>
2781
+ </xsl:choose>
2782
+ </xsl:for-each>
2783
+ </fo:table>-->
2784
+
2785
+
2786
+
2787
+
2788
+
2789
+ </fo:block-container>
2790
+ </xsl:variable>
2791
+
2792
+
2793
+
2794
+ <xsl:choose>
2795
+ <xsl:when test="@width">
2796
+
2797
+ <!-- centered table when table name is centered (see table-name-style) -->
2798
+
2799
+ <fo:table table-layout="fixed" width="100%">
2800
+ <fo:table-column column-width="proportional-column-width(1)"/>
2801
+ <fo:table-column column-width="{@width}"/>
2802
+ <fo:table-column column-width="proportional-column-width(1)"/>
2803
+ <fo:table-body>
2804
+ <fo:table-row>
2805
+ <fo:table-cell column-number="2">
2806
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
2807
+ </fo:table-cell>
2808
+ </fo:table-row>
2809
+ </fo:table-body>
2810
+ </fo:table>
2811
+
2812
+
2813
+
2814
+
2815
+ </xsl:when>
2816
+ <xsl:otherwise>
2817
+ <xsl:copy-of select="$table"/>
2818
+ </xsl:otherwise>
2819
+ </xsl:choose>
2820
+
2861
2821
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2862
2822
  <xsl:if test="normalize-space() != ''">
2863
2823
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -3083,12 +3043,22 @@
3083
3043
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
3084
3044
  <xsl:param name="table_attributes"/>
3085
3045
  <xsl:param name="colwidths"/>
3046
+ <xsl:param name="colgroup"/>
3086
3047
 
3087
3048
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3088
3049
 
3089
3050
  <xsl:if test="$isNoteOrFnExist = 'true'">
3090
3051
 
3091
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
3052
+ <xsl:variable name="cols-count">
3053
+ <xsl:choose>
3054
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
3055
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
3056
+ </xsl:when>
3057
+ <xsl:otherwise>
3058
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
3059
+ </xsl:otherwise>
3060
+ </xsl:choose>
3061
+ </xsl:variable>
3092
3062
 
3093
3063
  <fo:table keep-with-previous="always">
3094
3064
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -3106,16 +3076,25 @@
3106
3076
  </xsl:choose>
3107
3077
  </xsl:for-each>
3108
3078
 
3109
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3110
- <xsl:choose>
3111
- <xsl:when test=". = 1 or . = 0">
3112
- <fo:table-column column-width="proportional-column-width(2)"/>
3113
- </xsl:when>
3114
- <xsl:otherwise>
3115
- <fo:table-column column-width="proportional-column-width({.})"/>
3116
- </xsl:otherwise>
3117
- </xsl:choose>
3118
- </xsl:for-each>
3079
+ <xsl:choose>
3080
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
3081
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
3082
+ <fo:table-column column-width="{@width}"/>
3083
+ </xsl:for-each>
3084
+ </xsl:when>
3085
+ <xsl:otherwise>
3086
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3087
+ <xsl:choose>
3088
+ <xsl:when test=". = 1 or . = 0">
3089
+ <fo:table-column column-width="proportional-column-width(2)"/>
3090
+ </xsl:when>
3091
+ <xsl:otherwise>
3092
+ <fo:table-column column-width="proportional-column-width({.})"/>
3093
+ </xsl:otherwise>
3094
+ </xsl:choose>
3095
+ </xsl:for-each>
3096
+ </xsl:otherwise>
3097
+ </xsl:choose>
3119
3098
 
3120
3099
  <fo:table-body>
3121
3100
  <fo:table-row>
@@ -3537,7 +3516,9 @@
3537
3516
  </xsl:template><xsl:template match="*[local-name()='dl']">
3538
3517
  <fo:block-container>
3539
3518
 
3540
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
3519
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3520
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3521
+ </xsl:if>
3541
3522
 
3542
3523
 
3543
3524
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -3552,6 +3533,7 @@
3552
3533
  <fo:block-container>
3553
3534
 
3554
3535
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3536
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3555
3537
 
3556
3538
 
3557
3539
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -3676,7 +3658,7 @@
3676
3658
  <xsl:with-param name="table" select="$html-table"/>
3677
3659
  </xsl:call-template>
3678
3660
  </xsl:variable>
3679
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3661
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3680
3662
  <xsl:variable name="maxlength_dt">
3681
3663
  <xsl:call-template name="getMaxLength_dt"/>
3682
3664
  </xsl:variable>
@@ -3705,13 +3687,22 @@
3705
3687
  </xsl:when>
3706
3688
  <xsl:otherwise>
3707
3689
  <xsl:choose>
3690
+ <!-- to set width check most wide chars like `W` -->
3708
3691
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3709
- <fo:table-column column-width="5%"/>
3710
- <fo:table-column column-width="95%"/>
3692
+ <fo:table-column column-width="7%"/>
3693
+ <fo:table-column column-width="93%"/>
3694
+ </xsl:when>
3695
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
3696
+ <fo:table-column column-width="15%"/>
3697
+ <fo:table-column column-width="85%"/>
3698
+ </xsl:when>
3699
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
3700
+ <fo:table-column column-width="20%"/>
3701
+ <fo:table-column column-width="80%"/>
3711
3702
  </xsl:when>
3712
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3713
- <fo:table-column column-width="10%"/>
3714
- <fo:table-column column-width="90%"/>
3703
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
3704
+ <fo:table-column column-width="25%"/>
3705
+ <fo:table-column column-width="75%"/>
3715
3706
  </xsl:when>
3716
3707
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3717
3708
  <fo:table-column column-width="60%"/>
@@ -3743,12 +3734,32 @@
3743
3734
  </xsl:otherwise>
3744
3735
  </xsl:choose>
3745
3736
  </xsl:template><xsl:template name="getMaxLength_dt">
3746
- <xsl:for-each select="*[local-name()='dt']">
3747
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3748
- <xsl:if test="position() = 1">
3749
- <xsl:value-of select="string-length(normalize-space(.))"/>
3750
- </xsl:if>
3751
- </xsl:for-each>
3737
+ <xsl:variable name="lengths">
3738
+ <xsl:for-each select="*[local-name()='dt']">
3739
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
3740
+ <xsl:variable name="attributes">
3741
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
3742
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
3743
+ </xsl:variable>
3744
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
3745
+ </xsl:for-each>
3746
+ </xsl:variable>
3747
+ <xsl:variable name="maxLength">
3748
+ <!-- <xsl:for-each select="*[local-name()='dt']">
3749
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3750
+ <xsl:if test="position() = 1">
3751
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3752
+ </xsl:if>
3753
+ </xsl:for-each> -->
3754
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
3755
+ <xsl:sort select="." data-type="number" order="descending"/>
3756
+ <xsl:if test="position() = 1">
3757
+ <xsl:value-of select="."/>
3758
+ </xsl:if>
3759
+ </xsl:for-each>
3760
+ </xsl:variable>
3761
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
3762
+ <xsl:value-of select="$maxLength"/>
3752
3763
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3753
3764
  <xsl:param name="key_iso"/>
3754
3765
 
@@ -3903,6 +3914,7 @@
3903
3914
 
3904
3915
 
3905
3916
 
3917
+
3906
3918
 
3907
3919
  </xsl:variable>
3908
3920
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -3916,6 +3928,10 @@
3916
3928
  </xsl:if>
3917
3929
  <xsl:apply-templates/>
3918
3930
  </fo:inline>
3931
+ </xsl:template><xsl:template match="*[local-name()='underline']">
3932
+ <fo:inline text-decoration="underline">
3933
+ <xsl:apply-templates/>
3934
+ </fo:inline>
3919
3935
  </xsl:template><xsl:template match="*[local-name()='del']">
3920
3936
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3921
3937
  <xsl:apply-templates/>
@@ -4009,6 +4025,10 @@
4009
4025
  <xsl:param name="text" select="."/>
4010
4026
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4011
4027
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4028
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
4029
+ <xsl:param name="text" select="."/>
4030
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4031
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4012
4032
  </xsl:template><xsl:template name="add-zero-spaces">
4013
4033
  <xsl:param name="text" select="."/>
4014
4034
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -4269,6 +4289,11 @@
4269
4289
  <!-- replace start and end spaces to non-break space -->
4270
4290
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4271
4291
  </xsl:copy>
4292
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
4293
+ <xsl:copy>
4294
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
4295
+ </xsl:copy>
4296
+ <mathml:mspace width="0.5ex"/>
4272
4297
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4273
4298
  <xsl:variable name="target">
4274
4299
  <xsl:choose>
@@ -4290,7 +4315,10 @@
4290
4315
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4291
4316
  <xsl:choose>
4292
4317
  <xsl:when test="normalize-space(.) = ''">
4293
- <xsl:value-of select="$target"/>
4318
+ <!-- <xsl:value-of select="$target"/> -->
4319
+ <xsl:call-template name="add-zero-spaces-link-java">
4320
+ <xsl:with-param name="text" select="$target"/>
4321
+ </xsl:call-template>
4294
4322
  </xsl:when>
4295
4323
  <xsl:otherwise>
4296
4324
  <xsl:apply-templates/>
@@ -4496,7 +4524,7 @@
4496
4524
  </xsl:if> -->
4497
4525
  </fo:inline>
4498
4526
  </xsl:if>
4499
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
4527
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4500
4528
  <fo:block-container id="{@id}">
4501
4529
 
4502
4530
  <fo:block>
@@ -4565,6 +4593,8 @@
4565
4593
  <xsl:variable name="bookmark-title_">
4566
4594
  <xsl:call-template name="getLangVersion">
4567
4595
  <xsl:with-param name="lang" select="@lang"/>
4596
+ <xsl:with-param name="doctype" select="@doctype"/>
4597
+ <xsl:with-param name="title" select="@title-part"/>
4568
4598
  </xsl:call-template>
4569
4599
  </xsl:variable>
4570
4600
  <xsl:choose>
@@ -4582,13 +4612,34 @@
4582
4612
  </xsl:choose>
4583
4613
  </fo:bookmark-title>
4584
4614
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4615
+
4616
+ <xsl:call-template name="insertFigureBookmarks">
4617
+ <xsl:with-param name="contents" select="contents"/>
4618
+ </xsl:call-template>
4619
+
4620
+ <xsl:call-template name="insertTableBookmarks">
4621
+ <xsl:with-param name="contents" select="contents"/>
4622
+ <xsl:with-param name="lang" select="@lang"/>
4623
+ </xsl:call-template>
4624
+
4585
4625
  </fo:bookmark>
4586
4626
 
4587
4627
  </xsl:for-each>
4588
4628
  </xsl:when>
4589
4629
  <xsl:otherwise>
4590
4630
  <xsl:for-each select="xalan:nodeset($contents)/doc">
4631
+
4591
4632
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4633
+
4634
+ <xsl:call-template name="insertFigureBookmarks">
4635
+ <xsl:with-param name="contents" select="contents"/>
4636
+ </xsl:call-template>
4637
+
4638
+ <xsl:call-template name="insertTableBookmarks">
4639
+ <xsl:with-param name="contents" select="contents"/>
4640
+ <xsl:with-param name="lang" select="@lang"/>
4641
+ </xsl:call-template>
4642
+
4592
4643
  </xsl:for-each>
4593
4644
  </xsl:otherwise>
4594
4645
  </xsl:choose>
@@ -4634,8 +4685,44 @@
4634
4685
 
4635
4686
  </fo:bookmark-tree>
4636
4687
  </xsl:if>
4688
+ </xsl:template><xsl:template name="insertFigureBookmarks">
4689
+ <xsl:param name="contents"/>
4690
+ <xsl:if test="xalan:nodeset($contents)/figure">
4691
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
4692
+ <fo:bookmark-title>Figures</fo:bookmark-title>
4693
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
4694
+ <fo:bookmark internal-destination="{@id}">
4695
+ <fo:bookmark-title>
4696
+ <xsl:value-of select="normalize-space(title)"/>
4697
+ </fo:bookmark-title>
4698
+ </fo:bookmark>
4699
+ </xsl:for-each>
4700
+ </fo:bookmark>
4701
+ </xsl:if>
4702
+ </xsl:template><xsl:template name="insertTableBookmarks">
4703
+ <xsl:param name="contents"/>
4704
+ <xsl:param name="lang"/>
4705
+ <xsl:if test="xalan:nodeset($contents)/table">
4706
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
4707
+ <fo:bookmark-title>
4708
+ <xsl:choose>
4709
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
4710
+ <xsl:otherwise>Tables</xsl:otherwise>
4711
+ </xsl:choose>
4712
+ </fo:bookmark-title>
4713
+ <xsl:for-each select="xalan:nodeset($contents)/table">
4714
+ <fo:bookmark internal-destination="{@id}">
4715
+ <fo:bookmark-title>
4716
+ <xsl:value-of select="normalize-space(title)"/>
4717
+ </fo:bookmark-title>
4718
+ </fo:bookmark>
4719
+ </xsl:for-each>
4720
+ </fo:bookmark>
4721
+ </xsl:if>
4637
4722
  </xsl:template><xsl:template name="getLangVersion">
4638
4723
  <xsl:param name="lang"/>
4724
+ <xsl:param name="doctype" select="''"/>
4725
+ <xsl:param name="title" select="''"/>
4639
4726
  <xsl:choose>
4640
4727
  <xsl:when test="$lang = 'en'">
4641
4728
 
@@ -4675,6 +4762,12 @@
4675
4762
  <!-- <xsl:text> </xsl:text> -->
4676
4763
  </xsl:template><xsl:template name="getSection">
4677
4764
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4765
+ <!--
4766
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
4767
+ <xsl:value-of select="."/>
4768
+ </xsl:for-each>
4769
+ -->
4770
+
4678
4771
  </xsl:template><xsl:template name="getName">
4679
4772
  <xsl:choose>
4680
4773
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -4727,6 +4820,12 @@
4727
4820
  <xsl:copy>
4728
4821
  <xsl:apply-templates mode="contents_item"/>
4729
4822
  </xsl:copy>
4823
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
4824
+ <xsl:copy>
4825
+ <xsl:apply-templates mode="contents_item"/>
4826
+ </xsl:copy>
4827
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
4828
+ <xsl:copy-of select="."/>
4730
4829
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4731
4830
  <xsl:text> </xsl:text>
4732
4831
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4752,6 +4851,7 @@
4752
4851
 
4753
4852
 
4754
4853
 
4854
+
4755
4855
 
4756
4856
 
4757
4857
  10
@@ -5121,10 +5221,13 @@
5121
5221
  </xsl:if>
5122
5222
  </xsl:if>
5123
5223
 
5224
+
5124
5225
  <fo:block-container margin-left="0mm">
5125
5226
 
5126
5227
  <fo:block xsl:use-attribute-sets="quote-style">
5127
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
5228
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
5229
+
5230
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5128
5231
  </fo:block>
5129
5232
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5130
5233
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -5278,6 +5381,7 @@
5278
5381
 
5279
5382
 
5280
5383
 
5384
+
5281
5385
 
5282
5386
 
5283
5387
 
@@ -5293,7 +5397,7 @@
5293
5397
  </xsl:if>
5294
5398
 
5295
5399
 
5296
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
5400
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
5297
5401
  <fo:block break-after="page"/>
5298
5402
  <fo:block>
5299
5403
  <xsl:call-template name="setId"/>
@@ -5301,7 +5405,8 @@
5301
5405
  </fo:block>
5302
5406
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
5303
5407
  <fo:block>
5304
- <xsl:call-template name="setId"/>
5408
+ <xsl:call-template name="setId"/>
5409
+
5305
5410
 
5306
5411
  <xsl:apply-templates/>
5307
5412
  </fo:block>
@@ -5368,7 +5473,10 @@
5368
5473
  <fo:table-column column-width="107mm"/>
5369
5474
  <fo:table-column column-width="15mm"/>
5370
5475
  <fo:table-body>
5371
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
5476
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
5477
+
5478
+ <xsl:attribute name="font-family">Arial</xsl:attribute>
5479
+
5372
5480
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
5373
5481
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
5374
5482
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -5386,6 +5494,10 @@
5386
5494
  <fo:block><xsl:apply-templates/></fo:block>
5387
5495
  </fo:table-cell>
5388
5496
  </xsl:template><xsl:template name="processBibitem">
5497
+
5498
+
5499
+ <!-- end BIPM bibitem processing-->
5500
+
5389
5501
 
5390
5502
 
5391
5503
 
@@ -5444,6 +5556,8 @@
5444
5556
  <xsl:value-of select="translate(.,'. ','')"/>
5445
5557
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
5446
5558
  <xsl:value-of select="substring(.,1,1)"/>
5559
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5560
+ <fo:inline><xsl:apply-templates/></fo:inline>
5447
5561
  </xsl:template><xsl:template name="convertDate">
5448
5562
  <xsl:param name="date"/>
5449
5563
  <xsl:param name="format" select="'short'"/>
@@ -5468,6 +5582,57 @@
5468
5582
  </xsl:variable>
5469
5583
  <xsl:variable name="result">
5470
5584
  <xsl:choose>
5585
+ <xsl:when test="$format = 'ddMMyyyy'">
5586
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5587
+ <xsl:text> </xsl:text>
5588
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5589
+ </xsl:when>
5590
+ <xsl:when test="$format = 'ddMM'">
5591
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5592
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5593
+ </xsl:when>
5594
+ <xsl:when test="$format = 'short' or $day = ''">
5595
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5596
+ </xsl:when>
5597
+ <xsl:otherwise>
5598
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
5599
+ </xsl:otherwise>
5600
+ </xsl:choose>
5601
+ </xsl:variable>
5602
+ <xsl:value-of select="$result"/>
5603
+ </xsl:template><xsl:template name="convertDateLocalized">
5604
+ <xsl:param name="date"/>
5605
+ <xsl:param name="format" select="'short'"/>
5606
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
5607
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
5608
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
5609
+ <xsl:variable name="monthStr">
5610
+ <xsl:choose>
5611
+ <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>
5612
+ <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>
5613
+ <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>
5614
+ <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>
5615
+ <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>
5616
+ <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>
5617
+ <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>
5618
+ <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>
5619
+ <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>
5620
+ <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>
5621
+ <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>
5622
+ <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>
5623
+ </xsl:choose>
5624
+ </xsl:variable>
5625
+ <xsl:variable name="result">
5626
+ <xsl:choose>
5627
+ <xsl:when test="$format = 'ddMMyyyy'">
5628
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5629
+ <xsl:text> </xsl:text>
5630
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5631
+ </xsl:when>
5632
+ <xsl:when test="$format = 'ddMM'">
5633
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5634
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5635
+ </xsl:when>
5471
5636
  <xsl:when test="$format = 'short' or $day = ''">
5472
5637
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5473
5638
  </xsl:when>
@@ -5483,7 +5648,7 @@
5483
5648
  <xsl:param name="charDelim" select="', '"/>
5484
5649
  <xsl:choose>
5485
5650
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
5486
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5651
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5487
5652
  <xsl:sort data-type="text" order="ascending"/>
5488
5653
  <xsl:call-template name="insertKeyword">
5489
5654
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -5492,7 +5657,7 @@
5492
5657
  </xsl:for-each>
5493
5658
  </xsl:when>
5494
5659
  <xsl:otherwise>
5495
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5660
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5496
5661
  <xsl:call-template name="insertKeyword">
5497
5662
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
5498
5663
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -5509,6 +5674,9 @@
5509
5674
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5510
5675
  </xsl:choose>
5511
5676
  </xsl:template><xsl:template name="addPDFUAmeta">
5677
+ <xsl:variable name="lang">
5678
+ <xsl:call-template name="getLang"/>
5679
+ </xsl:variable>
5512
5680
  <fo:declarations>
5513
5681
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5514
5682
  <pdf:dictionary type="normal" key="ViewerPreferences">
@@ -5521,13 +5689,16 @@
5521
5689
  <!-- Dublin Core properties go here -->
5522
5690
  <dc:title>
5523
5691
  <xsl:variable name="title">
5524
-
5525
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
5526
-
5527
-
5528
-
5529
-
5530
-
5692
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5693
+
5694
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5695
+
5696
+
5697
+
5698
+
5699
+
5700
+
5701
+ </xsl:for-each>
5531
5702
  </xsl:variable>
5532
5703
  <xsl:choose>
5533
5704
  <xsl:when test="normalize-space($title) != ''">
@@ -5539,22 +5710,21 @@
5539
5710
  </xsl:choose>
5540
5711
  </dc:title>
5541
5712
  <dc:creator>
5542
-
5543
-
5544
-
5545
- <xsl:for-each select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5546
- <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
5547
- <xsl:if test="position() != last()">; </xsl:if>
5548
- </xsl:for-each>
5549
-
5550
- </dc:creator>
5551
- <dc:description>
5552
- <xsl:variable name="abstract">
5713
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5714
+
5553
5715
 
5554
5716
 
5717
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5718
+ <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
5719
+ <xsl:if test="position() != last()">; </xsl:if>
5720
+ </xsl:for-each>
5555
5721
 
5556
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5722
+ </xsl:for-each>
5723
+ </dc:creator>
5724
+ <dc:description>
5725
+ <xsl:variable name="abstract">
5557
5726
 
5727
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5558
5728
 
5559
5729
 
5560
5730
  </xsl:variable>
@@ -5667,6 +5837,7 @@
5667
5837
 
5668
5838
 
5669
5839
 
5840
+
5670
5841
  </xsl:variable>
5671
5842
  <xsl:if test="$documentNS != $XSLNS">
5672
5843
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -5726,6 +5897,11 @@
5726
5897
  <xsl:call-template name="getLang"/>
5727
5898
  </xsl:variable>
5728
5899
 
5729
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5900
+ <xsl:choose>
5901
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5902
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5903
+ </xsl:when>
5904
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5905
+ </xsl:choose>
5730
5906
 
5731
5907
  </xsl:template></xsl:stylesheet>