metanorma-iec 1.3.0 → 1.3.5

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.
@@ -14,14 +14,14 @@ module IsoDoc
14
14
  def default_fonts(options)
15
15
  {
16
16
  bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' : '"Arial",sans-serif'),
17
- headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' : '"Arial",sans-serif'),
18
- monospacefont: ('"Courier New",monospace'),
19
- monospacefontsize: "1.0em",
20
- footnotefontsize: "0.9em",
17
+ headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' : '"Arial",sans-serif'),
18
+ monospacefont: '"Courier New",monospace',
19
+ monospacefontsize: "1.0em",
20
+ footnotefontsize: "0.9em",
21
21
  }
22
22
  end
23
23
 
24
- def default_file_locations(options)
24
+ def default_file_locations(_options)
25
25
  @libdir = File.dirname(__FILE__)
26
26
  {
27
27
  htmlstylesheet: html_doc_path("htmlstyle.scss"),
@@ -30,7 +30,7 @@ module IsoDoc
30
30
  }
31
31
  end
32
32
 
33
- def htmlstyle(docxml)
33
+ def htmlstyle(_docxml)
34
34
  docxml = super
35
35
  b = docxml.at("div[@class = 'boilerplate_legal']/ol")
36
36
  b and b["type"] = "1"
@@ -2611,6 +2611,9 @@
2611
2611
  <title-continued lang="en">(continued)</title-continued>
2612
2612
  <title-continued lang="fr">(continué)</title-continued>
2613
2613
 
2614
+ </xsl:variable><xsl:variable name="bibdata">
2615
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
2616
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
2614
2617
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2615
2618
  <xsl:param name="name"/>
2616
2619
  <xsl:param name="lang"/>
@@ -2636,10 +2639,13 @@
2636
2639
  </xsl:choose>
2637
2640
  </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
2638
2641
 
2642
+
2639
2643
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2640
2644
 
2641
2645
 
2642
2646
 
2647
+
2648
+
2643
2649
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2644
2650
  <xsl:attribute name="white-space">pre</xsl:attribute>
2645
2651
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -2688,7 +2694,7 @@
2688
2694
 
2689
2695
 
2690
2696
 
2691
-
2697
+
2692
2698
  </xsl:attribute-set><xsl:attribute-set name="example-style">
2693
2699
 
2694
2700
 
@@ -2701,6 +2707,7 @@
2701
2707
 
2702
2708
 
2703
2709
 
2710
+
2704
2711
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2705
2712
 
2706
2713
 
@@ -2719,9 +2726,7 @@
2719
2726
 
2720
2727
 
2721
2728
 
2722
-
2723
-
2724
-
2729
+
2725
2730
 
2726
2731
 
2727
2732
 
@@ -2748,8 +2753,10 @@
2748
2753
 
2749
2754
 
2750
2755
 
2756
+
2751
2757
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2752
2758
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2759
+
2753
2760
 
2754
2761
 
2755
2762
 
@@ -2767,6 +2774,9 @@
2767
2774
 
2768
2775
 
2769
2776
 
2777
+
2778
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
2779
+
2770
2780
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2771
2781
 
2772
2782
 
@@ -2786,16 +2796,20 @@
2786
2796
 
2787
2797
 
2788
2798
 
2799
+
2800
+
2789
2801
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
2790
2802
 
2791
2803
 
2792
2804
 
2793
2805
 
2806
+
2794
2807
  </xsl:attribute-set><xsl:attribute-set name="note-style">
2795
2808
 
2796
2809
 
2797
2810
 
2798
2811
 
2812
+
2799
2813
  <xsl:attribute name="font-size">8pt</xsl:attribute>
2800
2814
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
2801
2815
  <xsl:attribute name="margin-bottom">9pt</xsl:attribute>
@@ -2810,11 +2824,13 @@
2810
2824
 
2811
2825
 
2812
2826
 
2827
+
2813
2828
  </xsl:attribute-set><xsl:variable name="note-body-indent">10mm</xsl:variable><xsl:variable name="note-body-indent-table">5mm</xsl:variable><xsl:attribute-set name="note-name-style">
2814
2829
 
2815
2830
 
2816
2831
 
2817
2832
 
2833
+
2818
2834
  <xsl:attribute name="padding-right">6mm</xsl:attribute>
2819
2835
 
2820
2836
 
@@ -2844,6 +2860,7 @@
2844
2860
  </xsl:attribute-set><xsl:attribute-set name="termnote-style">
2845
2861
 
2846
2862
 
2863
+
2847
2864
  <xsl:attribute name="font-size">8pt</xsl:attribute>
2848
2865
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
2849
2866
  <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
@@ -2851,9 +2868,12 @@
2851
2868
 
2852
2869
 
2853
2870
 
2871
+
2854
2872
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2873
+
2855
2874
 
2856
2875
 
2876
+
2857
2877
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2858
2878
 
2859
2879
 
@@ -2879,20 +2899,24 @@
2879
2899
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
2880
2900
 
2881
2901
 
2902
+
2882
2903
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2883
2904
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2884
2905
 
2885
2906
 
2886
2907
 
2887
2908
 
2909
+
2888
2910
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
2889
2911
 
2890
2912
 
2891
2913
 
2914
+
2892
2915
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2893
2916
 
2894
2917
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2895
2918
 
2919
+
2896
2920
 
2897
2921
 
2898
2922
 
@@ -2912,6 +2936,7 @@
2912
2936
 
2913
2937
 
2914
2938
 
2939
+
2915
2940
 
2916
2941
 
2917
2942
 
@@ -2925,12 +2950,14 @@
2925
2950
 
2926
2951
 
2927
2952
 
2953
+
2928
2954
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
2929
2955
 
2930
2956
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
2931
2957
 
2932
2958
 
2933
2959
 
2960
+
2934
2961
  <xsl:attribute name="width">75%</xsl:attribute>
