metanorma-nist 1.2.9 → 1.2.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -0
  3. data/.rubocop.yml +0 -4
  4. data/README.adoc +23 -3
  5. data/lib/asciidoctor/nist/basicdoc.rng +20 -3
  6. data/lib/asciidoctor/nist/boilerplate.rb +5 -3
  7. data/lib/asciidoctor/nist/cleanup.rb +4 -3
  8. data/lib/asciidoctor/nist/converter.rb +5 -2
  9. data/lib/asciidoctor/nist/front.rb +37 -46
  10. data/lib/asciidoctor/nist/front_id.rb +18 -7
  11. data/lib/asciidoctor/nist/isodoc.rng +118 -4
  12. data/lib/asciidoctor/nist/nist.rng +6 -0
  13. data/lib/asciidoctor/nist/nist_intro.xml +9 -9
  14. data/lib/asciidoctor/nist/nist_intro_cswp.xml +9 -9
  15. data/lib/asciidoctor/nist/validate.rb +17 -6
  16. data/lib/isodoc/nist/base_convert.rb +2 -3
  17. data/lib/isodoc/nist/html/header_cswp.html +2 -3
  18. data/lib/isodoc/nist/html/html_nist_titlepage.html +5 -3
  19. data/lib/isodoc/nist/html/word_nist_titlepage.html +8 -8
  20. data/lib/isodoc/nist/html/word_nist_titlepage_cswp.html +2 -0
  21. data/lib/isodoc/nist/html_convert.rb +6 -8
  22. data/lib/isodoc/nist/metadata.rb +28 -40
  23. data/lib/isodoc/nist/metadata_id.rb +3 -7
  24. data/lib/isodoc/nist/nist.csts.xsl +4844 -0
  25. data/lib/isodoc/nist/nist.cswp.xsl +477 -292
  26. data/lib/isodoc/nist/nist.sp.xsl +464 -327
  27. data/lib/isodoc/nist/pdf_convert.rb +5 -1
  28. data/lib/isodoc/nist/presentation_xml_convert.rb +30 -10
  29. data/lib/isodoc/nist/refs.rb +4 -20
  30. data/lib/isodoc/nist/render.rb +42 -40
  31. data/lib/isodoc/nist/render_dates.rb +8 -9
  32. data/lib/isodoc/nist/word_convert.rb +5 -6
  33. data/lib/isodoc/nist/xref.rb +11 -5
  34. data/lib/metanorma/nist/processor.rb +12 -0
  35. data/lib/metanorma/nist/version.rb +1 -1
  36. data/metanorma-nist.gemspec +2 -2
  37. metadata +8 -8
  38. data/lib/metanorma/nist/fonts_manifest.yaml +0 -6
@@ -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>
@@ -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,200 +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:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2725
- <xsl:call-template name="calculate-column-widths">
2726
- <xsl:with-param name="cols-count" select="$cols-count"/>
2727
- <xsl:with-param name="table" select="$simple-table"/>
2728
- </xsl:call-template>
2729
- </xsl:if>
2730
- </xsl:variable>
2731
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2732
-
2733
- <!-- <xsl:variable name="colwidths2">
2734
- <xsl:call-template name="calculate-column-widths">
2735
- <xsl:with-param name="cols-count" select="$cols-count"/>
2736
- </xsl:call-template>
2737
- </xsl:variable> -->
2738
-
2739
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2740
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
2741
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2742
-
2743
- <xsl:variable name="margin-left">
2744
- <xsl:choose>
2745
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2746
- <xsl:otherwise>0</xsl:otherwise>
2747
- </xsl:choose>
2748
- </xsl:variable>
2749
-
2750
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2751
2597
 
2752
2598
 
2753
- <xsl:attribute name="space-after">6pt</xsl:attribute>
2754
2599
 
2755
-
2756
-
2757
-
2600
+ <!-- <xsl:if test="$namespace = 'bipm'">
2601
+ <fo:block>&#xA0;</fo:block>
2602
+ </xsl:if> -->
2758
2603
 
2604
+ <!-- $namespace = 'iso' or -->
2759
2605
 
2760
- <xsl:if test="ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface']">
2761
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2762
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2763
- </xsl:if>
2764
- <xsl:if test="not(ancestor::*[local-name()='annex'] or ancestor::*[local-name()='preface'])">
2765
- <xsl:attribute name="font-family">Times New Roman</xsl:attribute>
2766
- <xsl:attribute name="font-size">12pt</xsl:attribute>
2767
- </xsl:if>
2768
- <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2606
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2769
2607
 
2770
-
2608
+
2609
+
2610
+
2771
2611
 
2612
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2772
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"/> -->
2773
2630
 
2774
2631
 
