metanorma-iso 1.5.12 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +18 -1
  3. data/lib/asciidoctor/iso/base.rb +5 -5
  4. data/lib/asciidoctor/iso/basicdoc.rng +52 -3
  5. data/lib/asciidoctor/iso/cleanup.rb +0 -6
  6. data/lib/asciidoctor/iso/front.rb +10 -5
  7. data/lib/asciidoctor/iso/isodoc.rng +51 -3
  8. data/lib/asciidoctor/iso/isostandard-amd.rng +8 -4
  9. data/lib/asciidoctor/iso/isostandard.rng +27 -10
  10. data/lib/asciidoctor/iso/validate.rb +78 -0
  11. data/lib/asciidoctor/iso/validate_section.rb +12 -9
  12. data/lib/isodoc/iso/base_convert.rb +2 -1
  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/htmlstyle.css +1 -1
  17. data/lib/isodoc/iso/html/htmlstyle.scss +1 -1
  18. data/lib/isodoc/iso/html/isodoc.css +42 -42
  19. data/lib/isodoc/iso/html/isodoc.scss +42 -42
  20. data/lib/isodoc/iso/html/style-human.css +9 -9
  21. data/lib/isodoc/iso/html/style-human.scss +7 -7
  22. data/lib/isodoc/iso/html/style-iso.css +7 -7
  23. data/lib/isodoc/iso/html/style-iso.scss +5 -5
  24. data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
  25. data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
  26. data/lib/isodoc/iso/html/wordstyle.css +67 -67
  27. data/lib/isodoc/iso/html/wordstyle.scss +67 -67
  28. data/lib/isodoc/iso/html_convert.rb +6 -2
  29. data/lib/isodoc/iso/i18n-en.yaml +2 -0
  30. data/lib/isodoc/iso/i18n-fr.yaml +1 -1
  31. data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -1
  32. data/lib/isodoc/iso/iso.amendment.xsl +276 -59
  33. data/lib/isodoc/iso/iso.international-standard.xsl +276 -59
  34. data/lib/isodoc/iso/metadata.rb +1 -0
  35. data/lib/isodoc/iso/sections.rb +1 -1
  36. data/lib/isodoc/iso/word_convert.rb +6 -2
  37. data/lib/isodoc/iso/xref.rb +34 -8
  38. data/lib/metanorma/iso/processor.rb +11 -9
  39. data/lib/metanorma/iso/version.rb +1 -1
  40. data/metanorma-iso.gemspec +2 -2
  41. data/spec/asciidoctor-iso/amd_spec.rb +14 -14
  42. data/spec/asciidoctor-iso/base_spec.rb +22 -20
  43. data/spec/asciidoctor-iso/blocks_spec.rb +22 -22
  44. data/spec/asciidoctor-iso/cleanup_spec.rb +32 -26
  45. data/spec/asciidoctor-iso/inline_spec.rb +7 -7
  46. data/spec/asciidoctor-iso/lists_spec.rb +9 -9
  47. data/spec/asciidoctor-iso/refs_spec.rb +5 -5
  48. data/spec/asciidoctor-iso/section_spec.rb +12 -7
  49. data/spec/asciidoctor-iso/table_spec.rb +4 -4
  50. data/spec/asciidoctor-iso/validate_spec.rb +455 -87
  51. data/spec/isodoc/amd_spec.rb +13 -13
  52. data/spec/isodoc/iso_spec.rb +2 -2
  53. data/spec/isodoc/metadata_spec.rb +2 -0
  54. data/spec/isodoc/section_spec.rb +20 -0
  55. data/spec/isodoc/xref_spec.rb +12 -0
  56. metadata +6 -12
  57. data/.github/workflows/macos.yml +0 -49
  58. data/.github/workflows/ubuntu.yml +0 -53
  59. data/.github/workflows/windows.yml +0 -50
  60. data/lib/asciidoctor/iso/macros.rb +0 -21
  61. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -86
  62. data/spec/asciidoctor-iso/macros_spec.rb +0 -310
@@ -166,9 +166,9 @@
166
166
 
167
167
  <xsl:template match="/">
168
168
  <xsl:call-template name="namespaceCheck"/>
