metanorma-iso 1.5.14 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +17 -0
  3. data/.rubocop.yml +0 -4
  4. data/lib/asciidoctor/iso/base.rb +13 -13
  5. data/lib/asciidoctor/iso/basicdoc.rng +20 -3
  6. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  7. data/lib/asciidoctor/iso/front.rb +5 -5
  8. data/lib/asciidoctor/iso/isodoc.rng +118 -4
  9. data/lib/asciidoctor/iso/isostandard-amd.rng +11 -4
  10. data/lib/asciidoctor/iso/isostandard.rng +22 -10
  11. data/lib/asciidoctor/iso/validate.rb +78 -0
  12. data/lib/asciidoctor/iso/validate_section.rb +12 -9
  13. data/lib/isodoc/iso/html/header.html +12 -12
  14. data/lib/isodoc/iso/html/html_iso_intro.html +1 -1
  15. data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
  16. data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
  17. data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
  18. data/lib/isodoc/iso/html_convert.rb +2 -2
  19. data/lib/isodoc/iso/i18n-en.yaml +2 -0
  20. data/lib/isodoc/iso/i18n-fr.yaml +1 -1
  21. data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -1
  22. data/lib/isodoc/iso/iso.amendment.xsl +451 -208
  23. data/lib/isodoc/iso/iso.international-standard.xsl +451 -208
  24. data/lib/isodoc/iso/sections.rb +1 -1
  25. data/lib/isodoc/iso/word_convert.rb +2 -2
  26. data/lib/isodoc/iso/xref.rb +28 -12
  27. data/lib/metanorma/iso/processor.rb +11 -0
  28. data/lib/metanorma/iso/version.rb +1 -1
  29. data/metanorma-iso.gemspec +2 -2
  30. data/spec/asciidoctor-iso/amd_spec.rb +575 -573
  31. data/spec/asciidoctor-iso/base_spec.rb +449 -458
  32. data/spec/asciidoctor-iso/blocks_spec.rb +333 -288
  33. data/spec/asciidoctor-iso/cleanup_spec.rb +814 -699
  34. data/spec/asciidoctor-iso/inline_spec.rb +116 -91
  35. data/spec/asciidoctor-iso/lists_spec.rb +128 -121
  36. data/spec/asciidoctor-iso/refs_spec.rb +308 -250
  37. data/spec/asciidoctor-iso/section_spec.rb +273 -242
  38. data/spec/asciidoctor-iso/table_spec.rb +258 -242
  39. data/spec/asciidoctor-iso/validate_spec.rb +1223 -919
  40. data/spec/isodoc/amd_spec.rb +967 -946
  41. data/spec/isodoc/blocks_spec.rb +530 -507
  42. data/spec/isodoc/i18n_spec.rb +953 -911
  43. data/spec/isodoc/inline_spec.rb +355 -293
  44. data/spec/isodoc/iso_spec.rb +340 -316
  45. data/spec/isodoc/metadata_spec.rb +392 -382
  46. data/spec/isodoc/postproc_spec.rb +834 -656
  47. data/spec/isodoc/ref_spec.rb +374 -331
  48. data/spec/isodoc/section_spec.rb +608 -525
  49. data/spec/isodoc/table_spec.rb +472 -411
  50. data/spec/isodoc/terms_spec.rb +209 -185
  51. data/spec/isodoc/xref_spec.rb +1370 -1236
  52. data/spec/metanorma/processor_spec.rb +28 -26
  53. data/spec/spec_helper.rb +184 -189
  54. metadata +7 -10
  55. data/.rubocop.ribose.yml +0 -66
  56. data/lib/metanorma/iso/fonts_manifest.yaml +0 -6
  57. data/spec/assets/xref_error.adoc +0 -7
@@ -1024,20 +1024,20 @@
1024
1024
  <fo:block-container font-weight="bold">
1025
1025
 
1026
1026
  <fo:block text-align-last="justify" font-size="16pt" margin-top="10pt" margin-bottom="18pt">
1027
- <xsl:variable name="title-toc">
1028
- <xsl:call-template name="getTitle">
1029
- <xsl:with-param name="name" select="'title-toc'"/>
1027
+ <fo:inline font-size="16pt" font-weight="bold">
1028
+ <!-- Contents -->
1029
+ <xsl:call-template name="getLocalizedString">
1030
+ <xsl:with-param name="key">table_of_contents</xsl:with-param>
1030
1031
  </xsl:call-template>
1031
- </xsl:variable>
1032
- <fo:inline font-size="16pt" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:inline>
1032
+ </fo:inline>
1033
1033
  <fo:inline keep-together.within-line="always">
1034
1034
  <fo:leader leader-pattern="space"/>