2775
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"/> -->
2776
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> -->
2777
2648
 
2778
- <xsl:variable name="table_attributes">
2779
- <attribute name="table-layout">fixed</attribute>
2780
- <attribute name="width">100%</attribute>
2781
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2782
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2649
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2650
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
2651
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
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>
2659
+
2660
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2783
2661
 
2784
2662
 
2663
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
2785
2664
 
2665
+
2666
+
2667
+
2786
2668
 
2787
-
2788
-
2789
-
2790
2669
 
2791
-
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>
2792
2679
 
2793
- </xsl:variable>
2794
-
2795
-
2796
- <fo:table id="{@id}" table-omit-footer-at-break="true">
2680
+
2797
2681
 
2798
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2799
- <xsl:attribute name="{@name}">
2800
- <xsl:value-of select="."/>
2801
- </xsl:attribute>
2802
- </xsl:for-each>
2803
2682
 
2804
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2805
- <xsl:if test="$isNoteOrFnExist = 'true'">
2806
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2807
- </xsl:if>
2808
2683
 
2809
- <xsl:choose>
2810
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2811
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2812
- <fo:table-column column-width="{@width}"/>
2813
- </xsl:for-each>
2814
- </xsl:when>
2815
- <xsl:otherwise>
2816
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2817
- <xsl:choose>
2818
- <xsl:when test=". = 1 or . = 0">
2819
- <fo:table-column column-width="proportional-column-width(2)"/>
2820
- </xsl:when>
2821
- <xsl:otherwise>
2822
- <fo:table-column column-width="proportional-column-width({.})"/>
2823
- </xsl:otherwise>
2824
- </xsl:choose>
2825
- </xsl:for-each>
2826
- </xsl:otherwise>
2827
- </xsl:choose>
2828
2684
 
2829
- <xsl:choose>
2830
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2831
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2832
- </xsl:when>
2833
- <xsl:otherwise>
2834
- <xsl:apply-templates/>
2835
- </xsl:otherwise>
2836
- </xsl:choose>
2837
2685
 
2838
- </fo:table>
2839
-
2840
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2841
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2842
- <xsl:call-template name="insertTableFooterInSeparateTable">
2843
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
2844
- <xsl:with-param name="colwidths" select="$colwidths"/>
2845
- <xsl:with-param name="colgroup" select="$colgroup"/>
2846
- </xsl:call-template>
2847
- </xsl:for-each>
2848
-
2849
- <!-- insert footer as table -->
2850
- <!-- <fo:table>
2851
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2852
- <xsl:attribute name="{@name}">
2853
- <xsl:value-of select="."/>
2854
- </xsl:attribute>
2855
- </xsl:for-each>
2856
2686
 
2857
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
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
+
2725
+ <xsl:choose>
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>
2730
+ </xsl:when>
2731
+ <xsl:otherwise>
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>
2742
+ </xsl:otherwise>
2743
+ </xsl:choose>
2744
+
2858
2745
  <xsl:choose>
2859
- <xsl:when test=". = 1 or . = 0">
2860
- <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"/>
2861
2748
  </xsl:when>
2862
2749
  <xsl:otherwise>
2863
- <fo:table-column column-width="proportional-column-width({.})"/>
2750
+ <xsl:apply-templates/>
2864
2751
  </xsl:otherwise>
2865
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>
2866
2763
  </xsl:for-each>
2867
- </fo:table>-->
2868
-
2869
-
2870
-
2871
-
2872
-
2873
- </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
+
2874
2821
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2875
2822
  <xsl:if test="normalize-space() != ''">
2876
2823
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -3569,7 +3516,9 @@
3569
3516
  </xsl:template><xsl:template match="*[local-name()='dl']">
3570
3517
  <fo:block-container>
3571
3518
 
3572
- <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>
3573
3522
 
3574
3523
 
3575
3524
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -3584,6 +3533,7 @@
3584
3533
  <fo:block-container>
3585
3534
 
3586
3535
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3536
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3587
3537
 
3588
3538
 
3589
3539
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -3708,7 +3658,7 @@
3708
3658
  <xsl:with-param name="table" select="$html-table"/>
3709
3659
  </xsl:call-template>
3710
3660
  </xsl:variable>
3711
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3661
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3712
3662
  <xsl:variable name="maxlength_dt">
3713
3663
  <xsl:call-template name="getMaxLength_dt"/>
3714
3664
  </xsl:variable>
@@ -3737,13 +3687,22 @@
3737
3687
  </xsl:when>
3738
3688
  <xsl:otherwise>
3739
3689
  <xsl:choose>
3690
+ <!-- to set width check most wide chars like `W` -->
3740
3691
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3741
- <fo:table-column column-width="5%"/>
3742
- <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%"/>
3743
3698
  </xsl:when>