2935
2962
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
2936
2963
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -2955,24 +2982,41 @@
2955
2982
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2956
2983
 
2957
2984
 
2985
+
2958
2986
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2959
2987
 
2960
2988
  <xsl:attribute name="font-size">8pt</xsl:attribute>
2961
2989
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
2962
2990
  <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
2963
2991
 
2992
+
2964
2993
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
2965
2994
 
2966
2995
 
2967
2996
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2968
2997
 
2969
- </xsl:attribute-set><xsl:attribute-set name="add-style">
2998
+
2999
+ </xsl:attribute-set><xsl:variable name="color-added-text">
3000
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
3001
+ </xsl:variable><xsl:attribute-set name="add-style">
2970
3002
  <xsl:attribute name="color">red</xsl:attribute>
2971
3003
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
2972
- </xsl:attribute-set><xsl:attribute-set name="del-style">
2973
- <xsl:attribute name="color">red</xsl:attribute>
3004
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
3005
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
3006
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
3007
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
3008
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
3009
+ <xsl:text>red</xsl:text>
3010
+ </xsl:variable><xsl:attribute-set name="del-style">
3011
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
2974
3012
  <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2975
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
3013
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
3014
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
3015
+
3016
+
3017
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
3018
+
3019
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
2976
3020
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2977
3021
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2978
3022
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -3017,18 +3061,19 @@
3017
3061
  <xsl:call-template name="add-zero-spaces-java"/>
3018
3062
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3019
3063
 
3064
+ <xsl:variable name="table-preamble">
3065
+
3066
+
3067
+ </xsl:variable>
3068
+
3020
3069
  <xsl:variable name="table">
3021
3070
 
3022
3071
  <xsl:variable name="simple-table">
3023
- <xsl:call-template name="getSimpleTable"/>
3072
+ <xsl:call-template name="getSimpleTable"/>
3024
3073
  </xsl:variable>
3025
3074
 
3026
-
3027
-
3028
-
3029
-
3030
3075
  <!-- <xsl:if test="$namespace = 'bipm'">
3031
- <fo:block>&#xA0;</fo:block>
3076
+ <fo:block>&#xA0;</fo:block>
3032
3077
  </xsl:if> -->
3033
3078
 
3034
3079
  <!-- $namespace = 'iso' or -->
@@ -3041,7 +3086,7 @@
3041
3086
 
3042
3087
 
3043
3088
 
3044
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3089
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
3045
3090
 
3046
3091
  <!-- <xsl:variable name="cols-count">
3047
3092
  <xsl:choose>
@@ -3060,8 +3105,6 @@
3060
3105
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3061
3106
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3062
3107
 
3063
-
3064
-
3065
3108
  <xsl:variable name="colwidths">
3066
3109
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3067
3110
  <xsl:call-template name="calculate-column-widths">
@@ -3089,10 +3132,12 @@
3089
3132
  </xsl:choose>
3090
3133
  </xsl:variable>
3091
3134
 
3135
+
3092
3136
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3093
3137
 
3094
3138
 
3095
3139
 
3140
+
3096
3141
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3097
3142
  <xsl:attribute name="space-after">12pt</xsl:attribute>
3098
3143
  <xsl:if test="ancestor::*[local-name() = 'preface']">
@@ -3110,6 +3155,8 @@
3110
3155
 
3111
3156
 
3112
3157
 
3158
+
3159
+
3113
3160
  <xsl:variable name="table_width">
3114
3161
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3115
3162
  100%
@@ -3124,6 +3171,8 @@
3124
3171
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3125
3172
 
3126
3173
 
3174
+
3175
+
3127
3176
  <attribute name="border">0.5pt solid black</attribute>
3128
3177
 
3129
3178
 
@@ -3134,6 +3183,7 @@
3134
3183
 
3135
3184
 
3136
3185
 
3186
+
3137
3187
  </xsl:variable>
3138
3188
 
3139
3189
 
@@ -3217,7 +3267,8 @@
3217
3267
  </fo:block-container>
3218
3268
  </xsl:variable>
3219
3269
 
3220
-
3270
+ <xsl:variable name="isAdded" select="@added"/>
3271
+ <xsl:variable name="isDeleted" select="@deleted"/>
3221
3272
 
3222
3273
  <xsl:choose>
3223
3274
  <xsl:when test="@width">
@@ -3231,7 +3282,14 @@
3231
3282
  <fo:table-body>
3232
3283
  <fo:table-row>
3233
3284
  <fo:table-cell column-number="2">
3234
- <fo:block><xsl:copy-of select="$table"/></fo:block>
3285
+ <xsl:copy-of select="$table-preamble"/>
3286
+ <fo:block>
3287
+ <xsl:call-template name="setTrackChangesStyles">
3288
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3289
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3290
+ </xsl:call-template>
3291
+ <xsl:copy-of select="$table"/>
3292
+ </fo:block>
3235
3293
  </fo:table-cell>
3236
3294
  </fo:table-row>
3237
3295
  </fo:table-body>
@@ -3242,16 +3300,45 @@
3242
3300
 
3243
3301
  </xsl:when>
3244
3302
  <xsl:otherwise>
3245
- <xsl:copy-of select="$table"/>
3303
+ <xsl:choose>
3304
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
3305
+ <xsl:copy-of select="$table-preamble"/>
3306
+ <fo:block>
3307
+ <xsl:call-template name="setTrackChangesStyles">
3308
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3309
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3310
+ </xsl:call-template>
3311
+ <xsl:copy-of select="$table"/>
3312
+ </fo:block>
3313
+ </xsl:when>
3314
+ <xsl:otherwise>
3315
+ <xsl:copy-of select="$table-preamble"/>
3316
+ <xsl:copy-of select="$table"/>
3317
+ </xsl:otherwise>
3318
+ </xsl:choose>
3246
3319
  </xsl:otherwise>
3247
3320
  </xsl:choose>
3248
3321
 
3249
3322
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
3323
+ <xsl:param name="continued"/>
3250
3324
  <xsl:if test="normalize-space() != ''">