1035
- <xsl:variable name="title-page">
1036
- <xsl:call-template name="getTitle">
1037
- <xsl:with-param name="name" select="'title-page'"/>
1038
- </xsl:call-template>
1039
- </xsl:variable>
1040
- <fo:inline font-weight="normal" font-size="10pt"><xsl:value-of select="$title-page"/></fo:inline>
1035
+ <fo:inline font-weight="normal" font-size="10pt">
1036
+ <!-- Page -->
1037
+ <xsl:call-template name="getLocalizedString">
1038
+ <xsl:with-param name="key">locality.page</xsl:with-param>
1039
+ </xsl:call-template>
1040
+ </fo:inline>
1041
1041
  </fo:inline>
1042
1042
  </fo:block>
1043
1043
 
@@ -1363,13 +1363,22 @@
1363
1363
  <xsl:otherwise> <!-- for ordered lists -->
1364
1364
  <xsl:choose>
1365
1365
  <xsl:when test="../@type = 'arabic'">
1366
- <xsl:number format="a)" lang="en"/>
1366
+ <xsl:number format="1." lang="en"/>
1367
1367
  </xsl:when>
1368
1368
  <xsl:when test="../@type = 'alphabet'">
1369
1369
  <xsl:number format="a)" lang="en"/>
1370
1370
  </xsl:when>
1371
+ <xsl:when test="../@type = 'alphabet_upper'">
1372
+ <xsl:number format="A." lang="en"/>
1373
+ </xsl:when>
1374
+ <xsl:when test="../@type = 'roman'">
1375
+ <xsl:number format="i)"/>
1376
+ </xsl:when>
1377
+ <xsl:when test="../@type = 'roman_upper'">
1378
+ <xsl:number format="I."/>
1379
+ </xsl:when>
1371
1380
  <xsl:otherwise>
1372
- <xsl:number format="1."/>
1381
+ <xsl:number format="a)"/>
1373
1382
  </xsl:otherwise>
1374
1383
  </xsl:choose>
1375
1384
  </xsl:otherwise>
@@ -2513,6 +2522,7 @@
2513
2522
 
2514
2523
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2515
2524
 
2525
+
2516
2526
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2517
2527
 
2518
2528
 
@@ -2524,6 +2534,7 @@
2524
2534
 
2525
2535
 
2526
2536
 
2537
+
2527
2538
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
2528
2539
 
2529
2540
 
@@ -2660,201 +2671,240 @@
2660
2671
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2661
2672
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2662
2673
  <xsl:call-template name="add-zero-spaces-java"/>
2663
- </xsl:template><xsl:template match="*[local-name()='table']">
2674
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2664
2675
 
2665
- <xsl:variable name="simple-table">
2666
- <xsl:call-template name="getSimpleTable"/>
2667
- </xsl:variable>
2676
+ <xsl:variable name="table">
2668
2677
 
2669
-
2670
-
2671
-
2672
-
2673
- <!-- <xsl:if test="$namespace = 'bipm'">
2674
- <fo:block>&#xA0;</fo:block>
2675
- </xsl:if> -->
2676
-
2677
- <!-- $namespace = 'iso' or -->
2678
-
2679
-
2678
+ <xsl:variable name="simple-table">
2679
+ <xsl:call-template name="getSimpleTable"/>
2680
+ </xsl:variable>
2680
2681
 
2681
2682
 
2682
-
2683
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2684
-
2685
- <!-- <xsl:variable name="cols-count">
2686
- <xsl:choose>
2687
- <xsl:when test="*[local-name()='thead']">
2688
- <xsl:call-template name="calculate-columns-numbers">
2689
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2690
- </xsl:call-template>
2691
- </xsl:when>
2692
- <xsl:otherwise>
2693
- <xsl:call-template name="calculate-columns-numbers">
2694
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2695
- </xsl:call-template>
2696
- </xsl:otherwise>
2697
- </xsl:choose>
2698
- </xsl:variable> -->
2699
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2700
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2701
-
2702
-
2703
-
2704
- <xsl:variable name="colwidths">
2705
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2706
- <xsl:call-template name="calculate-column-widths">
2707
- <xsl:with-param name="cols-count" select="$cols-count"/>
2708
- <xsl:with-param name="table" select="$simple-table"/>
2709
- </xsl:call-template>
2710
- </xsl:if>
2711
- </xsl:variable>
2712
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2713
-
2714
- <!-- <xsl:variable name="colwidths2">
2715
- <xsl:call-template name="calculate-column-widths">
2716
- <xsl:with-param name="cols-count" select="$cols-count"/>
2717
- </xsl:call-template>
2718
- </xsl:variable> -->
2719
-
2720
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2721
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
2722
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2723
-
2724
- <xsl:variable name="margin-left">
2725
- <xsl:choose>
2726
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2727
- <xsl:otherwise>0</xsl:otherwise>
2728
- </xsl:choose>
2729
- </xsl:variable>
2730
-
2731
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2732
2683
 