169
- <fo:root font-family="Cambria, Times New Roman, Cambria Math, HanSans" font-size="11pt" xml:lang="{$lang}"> <!-- -->
169
+ <fo:root font-family="Cambria, Times New Roman, Cambria Math, Source Han Sans" font-size="11pt" xml:lang="{$lang}"> <!-- -->
170
170
  <xsl:if test="$lang = 'zh'">
171
- <xsl:attribute name="font-family">HanSans, Times New Roman, Cambria Math</xsl:attribute>
171
+ <xsl:attribute name="font-family">Source Han Sans, Times New Roman, Cambria Math</xsl:attribute>
172
172
  </xsl:if>
173
173
  <fo:layout-master-set>
174
174
 
@@ -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)"/>
1366
+ <xsl:number format="1." lang="en"/>
1367
1367
  </xsl:when>
1368
1368
  <xsl:when test="../@type = 'alphabet'">
1369
- <xsl:number format="a)"/>
1369
+ <xsl:number format="a)" lang="en"/>
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."/>
1370
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
 
@@ -2547,6 +2558,7 @@
2547
2558
  <xsl:attribute name="margin-bottom">10pt</xsl:attribute>
2548
2559
 
2549
2560
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2561
+
2550
2562
 
2551
2563
 
2552
2564
 
@@ -2659,7 +2671,7 @@
2659
2671
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2660
2672
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
2661
2673
  <xsl:call-template name="add-zero-spaces-java"/>
2662
- </xsl:template><xsl:template match="*[local-name()='table']">
2674
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2663
2675
 
2664
2676
  <xsl:variable name="simple-table">
2665
2677
  <xsl:call-template name="getSimpleTable"/>
@@ -2701,10 +2713,12 @@
2701
2713
 
2702
2714
 
2703
2715
  <xsl:variable name="colwidths">
2704
- <xsl:call-template name="calculate-column-widths">
2705
- <xsl:with-param name="cols-count" select="$cols-count"/>
2706
- <xsl:with-param name="table" select="$simple-table"/>
2707
- </xsl:call-template>
2716
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2717
+ <xsl:call-template name="calculate-column-widths">
2718
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2719
+ <xsl:with-param name="table" select="$simple-table"/>
2720
+ </xsl:call-template>
2721
+ </xsl:if>
2708
2722
  </xsl:variable>
2709
2723
  <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2710
2724
 
@@ -2750,7 +2764,12 @@
2750
2764
 
2751
2765
  <xsl:variable name="table_attributes">
2752
2766
  <attribute name="table-layout">fixed</attribute>
2753
- <attribute name="width">100%</attribute>
2767
+ <attribute name="width">
2768
+ <xsl:choose>
2769
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2770
+ <xsl:otherwise>100%</xsl:otherwise>
2771
+ </xsl:choose>
2772
+ </attribute>
2754
2773
  <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2755
2774
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2756
2775
 
@@ -2787,16 +2806,25 @@
2787
2806
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2788
2807
  </xsl:if>
2789
2808
 
2790
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2791
- <xsl:choose>
2792
- <xsl:when test=". = 1 or . = 0">
2793
- <fo:table-column column-width="proportional-column-width(2)"/>
2794
- </xsl:when>
2795
- <xsl:otherwise>
2796
- <fo:table-column column-width="proportional-column-width({.})"/>
2797
- </xsl:otherwise>
2798
- </xsl:choose>
2799
- </xsl:for-each>
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>
2800
2828
 
2801
2829
  <xsl:choose>
2802
2830
  <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
@@ -2809,10 +2837,12 @@
2809
2837
 
2810
2838
  </fo:table>
2811
2839
 
2840
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2812
2841
  <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2813
2842
  <xsl:call-template name="insertTableFooterInSeparateTable">
2814
2843
  <xsl:with-param name="table_attributes" select="$table_attributes"/>
2815
2844
  <xsl:with-param name="colwidths" select="$colwidths"/>
2845
+ <xsl:with-param name="colgroup" select="$colgroup"/>
2816
2846
  </xsl:call-template>
2817
2847
  </xsl:for-each>
2818
2848
 
@@ -3074,12 +3104,22 @@
3074
3104
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
3075
3105
  <xsl:param name="table_attributes"/>
3076
3106
  <xsl:param name="colwidths"/>
3107
+ <xsl:param name="colgroup"/>
3077
3108
 
3078
3109
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
3079
3110
 