3251
3325
  <fo:block xsl:use-attribute-sets="table-name-style">
3252
3326
 
3253
3327
 
3254
- <xsl:apply-templates/>
3328
+
3329
+
3330
+
3331
+ <xsl:choose>
3332
+ <xsl:when test="$continued = 'true'">
3333
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
3334
+
3335
+ </xsl:when>
3336
+ <xsl:otherwise>
3337
+ <xsl:apply-templates/>
3338
+ </xsl:otherwise>
3339
+ </xsl:choose>
3340
+
3341
+
3255
3342
  </fo:block>
3256
3343
  </xsl:if>
3257
3344
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -3303,7 +3390,7 @@
3303
3390
  </xsl:for-each>
3304
3391
  </xsl:when>
3305
3392
  <xsl:otherwise>
3306
- <xsl:for-each select="xalan:nodeset($table)//tr">
3393
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
3307
3394
  <xsl:variable name="td_text">
3308
3395
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3309
3396
 
@@ -3388,21 +3475,22 @@
3388
3475
  <!-- font-weight="bold" -->
3389
3476
  <fo:table-header>
3390
3477
 
3478
+
3391
3479
  <xsl:apply-templates/>
3392
3480
  </fo:table-header>
3393
3481
  </xsl:template><xsl:template name="table-header-title">
3394
- <xsl:param name="cols-count"/>
3482
+ <xsl:param name="cols-count"/>
3395
3483
  <!-- row for title -->
3396
3484
  <fo:table-row>
3397
3485
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
3398
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
3486
+
3487
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
3488
+ <xsl:with-param name="continued">true</xsl:with-param>
3489
+ </xsl:apply-templates>
3399
3490
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
3400
3491
  <xsl:call-template name="fn_name_display"/>
3401
- </xsl:for-each>
3402
- <fo:block text-align="right" font-style="italic">
3403
- <xsl:text> </xsl:text>
3404
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3405
- </fo:block>
3492
+ </xsl:for-each>
3493
+
3406
3494
  </fo:table-cell>
3407
3495
  </fo:table-row>
3408
3496
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -3646,6 +3734,7 @@
3646
3734
 
3647
3735
 
3648
3736
 
3737
+
3649
3738
  <xsl:attribute name="border-top">solid black 0.5pt</xsl:attribute>
3650
3739
  <xsl:attribute name="border-bottom">solid black 0.5pt</xsl:attribute>
3651
3740
 
@@ -3662,6 +3751,10 @@
3662
3751
 
3663
3752
 
3664
3753
 
3754
+
3755
+
3756
+
3757
+
3665
3758
  <!-- <xsl:if test="$namespace = 'bipm'">
3666
3759
  <xsl:attribute name="height">8mm</xsl:attribute>
3667
3760
  </xsl:if> -->
@@ -3673,12 +3766,14 @@
3673
3766
  <xsl:attribute name="text-align">
3674
3767
  <xsl:choose>
3675
3768
  <xsl:when test="@align">
3676
- <xsl:value-of select="@align"/>
3769
+ <xsl:call-template name="setAlignment"/>
3770
+ <!-- <xsl:value-of select="@align"/> -->
3677
3771
  </xsl:when>
3678
3772
  <xsl:otherwise>center</xsl:otherwise>
3679
3773
  </xsl:choose>
3680
3774
  </xsl:attribute>
3681
3775
 
3776
+
3682
3777
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
3683
3778
 
3684
3779
 
@@ -3697,6 +3792,10 @@
3697
3792
 
3698
3793
 
3699
3794
 
3795
+
3796
+ <xsl:if test="$lang = 'ar'">
3797
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3798
+ </xsl:if>
3700
3799
  <xsl:if test="@colspan">
3701
3800
  <xsl:attribute name="number-columns-spanned">
3702
3801
  <xsl:value-of select="@colspan"/>
@@ -3728,16 +3827,21 @@
3728
3827
  <xsl:attribute name="text-align">
3729
3828
  <xsl:choose>
3730
3829
  <xsl:when test="@align">
3731
- <xsl:value-of select="@align"/>
3830
+ <xsl:call-template name="setAlignment"/>
3831
+ <!-- <xsl:value-of select="@align"/> -->
3732
3832
  </xsl:when>
3733
3833
  <xsl:otherwise>left</xsl:otherwise>
3734
3834
  </xsl:choose>
3735
3835
  </xsl:attribute>
3836
+ <xsl:if test="$lang = 'ar'">
3837
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3838
+ </xsl:if>
3736
3839
  <!-- and ancestor::*[local-name() = 'thead'] -->
3737
3840
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3738
3841
 
3739
3842
 
3740
3843
 
3844
+
3741
3845
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3742
3846
  <xsl:attribute name="border">solid black 0</xsl:attribute>
3743
3847
  </xsl:if>
@@ -3755,6 +3859,12 @@
3755
3859
 
3756
3860
 
3757
3861
 
3862
+
3863
+
3864
+
3865
+ <xsl:if test=".//*[local-name() = 'table']">
3866
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3867
+ </xsl:if>
3758
3868
  <xsl:if test="@colspan">
3759
3869
  <xsl:attribute name="number-columns-spanned">
3760
3870
  <xsl:value-of select="@colspan"/>
@@ -3891,13 +4001,13 @@
3891
4001
  </xsl:choose>
3892
4002
  </xsl:variable>
3893
4003
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3894
- <xsl:element name="{$ns}:table">
4004
+ <!-- <xsl:element name="{$ns}:table"> -->
3895
4005
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3896
4006
  <tbody>
3897
4007
  <xsl:apply-templates mode="dl"/>
3898
4008
  </tbody>
3899
4009
  </xsl:for-each>
3900
- </xsl:element>
4010
+ <!-- </xsl:element> -->
3901
4011
  </xsl:variable>
3902
4012
 