2733
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2734
2684
 
2735
2685
 
2736
-
2737
-
2738
-
2686
+ <!-- <xsl:if test="$namespace = 'bipm'">
2687
+ <fo:block>&#xA0;</fo:block>
2688
+ </xsl:if> -->
2739
2689
 
2690
+ <!-- $namespace = 'iso' or -->
2740
2691
 
2741
-
2692
+
2693
+
2694
+
2695
+
2696
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2742
2697
 
2698
+ <!-- <xsl:variable name="cols-count">
2699
+ <xsl:choose>
2700
+ <xsl:when test="*[local-name()='thead']">
2701
+ <xsl:call-template name="calculate-columns-numbers">
2702
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2703
+ </xsl:call-template>
2704
+ </xsl:when>
2705
+ <xsl:otherwise>
2706
+ <xsl:call-template name="calculate-columns-numbers">
2707
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2708
+ </xsl:call-template>
2709
+ </xsl:otherwise>
2710
+ </xsl:choose>
2711
+ </xsl:variable> -->
2712
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2713
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2743
2714
 
2744
- <xsl:attribute name="margin-top">12pt</xsl:attribute>
2745
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2746
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2747
- <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2748
2715
 
2749
2716
 
2717
+ <xsl:variable name="colwidths">
2718
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2719
+ <xsl:call-template name="calculate-column-widths">
2720
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2721
+ <xsl:with-param name="table" select="$simple-table"/>
2722
+ </xsl:call-template>
2723
+ </xsl:if>
2724
+ </xsl:variable>
2725
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2750
2726
 
2727
+ <!-- <xsl:variable name="colwidths2">
2728
+ <xsl:call-template name="calculate-column-widths">
2729
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2730
+ </xsl:call-template>
2731
+ </xsl:variable> -->
2751
2732
 
2733
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2734
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
2735
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2752
2736
 
2737
+ <xsl:variable name="margin-left">
2738
+ <xsl:choose>
2739
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2740
+ <xsl:otherwise>0</xsl:otherwise>
2741
+ </xsl:choose>
2742
+ </xsl:variable>
2753
2743
 
2754
- <xsl:variable name="table_attributes">
2755
- <attribute name="table-layout">fixed</attribute>
2756
- <attribute name="width">100%</attribute>
2757
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2758
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2744
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2759
2745
 
2760
- <attribute name="border">1.5pt solid black</attribute>
2761
- <xsl:if test="*[local-name()='thead']">
2762
- <attribute name="border-top">1pt solid black</attribute>
2763
- </xsl:if>
2746
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2764
2747
 
2765
2748
 
2749
+
2750
+
2751
+
2752
+
2766
2753
 
2754
+
2767
2755
 
2768
- <attribute name="margin-left">0mm</attribute>
2769
- <attribute name="margin-right">0mm</attribute>
2770
2756
 
2771
-
2772
-
2773
-
2757
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
2758
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2759
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2760
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2774
2761
 
2775
-
2776
2762
 
2777
- </xsl:variable>
2778
-
2779
-
2780
- <fo:table id="{@id}" table-omit-footer-at-break="true">
2781
2763
 
2782
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2783
- <xsl:attribute name="{@name}">
2784
- <xsl:value-of select="."/>
2785
- </xsl:attribute>
2786
- </xsl:for-each>
2787
2764
 
2788
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2789
- <xsl:if test="$isNoteOrFnExist = 'true'">
2790
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2791
- </xsl:if>
2792
2765
 
2793
- <xsl:choose>
2794
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2795
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2796
- <fo:table-column column-width="{@width}"/>
2797
- </xsl:for-each>
2798
- </xsl:when>
2799
- <xsl:otherwise>
2800
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2801
- <xsl:choose>
2802
- <xsl:when test=". = 1 or . = 0">
2803
- <fo:table-column column-width="proportional-column-width(2)"/>
2804
- </xsl:when>
2805
- <xsl:otherwise>
2806
- <fo:table-column column-width="proportional-column-width({.})"/>
2807
- </xsl:otherwise>
2808
- </xsl:choose>
2809
- </xsl:for-each>
2810
- </xsl:otherwise>
2811
- </xsl:choose>
2766
+ <xsl:variable name="table_width">
2767
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2768
+ 100%
2769
+
2770
+
2771
+ </xsl:variable>
2812
2772
 