3080
3111
  <xsl:if test="$isNoteOrFnExist = 'true'">
3081
3112
 
3082
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
3113
+ <xsl:variable name="cols-count">
3114
+ <xsl:choose>
3115
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
3116
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
3117
+ </xsl:when>
3118
+ <xsl:otherwise>
3119
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
3120
+ </xsl:otherwise>
3121
+ </xsl:choose>
3122
+ </xsl:variable>
3083
3123
 
3084
3124
  <fo:table keep-with-previous="always">
3085
3125
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -3097,16 +3137,25 @@
3097
3137
  </xsl:choose>
3098
3138
  </xsl:for-each>
3099
3139
 
3100
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3101
- <xsl:choose>
3102
- <xsl:when test=". = 1 or . = 0">
3103
- <fo:table-column column-width="proportional-column-width(2)"/>
3104
- </xsl:when>
3105
- <xsl:otherwise>
3106
- <fo:table-column column-width="proportional-column-width({.})"/>
3107
- </xsl:otherwise>
3108
- </xsl:choose>
3109
- </xsl:for-each>
3140
+ <xsl:choose>
3141
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
3142
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
3143
+ <fo:table-column column-width="{@width}"/>
3144
+ </xsl:for-each>
3145
+ </xsl:when>
3146
+ <xsl:otherwise>
3147
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3148
+ <xsl:choose>
3149
+ <xsl:when test=". = 1 or . = 0">
3150
+ <fo:table-column column-width="proportional-column-width(2)"/>
3151
+ </xsl:when>
3152
+ <xsl:otherwise>
3153
+ <fo:table-column column-width="proportional-column-width({.})"/>
3154
+ </xsl:otherwise>
3155
+ </xsl:choose>
3156
+ </xsl:for-each>
3157
+ </xsl:otherwise>
3158
+ </xsl:choose>
3110
3159
 
3111
3160
  <fo:table-body>
3112
3161
  <fo:table-row>
@@ -3580,7 +3629,9 @@
3580
3629
  </xsl:template><xsl:template match="*[local-name()='dl']">
3581
3630
  <fo:block-container>
3582
3631
 
3583
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
3632
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
3633
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3634
+ </xsl:if>
3584
3635
 
3585
3636
 
3586
3637
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -3595,6 +3646,7 @@
3595
3646
  <fo:block-container>
3596
3647
 
3597
3648
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
3649
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3598
3650
 
3599
3651
 
3600
3652
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -3792,12 +3844,32 @@
3792
3844
  </xsl:otherwise>
3793
3845
  </xsl:choose>
3794
3846
  </xsl:template><xsl:template name="getMaxLength_dt">
3795
- <xsl:for-each select="*[local-name()='dt']">
3796
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3797
- <xsl:if test="position() = 1">
3798
- <xsl:value-of select="string-length(normalize-space(.))"/>
3799
- </xsl:if>
3800
- </xsl:for-each>
3847
+ <xsl:variable name="lengths">
3848
+ <xsl:for-each select="*[local-name()='dt']">
3849
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
3850
+ <xsl:variable name="attributes">
3851
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
3852
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
3853
+ </xsl:variable>
3854
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
3855
+ </xsl:for-each>
3856
+ </xsl:variable>
3857
+ <xsl:variable name="maxLength">
3858
+ <!-- <xsl:for-each select="*[local-name()='dt']">
3859
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
3860
+ <xsl:if test="position() = 1">
3861
+ <xsl:value-of select="string-length(normalize-space(.))"/>
3862
+ </xsl:if>
3863
+ </xsl:for-each> -->
3864
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
3865
+ <xsl:sort select="." data-type="number" order="descending"/>
3866
+ <xsl:if test="position() = 1">
3867
+ <xsl:value-of select="."/>
3868
+ </xsl:if>
3869
+ </xsl:for-each>
3870
+ </xsl:variable>
3871
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
3872
+ <xsl:value-of select="$maxLength"/>
3801
3873
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
3802
3874
  <xsl:param name="key_iso"/>
3803
3875
 
@@ -3911,6 +3983,7 @@
3911
3983
  </fo:inline>
3912
3984
  </xsl:template><xsl:template match="*[local-name()='strong'] | *[local-name()='b']">
3913
3985
  <fo:inline font-weight="bold">