3903
4013
  <xsl:call-template name="calculate-column-widths">
@@ -3991,6 +4101,7 @@
3991
4101
 
3992
4102
 
3993
4103
 
4104
+
3994
4105
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
3995
4106
 
3996
4107
 
@@ -4003,6 +4114,8 @@
4003
4114
  <xsl:apply-templates/>
4004
4115
  </fo:inline>
4005
4116
  </xsl:template><xsl:template match="*[local-name()='dl']">
4117
+ <xsl:variable name="isAdded" select="@added"/>
4118
+ <xsl:variable name="isDeleted" select="@deleted"/>
4006
4119
  <fo:block-container>
4007
4120
 
4008
4121
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -4019,6 +4132,12 @@
4019
4132
  </xsl:attribute>
4020
4133
 
4021
4134
  </xsl:if>
4135
+
4136
+ <xsl:call-template name="setTrackChangesStyles">
4137
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4138
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4139
+ </xsl:call-template>
4140
+
4022
4141
  <fo:block-container>
4023
4142
 
4024
4143
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -4088,6 +4207,7 @@
4088
4207
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
4089
4208
 
4090
4209
 
4210
+
4091
4211
  <xsl:variable name="title-key">
4092
4212
 
4093
4213
 
@@ -4142,11 +4262,11 @@
4142
4262
  </xsl:choose>
4143
4263
  </xsl:variable>
4144
4264
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
4145
- <xsl:element name="{$ns}:table">
4265
+ <!-- <xsl:element name="{$ns}:table"> -->
4146
4266
  <tbody>
4147
4267
  <xsl:apply-templates mode="dl"/>
4148
4268
  </tbody>
4149
- </xsl:element>
4269
+ <!-- </xsl:element> -->
4150
4270
  </xsl:variable>
4151
4271
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
4152
4272
  <xsl:variable name="colwidths">
@@ -4300,6 +4420,7 @@
4300
4420
 
4301
4421
  <fo:table-row>
4302
4422
 
4423
+
4303
4424
  <fo:table-cell>
4304
4425
 
4305
4426
  <fo:block margin-top="6pt">
@@ -4319,6 +4440,7 @@
4319
4440
 
4320
4441
 
4321
4442
 
4443
+
4322
4444
  <xsl:apply-templates/>
4323
4445
  <!-- <xsl:if test="$namespace = 'gb'">
4324
4446
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -4375,6 +4497,8 @@
4375
4497
 
4376
4498
  <xsl:apply-templates/>
4377
4499
  </fo:inline>
4500
+ </xsl:template><xsl:template match="*[local-name()='padding']">
4501
+ <fo:inline padding-right="{@value}"> </fo:inline>
4378
4502
  </xsl:template><xsl:template match="*[local-name()='sup']">
4379
4503
  <fo:inline font-size="80%" vertical-align="super">
4380
4504
  <xsl:apply-templates/>
@@ -4400,6 +4524,7 @@
4400
4524
 
4401
4525
 
4402
4526
 
4527
+
4403
4528
 
4404
4529
  </xsl:variable>
4405
4530
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4418,9 +4543,71 @@
4418
4543
  <xsl:apply-templates/>
4419
4544
  </fo:inline>
4420
4545
  </xsl:template><xsl:template match="*[local-name()='add']">
4421
- <fo:inline xsl:use-attribute-sets="add-style">
4422
- <xsl:apply-templates/>
4423
- </fo:inline>
4546
+ <xsl:choose>
4547
+ <xsl:when test="@amendment">
4548
+ <fo:inline>
4549
+ <xsl:call-template name="insertTag">
4550
+ <xsl:with-param name="kind">A</xsl:with-param>
4551
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4552
+ </xsl:call-template>
4553
+ <xsl:apply-templates/>
4554
+ <xsl:call-template name="insertTag">
4555
+ <xsl:with-param name="type">closing</xsl:with-param>
4556
+ <xsl:with-param name="kind">A</xsl:with-param>
4557
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4558
+ </xsl:call-template>
4559
+ </fo:inline>
4560
+ </xsl:when>
4561
+ <xsl:when test="@corrigenda">
4562
+ <fo:inline>
4563
+ <xsl:call-template name="insertTag">
4564
+ <xsl:with-param name="kind">C</xsl:with-param>
4565
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4566
+ </xsl:call-template>
4567
+ <xsl:apply-templates/>
4568
+ <xsl:call-template name="insertTag">
4569
+ <xsl:with-param name="type">closing</xsl:with-param>
4570
+ <xsl:with-param name="kind">C</xsl:with-param>
4571
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4572
+ </xsl:call-template>
4573
+ </fo:inline>
4574
+ </xsl:when>
4575
+ <xsl:otherwise>
4576
+ <fo:inline xsl:use-attribute-sets="add-style">
4577
+ <xsl:apply-templates/>
4578
+ </fo:inline>
4579
+ </xsl:otherwise>
4580
+ </xsl:choose>
4581
+
4582
+ </xsl:template><xsl:template name="insertTag">
4583
+ <xsl:param name="type"/>
4584
+ <xsl:param name="kind"/>
4585
+ <xsl:param name="value"/>
4586
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4587
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4588
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4589
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4590
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4591
+ <xsl:attribute name="height">5mm</xsl:attribute>
4592
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4593
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4594
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4595
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4596
+ <g>
4597
+ <xsl:if test="$type = 'closing'">
4598
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4599
+ </xsl:if>
4600
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4601
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4602
+ </g>
4603
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4604
+ <xsl:if test="$type = 'closing'">
4605
+ <xsl:attribute name="x">25</xsl:attribute>
4606
+ </xsl:if>
4607
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4608
+ </text>
4609
+ </svg>
4610
+ </fo:instream-foreign-object>
4424
4611
  </xsl:template><xsl:template match="*[local-name()='del']">
4425
4612
  <fo:inline xsl:use-attribute-sets="del-style">
4426
4613
  <xsl:apply-templates/>