2813
- <xsl:choose>
2814
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2815
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2816
- </xsl:when>
2817
- <xsl:otherwise>
2818
- <xsl:apply-templates/>
2819
- </xsl:otherwise>
2820
- </xsl:choose>
2773
+ <xsl:variable name="table_attributes">
2774
+ <attribute name="table-layout">fixed</attribute>
2775
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
2776
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2777
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2778
+
2779
+ <attribute name="border">1.5pt solid black</attribute>
2780
+ <xsl:if test="*[local-name()='thead']">
2781
+ <attribute name="border-top">1pt solid black</attribute>
2782
+ </xsl:if>
2783
+
2784
+
2785
+
2786
+
2787
+ <attribute name="margin-left">0mm</attribute>
2788
+ <attribute name="margin-right">0mm</attribute>
2789
+
2790
+
2791
+
2792
+
2793
+
2794
+
2795
+
2796
+ </xsl:variable>
2821
2797
 
2822
- </fo:table>
2823
-
2824
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2825
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2826
- <xsl:call-template name="insertTableFooterInSeparateTable">
2827
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
2828
- <xsl:with-param name="colwidths" select="$colwidths"/>
2829
- <xsl:with-param name="colgroup" select="$colgroup"/>
2830
- </xsl:call-template>
2831
- </xsl:for-each>
2832
-
2833
- <!-- insert footer as table -->
2834
- <!-- <fo:table>
2835
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2836
- <xsl:attribute name="{@name}">
2837
- <xsl:value-of select="."/>
2838
- </xsl:attribute>
2839
- </xsl:for-each>
2840
2798
 
2841
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2799
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
2800
+
2801
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2802
+ <xsl:attribute name="{@name}">
2803
+ <xsl:value-of select="."/>
2804
+ </xsl:attribute>
2805
+ </xsl:for-each>
2806
+
2807
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2808
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2809
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2810
+ </xsl:if>
2811
+
2842
2812
  <xsl:choose>
2843
- <xsl:when test=". = 1 or . = 0">
2844
- <fo:table-column column-width="proportional-column-width(2)"/>
2813
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2814
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2815
+ <fo:table-column column-width="{@width}"/>
2816
+ </xsl:for-each>
2845
2817
  </xsl:when>
2846
2818
  <xsl:otherwise>
2847
- <fo:table-column column-width="proportional-column-width({.})"/>
2819
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2820
+ <xsl:choose>
2821
+ <xsl:when test=". = 1 or . = 0">
2822
+ <fo:table-column column-width="proportional-column-width(2)"/>
2823
+ </xsl:when>
2824
+ <xsl:otherwise>
2825
+ <fo:table-column column-width="proportional-column-width({.})"/>
2826
+ </xsl:otherwise>
2827
+ </xsl:choose>
2828
+ </xsl:for-each>
2848
2829
  </xsl:otherwise>
2849
2830
  </xsl:choose>
2831
+
2832
+ <xsl:choose>
2833
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2834
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2835
+ </xsl:when>
2836
+ <xsl:otherwise>
2837
+ <xsl:apply-templates/>
2838
+ </xsl:otherwise>
2839
+ </xsl:choose>
2840
+
2841
+ </fo:table>
2842
+
2843
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2844
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2845
+ <xsl:call-template name="insertTableFooterInSeparateTable">
2846
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
2847
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2848
+ <xsl:with-param name="colgroup" select="$colgroup"/>
2849
+ </xsl:call-template>
2850
2850
  </xsl:for-each>
2851
- </fo:table>-->
2852
-
2853
-
2854
-
2855
-
2856
-
2857
- </fo:block-container>
2851
+
2852
+ <!-- insert footer as table -->
2853
+ <!-- <fo:table>
2854
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2855
+ <xsl:attribute name="{@name}">
2856
+ <xsl:value-of select="."/>
2857
+ </xsl:attribute>
2858
+ </xsl:for-each>
2859
+
2860
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2861
+ <xsl:choose>
2862
+ <xsl:when test=". = 1 or . = 0">
2863
+ <fo:table-column column-width="proportional-column-width(2)"/>
2864
+ </xsl:when>
2865
+ <xsl:otherwise>
2866
+ <fo:table-column column-width="proportional-column-width({.})"/>
2867
+ </xsl:otherwise>
2868
+ </xsl:choose>
2869
+ </xsl:for-each>
2870
+ </fo:table>-->
2871
+
2872
+
2873
+
2874
+
2875
+
2876
+ </fo:block-container>
2877
+ </xsl:variable>
2878
+
2879
+
2880
+
2881
+ <xsl:choose>
2882
+ <xsl:when test="@width">
2883
+
2884
+ <!-- centered table when table name is centered (see table-name-style) -->
2885
+
2886
+ <fo:table table-layout="fixed" width="100%">
2887
+ <fo:table-column column-width="proportional-column-width(1)"/>
2888
+ <fo:table-column column-width="{@width}"/>
2889
+ <fo:table-column column-width="proportional-column-width(1)"/>
2890
+ <fo:table-body>
2891
+ <fo:table-row>
2892
+ <fo:table-cell column-number="2">
2893
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
2894
+ </fo:table-cell>
2895
+ </fo:table-row>
2896
+ </fo:table-body>
2897
+ </fo:table>
2898
+
2899
+
2900
+
2901
+
2902
+ </xsl:when>
2903
+ <xsl:otherwise>
2904
+ <xsl:copy-of select="$table"/>
2905
+ </xsl:otherwise>
2906
+ </xsl:choose>
2907
+
2858
2908
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2859
2909
  <xsl:if test="normalize-space() != ''">