3744
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3745
- <fo:table-column column-width="10%"/>
3746
- <fo:table-column column-width="90%"/>
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%"/>
3702
+ </xsl:when>
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%"/>
3747
3706
  </xsl:when>
3748
3707
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3749
3708
  <fo:table-column column-width="60%"/>
@@ -3775,12 +3734,32 @@
3775
3734
  </xsl:otherwise>
3776
3735
  </xsl:choose>
3777
3736
  </xsl:template><xsl:template name="getMaxLength_dt">
3778
- <xsl:for-each select="*[local-name()='dt']">
3779
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3780
- <xsl:if test="position() = 1">
3781
- <xsl:value-of select="string-length(normalize-space(.))"/>
3782
- </xsl:if>
3783
- </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"/>
3784
3763
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3785
3764
  <xsl:param name="key_iso"/>
3786
3765
 
@@ -3935,6 +3914,7 @@
3935
3914
 
3936
3915
 
3937
3916
 
3917
+
3938
3918
 
3939
3919
  </xsl:variable>
3940
3920
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -3948,6 +3928,10 @@
3948
3928
  </xsl:if>
3949
3929
  <xsl:apply-templates/>
3950
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>
3951
3935
  </xsl:template><xsl:template match="*[local-name()='del']">
3952
3936
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3953
3937
  <xsl:apply-templates/>
@@ -4041,6 +4025,10 @@
4041
4025
  <xsl:param name="text" select="."/>
4042
4026
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4043
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​')"/>
4044
4032
  </xsl:template><xsl:template name="add-zero-spaces">
4045
4033
  <xsl:param name="text" select="."/>
4046
4034
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -4301,6 +4289,11 @@
4301
4289
  <!-- replace start and end spaces to non-break space -->
4302
4290
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4303
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"/>
4304
4297
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4305
4298
  <xsl:variable name="target">
4306
4299
  <xsl:choose>
@@ -4322,7 +4315,10 @@
4322
4315
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4323
4316
  <xsl:choose>
4324
4317
  <xsl:when test="normalize-space(.) = ''">
4325
- <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>
4326
4322
  </xsl:when>
4327
4323
  <xsl:otherwise>
4328
4324
  <xsl:apply-templates/>
@@ -4528,7 +4524,7 @@
4528
4524
  </xsl:if> -->
4529
4525
  </fo:inline>
4530
4526
  </xsl:if>
4531
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
4527
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4532
4528
  <fo:block-container id="{@id}">
4533
4529
 
4534
4530
  <fo:block>
@@ -4597,6 +4593,8 @@
4597
4593
  <xsl:variable name="bookmark-title_">
4598
4594
  <xsl:call-template name="getLangVersion">
4599
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"/>
4600
4598
  </xsl:call-template>
4601
4599
  </xsl:variable>
4602
4600
  <xsl:choose>
@@ -4614,13 +4612,34 @@
4614
4612
  </xsl:choose>
4615
4613
  </fo:bookmark-title>
4616
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
+
4617
4625
  </fo:bookmark>
4618
4626
 
4619
4627
  </xsl:for-each>
4620
4628
  </xsl:when>
4621
4629
  <xsl:otherwise>
4622
4630
  <xsl:for-each select="xalan:nodeset($contents)/doc">
4631
+
4623
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
+
4624
4643
  </xsl:for-each>
4625
4644
  </xsl:otherwise>
4626
4645
  </xsl:choose>
@@ -4666,8 +4685,44 @@
4666
4685
 
4667
4686
  </fo:bookmark-tree>
4668
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>
4669
4722
  </xsl:template><xsl:template name="getLangVersion">
4670
4723
  <xsl:param name="lang"/>
4724
+ <xsl:param name="doctype" select="''"/>
4725
+ <xsl:param name="title" select="''"/>
4671
4726
  <xsl:choose>
4672
4727
  <xsl:when test="$lang = 'en'">
4673
4728
 
@@ -4707,6 +4762,12 @@
4707
4762
  <!-- <xsl:text> </xsl:text> -->
4708
4763
  </xsl:template><xsl:template name="getSection">
4709
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
+
4710
4771
  </xsl:template><xsl:template name="getName">
4711
4772
  <xsl:choose>
4712
4773
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -4759,6 +4820,12 @@
4759
4820
  <xsl:copy>
4760
4821
  <xsl:apply-templates mode="contents_item"/>
4761
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="."/>
4762
4829
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4763
4830
  <xsl:text> </xsl:text>
4764
4831
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4784,6 +4851,7 @@
4784
4851
 
4785
4852
 
4786
4853
 
4854
+
4787
4855
 
4788
4856
 