@@ -4719,11 +4906,15 @@
4719
4906
  </xsl:apply-templates>
4720
4907
  </xsl:template><xsl:template name="getLang">
4721
4908
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4909
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4722
4910
  <xsl:variable name="language">
4723
4911
  <xsl:choose>
4724
4912
  <xsl:when test="$language_current != ''">
4725
4913
  <xsl:value-of select="$language_current"/>
4726
4914
  </xsl:when>
4915
+ <xsl:when test="$language_current_2 != ''">
4916
+ <xsl:value-of select="$language_current_2"/>
4917
+ </xsl:when>
4727
4918
  <xsl:otherwise>
4728
4919
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4729
4920
  </xsl:otherwise>
@@ -4763,13 +4954,23 @@
4763
4954
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4764
4955
  <xsl:value-of select="substring($str, 2)"/>
4765
4956
  </xsl:template><xsl:template match="mathml:math">
4766
- <fo:inline font-family="STIX Two Math"> <!-- -->
4957
+ <xsl:variable name="isAdded" select="@added"/>
4958
+ <xsl:variable name="isDeleted" select="@deleted"/>
4959
+
4960
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4961
+
4962
+
4963
+ <xsl:call-template name="setTrackChangesStyles">
4964
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4965
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4966
+ </xsl:call-template>
4767
4967
 
4768
4968
  <xsl:variable name="mathml">
4769
4969
  <xsl:apply-templates select="." mode="mathml"/>
4770
4970
  </xsl:variable>
4771
4971
  <fo:instream-foreign-object fox:alt-text="Math">
4772
4972
 
4973
+
4773
4974
  <!-- <xsl:copy-of select="."/> -->
4774
4975
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4775
4976
  </fo:instream-foreign-object>
@@ -4787,9 +4988,27 @@
4787
4988
  <xsl:copy>
4788
4989
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4789
4990
  </xsl:copy>
4790
- <mathml:mspace width="0.5ex"/>
4991
+ <xsl:choose>
4992
+ <!-- if in msub, then don't add space -->
4993
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
4994
+ <!-- if next char in digit, don't add space -->
4995
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
4996
+ <xsl:otherwise>
4997
+ <mathml:mspace width="0.5ex"/>
4998
+ </xsl:otherwise>
4999
+ </xsl:choose>
4791
5000
  </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4792
5001
  <xsl:variable name="target">
5002
+ <xsl:choose>
5003
+ <xsl:when test="@updatetype = 'true'">
5004
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
5005
+ </xsl:when>
5006
+ <xsl:otherwise>
5007
+ <xsl:value-of select="normalize-space(@target)"/>
5008
+ </xsl:otherwise>
5009
+ </xsl:choose>
5010
+ </xsl:variable>
5011
+ <xsl:variable name="target_text">
4793
5012
  <xsl:choose>
4794
5013
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
4795
5014
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -4805,20 +5024,21 @@
4805
5024
  <xsl:attribute name="color">blue</xsl:attribute>
4806
5025
  </xsl:if>
4807
5026
 
5027
+
4808
5028
  <xsl:choose>
4809
- <xsl:when test="$target = ''">
5029
+ <xsl:when test="$target_text = ''">
4810
5030
  <xsl:apply-templates/>
4811
5031
  </xsl:when>
4812
5032
  <xsl:otherwise>
4813
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
5033
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
4814
5034
  <xsl:choose>
4815
5035
  <xsl:when test="normalize-space(.) = ''">
4816
- <!-- <xsl:value-of select="$target"/> -->
4817
5036
  <xsl:call-template name="add-zero-spaces-link-java">
4818
- <xsl:with-param name="text" select="$target"/>
5037
+ <xsl:with-param name="text" select="$target_text"/>
4819
5038
  </xsl:call-template>
4820
5039
  </xsl:when>
4821
5040
  <xsl:otherwise>
5041
+ <!-- output text from <link>text</link> -->
4822
5042
  <xsl:apply-templates/>
4823
5043
  </xsl:otherwise>
4824
5044
  </xsl:choose>
@@ -4930,6 +5150,7 @@
4930
5150
 
4931
5151
 
4932
5152
  <fo:inline xsl:use-attribute-sets="note-name-style">
5153
+
4933
5154
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4934
5155
  </fo:inline>
4935
5156
  <xsl:apply-templates/>
@@ -4955,7 +5176,9 @@
4955
5176
  </xsl:choose>
4956
5177
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
4957
5178
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
5179
+
4958
5180
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5181
+
4959
5182
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4960
5183
  </fo:inline>
4961
5184
  <xsl:apply-templates/>
@@ -5019,16 +5242,27 @@
5019
5242
  </fo:inline>
5020
5243
  </xsl:if>
5021
5244
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
5245
+ <xsl:variable name="isAdded" select="@added"/>
5246
+ <xsl:variable name="isDeleted" select="@deleted"/>
5022
5247
  <fo:block-container id="{@id}">
5023
5248
 
5249
+ <xsl:call-template name="setTrackChangesStyles">
5250
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5251
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5252
+ </xsl:call-template>
5253
+
5024
5254
  <fo:block>
5255
+
5025
5256
  <xsl:apply-templates/>
5026
5257
  </fo:block>
5027
5258
  <xsl:call-template name="fn_display_figure"/>
5028
5259
  <xsl:for-each select="*[local-name() = 'note']">
5029
5260
  <xsl:call-template name="note"/>
5030
5261
  </xsl:for-each>
5031
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5262
+
5263
+
5264
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5265
+
5032
5266
  </fo:block-container>
5033
5267
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
5034
5268
  <fo:block id="{@id}">
@@ -5040,6 +5274,8 @@
5040
5274
  <xsl:apply-templates/>
5041
5275
  </fo:block>
5042
5276
  </xsl:template><xsl:template match="*[local-name() = 'image']">