2860
2910
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -3613,7 +3663,9 @@
3613
3663
  </xsl:template><xsl:template match="*[local-name()='dl']">
3614
3664
  <fo:block-container>
3615
3665
 
3616
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
3666
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3667
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3668
+ </xsl:if>
3617
3669
 
3618
3670
 
3619
3671
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -3628,6 +3680,7 @@
3628
3680
  <fo:block-container>
3629
3681
 
3630
3682
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3683
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3631
3684
 
3632
3685
 
3633
3686
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -3758,7 +3811,7 @@
3758
3811
  <xsl:with-param name="table" select="$html-table"/>
3759
3812
  </xsl:call-template>
3760
3813
  </xsl:variable>
3761
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3814
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3762
3815
  <xsl:variable name="maxlength_dt">
3763
3816
  <xsl:call-template name="getMaxLength_dt"/>
3764
3817
  </xsl:variable>
@@ -3787,13 +3840,22 @@
3787
3840
  </xsl:when>
3788
3841
  <xsl:otherwise>
3789
3842
  <xsl:choose>
3843
+ <!-- to set width check most wide chars like `W` -->
3790
3844
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3791
- <fo:table-column column-width="5%"/>
3792
- <fo:table-column column-width="95%"/>
3845
+ <fo:table-column column-width="7%"/>
3846
+ <fo:table-column column-width="93%"/>
3793
3847
  </xsl:when>
3794
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3795
- <fo:table-column column-width="10%"/>
3796
- <fo:table-column column-width="90%"/>
3848
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
3849
+ <fo:table-column column-width="15%"/>
3850
+ <fo:table-column column-width="85%"/>
3851
+ </xsl:when>
3852
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
3853
+ <fo:table-column column-width="20%"/>
3854
+ <fo:table-column column-width="80%"/>
3855
+ </xsl:when>
3856
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
3857
+ <fo:table-column column-width="25%"/>
3858
+ <fo:table-column column-width="75%"/>
3797
3859
  </xsl:when>
3798
3860
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3799
3861
  <fo:table-column column-width="60%"/>
@@ -3825,12 +3887,32 @@
3825
3887
  </xsl:otherwise>
3826
3888
  </xsl:choose>
3827
3889
  </xsl:template><xsl:template name="getMaxLength_dt">
3828
- <xsl:for-each select="*[local-name()='dt']">
3829
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3830
- <xsl:if test="position() = 1">
3831
- <xsl:value-of select="string-length(normalize-space(.))"/>
3832
- </xsl:if>
3833
- </xsl:for-each>
3890
+ <xsl:variable name="lengths">
3891
+ <xsl:for-each select="*[local-name()='dt']">
3892
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
3893
+ <xsl:variable name="attributes">
3894
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
3895
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
3896
+ </xsl:variable>
3897
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
3898
+ </xsl:for-each>
3899
+ </xsl:variable>
3900
+ <xsl:variable name="maxLength">
3901
+ <!-- <xsl:for-each select="*[local-name()='dt']">
3902
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3903
+ <xsl:if test="position() = 1">
3904
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3905
+ </xsl:if>
3906
+ </xsl:for-each> -->
3907
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
3908
+ <xsl:sort select="." data-type="number" order="descending"/>
3909
+ <xsl:if test="position() = 1">
3910
+ <xsl:value-of select="."/>
3911
+ </xsl:if>
3912
+ </xsl:for-each>
3913
+ </xsl:variable>
3914
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
3915
+ <xsl:value-of select="$maxLength"/>
3834
3916
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3835
3917
  <xsl:param name="key_iso"/>
3836
3918
 
@@ -3971,6 +4053,7 @@
3971
4053
 
3972
4054
 
3973
4055
 
4056
+
3974
4057
 
3975
4058
  </xsl:variable>
3976
4059
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -3984,6 +4067,10 @@
3984
4067
  </xsl:if>
3985
4068
  <xsl:apply-templates/>
3986
4069
  </fo:inline>