3986
+
3914
3987
  <xsl:apply-templates/>
3915
3988
  </fo:inline>
3916
3989
  </xsl:template><xsl:template match="*[local-name()='sup']">
@@ -3937,6 +4010,7 @@
3937
4010
 
3938
4011
 
3939
4012
 
4013
+
3940
4014
 
3941
4015
  </xsl:variable>
3942
4016
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -3950,6 +4024,10 @@
3950
4024
  </xsl:if>
3951
4025
  <xsl:apply-templates/>
3952
4026
  </fo:inline>
4027
+ </xsl:template><xsl:template match="*[local-name()='underline']">
4028
+ <fo:inline text-decoration="underline">
4029
+ <xsl:apply-templates/>
4030
+ </fo:inline>
3953
4031
  </xsl:template><xsl:template match="*[local-name()='del']">
3954
4032
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3955
4033
  <xsl:apply-templates/>
@@ -4315,6 +4393,7 @@
4315
4393
  </xsl:choose>
4316
4394
  </xsl:variable>
4317
4395
  <fo:inline xsl:use-attribute-sets="link-style">
4396
+
4318
4397
  <xsl:choose>
4319
4398
  <xsl:when test="$target = ''">
4320
4399
  <xsl:apply-templates/>
@@ -4527,8 +4606,9 @@
4527
4606
  </xsl:if> -->
4528
4607
  </fo:inline>
4529
4608
  </xsl:if>
4530
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
4531
- <fo:block-container id="{@id}">
4609
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
4610
+ <fo:block-container id="{@id}">
4611
+
4532
4612
  <fo:block>
4533
4613
  <xsl:apply-templates/>
4534
4614
  </fo:block>
@@ -4579,7 +4659,7 @@
4579
4659
  <xsl:apply-templates mode="bookmarks"/>
4580
4660
  </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
4581
4661
  <xsl:apply-templates select="."/>
4582
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4662
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
4583
4663
  <xsl:apply-templates mode="bookmarks"/>
4584
4664
  </xsl:template><xsl:template name="addBookmarks">
4585
4665
  <xsl:param name="contents"/>
@@ -4595,6 +4675,8 @@
4595
4675
  <xsl:variable name="bookmark-title_">
4596
4676
  <xsl:call-template name="getLangVersion">
4597
4677
  <xsl:with-param name="lang" select="@lang"/>
4678
+ <xsl:with-param name="doctype" select="@doctype"/>
4679
+ <xsl:with-param name="title" select="@title-part"/>
4598
4680
  </xsl:call-template>
4599
4681
  </xsl:variable>
4600
4682
  <xsl:choose>
@@ -4612,13 +4694,34 @@
4612
4694
  </xsl:choose>
4613
4695
  </fo:bookmark-title>
4614
4696
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4697
+
4698
+ <xsl:call-template name="insertFigureBookmarks">
4699
+ <xsl:with-param name="contents" select="contents"/>
4700
+ </xsl:call-template>
4701
+
4702
+ <xsl:call-template name="insertTableBookmarks">
4703
+ <xsl:with-param name="contents" select="contents"/>
4704
+ <xsl:with-param name="lang" select="@lang"/>
4705
+ </xsl:call-template>
4706
+
4615
4707
  </fo:bookmark>
4616
4708
 
4617
4709
  </xsl:for-each>
4618
4710
  </xsl:when>
4619
4711
  <xsl:otherwise>
4620
4712
  <xsl:for-each select="xalan:nodeset($contents)/doc">
4713
+
4621
4714
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
4715
+
4716
+ <xsl:call-template name="insertFigureBookmarks">
4717
+ <xsl:with-param name="contents" select="contents"/>
4718
+ </xsl:call-template>
4719
+
4720
+ <xsl:call-template name="insertTableBookmarks">
4721
+ <xsl:with-param name="contents" select="contents"/>
4722
+ <xsl:with-param name="lang" select="@lang"/>
4723
+ </xsl:call-template>
4724
+
4622
4725
  </xsl:for-each>
4623
4726
  </xsl:otherwise>
4624
4727
  </xsl:choose>
@@ -4637,8 +4740,44 @@
4637
4740
 
4638
4741
  </fo:bookmark-tree>
4639
4742
  </xsl:if>