5277
+ <xsl:variable name="isAdded" select="../@added"/>
5278
+ <xsl:variable name="isDeleted" select="../@deleted"/>
5043
5279
  <xsl:choose>
5044
5280
  <xsl:when test="ancestor::*[local-name() = 'title']">
5045
5281
  <fo:inline padding-left="1mm" padding-right="1mm">
@@ -5055,7 +5291,26 @@
5055
5291
  <xsl:variable name="src">
5056
5292
  <xsl:call-template name="image_src"/>
5057
5293
  </xsl:variable>
5058
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5294
+
5295
+ <xsl:choose>
5296
+ <xsl:when test="$isDeleted = 'true'">
5297
+ <!-- enclose in svg -->
5298
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
5299
+ <xsl:attribute name="width">100%</xsl:attribute>
5300
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5301
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5302
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5303
+
5304
+
5305
+ <xsl:apply-templates select="." mode="cross_image"/>
5306
+
5307
+ </fo:instream-foreign-object>
5308
+ </xsl:when>
5309
+ <xsl:otherwise>
5310
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5311
+ </xsl:otherwise>
5312
+ </xsl:choose>
5313
+
5059
5314
  </fo:block>
5060
5315
  </xsl:otherwise>
5061
5316
  </xsl:choose>
@@ -5071,21 +5326,70 @@
5071
5326
  <xsl:value-of select="@src"/>
5072
5327
  </xsl:otherwise>
5073
5328
  </xsl:choose>
5329
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
5330
+ <xsl:choose>
5331
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5332
+ <xsl:variable name="src">
5333
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5334
+ </xsl:variable>
5335
+ <xsl:variable name="width" select="document($src)/@width"/>
5336
+ <xsl:variable name="height" select="document($src)/@height"/>
5337
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5338
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
5339
+ </svg>
5340
+ </xsl:when>
5341
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5342
+ <xsl:variable name="src">
5343
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5344
+ </xsl:variable>
5345
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
5346
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
5347
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5348
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5349
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5350
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
5351
+ </svg>
5352
+ </xsl:when>
5353
+ <xsl:otherwise>
5354
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
5355
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
5356
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
5357
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
5358
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
5359
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5360
+ <!-- width=<xsl:value-of select="$width"/> -->
5361
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5362
+ <!-- height=<xsl:value-of select="$height"/> -->
5363
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
5364
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
5365
+ <xsl:call-template name="svg_cross">
5366
+ <xsl:with-param name="width" select="$width"/>
5367
+ <xsl:with-param name="height" select="$height"/>
5368
+ </xsl:call-template>
5369
+ </svg>
5370
+ </xsl:otherwise>
5371
+ </xsl:choose>
5372
+
5373
+ </xsl:template><xsl:template name="svg_cross">
5374
+ <xsl:param name="width"/>
5375
+ <xsl:param name="height"/>
5376
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
5377
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
5074
5378
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
5075
5379
  <xsl:apply-templates mode="contents"/>
5076
5380
  <xsl:text> </xsl:text>
5077
5381
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
5078
5382
  <xsl:apply-templates mode="bookmarks"/>
5079
5383
  <xsl:text> </xsl:text>
5080
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
5384
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="contents" priority="2">
5081
5385
  <xsl:value-of select="."/>
5082
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
5386
+ </xsl:template><xsl:template match="*[local-name() = 'figure' or local-name() = 'table' or local-name() = 'permission' or local-name() = 'recommendation' or local-name() = 'requirement']/*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
5083
5387
  <xsl:value-of select="."/>
5084
5388
  </xsl:template><xsl:template match="node()" mode="contents">
5085
5389
  <xsl:apply-templates mode="contents"/>
5086
5390
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5087
5391
  <xsl:apply-templates mode="bookmarks"/>
5088
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
5392
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5089
5393
  <xsl:apply-templates select="."/>
5090
5394
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5091
5395
  <xsl:apply-templates mode="bookmarks"/>
@@ -5233,6 +5537,7 @@
5233
5537
  <xsl:if test="normalize-space() != ''">
5234
5538
  <fo:block xsl:use-attribute-sets="figure-name-style">
5235
5539
 
5540
+
5236
5541
  <xsl:apply-templates/>
5237
5542
  </fo:block>
5238
5543
  </xsl:if>
@@ -5284,6 +5589,8 @@
5284
5589
  </fo:list-item-body>
5285
5590
  </fo:list-item>
5286
5591
  </fo:list-block>
5592
+ </xsl:template><xsl:template name="extractSection">
5593
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5287
5594
  </xsl:template><xsl:template name="extractTitle">
5288
5595
  <xsl:choose>
5289
5596
  <xsl:when test="*[local-name() = 'tab']">
@@ -5310,6 +5617,8 @@
5310
5617
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5311
5618
 
5312
5619
  <fo:block-container margin-left="0mm">
5620
+ <xsl:copy-of select="@id"/>
5621
+
5313
5622
  <xsl:if test="parent::*[local-name() = 'note']">
5314
5623
  <xsl:attribute name="margin-left">
5315
5624
  <xsl:choose>
@@ -5320,7 +5629,9 @@
5320
5629
 
5321
5630
  </xsl:if>
5322
5631
  <fo:block-container margin-left="0mm">
5323
-
5632
+
5633
+
5634
+
5324
5635
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5325
5636
  <xsl:variable name="_font-size">
5326
5637
 
@@ -5331,6 +5642,7 @@
5331
5642
 
5332
5643
 
5333
5644
 
5645
+
5334
5646
 
5335
5647
 
5336
5648
 
@@ -5348,10 +5660,14 @@
5348
5660
  </xsl:choose>
5349
5661
  </xsl:attribute>
5350
5662
  </xsl:if>
5351
- <xsl:apply-templates/>
5352
- </fo:block>
5663
+
5664
+ <xsl:apply-templates/>
5665
+ </fo:block>
5666
+
5667
+
5353
5668
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5354
5669
 
5670
+
5355
5671
  </fo:block-container>