4070
+ </xsl:template><xsl:template match="*[local-name()='underline']">
4071
+ <fo:inline text-decoration="underline">
4072
+ <xsl:apply-templates/>
4073
+ </fo:inline>
3987
4074
  </xsl:template><xsl:template match="*[local-name()='del']">
3988
4075
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3989
4076
  <xsl:apply-templates/>
@@ -4077,6 +4164,10 @@
4077
4164
  <xsl:param name="text" select="."/>
4078
4165
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4079
4166
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4167
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
4168
+ <xsl:param name="text" select="."/>
4169
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4170
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4080
4171
  </xsl:template><xsl:template name="add-zero-spaces">
4081
4172
  <xsl:param name="text" select="."/>
4082
4173
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -4337,6 +4428,11 @@
4337
4428
  <!-- replace start and end spaces to non-break space -->
4338
4429
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4339
4430
  </xsl:copy>
4431
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
4432
+ <xsl:copy>
4433
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
4434
+ </xsl:copy>
4435
+ <mathml:mspace width="0.5ex"/>
4340
4436
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4341
4437
  <xsl:variable name="target">
4342
4438
  <xsl:choose>
@@ -4358,7 +4454,10 @@
4358
4454
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4359
4455
  <xsl:choose>
4360
4456
  <xsl:when test="normalize-space(.) = ''">
4361
- <xsl:value-of select="$target"/>
4457
+ <!-- <xsl:value-of select="$target"/> -->
4458
+ <xsl:call-template name="add-zero-spaces-link-java">
4459
+ <xsl:with-param name="text" select="$target"/>
4460
+ </xsl:call-template>
4362
4461
  </xsl:when>
4363
4462
  <xsl:otherwise>
4364
4463
  <xsl:apply-templates/>
@@ -4562,7 +4661,7 @@
4562
4661
  </xsl:if> -->
4563
4662
  </fo:inline>
4564
4663
  </xsl:if>
4565
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
4664
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4566
4665
  <fo:block-container id="{@id}">
4567
4666
 
4568
4667
  <fo:block>
@@ -4631,6 +4730,8 @@
4631
4730
  <xsl:variable name="bookmark-title_">
4632
4731
  <xsl:call-template name="getLangVersion">
4633
4732
  <xsl:with-param name="lang" select="@lang"/>
4733
+ <xsl:with-param name="doctype" select="@doctype"/>
4734
+ <xsl:with-param name="title" select="@title-part"/>
4634
4735
  </xsl:call-template>
4635
4736
  </xsl:variable>
4636
4737
  <xsl:choose>
@@ -4648,13 +4749,34 @@
4648
4749
  </xsl:choose>
4649
4750
  </fo:bookmark-title>
4650
4751
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4752
+
4753
+ <xsl:call-template name="insertFigureBookmarks">
4754
+ <xsl:with-param name="contents" select="contents"/>
4755
+ </xsl:call-template>
4756
+
4757
+ <xsl:call-template name="insertTableBookmarks">
4758
+ <xsl:with-param name="contents" select="contents"/>
4759
+ <xsl:with-param name="lang" select="@lang"/>
4760
+ </xsl:call-template>
4761
+
4651
4762
  </fo:bookmark>
4652
4763
 
4653
4764
  </xsl:for-each>
4654
4765
  </xsl:when>
4655
4766
  <xsl:otherwise>
4656
4767
  <xsl:for-each select="xalan:nodeset($contents)/doc">
4768
+
4657
4769
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4770
+
4771
+ <xsl:call-template name="insertFigureBookmarks">
4772
+ <xsl:with-param name="contents" select="contents"/>
4773
+ </xsl:call-template>
4774
+
4775
+ <xsl:call-template name="insertTableBookmarks">
4776
+ <xsl:with-param name="contents" select="contents"/>
4777
+ <xsl:with-param name="lang" select="@lang"/>
4778
+ </xsl:call-template>
4779
+
4658
4780
  </xsl:for-each>
4659
4781
  </xsl:otherwise>
4660
4782
  </xsl:choose>
@@ -4673,8 +4795,44 @@
4673
4795
 
4674
4796
  </fo:bookmark-tree>
4675
4797
  </xsl:if>