4743
+ </xsl:template><xsl:template name="insertFigureBookmarks">
4744
+ <xsl:param name="contents"/>
4745
+ <xsl:if test="xalan:nodeset($contents)/figure">
4746
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
4747
+ <fo:bookmark-title>Figures</fo:bookmark-title>
4748
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
4749
+ <fo:bookmark internal-destination="{@id}">
4750
+ <fo:bookmark-title>
4751
+ <xsl:value-of select="normalize-space(title)"/>
4752
+ </fo:bookmark-title>
4753
+ </fo:bookmark>
4754
+ </xsl:for-each>
4755
+ </fo:bookmark>
4756
+ </xsl:if>
4757
+ </xsl:template><xsl:template name="insertTableBookmarks">
4758
+ <xsl:param name="contents"/>
4759
+ <xsl:param name="lang"/>
4760
+ <xsl:if test="xalan:nodeset($contents)/table">
4761
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
4762
+ <fo:bookmark-title>
4763
+ <xsl:choose>
4764
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
4765
+ <xsl:otherwise>Tables</xsl:otherwise>
4766
+ </xsl:choose>
4767
+ </fo:bookmark-title>
4768
+ <xsl:for-each select="xalan:nodeset($contents)/table">
4769
+ <fo:bookmark internal-destination="{@id}">
4770
+ <fo:bookmark-title>
4771
+ <xsl:value-of select="normalize-space(title)"/>
4772
+ </fo:bookmark-title>
4773
+ </fo:bookmark>
4774
+ </xsl:for-each>
4775
+ </fo:bookmark>
4776
+ </xsl:if>
4640
4777
  </xsl:template><xsl:template name="getLangVersion">
4641
4778
  <xsl:param name="lang"/>
4779
+ <xsl:param name="doctype" select="''"/>
4780
+ <xsl:param name="title" select="''"/>
4642
4781
  <xsl:choose>
4643
4782
  <xsl:when test="$lang = 'en'">
4644
4783
 
@@ -4674,6 +4813,12 @@
4674
4813
  <!-- <xsl:text> </xsl:text> -->
4675
4814
  </xsl:template><xsl:template name="getSection">
4676
4815
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
4816
+ <!--
4817
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
4818
+ <xsl:value-of select="."/>
4819
+ </xsl:for-each>
4820
+ -->
4821
+
4677
4822
  </xsl:template><xsl:template name="getName">
4678
4823
  <xsl:choose>
4679
4824
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -4726,6 +4871,10 @@
4726
4871
  <xsl:copy>
4727
4872
  <xsl:apply-templates mode="contents_item"/>
4728
4873
  </xsl:copy>
4874
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
4875
+ <xsl:copy>
4876
+ <xsl:apply-templates mode="contents_item"/>
4877
+ </xsl:copy>
4729
4878
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4730
4879
  <xsl:text> </xsl:text>
4731
4880
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4751,6 +4900,7 @@
4751
4900
 
4752
4901
  9
4753
4902
 
4903
+
4754
4904
 
4755
4905
 
4756
4906
 
@@ -5134,7 +5284,8 @@
5134
5284
  <fo:block-container margin-left="0mm">
5135
5285
 
5136
5286
  <fo:block xsl:use-attribute-sets="quote-style">
5137
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
5287
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
5288
+ <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5138
5289
  </fo:block>
5139
5290
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5140
5291
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -5290,6 +5441,7 @@
5290
5441
  <xsl:attribute name="space-before">18pt</xsl:attribute>
5291
5442
  </xsl:if>
5292
5443
 
5444
+
5293
5445
 
5294
5446
 
5295
5447
 
@@ -5301,7 +5453,7 @@
5301
5453
 
5302
5454
 
5303
5455
 
5304
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
5456
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
5305
5457
  <fo:block break-after="page"/>
5306
5458
  <fo:block>
5307
5459
  <xsl:call-template name="setId"/>
@@ -5309,7 +5461,8 @@
5309
5461
  </fo:block>
5310
5462
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
5311
5463
  <fo:block>
5312
- <xsl:call-template name="setId"/>
5464
+ <xsl:call-template name="setId"/>
5465
+
5313
5466
 
5314
5467
  <xsl:apply-templates/>
5315
5468
  </fo:block>
@@ -5317,7 +5470,7 @@
5317
5470
  <fo:block id="{@id}">