5356
5672
  </fo:block-container>
5357
5673
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -5586,6 +5902,7 @@
5586
5902
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5587
5903
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5588
5904
 
5905
+
5589
5906
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5590
5907
 
5591
5908
  <xsl:variable name="element">
@@ -5613,6 +5930,7 @@
5613
5930
  <xsl:variable name="element">
5614
5931
 
5615
5932
  inline
5933
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5616
5934
  </xsl:variable>
5617
5935
  <xsl:choose>
5618
5936
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5620,7 +5938,7 @@
5620
5938
  <xsl:apply-templates/>
5621
5939
  </fo:inline>
5622
5940
  </xsl:when>
5623
- <xsl:when test="normalize-space($element) = 'block'">
5941
+ <xsl:when test="contains(normalize-space($element), 'block')">
5624
5942
  <fo:block xsl:use-attribute-sets="example-name-style">
5625
5943
  <xsl:apply-templates/>
5626
5944
  </fo:block>
@@ -5652,7 +5970,7 @@
5652
5970
  </fo:inline>
5653
5971
  </xsl:otherwise>
5654
5972
  </xsl:choose>
5655
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
5973
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
5656
5974
  <fo:block xsl:use-attribute-sets="termsource-style">
5657
5975
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
5658
5976
  <xsl:variable name="termsource_text">
@@ -5661,13 +5979,15 @@
5661
5979
 
5662
5980
  <xsl:choose>
5663
5981
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5664
- <xsl:apply-templates/>
5982
+ <!-- <xsl:apply-templates /> -->
5983
+ <xsl:copy-of select="$termsource_text"/>
5665
5984
  </xsl:when>
5666
5985
  <xsl:otherwise>
5667
5986
 
5668
5987
  <xsl:text>[</xsl:text>
5669
5988
 
5670
- <xsl:apply-templates/>
5989
+ <!-- <xsl:apply-templates /> -->
5990
+ <xsl:copy-of select="$termsource_text"/>
5671
5991
 
5672
5992
  <xsl:text>]</xsl:text>
5673
5993
 
@@ -5678,20 +5998,29 @@
5678
5998
  <xsl:if test="normalize-space() != ''">
5679
5999
  <xsl:value-of select="."/>
5680
6000
  </xsl:if>
5681
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
6001
+ </xsl:template><xsl:variable name="localized.source">
6002
+ <xsl:call-template name="getLocalizedString">
6003
+ <xsl:with-param name="key">source</xsl:with-param>
6004
+ </xsl:call-template>
6005
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5682
6006
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6007
+ <xsl:if test="normalize-space(@citeas) = ''">
6008
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6009
+ </xsl:if>
5683
6010
 
5684
6011
  <fo:inline>
5685
6012
 
5686
6013
 
5687
6014
 
5688
6015
 
6016
+
6017
+
5689
6018
  <xsl:call-template name="getTitle">
5690
6019
  <xsl:with-param name="name" select="'title-source'"/>
5691
6020
  </xsl:call-template>
6021
+ <xsl:text>: </xsl:text>
5692
6022
 
5693
6023
 
5694
- <xsl:text>: </xsl:text>
5695
6024
  </fo:inline>
5696
6025
 
5697
6026
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -5816,6 +6145,7 @@
5816
6145
 
5817
6146
 
5818
6147
 
6148
+
5819
6149
  </xsl:variable>
5820
6150
 
5821
6151
  <xsl:variable name="padding-right">
@@ -5841,7 +6171,8 @@
5841
6171
  </fo:inline>
5842
6172
  </xsl:when>
5843
6173
  <xsl:otherwise>
5844
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
6174
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
6175
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5845
6176
  </xsl:otherwise>
5846
6177
  </xsl:choose>
5847
6178
 
@@ -5895,7 +6226,6 @@
5895
6226
 
5896
6227
 
5897
6228
 
5898
-
5899
6229
  <xsl:apply-templates/>
5900
6230
  </fo:block>
5901
6231
 
@@ -5912,6 +6242,7 @@
5912
6242
  <xsl:call-template name="setId"/>
5913
6243
 
5914
6244
 
6245
+
5915
6246
  <xsl:apply-templates/>
5916
6247
  </fo:block>
5917
6248
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -5938,7 +6269,7 @@
5938
6269
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
5939
6270
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
5940
6271
  <xsl:choose>
5941
- <xsl:when test="parent::*[local-name() = 'note']">
6272
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
5942
6273
  <fo:block-container>
5943
6274
  <xsl:attribute name="margin-left">
5944
6275
  <xsl:choose>
@@ -5948,6 +6279,7 @@
5948
6279
  </xsl:attribute>
5949
6280
 
5950
6281
 
6282
+
5951
6283
  <fo:block-container margin-left="0mm">
5952
6284
  <fo:block>
5953
6285
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -6149,21 +6481,25 @@
6149
6481
 
6150
6482
 
6151
6483
 
6484
+
6485
+
6486
+
6487
+
6152
6488
  </xsl:template><xsl:template name="processBibitemDocId">
6153
6489
  <xsl:variable name="_doc_ident" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]"/>
6154
6490
  <xsl:choose>
6155
6491
  <xsl:when test="normalize-space($_doc_ident) != ''">
6156
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
6492
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or @type = 'ISBN' or @type = 'rfc-anchor')]/@type"/>
6157
6493
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
6158
6494
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6159
- </xsl:if>
6495
+ </xsl:if> -->
6160
6496
  <xsl:value-of select="$_doc_ident"/>
6161
6497
  </xsl:when>
6162
6498
  <xsl:otherwise>
6163
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6499
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6164
6500
  <xsl:if test="$type != ''">
6165
6501
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6166
- </xsl:if>
6502
+ </xsl:if> -->
6167
6503
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6168
6504
  </xsl:otherwise>
6169
6505
  </xsl:choose>
@@ -6205,6 +6541,70 @@
6205
6541
  <xsl:value-of select="substring(.,1,1)"/>