4798
+ </xsl:template><xsl:template name="insertFigureBookmarks">
4799
+ <xsl:param name="contents"/>
4800
+ <xsl:if test="xalan:nodeset($contents)/figure">
4801
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
4802
+ <fo:bookmark-title>Figures</fo:bookmark-title>
4803
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
4804
+ <fo:bookmark internal-destination="{@id}">
4805
+ <fo:bookmark-title>
4806
+ <xsl:value-of select="normalize-space(title)"/>
4807
+ </fo:bookmark-title>
4808
+ </fo:bookmark>
4809
+ </xsl:for-each>
4810
+ </fo:bookmark>
4811
+ </xsl:if>
4812
+ </xsl:template><xsl:template name="insertTableBookmarks">
4813
+ <xsl:param name="contents"/>
4814
+ <xsl:param name="lang"/>
4815
+ <xsl:if test="xalan:nodeset($contents)/table">
4816
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
4817
+ <fo:bookmark-title>
4818
+ <xsl:choose>
4819
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
4820
+ <xsl:otherwise>Tables</xsl:otherwise>
4821
+ </xsl:choose>
4822
+ </fo:bookmark-title>
4823
+ <xsl:for-each select="xalan:nodeset($contents)/table">
4824
+ <fo:bookmark internal-destination="{@id}">
4825
+ <fo:bookmark-title>
4826
+ <xsl:value-of select="normalize-space(title)"/>
4827
+ </fo:bookmark-title>
4828
+ </fo:bookmark>
4829
+ </xsl:for-each>
4830
+ </fo:bookmark>
4831
+ </xsl:if>
4676
4832
  </xsl:template><xsl:template name="getLangVersion">
4677
4833
  <xsl:param name="lang"/>
4834
+ <xsl:param name="doctype" select="''"/>
4835
+ <xsl:param name="title" select="''"/>
4678
4836
  <xsl:choose>
4679
4837
  <xsl:when test="$lang = 'en'">
4680
4838
 
@@ -4710,6 +4868,12 @@
4710
4868
  <!-- <xsl:text> </xsl:text> -->
4711
4869
  </xsl:template><xsl:template name="getSection">
4712
4870
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4871
+ <!--
4872
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
4873
+ <xsl:value-of select="."/>
4874
+ </xsl:for-each>
4875
+ -->
4876
+
4713
4877
  </xsl:template><xsl:template name="getName">
4714
4878
  <xsl:choose>
4715
4879
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -4762,6 +4926,12 @@
4762
4926
  <xsl:copy>
4763
4927
  <xsl:apply-templates mode="contents_item"/>
4764
4928
  </xsl:copy>
4929
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
4930
+ <xsl:copy>
4931
+ <xsl:apply-templates mode="contents_item"/>
4932
+ </xsl:copy>
4933
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
4934
+ <xsl:copy-of select="."/>
4765
4935
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4766
4936
  <xsl:text> </xsl:text>
4767
4937
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4787,6 +4957,7 @@
4787
4957
 
4788
4958
  9
4789
4959
 
4960
+
4790
4961
 
4791
4962
 
4792
4963
 
@@ -5167,10 +5338,13 @@
5167
5338
  </xsl:if>
5168
5339
  </xsl:if>
5169
5340
 
5341
+
5170
5342
  <fo:block-container margin-left="0mm">
5171
5343
 
5172
5344
  <fo:block xsl:use-attribute-sets="quote-style">
5173
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
5345
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
5346
+
5347
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5174
5348
  </fo:block>
5175
5349
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5176
5350
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -5326,6 +5500,7 @@
5326
5500
  <xsl:attribute name="space-before">18pt</xsl:attribute>
5327
5501
  </xsl:if>
5328
5502
 
5503
+
5329
5504
 
5330
5505
 
5331
5506
 
@@ -5337,7 +5512,7 @@
5337
5512
 
5338
5513
 
5339
5514
 
5340
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
5515
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
5341
5516
  <fo:block break-after="page"/>
5342
5517
  <fo:block>
5343
5518
  <xsl:call-template name="setId"/>
@@ -5345,7 +5520,8 @@
5345
5520
  </fo:block>
5346
5521
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
5347
5522
  <fo:block>
5348
- <xsl:call-template name="setId"/>
5523
+ <xsl:call-template name="setId"/>
5524
+
5349
5525
 
5350
5526
  <xsl:apply-templates/>
5351
5527
  </fo:block>
@@ -5491,6 +5667,8 @@
5491
5667
  <xsl:value-of select="translate(.,'. ','')"/>
5492
5668
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
5493
5669
  <xsl:value-of select="substring(.,1,1)"/>
5670
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5671
+ <fo:inline><xsl:apply-templates/></fo:inline>
5494
5672
  </xsl:template><xsl:template name="convertDate">
5495
5673
  <xsl:param name="date"/>
5496
5674
  <xsl:param name="format" select="'short'"/>
@@ -5515,6 +5693,57 @@
5515
5693
  </xsl:variable>
5516
5694
  <xsl:variable name="result">
5517
5695
  <xsl:choose>