5318
5471
  <xsl:apply-templates/>
5319
5472
  </fo:block>
5320
- </xsl:template><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
5473
+ </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" priority="3"/><xsl:template match="*[local-name() = 'bibitem'][@hidden='true']" priority="3"/><xsl:template match="/*/*[local-name() = 'bibliography']/*[local-name() = 'references'][@normative='true']">
5321
5474
 
5322
5475
  <fo:block id="{@id}">
5323
5476
  <xsl:apply-templates/>
@@ -5374,7 +5527,8 @@
5374
5527
  <fo:table-column column-width="107mm"/>
5375
5528
  <fo:table-column column-width="15mm"/>
5376
5529
  <fo:table-body>
5377
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
5530
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
5531
+
5378
5532
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
5379
5533
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
5380
5534
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -5392,6 +5546,10 @@
5392
5546
  <fo:block><xsl:apply-templates/></fo:block>
5393
5547
  </fo:table-cell>
5394
5548
  </xsl:template><xsl:template name="processBibitem">
5549
+
5550
+
5551
+ <!-- end BIPM bibitem processing-->
5552
+
5395
5553
 
5396
5554
 
5397
5555
 
@@ -5450,6 +5608,8 @@
5450
5608
  <xsl:value-of select="translate(.,'. ','')"/>
5451
5609
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
5452
5610
  <xsl:value-of select="substring(.,1,1)"/>
5611
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5612
+ <fo:inline><xsl:apply-templates/></fo:inline>
5453
5613
  </xsl:template><xsl:template name="convertDate">
5454
5614
  <xsl:param name="date"/>
5455
5615
  <xsl:param name="format" select="'short'"/>
@@ -5474,6 +5634,57 @@
5474
5634
  </xsl:variable>
5475
5635
  <xsl:variable name="result">
5476
5636
  <xsl:choose>
5637
+ <xsl:when test="$format = 'ddMMyyyy'">
5638
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5639
+ <xsl:text> </xsl:text>
5640
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5641
+ </xsl:when>
5642
+ <xsl:when test="$format = 'ddMM'">
5643
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5644
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5645
+ </xsl:when>
5646
+ <xsl:when test="$format = 'short' or $day = ''">
5647
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5648
+ </xsl:when>
5649
+ <xsl:otherwise>
5650
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
5651
+ </xsl:otherwise>
5652
+ </xsl:choose>
5653
+ </xsl:variable>
5654
+ <xsl:value-of select="$result"/>
5655
+ </xsl:template><xsl:template name="convertDateLocalized">
5656
+ <xsl:param name="date"/>
5657
+ <xsl:param name="format" select="'short'"/>
5658
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
5659
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
5660
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
5661
+ <xsl:variable name="monthStr">
5662
+ <xsl:choose>
5663
+ <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>
5664
+ <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>
5665
+ <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>
5666
+ <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>
5667
+ <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>
5668
+ <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>
5669
+ <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>
5670
+ <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>
5671
+ <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>
5672
+ <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>
5673
+ <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>
5674
+ <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>
5675
+ </xsl:choose>
5676
+ </xsl:variable>
5677
+ <xsl:variable name="result">
5678
+ <xsl:choose>
5679
+ <xsl:when test="$format = 'ddMMyyyy'">
5680
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5681
+ <xsl:text> </xsl:text>
5682
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
5683
+ </xsl:when>
5684
+ <xsl:when test="$format = 'ddMM'">
5685
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
5686
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
5687
+ </xsl:when>
5477
5688
  <xsl:when test="$format = 'short' or $day = ''">
5478
5689
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
5479
5690
  </xsl:when>
@@ -5670,6 +5881,7 @@
5670
5881
 
5671
5882
 
5672
5883
 
5884
+
5673
5885
  </xsl:variable>
5674
5886
  <xsl:if test="$documentNS != $XSLNS">
5675
5887
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -5729,6 +5941,11 @@
5729
5941
  <xsl:call-template name="getLang"/>
5730
5942
  </xsl:variable>
5731
5943
 
5732
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5944
+ <xsl:choose>
5945
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5946
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5947
+ </xsl:when>
5948
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
5949
+ </xsl:choose>
5733
5950
 
5734
5951
  </xsl:template></xsl:stylesheet>