6206
6542
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
6207
6543
  <fo:inline><xsl:apply-templates/></fo:inline>
6544
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6545
+ <fo:block>
6546
+ <xsl:apply-templates/>
6547
+ </fo:block>
6548
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6549
+ <fo:inline><xsl:apply-templates/></fo:inline>
6550
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6551
+ <fo:inline>
6552
+ <xsl:call-template name="text_input"/>
6553
+ </fo:inline>
6554
+ </xsl:template><xsl:template name="text_input">
6555
+ <xsl:variable name="count">
6556
+ <xsl:choose>
6557
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6558
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6559
+ <xsl:otherwise>10</xsl:otherwise>
6560
+ </xsl:choose>
6561
+ </xsl:variable>
6562
+ <xsl:call-template name="repeat">
6563
+ <xsl:with-param name="char" select="'_'"/>
6564
+ <xsl:with-param name="count" select="$count"/>
6565
+ </xsl:call-template>
6566
+ <xsl:text> </xsl:text>
6567
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6568
+ <xsl:variable name="caption">
6569
+ <xsl:choose>
6570
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6571
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6572
+ </xsl:choose>
6573
+ </xsl:variable>
6574
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6575
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6576
+ <fo:inline padding-right="1mm">
6577
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6578
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6579
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6580
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6581
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6582
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6583
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6584
+ </svg>
6585
+ </fo:instream-foreign-object>
6586
+ </fo:inline>
6587
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6588
+ <fo:inline padding-right="1mm">
6589
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6590
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6591
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6592
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6593
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6594
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6595
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6596
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6597
+ </svg>
6598
+ </fo:instream-foreign-object>
6599
+ </fo:inline>
6600
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6601
+ <fo:inline>
6602
+ <xsl:call-template name="text_input"/>
6603
+ </fo:inline>
6604
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6605
+ <fo:block-container border="1pt solid black" width="50%">
6606
+ <fo:block> </fo:block>
6607
+ </fo:block-container>
6208
6608
  </xsl:template><xsl:template name="convertDate">
6209
6609
  <xsl:param name="date"/>
6210
6610
  <xsl:param name="format" select="'short'"/>
@@ -6412,6 +6812,9 @@
6412
6812
  <xsl:when test="parent::*[local-name() = 'preface']">
6413
6813
  <xsl:value-of select="$level_total - 1"/>
6414
6814
  </xsl:when>
6815
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
6816
+ <xsl:value-of select="$level_total - 1"/>
6817
+ </xsl:when>
6415
6818
  <xsl:when test="ancestor::*[local-name() = 'preface']">
6416
6819
  <xsl:value-of select="$level_total - 2"/>
6417
6820
  </xsl:when>
@@ -6468,6 +6871,7 @@
6468
6871
  <xsl:variable name="XSLNS">
6469
6872
 
6470
6873
 
6874
+
6471
6875
  <xsl:value-of select="document('')//*/namespace::iec"/>
6472
6876
 
6473
6877
 
@@ -6536,17 +6940,79 @@
6536
6940
  </xsl:call-template>
6537
6941
  </xsl:if>
6538
6942
  </xsl:template><xsl:template name="getLocalizedString">
6539
- <xsl:param name="key"/>
6943
+ <xsl:param name="key"/>
6540
6944
 
6541
6945
  <xsl:variable name="curr_lang">
6542
6946
  <xsl:call-template name="getLang"/>
6543
6947
  </xsl:variable>
6544
6948
 
6949
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
6950
+
6545
6951
  <xsl:choose>
6952
+ <xsl:when test="$data_value != ''">
6953
+ <xsl:value-of select="$data_value"/>
6954
+ </xsl:when>
6546
6955
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6547
6956
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6548
6957
  </xsl:when>
6549
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6958
+ <xsl:otherwise>
6959
+ <xsl:variable name="key_">
6960
+ <xsl:call-template name="capitalize">
6961
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
6962
+ </xsl:call-template>
6963
+ </xsl:variable>
6964
+ <xsl:value-of select="$key_"/>
6965
+ </xsl:otherwise>
6550
6966
  </xsl:choose>
6551
6967
 
6968
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6969
+ <xsl:param name="isAdded"/>
6970
+ <xsl:param name="isDeleted"/>
6971
+ <xsl:choose>
6972
+ <xsl:when test="local-name() = 'math'">
6973
+ <xsl:if test="$isAdded = 'true'">
6974
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6975
+ </xsl:if>
6976
+ <xsl:if test="$isDeleted = 'true'">
6977
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6978
+ </xsl:if>
6979
+ </xsl:when>
6980
+ <xsl:otherwise>
6981
+ <xsl:if test="$isAdded = 'true'">
6982
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6983
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6984
+ </xsl:if>
6985
+ <xsl:if test="$isDeleted = 'true'">
6986
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6987
+ <xsl:if test="local-name() = 'table'">
6988
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6989
+ </xsl:if>
6990
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6991
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6992
+ </xsl:if>
6993
+ </xsl:otherwise>
6994
+ </xsl:choose>
6995
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6996
+ <xsl:if test="$lang = 'ar'">
6997
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6998
+ </xsl:if>
6999
+ </xsl:template><xsl:template name="setAlignment">
7000
+ <xsl:param name="align" select="normalize-space(@align)"/>
7001
+ <xsl:choose>
7002
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
7003
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
7004
+ <xsl:when test="$align != ''">
7005
+ <xsl:value-of select="$align"/>
7006
+ </xsl:when>
7007
+ </xsl:choose>
7008
+ </xsl:template><xsl:template name="setTextAlignment">
7009
+ <xsl:param name="default">left</xsl:param>
7010
+ <xsl:attribute name="text-align">
7011
+ <xsl:choose>
7012
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
7013
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
7014
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
7015
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7016
+ </xsl:choose>
7017
+ </xsl:attribute>
6552
7018
  </xsl:template></xsl:stylesheet>