5696
+ <xsl:when test="$format = 'ddMMyyyy'">
5697
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5698
+ <xsl:text> </xsl:text>
5699
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5700
+ </xsl:when>
5701
+ <xsl:when test="$format = 'ddMM'">
5702
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5703
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5704
+ </xsl:when>
5705
+ <xsl:when test="$format = 'short' or $day = ''">
5706
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5707
+ </xsl:when>
5708
+ <xsl:otherwise>
5709
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
5710
+ </xsl:otherwise>
5711
+ </xsl:choose>
5712
+ </xsl:variable>
5713
+ <xsl:value-of select="$result"/>
5714
+ </xsl:template><xsl:template name="convertDateLocalized">
5715
+ <xsl:param name="date"/>
5716
+ <xsl:param name="format" select="'short'"/>
5717
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
5718
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
5719
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
5720
+ <xsl:variable name="monthStr">
5721
+ <xsl:choose>
5722
+ <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>
5723
+ <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>
5724
+ <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>
5725
+ <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>
5726
+ <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>
5727
+ <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>
5728
+ <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>
5729
+ <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>
5730
+ <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>
5731
+ <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>
5732
+ <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>
5733
+ <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>
5734
+ </xsl:choose>
5735
+ </xsl:variable>
5736
+ <xsl:variable name="result">
5737
+ <xsl:choose>
5738
+ <xsl:when test="$format = 'ddMMyyyy'">
5739
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5740
+ <xsl:text> </xsl:text>
5741
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5742
+ </xsl:when>
5743
+ <xsl:when test="$format = 'ddMM'">
5744
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5745
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5746
+ </xsl:when>
5518
5747
  <xsl:when test="$format = 'short' or $day = ''">
5519
5748
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5520
5749
  </xsl:when>
@@ -5530,7 +5759,7 @@
5530
5759
  <xsl:param name="charDelim" select="', '"/>
5531
5760
  <xsl:choose>
5532
5761
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
5533
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5762
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5534
5763
  <xsl:sort data-type="text" order="ascending"/>
5535
5764
  <xsl:call-template name="insertKeyword">
5536
5765
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -5539,7 +5768,7 @@
5539
5768
  </xsl:for-each>
5540
5769
  </xsl:when>
5541
5770
  <xsl:otherwise>
5542
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5771
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5543
5772
  <xsl:call-template name="insertKeyword">
5544
5773
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
5545
5774
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -5556,6 +5785,9 @@
5556
5785
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5557
5786
  </xsl:choose>
5558
5787
  </xsl:template><xsl:template name="addPDFUAmeta">
5788
+ <xsl:variable name="lang">
5789
+ <xsl:call-template name="getLang"/>
5790
+ </xsl:variable>
5559
5791
  <fo:declarations>
5560
5792
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5561
5793
  <pdf:dictionary type="normal" key="ViewerPreferences">
@@ -5568,13 +5800,16 @@
5568
5800
  <!-- Dublin Core properties go here -->
5569
5801
  <dc:title>
5570
5802
  <xsl:variable name="title">
5571
-
5572
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
5573
-
5574
-
5575
-
5576
-
5577
-
5803
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5804
+
5805
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5806
+
5807
+
5808
+
5809
+
5810
+
5811
+
5812
+ </xsl:for-each>
5578
5813
  </xsl:variable>
5579
5814
  <xsl:choose>
5580
5815
  <xsl:when test="normalize-space($title) != ''">
@@ -5586,19 +5821,21 @@
5586
5821
  </xsl:choose>
5587
5822
  </dc:title>
5588
5823
  <dc:creator>
5589
-
5590
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
5591
-
5592
-
5593
-
5594
- </dc:creator>
5595
- <dc:description>
5596
- <xsl:variable name="abstract">
5824
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5825
+
5826
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5827
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
5828
+ <xsl:if test="position() != last()">; </xsl:if>
5829
+ </xsl:for-each>
5597
5830
 
5598
- <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
5599
5831
 
5600
5832
 
5833
+ </xsl:for-each>
5834
+ </dc:creator>
5835
+ <dc:description>
5836
+ <xsl:variable name="abstract">
5601
5837
 
5838
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5602
5839
 
5603
5840
 
5604
5841
  </xsl:variable>
@@ -5711,6 +5948,7 @@
5711
5948
 
5712
5949
 
5713
5950
 
5951
+
5714
5952
  </xsl:variable>
5715
5953
  <xsl:if test="$documentNS != $XSLNS">
5716
5954
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -5770,6 +6008,11 @@
5770
6008
  <xsl:call-template name="getLang"/>
5771
6009
  </xsl:variable>
5772
6010
 
5773
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6011
+ <xsl:choose>
6012
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6013
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6014
+ </xsl:when>
6015
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6016
+ </xsl:choose>
5774
6017
 
5775
6018
  </xsl:template></xsl:stylesheet>