4789
4857
  10
@@ -5153,10 +5221,13 @@
5153
5221
  </xsl:if>
5154
5222
  </xsl:if>
5155
5223
 
5224
+
5156
5225
  <fo:block-container margin-left="0mm">
5157
5226
 
5158
5227
  <fo:block xsl:use-attribute-sets="quote-style">
5159
- <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 -->
5160
5231
  </fo:block>
5161
5232
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5162
5233
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -5310,6 +5381,7 @@
5310
5381
 
5311
5382
 
5312
5383
 
5384
+
5313
5385
 
5314
5386
 
5315
5387
 
@@ -5325,7 +5397,7 @@
5325
5397
  </xsl:if>
5326
5398
 
5327
5399
 
5328
- </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']/* -->
5329
5401
  <fo:block break-after="page"/>
5330
5402
  <fo:block>
5331
5403
  <xsl:call-template name="setId"/>
@@ -5333,7 +5405,8 @@
5333
5405
  </fo:block>
5334
5406
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
5335
5407
  <fo:block>
5336
- <xsl:call-template name="setId"/>
5408
+ <xsl:call-template name="setId"/>
5409
+
5337
5410
 
5338
5411
  <xsl:apply-templates/>
5339
5412
  </fo:block>
@@ -5483,6 +5556,8 @@
5483
5556
  <xsl:value-of select="translate(.,'. ','')"/>
5484
5557
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
5485
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>
5486
5561
  </xsl:template><xsl:template name="convertDate">
5487
5562
  <xsl:param name="date"/>
5488
5563
  <xsl:param name="format" select="'short'"/>
@@ -5507,6 +5582,57 @@
5507
5582
  </xsl:variable>
5508
5583
  <xsl:variable name="result">
5509
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>
5510
5636
  <xsl:when test="$format = 'short' or $day = ''">
5511
5637
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5512
5638
  </xsl:when>
@@ -5522,7 +5648,7 @@
5522
5648
  <xsl:param name="charDelim" select="', '"/>
5523
5649
  <xsl:choose>
5524
5650
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
5525
- <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']">
5526
5652
  <xsl:sort data-type="text" order="ascending"/>
5527
5653
  <xsl:call-template name="insertKeyword">
5528
5654
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -5531,7 +5657,7 @@
5531
5657
  </xsl:for-each>
5532
5658
  </xsl:when>
5533
5659
  <xsl:otherwise>
5534
- <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']">
5535
5661
  <xsl:call-template name="insertKeyword">
5536
5662
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
5537
5663
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -5548,6 +5674,9 @@
5548
5674
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5549
5675
  </xsl:choose>
5550
5676
  </xsl:template><xsl:template name="addPDFUAmeta">
5677
+ <xsl:variable name="lang">
5678
+ <xsl:call-template name="getLang"/>
5679
+ </xsl:variable>
5551
5680
  <fo:declarations>
5552
5681
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5553
5682
  <pdf:dictionary type="normal" key="ViewerPreferences">
@@ -5560,13 +5689,16 @@
5560
5689
  <!-- Dublin Core properties go here -->
5561
5690
  <dc:title>
5562
5691
  <xsl:variable name="title">
5563
-
5564
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
5565
-
5566
-
5567
-
5568
-
5569
-
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>
5570
5702
  </xsl:variable>
5571
5703
  <xsl:choose>
5572
5704
  <xsl:when test="normalize-space($title) != ''">
@@ -5578,22 +5710,21 @@
5578
5710
  </xsl:choose>
5579
5711
  </dc:title>
5580
5712
  <dc:creator>
5581
-
5582
-
5583
-
5584
- <xsl:for-each select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5585
- <xsl:value-of select="*[local-name() = 'person']/*[local-name() = 'name']/*[local-name() = 'completename']"/>
5586
- <xsl:if test="position() != last()">; </xsl:if>
5587
- </xsl:for-each>
5588
-
5589
- </dc:creator>
5590
- <dc:description>
5591
- <xsl:variable name="abstract">
5713
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5714
+
5592
5715
 
5593
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>
5594
5721
 
5595
- <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">
5596
5726
 
5727
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5597
5728
 
5598
5729
 
5599
5730
  </xsl:variable>
@@ -5706,6 +5837,7 @@
5706
5837
 
5707
5838
 
5708
5839
 
5840
+
5709
5841
  </xsl:variable>
5710
5842
  <xsl:if test="$documentNS != $XSLNS">
5711
5843
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -5765,6 +5897,11 @@
5765
5897
  <xsl:call-template name="getLang"/>
5766
5898
  </xsl:variable>
5767
5899
 
5768
- <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>
5769
5906
 
5770
5907
  </xsl:template></xsl:stylesheet>