metanorma-iec 1.3.1 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -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"
@@ -20,8 +20,12 @@
20
20
 
21
21
 
22
22
  <xsl:variable name="debug">false</xsl:variable>
23
- <xsl:variable name="pageWidth" select="'210mm'"/>
24
- <xsl:variable name="pageHeight" select="'297mm'"/>
23
+ <xsl:variable name="pageWidth" select="210"/>
24
+ <xsl:variable name="pageHeight" select="297"/>
25
+ <xsl:variable name="marginLeftRight1" select="25"/>
26
+ <xsl:variable name="marginLeftRight2" select="25"/>
27
+ <xsl:variable name="marginTop" select="31"/>
28
+ <xsl:variable name="marginBottom" select="15"/>
25
29
 
26
30
  <xsl:variable name="copyrightText" select="concat('© ', //iec:iec-standard/iec:bibdata/iec:copyright/iec:owner/iec:organization/iec:abbreviation, ':', //iec:iec-standard/iec:bibdata/iec:copyright/iec:from)"/>
27
31
  <!-- <xsl:variable name="lang-1st-letter" select="concat('(', translate(substring(iec:iec-standard/iec:bibdata/iec:language,1,1),$lower, $upper), ')')"/> -->
@@ -160,14 +164,14 @@
160
164
  <fo:root font-family="Arial, Times New Roman, STIX Two Math, Source Han Sans" font-size="10pt" xml:lang="{$lang}">
161
165
  <fo:layout-master-set>
162
166
  <!-- cover pages -->
163
- <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
167
+ <fo:simple-page-master master-name="cover" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
164
168
  <fo:region-body margin-top="17.5mm" margin-bottom="12.5mm" margin-left="18mm" margin-right="20.5mm"/>
165
169
  <fo:region-before region-name="header" extent="17.5mm"/>
166
170
  <fo:region-after region-name="footer" extent="12.5mm" precedence="true"/>
167
171
  <fo:region-start region-name="left-region" extent="18mm"/>
168
172
  <fo:region-end region-name="right-region" extent="20.5mm"/>
169
173
  </fo:simple-page-master>
170
- <fo:simple-page-master master-name="cover_2nd" page-width="{$pageWidth}" page-height="{$pageHeight}">
174
+ <fo:simple-page-master master-name="cover_2nd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
171
175
  <fo:region-body margin-top="17.5mm" margin-bottom="12.5mm" margin-left="25mm" margin-right="25mm" column-count="2" column-gap="5mm"/>
172
176
  <fo:region-before region-name="header" extent="17.5mm"/>
173
177
  <fo:region-after region-name="footer" extent="12.5mm" precedence="true"/>
@@ -175,7 +179,7 @@
175
179
  <fo:region-end region-name="right-region" extent="25mm"/>
176
180
  </fo:simple-page-master>
177
181
 
178
- <fo:simple-page-master master-name="cover-FDIS" page-width="{$pageWidth}" page-height="{$pageHeight}">
182
+ <fo:simple-page-master master-name="cover-FDIS" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
179
183
  <fo:region-body margin-top="17.5mm" margin-bottom="29mm" margin-left="18mm" margin-right="19mm"/>
180
184
  <fo:region-before region-name="header" extent="17.5mm"/>
181
185
  <fo:region-after region-name="footer-FDIS" extent="29mm"/>
@@ -184,20 +188,20 @@
184
188
  </fo:simple-page-master>
185
189
 
186
190
  <!-- odd pages -->
187
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
188
- <fo:region-body margin-top="31mm" margin-bottom="15mm" margin-left="25mm" margin-right="25mm"/>
189
- <fo:region-before region-name="header-odd" extent="31mm"/>
190
- <fo:region-after region-name="footer" extent="15mm"/>
191
- <fo:region-start region-name="left-region" extent="25mm"/>
192
- <fo:region-end region-name="right-region" extent="25mm"/>
191
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
192
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
193
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
194
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
195
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
196
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
193
197
  </fo:simple-page-master>
194
198
  <!-- even pages -->
195
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
196
- <fo:region-body margin-top="31mm" margin-bottom="15mm" margin-left="25mm" margin-right="25mm"/>
197
- <fo:region-before region-name="header-even" extent="31mm"/>
198
- <fo:region-after region-name="footer" extent="15mm"/>
199
- <fo:region-start region-name="left-region" extent="25mm"/>
200
- <fo:region-end region-name="right-region" extent="25mm"/>
199
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
200
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
201
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
202
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
203
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
204
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
201
205
  </fo:simple-page-master>
202
206
  <fo:page-sequence-master master-name="document">
203
207
  <fo:repeatable-page-master-alternatives>
@@ -206,11 +210,11 @@
206
210
  </fo:repeatable-page-master-alternatives>
207
211
  </fo:page-sequence-master>
208
212
 
209
- <fo:simple-page-master master-name="blank-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
213
+ <fo:simple-page-master master-name="blank-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
210
214
  <fo:region-body margin-top="107mm" margin-bottom="0mm" margin-left="18mm" margin-right="0mm"/>
211
215
  </fo:simple-page-master>
212
216
 
213
- <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
217
+ <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
214
218
  <fo:region-body margin-top="107mm" margin-bottom="0mm" margin-left="18mm" margin-right="0mm" background-color="rgb(236, 236, 236)"/>
215
219
  <fo:region-before region-name="header" extent="107mm"/>
216
220
  <fo:region-start region-name="left-region" extent="18mm"/>
@@ -2611,6 +2615,9 @@
2611
2615
  <title-continued lang="en">(continued)</title-continued>
2612
2616
  <title-continued lang="fr">(continué)</title-continued>
2613
2617
 
2618
+ </xsl:variable><xsl:variable name="bibdata">
2619
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']"/>
2620
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'localized-strings']"/>
2614
2621
  </xsl:variable><xsl:variable name="tab_zh"> </xsl:variable><xsl:template name="getTitle">
2615
2622
  <xsl:param name="name"/>
2616
2623
  <xsl:param name="lang"/>
@@ -2641,6 +2648,8 @@
2641
2648
 
2642
2649
 
2643
2650
 
2651
+
2652
+
2644
2653
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2645
2654
  <xsl:attribute name="white-space">pre</xsl:attribute>
2646
2655
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
@@ -2689,7 +2698,7 @@
2689
2698
 
2690
2699
 
2691
2700
 
2692
-
2701
+
2693
2702
  </xsl:attribute-set><xsl:attribute-set name="example-style">
2694
2703
 
2695
2704
 
@@ -2702,6 +2711,7 @@
2702
2711
 
2703
2712
 
2704
2713
 
2714
+
2705
2715
  </xsl:attribute-set><xsl:attribute-set name="example-body-style">
2706
2716
 
2707
2717
 
@@ -2720,9 +2730,7 @@
2720
2730
 
2721
2731
 
2722
2732
 
2723
-
2724
-
2725
-
2733
+
2726
2734
 
2727
2735
 
2728
2736
 
@@ -2749,8 +2757,10 @@
2749
2757
 
2750
2758
 
2751
2759
 
2760
+
2752
2761
  </xsl:attribute-set><xsl:attribute-set name="table-name-style">
2753
2762
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2763
+
2754
2764
 
2755
2765
 
2756
2766
 
@@ -2768,6 +2778,9 @@
2768
2778
 
2769
2779
 
2770
2780
 
2781
+
2782
+ </xsl:attribute-set><xsl:attribute-set name="table-footer-cell-style">
2783
+
2771
2784
  </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2772
2785
 
2773
2786
 
@@ -2787,16 +2800,21 @@
2787
2800
 
2788
2801
 
2789
2802
 
2803
+
2804
+
2790
2805
  </xsl:attribute-set><xsl:attribute-set name="eref-style">
2791
2806
 
2792
2807
 
2793
2808
 
2794
2809
 
2810
+
2811
+
2795
2812
  </xsl:attribute-set><xsl:attribute-set name="note-style">
2796
2813
 
2797
2814
 
2798
2815
 
2799
2816
 
2817
+
2800
2818
  <xsl:attribute name="font-size">8pt</xsl:attribute>
2801
2819
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
2802
2820
  <xsl:attribute name="margin-bottom">9pt</xsl:attribute>
@@ -2811,11 +2829,13 @@
2811
2829
 
2812
2830
 
2813
2831
 
2832
+
2814
2833
  </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">
2815
2834
 
2816
2835
 
2817
2836
 
2818
2837
 
2838
+
2819
2839
  <xsl:attribute name="padding-right">6mm</xsl:attribute>
2820
2840
 
2821
2841
 
@@ -2845,6 +2865,7 @@
2845
2865
  </xsl:attribute-set><xsl:attribute-set name="termnote-style">
2846
2866
 
2847
2867
 
2868
+
2848
2869
  <xsl:attribute name="font-size">8pt</xsl:attribute>
2849
2870
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
2850
2871
  <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
@@ -2852,9 +2873,12 @@
2852
2873
 
2853
2874
 
2854
2875
 
2876
+
2855
2877
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2878
+
2856
2879
 
2857
2880
 
2881
+
2858
2882
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
2859
2883
 
2860
2884
 
@@ -2880,20 +2904,24 @@
2880
2904
  </xsl:attribute-set><xsl:attribute-set name="termsource-style">
2881
2905
 
2882
2906
 
2907
+
2883
2908
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
2884
2909
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
2885
2910
 
2886
2911
 
2887
2912
 
2888
2913
 
2914
+
2889
2915
  </xsl:attribute-set><xsl:attribute-set name="origin-style">
2890
2916
 
2891
2917
 
2892
2918
 
2919
+
2893
2920
  </xsl:attribute-set><xsl:attribute-set name="term-style">
2894
2921
 
2895
2922
  </xsl:attribute-set><xsl:attribute-set name="figure-name-style">
2896
2923
 
2924
+
2897
2925
 
2898
2926
 
2899
2927
 
@@ -2913,6 +2941,7 @@
2913
2941
 
2914
2942
 
2915
2943
 
2944
+
2916
2945
 
2917
2946
 
2918
2947
 
@@ -2926,12 +2955,14 @@
2926
2955
 
2927
2956
 
2928
2957
 
2958
+
2929
2959
  </xsl:attribute-set><xsl:attribute-set name="figure-pseudocode-p-style">
2930
2960
 
2931
2961
  </xsl:attribute-set><xsl:attribute-set name="image-graphic-style">
2932
2962
 
2933
2963
 
2934
2964
 
2965
+
2935
2966
  <xsl:attribute name="width">75%</xsl:attribute>
2936
2967
  <xsl:attribute name="content-height">scale-to-fit</xsl:attribute>
2937
2968
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -2956,17 +2987,20 @@
2956
2987
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2957
2988
 
2958
2989
 
2990
+
2959
2991
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2960
2992
 
2961
2993
  <xsl:attribute name="font-size">8pt</xsl:attribute>
2962
2994
  <xsl:attribute name="margin-top">5pt</xsl:attribute>
2963
2995
  <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
2964
2996
 
2997
+
2965
2998
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
2966
2999
 
2967
3000
 
2968
3001
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2969
3002
 
3003
+
2970
3004
  </xsl:attribute-set><xsl:variable name="color-added-text">
2971
3005
  <xsl:text>rgb(0, 255, 0)</xsl:text>
2972
3006
  </xsl:variable><xsl:attribute-set name="add-style">
@@ -2985,6 +3019,8 @@
2985
3019
  <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2986
3020
 
2987
3021
 
3022
+ </xsl:attribute-set><xsl:attribute-set name="list-style">
3023
+
2988
3024
  </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">
2989
3025
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2990
3026
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2995,14 +3031,15 @@
2995
3031
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
2996
3032
 
2997
3033
  <!-- Normative references -->
2998
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']" mode="contents"/>
3034
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true'] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][@normative='true']]" mode="contents"/>
2999
3035
  <!-- Terms and definitions -->
3000
3036
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='terms'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='terms']] | /*/*[local-name()='sections']/*[local-name()='definitions'] | /*/*[local-name()='sections']/*[local-name()='clause'][.//*[local-name()='definitions']]" mode="contents"/>
3001
3037
  <!-- Another main sections -->
3002
3038
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name() != 'terms' and local-name() != 'definitions' and not(@type='scope') and not(local-name() = 'clause' and .//*[local-name()='terms']) and not(local-name() = 'clause' and .//*[local-name()='definitions'])]" mode="contents"/>
3003
3039
  <xsl:apply-templates select="/*/*[local-name()='annex']" mode="contents"/>
3004
3040
  <!-- Bibliography -->
3005
- <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]" mode="contents"/>
3041
+ <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
3042
+
3006
3043
  </xsl:template><xsl:template name="processPrefaceSectionsDefault">
3007
3044
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
3008
3045
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
@@ -3038,11 +3075,11 @@
3038
3075
  <xsl:variable name="table">
3039
3076
 
3040
3077
  <xsl:variable name="simple-table">
3041
- <xsl:call-template name="getSimpleTable"/>
3078
+ <xsl:call-template name="getSimpleTable"/>
3042
3079
  </xsl:variable>
3043
3080
 
3044
3081
  <!-- <xsl:if test="$namespace = 'bipm'">
3045
- <fo:block>&#xA0;</fo:block>
3082
+ <fo:block>&#xA0;</fo:block>
3046
3083
  </xsl:if> -->
3047
3084
 
3048
3085
  <!-- $namespace = 'iso' or -->
@@ -3106,6 +3143,7 @@
3106
3143
 
3107
3144
 
3108
3145
 
3146
+
3109
3147
  <xsl:attribute name="font-size">8pt</xsl:attribute>
3110
3148
  <xsl:attribute name="space-after">12pt</xsl:attribute>
3111
3149
  <xsl:if test="ancestor::*[local-name() = 'preface']">
@@ -3123,6 +3161,8 @@
3123
3161
 
3124
3162
 
3125
3163
 
3164
+
3165
+
3126
3166
  <xsl:variable name="table_width">
3127
3167
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3128
3168
  100%
@@ -3138,6 +3178,7 @@
3138
3178
 
3139
3179
 
3140
3180
 
3181
+
3141
3182
  <attribute name="border">0.5pt solid black</attribute>
3142
3183
 
3143
3184
 
@@ -3148,6 +3189,7 @@
3148
3189
 
3149
3190
 
3150
3191
 
3192
+
3151
3193
  </xsl:variable>
3152
3194
 
3153
3195
 
@@ -3284,11 +3326,25 @@
3284
3326
  </xsl:choose>
3285
3327
 
3286
3328
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
3329
+ <xsl:param name="continued"/>
3287
3330
  <xsl:if test="normalize-space() != ''">
3288
3331
  <fo:block xsl:use-attribute-sets="table-name-style">
3289
3332
 
3290
3333
 
3291
- <xsl:apply-templates/>
3334
+
3335
+
3336
+
3337
+ <xsl:choose>
3338
+ <xsl:when test="$continued = 'true'">
3339
+ <!-- <xsl:if test="$namespace = 'bsi'"></xsl:if> -->
3340
+
3341
+ </xsl:when>
3342
+ <xsl:otherwise>
3343
+ <xsl:apply-templates/>
3344
+ </xsl:otherwise>
3345
+ </xsl:choose>
3346
+
3347
+
3292
3348
  </fo:block>
3293
3349
  </xsl:if>
3294
3350
  </xsl:template><xsl:template name="calculate-columns-numbers">
@@ -3425,21 +3481,22 @@
3425
3481
  <!-- font-weight="bold" -->
3426
3482
  <fo:table-header>
3427
3483
 
3484
+
3428
3485
  <xsl:apply-templates/>
3429
3486
  </fo:table-header>
3430
3487
  </xsl:template><xsl:template name="table-header-title">
3431
- <xsl:param name="cols-count"/>
3488
+ <xsl:param name="cols-count"/>
3432
3489
  <!-- row for title -->
3433
3490
  <fo:table-row>
3434
3491
  <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">
3435
- <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation"/>
3492
+
3493
+ <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
3494
+ <xsl:with-param name="continued">true</xsl:with-param>
3495
+ </xsl:apply-templates>
3436
3496
  <xsl:for-each select="ancestor::*[local-name()='table'][1]">
3437
3497
  <xsl:call-template name="fn_name_display"/>
3438
- </xsl:for-each>
3439
- <fo:block text-align="right" font-style="italic">
3440
- <xsl:text> </xsl:text>
3441
- <fo:retrieve-table-marker retrieve-class-name="table_continued"/>
3442
- </fo:block>
3498
+ </xsl:for-each>
3499
+
3443
3500
  </fo:table-cell>
3444
3501
  </fo:table-row>
3445
3502
  </xsl:template><xsl:template match="*[local-name()='thead']" mode="process_tbody">
@@ -3683,6 +3740,7 @@
3683
3740
 
3684
3741
 
3685
3742
 
3743
+
3686
3744
  <xsl:attribute name="border-top">solid black 0.5pt</xsl:attribute>
3687
3745
  <xsl:attribute name="border-bottom">solid black 0.5pt</xsl:attribute>
3688
3746
 
@@ -3699,6 +3757,10 @@
3699
3757
 
3700
3758
 
3701
3759
 
3760
+
3761
+
3762
+
3763
+
3702
3764
  <!-- <xsl:if test="$namespace = 'bipm'">
3703
3765
  <xsl:attribute name="height">8mm</xsl:attribute>
3704
3766
  </xsl:if> -->
@@ -3717,6 +3779,7 @@
3717
3779
  </xsl:choose>
3718
3780
  </xsl:attribute>
3719
3781
 
3782
+
3720
3783
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
3721
3784
 
3722
3785
 
@@ -3735,6 +3798,7 @@
3735
3798
 
3736
3799
 
3737
3800
 
3801
+
3738
3802
  <xsl:if test="$lang = 'ar'">
3739
3803
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3740
3804
  </xsl:if>
@@ -3783,6 +3847,8 @@
3783
3847
 
3784
3848
 
3785
3849
 
3850
+
3851
+
3786
3852
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3787
3853
  <xsl:attribute name="border">solid black 0</xsl:attribute>
3788
3854
  </xsl:if>
@@ -3800,6 +3866,9 @@
3800
3866
 
3801
3867
 
3802
3868
 
3869
+
3870
+
3871
+
3803
3872
  <xsl:if test=".//*[local-name() = 'table']">
3804
3873
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
3805
3874
  </xsl:if>
@@ -3832,6 +3901,7 @@
3832
3901
 
3833
3902
 
3834
3903
 
3904
+
3835
3905
  <fo:inline padding-right="2mm">
3836
3906
 
3837
3907
 
@@ -3874,6 +3944,7 @@
3874
3944
 
3875
3945
 
3876
3946
 
3947
+
3877
3948
  <xsl:attribute name="baseline-shift">30%</xsl:attribute>
3878
3949
  <xsl:attribute name="font-size">70%</xsl:attribute>
3879
3950
 
@@ -4028,6 +4099,8 @@
4028
4099
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
4029
4100
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
4030
4101
 
4102
+
4103
+
4031
4104
  <xsl:if test="ancestor::*[local-name()='td']">
4032
4105
  <xsl:attribute name="font-weight">normal</xsl:attribute>
4033
4106
  <!-- <xsl:attribute name="alignment-baseline">hanging</xsl:attribute> -->
@@ -4039,6 +4112,8 @@
4039
4112
 
4040
4113
 
4041
4114
 
4115
+
4116
+
4042
4117
  <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
4043
4118
 
4044
4119
 
@@ -4144,6 +4219,7 @@
4144
4219
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
4145
4220
 
4146
4221
 
4222
+
4147
4223
  <xsl:variable name="title-key">
4148
4224
 
4149
4225
 
@@ -4356,6 +4432,7 @@
4356
4432
 
4357
4433
  <fo:table-row>
4358
4434
 
4435
+
4359
4436
  <fo:table-cell>
4360
4437
 
4361
4438
  <fo:block margin-top="6pt">
@@ -4375,6 +4452,7 @@
4375
4452
 
4376
4453
 
4377
4454
 
4455
+
4378
4456
  <xsl:apply-templates/>
4379
4457
  <!-- <xsl:if test="$namespace = 'gb'">
4380
4458
  <xsl:if test="ancestor::*[local-name()='formula']">
@@ -4431,6 +4509,8 @@
4431
4509
 
4432
4510
  <xsl:apply-templates/>
4433
4511
  </fo:inline>
4512
+ </xsl:template><xsl:template match="*[local-name()='padding']">
4513
+ <fo:inline padding-right="{@value}"> </fo:inline>
4434
4514
  </xsl:template><xsl:template match="*[local-name()='sup']">
4435
4515
  <fo:inline font-size="80%" vertical-align="super">
4436
4516
  <xsl:apply-templates/>
@@ -4456,6 +4536,7 @@
4456
4536
 
4457
4537
 
4458
4538
 
4539
+
4459
4540
 
4460
4541
  </xsl:variable>
4461
4542
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -4837,11 +4918,15 @@
4837
4918
  </xsl:apply-templates>
4838
4919
  </xsl:template><xsl:template name="getLang">
4839
4920
  <xsl:variable name="language_current" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4921
+ <xsl:variable name="language_current_2" select="normalize-space(xalan:nodeset($bibdata)//*[local-name()='bibdata']//*[local-name()='language'][@current = 'true'])"/>
4840
4922
  <xsl:variable name="language">
4841
4923
  <xsl:choose>
4842
4924
  <xsl:when test="$language_current != ''">
4843
4925
  <xsl:value-of select="$language_current"/>
4844
4926
  </xsl:when>
4927
+ <xsl:when test="$language_current_2 != ''">
4928
+ <xsl:value-of select="$language_current_2"/>
4929
+ </xsl:when>
4845
4930
  <xsl:otherwise>
4846
4931
  <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
4847
4932
  </xsl:otherwise>
@@ -4915,9 +5000,27 @@
4915
5000
  <xsl:copy>
4916
5001
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4917
5002
  </xsl:copy>
4918
- <mathml:mspace width="0.5ex"/>
5003
+ <xsl:choose>
5004
+ <!-- if in msub, then don't add space -->
5005
+ <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
5006
+ <!-- if next char in digit, don't add space -->
5007
+ <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
5008
+ <xsl:otherwise>
5009
+ <mathml:mspace width="0.5ex"/>
5010
+ </xsl:otherwise>
5011
+ </xsl:choose>
4919
5012
  </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">
4920
5013
  <xsl:variable name="target">
5014
+ <xsl:choose>
5015
+ <xsl:when test="@updatetype = 'true'">
5016
+ <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
5017
+ </xsl:when>
5018
+ <xsl:otherwise>
5019
+ <xsl:value-of select="normalize-space(@target)"/>
5020
+ </xsl:otherwise>
5021
+ </xsl:choose>
5022
+ </xsl:variable>
5023
+ <xsl:variable name="target_text">
4921
5024
  <xsl:choose>
4922
5025
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
4923
5026
  <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
@@ -4933,20 +5036,22 @@
4933
5036
  <xsl:attribute name="color">blue</xsl:attribute>
4934
5037
  </xsl:if>
4935
5038
 
5039
+
5040
+
4936
5041
  <xsl:choose>
4937
- <xsl:when test="$target = ''">
5042
+ <xsl:when test="$target_text = ''">
4938
5043
  <xsl:apply-templates/>
4939
5044
  </xsl:when>
4940
5045
  <xsl:otherwise>
4941
- <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
5046
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
4942
5047
  <xsl:choose>
4943
5048
  <xsl:when test="normalize-space(.) = ''">
4944
- <!-- <xsl:value-of select="$target"/> -->
4945
5049
  <xsl:call-template name="add-zero-spaces-link-java">
4946
- <xsl:with-param name="text" select="$target"/>
5050
+ <xsl:with-param name="text" select="$target_text"/>
4947
5051
  </xsl:call-template>
4948
5052
  </xsl:when>
4949
5053
  <xsl:otherwise>
5054
+ <!-- output text from <link>text</link> -->
4950
5055
  <xsl:apply-templates/>
4951
5056
  </xsl:otherwise>
4952
5057
  </xsl:choose>
@@ -5058,6 +5163,7 @@
5058
5163
 
5059
5164
 
5060
5165
  <fo:inline xsl:use-attribute-sets="note-name-style">
5166
+
5061
5167
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5062
5168
  </fo:inline>
5063
5169
  <xsl:apply-templates/>
@@ -5083,7 +5189,9 @@
5083
5189
  </xsl:choose>
5084
5190
  </xsl:template><xsl:template match="*[local-name() = 'termnote']">
5085
5191
  <fo:block id="{@id}" xsl:use-attribute-sets="termnote-style">
5192
+
5086
5193
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5194
+
5087
5195
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5088
5196
  </fo:inline>
5089
5197
  <xsl:apply-templates/>
@@ -5157,13 +5265,17 @@
5157
5265
  </xsl:call-template>
5158
5266
 
5159
5267
  <fo:block>
5268
+
5160
5269
  <xsl:apply-templates/>
5161
5270
  </fo:block>
5162
5271
  <xsl:call-template name="fn_display_figure"/>
5163
5272
  <xsl:for-each select="*[local-name() = 'note']">
5164
5273
  <xsl:call-template name="note"/>
5165
5274
  </xsl:for-each>
5166
- <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5275
+
5276
+
5277
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5278
+
5167
5279
  </fo:block-container>
5168
5280
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']">
5169
5281
  <fo:block id="{@id}">
@@ -5276,21 +5388,249 @@
5276
5388
  <xsl:param name="height"/>
5277
5389
  <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; "/>
5278
5390
  <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; "/>
5391
+ </xsl:template><xsl:variable name="figure_name_height">14</xsl:variable><xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><xsl:variable name="image_dpi" select="96"/><xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/><xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/><xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
5392
+ <xsl:param name="name"/>
5393
+
5394
+ <xsl:variable name="svg_content">
5395
+ <xsl:apply-templates select="." mode="svg_update"/>
5396
+ </xsl:variable>
5397
+
5398
+ <xsl:variable name="alt-text">
5399
+ <xsl:choose>
5400
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
5401
+ <xsl:value-of select="../*[local-name() = 'name']"/>
5402
+ </xsl:when>
5403
+ <xsl:when test="normalize-space($name) != ''">
5404
+ <xsl:value-of select="$name"/>
5405
+ </xsl:when>
5406
+ <xsl:otherwise>Figure</xsl:otherwise>
5407
+ </xsl:choose>
5408
+ </xsl:variable>
5409
+
5410
+ <xsl:choose>
5411
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
5412
+ <fo:block>
5413
+ <xsl:variable name="width" select="@width"/>
5414
+ <xsl:variable name="height" select="@height"/>
5415
+
5416
+ <xsl:variable name="scale_x">
5417
+ <xsl:choose>
5418
+ <xsl:when test="$width &gt; $width_effective_px">
5419
+ <xsl:value-of select="$width_effective_px div $width"/>
5420
+ </xsl:when>
5421
+ <xsl:otherwise>1</xsl:otherwise>
5422
+ </xsl:choose>
5423
+ </xsl:variable>
5424
+
5425
+ <xsl:variable name="scale_y">
5426
+ <xsl:choose>
5427
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
5428
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
5429
+ </xsl:when>
5430
+ <xsl:otherwise>1</xsl:otherwise>
5431
+ </xsl:choose>
5432
+ </xsl:variable>
5433
+
5434
+ <xsl:variable name="scale">
5435
+ <xsl:choose>
5436
+ <xsl:when test="$scale_y != 1">
5437
+ <xsl:value-of select="$scale_x * $scale_y"/>
5438
+ </xsl:when>
5439
+ <xsl:otherwise>
5440
+ <xsl:value-of select="$scale_x"/>
5441
+ </xsl:otherwise>
5442
+ </xsl:choose>
5443
+ </xsl:variable>
5444
+
5445
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
5446
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
5447
+
5448
+ <fo:table table-layout="fixed" width="100%">
5449
+ <fo:table-column column-width="proportional-column-width(1)"/>
5450
+ <fo:table-column column-width="{$width_scale}px"/>
5451
+ <fo:table-column column-width="proportional-column-width(1)"/>
5452
+ <fo:table-body>
5453
+ <fo:table-row>
5454
+ <fo:table-cell column-number="2">
5455
+ <fo:block>
5456
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
5457
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
5458
+ <fo:block line-height="0" font-size="0">
5459
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
5460
+ <xsl:call-template name="bookmark"/>
5461
+ </xsl:for-each>
5462
+ </fo:block>
5463
+ </xsl:if>
5464
+ <fo:block text-depth="0" line-height="0" font-size="0">
5465
+
5466
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5467
+ <xsl:attribute name="width">100%</xsl:attribute>
5468
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5469
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5470
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5471
+
5472
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
5473
+ </fo:instream-foreign-object>
5474
+ </fo:block>
5475
+
5476
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
5477
+ <xsl:with-param name="scale" select="$scale"/>
5478
+ </xsl:apply-templates>
5479
+ </fo:block-container>
5480
+ </fo:block>
5481
+ </fo:table-cell>
5482
+ </fo:table-row>
5483
+ </fo:table-body>
5484
+ </fo:table>
5485
+ </fo:block>
5486
+
5487
+ </xsl:when>
5488
+ <xsl:otherwise>
5489
+ <fo:block xsl:use-attribute-sets="image-style">
5490
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
5491
+ <xsl:attribute name="width">100%</xsl:attribute>
5492
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5493
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5494
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
5495
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
5496
+ <!-- effective height / width = 1.48, 1.4 - with title -->
5497
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
5498
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
5499
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
5500
+ </xsl:if>
5501
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5502
+ <xsl:copy-of select="$svg_content"/>
5503
+ </fo:instream-foreign-object>
5504
+ </fo:block>
5505
+ </xsl:otherwise>
5506
+ </xsl:choose>
5507
+ </xsl:template><xsl:template match="@*|node()" mode="svg_update">
5508
+ <xsl:copy>
5509
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
5510
+ </xsl:copy>
5511
+ </xsl:template><xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
5512
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
5513
+ <xsl:value-of select="."/>
5514
+ </xsl:attribute>
5515
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
5516
+ <xsl:variable name="svg_content" select="document(@src)"/>
5517
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
5518
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
5519
+ <xsl:call-template name="image_svg">
5520
+ <xsl:with-param name="name" select="$name"/>
5521
+ </xsl:call-template>
5522
+ </xsl:for-each>
5523
+ </xsl:template><xsl:template match="@*|node()" mode="svg_remove_a">
5524
+ <xsl:copy>
5525
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
5526
+ </xsl:copy>
5527
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
5528
+ <xsl:apply-templates mode="svg_remove_a"/>
5529
+ </xsl:template><xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
5530
+ <xsl:param name="scale"/>
5531
+ <xsl:variable name="dest">
5532
+ <xsl:choose>
5533
+ <xsl:when test="starts-with(@href, '#')">
5534
+ <xsl:value-of select="substring-after(@href, '#')"/>
5535
+ </xsl:when>
5536
+ <xsl:otherwise>
5537
+ <xsl:value-of select="@href"/>
5538
+ </xsl:otherwise>
5539
+ </xsl:choose>
5540
+ </xsl:variable>
5541
+ <xsl:for-each select="./*[local-name() = 'rect']">
5542
+ <xsl:call-template name="insertSVGMapLink">
5543
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
5544
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
5545
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
5546
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
5547
+ <xsl:with-param name="dest" select="$dest"/>
5548
+ </xsl:call-template>
5549
+ </xsl:for-each>
5550
+
5551
+ <xsl:for-each select="./*[local-name() = 'polygon']">
5552
+ <xsl:variable name="points">
5553
+ <xsl:call-template name="split">
5554
+ <xsl:with-param name="pText" select="@points"/>
5555
+ </xsl:call-template>
5556
+ </xsl:variable>
5557
+ <xsl:variable name="x_coords">
5558
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
5559
+ <xsl:sort select="." data-type="number"/>
5560
+ <x><xsl:value-of select="."/></x>
5561
+ </xsl:for-each>
5562
+ </xsl:variable>
5563
+ <xsl:variable name="y_coords">
5564
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
5565
+ <xsl:sort select="." data-type="number"/>
5566
+ <y><xsl:value-of select="."/></y>
5567
+ </xsl:for-each>
5568
+ </xsl:variable>
5569
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
5570
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
5571
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
5572
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
5573
+ <xsl:call-template name="insertSVGMapLink">
5574
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
5575
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
5576
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
5577
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
5578
+ <xsl:with-param name="dest" select="$dest"/>
5579
+ </xsl:call-template>
5580
+ </xsl:for-each>
5581
+
5582
+ <xsl:for-each select="./*[local-name() = 'circle']">
5583
+ <xsl:call-template name="insertSVGMapLink">
5584
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
5585
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
5586
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
5587
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
5588
+ <xsl:with-param name="dest" select="$dest"/>
5589
+ </xsl:call-template>
5590
+ </xsl:for-each>
5591
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
5592
+ <xsl:call-template name="insertSVGMapLink">
5593
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
5594
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
5595
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
5596
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
5597
+ <xsl:with-param name="dest" select="$dest"/>
5598
+ </xsl:call-template>
5599
+ </xsl:for-each>
5600
+ </xsl:template><xsl:template name="insertSVGMapLink">
5601
+ <xsl:param name="left"/>
5602
+ <xsl:param name="top"/>
5603
+ <xsl:param name="width"/>
5604
+ <xsl:param name="height"/>
5605
+ <xsl:param name="dest"/>
5606
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
5607
+ <fo:block font-size="1pt">
5608
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
5609
+ <fo:inline-container inline-progression-dimension="100%">
5610
+ <fo:block-container height="{$height - 1}px" width="100%">
5611
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
5612
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
5613
+ </xsl:if> -->
5614
+ <fo:block> </fo:block></fo:block-container>
5615
+ </fo:inline-container>
5616
+ </fo:basic-link>
5617
+ </fo:block>
5618
+ </fo:block-container>
5279
5619
  </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">
5280
5620
  <xsl:apply-templates mode="contents"/>
5281
5621
  <xsl:text> </xsl:text>
5282
5622
  </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">
5283
5623
  <xsl:apply-templates mode="bookmarks"/>
5284
5624
  <xsl:text> </xsl:text>
5285
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
5625
+ </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">
5286
5626
  <xsl:value-of select="."/>
5287
- </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
5627
+ </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">
5288
5628
  <xsl:value-of select="."/>
5289
5629
  </xsl:template><xsl:template match="node()" mode="contents">
5290
5630
  <xsl:apply-templates mode="contents"/>
5291
5631
  </xsl:template><xsl:template match="node()" mode="bookmarks">
5292
5632
  <xsl:apply-templates mode="bookmarks"/>
5293
- </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
5633
+ </xsl:template><xsl:template match="*[local-name() = 'title' or local-name() = 'name']//*[local-name() = 'stem']" mode="contents">
5294
5634
  <xsl:apply-templates select="."/>
5295
5635
  </xsl:template><xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
5296
5636
  <xsl:apply-templates mode="bookmarks"/>
@@ -5304,28 +5644,39 @@
5304
5644
  <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
5305
5645
  <xsl:for-each select="xalan:nodeset($contents)/doc">
5306
5646
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
5647
+ <xsl:if test="@bundle = 'true'">
5648
+ <xsl:attribute name="internal-destination"><xsl:value-of select="@firstpage_id"/></xsl:attribute>
5649
+ </xsl:if>
5307
5650
  <fo:bookmark-title>
5308
- <xsl:variable name="bookmark-title_">
5309
- <xsl:call-template name="getLangVersion">
5310
- <xsl:with-param name="lang" select="@lang"/>
5311
- <xsl:with-param name="doctype" select="@doctype"/>
5312
- <xsl:with-param name="title" select="@title-part"/>
5313
- </xsl:call-template>
5314
- </xsl:variable>
5315
5651
  <xsl:choose>
5316
- <xsl:when test="normalize-space($bookmark-title_) != ''">
5317
- <xsl:value-of select="normalize-space($bookmark-title_)"/>
5318
- </xsl:when>
5319
- <xsl:otherwise>
5652
+ <xsl:when test="not(normalize-space(@bundle) = 'true')"> <!-- 'bundle' means several different documents (not language versions) in one xml -->
5653
+ <xsl:variable name="bookmark-title_">
5654
+ <xsl:call-template name="getLangVersion">
5655
+ <xsl:with-param name="lang" select="@lang"/>
5656
+ <xsl:with-param name="doctype" select="@doctype"/>
5657
+ <xsl:with-param name="title" select="@title-part"/>
5658
+ </xsl:call-template>
5659
+ </xsl:variable>
5320
5660
  <xsl:choose>
5321
- <xsl:when test="@lang = 'en'">English</xsl:when>
5322
- <xsl:when test="@lang = 'fr'">Français</xsl:when>
5323
- <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5324
- <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5661
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
5662
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
5663
+ </xsl:when>
5664
+ <xsl:otherwise>
5665
+ <xsl:choose>
5666
+ <xsl:when test="@lang = 'en'">English</xsl:when>
5667
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
5668
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
5669
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
5670
+ </xsl:choose>
5671
+ </xsl:otherwise>
5325
5672
  </xsl:choose>
5673
+ </xsl:when>
5674
+ <xsl:otherwise>
5675
+ <xsl:value-of select="@title-part"/>
5326
5676
  </xsl:otherwise>
5327
5677
  </xsl:choose>
5328
5678
  </fo:bookmark-title>
5679
+
5329
5680
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
5330
5681
 
5331
5682
  <xsl:call-template name="insertFigureBookmarks">
@@ -5424,20 +5775,28 @@
5424
5775
  <xsl:otherwise><xsl:value-of select="$lang"/> version</xsl:otherwise>
5425
5776
  </xsl:choose>
5426
5777
  </xsl:template><xsl:template match="item" mode="bookmark">
5427
- <fo:bookmark internal-destination="{@id}" starting-state="hide">
5428
- <fo:bookmark-title>
5429
- <xsl:if test="@section != ''">
5430
- <xsl:value-of select="@section"/>
5431
- <xsl:text> </xsl:text>
5432
- </xsl:if>
5433
- <xsl:value-of select="normalize-space(title)"/>
5434
- </fo:bookmark-title>
5435
- <xsl:apply-templates mode="bookmark"/>
5436
- </fo:bookmark>
5778
+ <xsl:choose>
5779
+ <xsl:when test="@id != ''">
5780
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
5781
+ <fo:bookmark-title>
5782
+ <xsl:if test="@section != ''">
5783
+ <xsl:value-of select="@section"/>
5784
+ <xsl:text> </xsl:text>
5785
+ </xsl:if>
5786
+ <xsl:value-of select="normalize-space(title)"/>
5787
+ </fo:bookmark-title>
5788
+ <xsl:apply-templates mode="bookmark"/>
5789
+ </fo:bookmark>
5790
+ </xsl:when>
5791
+ <xsl:otherwise>
5792
+ <xsl:apply-templates mode="bookmark"/>
5793
+ </xsl:otherwise>
5794
+ </xsl:choose>
5437
5795
  </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
5438
5796
  <xsl:if test="normalize-space() != ''">
5439
5797
  <fo:block xsl:use-attribute-sets="figure-name-style">
5440
5798
 
5799
+
5441
5800
  <xsl:apply-templates/>
5442
5801
  </fo:block>
5443
5802
  </xsl:if>
@@ -5489,6 +5848,8 @@
5489
5848
  </fo:list-item-body>
5490
5849
  </fo:list-item>
5491
5850
  </fo:list-block>
5851
+ </xsl:template><xsl:template name="extractSection">
5852
+ <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
5492
5853
  </xsl:template><xsl:template name="extractTitle">
5493
5854
  <xsl:choose>
5494
5855
  <xsl:when test="*[local-name() = 'tab']">
@@ -5515,6 +5876,8 @@
5515
5876
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
5516
5877
 
5517
5878
  <fo:block-container margin-left="0mm">
5879
+ <xsl:copy-of select="@id"/>
5880
+
5518
5881
  <xsl:if test="parent::*[local-name() = 'note']">
5519
5882
  <xsl:attribute name="margin-left">
5520
5883
  <xsl:choose>
@@ -5525,7 +5888,9 @@
5525
5888
 
5526
5889
  </xsl:if>
5527
5890
  <fo:block-container margin-left="0mm">
5528
-
5891
+
5892
+
5893
+
5529
5894
  <fo:block xsl:use-attribute-sets="sourcecode-style">
5530
5895
  <xsl:variable name="_font-size">
5531
5896
 
@@ -5536,6 +5901,7 @@
5536
5901
 
5537
5902
 
5538
5903
 
5904
+
5539
5905
 
5540
5906
 
5541
5907
 
@@ -5553,10 +5919,14 @@
5553
5919
  </xsl:choose>
5554
5920
  </xsl:attribute>
5555
5921
  </xsl:if>
5556
- <xsl:apply-templates/>
5557
- </fo:block>
5922
+
5923
+ <xsl:apply-templates/>
5924
+ </fo:block>
5925
+
5926
+
5558
5927
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5559
5928
 
5929
+
5560
5930
  </fo:block-container>
5561
5931
  </fo:block-container>
5562
5932
  </xsl:template><xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -5791,6 +6161,7 @@
5791
6161
  </xsl:template><xsl:template match="*[local-name() = 'example']">
5792
6162
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
5793
6163
 
6164
+
5794
6165
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5795
6166
 
5796
6167
  <xsl:variable name="element">
@@ -5858,7 +6229,7 @@
5858
6229
  </fo:inline>
5859
6230
  </xsl:otherwise>
5860
6231
  </xsl:choose>
5861
- </xsl:template><xsl:template match="*[local-name() = 'termsource']">
6232
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']" name="termsource">
5862
6233
  <fo:block xsl:use-attribute-sets="termsource-style">
5863
6234
  <!-- Example: [SOURCE: ISO 5127:2017, 3.1.6.02] -->
5864
6235
  <xsl:variable name="termsource_text">
@@ -5867,13 +6238,15 @@
5867
6238
 
5868
6239
  <xsl:choose>
5869
6240
  <xsl:when test="starts-with(normalize-space($termsource_text), '[')">
5870
- <xsl:apply-templates/>
6241
+ <!-- <xsl:apply-templates /> -->
6242
+ <xsl:copy-of select="$termsource_text"/>
5871
6243
  </xsl:when>
5872
6244
  <xsl:otherwise>
5873
6245
 
5874
6246
  <xsl:text>[</xsl:text>
5875
6247
 
5876
- <xsl:apply-templates/>
6248
+ <!-- <xsl:apply-templates /> -->
6249
+ <xsl:copy-of select="$termsource_text"/>
5877
6250
 
5878
6251
  <xsl:text>]</xsl:text>
5879
6252
 
@@ -5884,20 +6257,29 @@
5884
6257
  <xsl:if test="normalize-space() != ''">
5885
6258
  <xsl:value-of select="."/>
5886
6259
  </xsl:if>
5887
- </xsl:template><xsl:template match="*[local-name() = 'origin']">
6260
+ </xsl:template><xsl:variable name="localized.source">
6261
+ <xsl:call-template name="getLocalizedString">
6262
+ <xsl:with-param name="key">source</xsl:with-param>
6263
+ </xsl:call-template>
6264
+ </xsl:variable><xsl:template match="*[local-name() = 'origin']">
5888
6265
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6266
+ <xsl:if test="normalize-space(@citeas) = ''">
6267
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
6268
+ </xsl:if>
5889
6269
 
5890
6270
  <fo:inline>
5891
6271
 
5892
6272
 
5893
6273
 
5894
6274
 
6275
+
6276
+
5895
6277
  <xsl:call-template name="getTitle">
5896
6278
  <xsl:with-param name="name" select="'title-source'"/>
5897
6279
  </xsl:call-template>
6280
+ <xsl:text>: </xsl:text>
5898
6281
 
5899
6282
 
5900
- <xsl:text>: </xsl:text>
5901
6283
  </fo:inline>
5902
6284
 
5903
6285
  <fo:inline xsl:use-attribute-sets="origin-style">
@@ -5970,6 +6352,7 @@
5970
6352
  </xsl:if>
5971
6353
 
5972
6354
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6355
+
5973
6356
  <xsl:if test="normalize-space(@citeas) = ''">
5974
6357
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5975
6358
  </xsl:if>
@@ -6022,6 +6405,7 @@
6022
6405
 
6023
6406
 
6024
6407
 
6408
+
6025
6409
  </xsl:variable>
6026
6410
 
6027
6411
  <xsl:variable name="padding-right">
@@ -6102,7 +6486,6 @@
6102
6486
 
6103
6487
 
6104
6488
 
6105
-
6106
6489
  <xsl:apply-templates/>
6107
6490
  </fo:block>
6108
6491
 
@@ -6119,6 +6502,7 @@
6119
6502
  <xsl:call-template name="setId"/>
6120
6503
 
6121
6504
 
6505
+
6122
6506
  <xsl:apply-templates/>
6123
6507
  </fo:block>
6124
6508
  </xsl:template><xsl:template match="*[local-name() = 'definitions']">
@@ -6145,7 +6529,7 @@
6145
6529
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
6146
6530
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
6147
6531
  <xsl:choose>
6148
- <xsl:when test="parent::*[local-name() = 'note']">
6532
+ <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
6149
6533
  <fo:block-container>
6150
6534
  <xsl:attribute name="margin-left">
6151
6535
  <xsl:choose>
@@ -6155,6 +6539,7 @@
6155
6539
  </xsl:attribute>
6156
6540
 
6157
6541
 
6542
+
6158
6543
  <fo:block-container margin-left="0mm">
6159
6544
  <fo:block>
6160
6545
  <xsl:apply-templates select="." mode="ul_ol"/>
@@ -6356,21 +6741,25 @@
6356
6741
 
6357
6742
 
6358
6743
 
6744
+
6745
+
6746
+
6747
+
6359
6748
  </xsl:template><xsl:template name="processBibitemDocId">
6360
6749
  <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')]"/>
6361
6750
  <xsl:choose>
6362
6751
  <xsl:when test="normalize-space($_doc_ident) != ''">
6363
- <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"/>
6752
+ <!-- <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"/>
6364
6753
  <xsl:if test="$type != '' and not(contains($_doc_ident, $type))">
6365
6754
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6366
- </xsl:if>
6755
+ </xsl:if> -->
6367
6756
  <xsl:value-of select="$_doc_ident"/>
6368
6757
  </xsl:when>
6369
6758
  <xsl:otherwise>
6370
- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6759
+ <!-- <xsl:variable name="type" select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]/@type"/>
6371
6760
  <xsl:if test="$type != ''">
6372
6761
  <xsl:value-of select="$type"/><xsl:text> </xsl:text>
6373
- </xsl:if>
6762
+ </xsl:if> -->
6374
6763
  <xsl:value-of select="*[local-name() = 'docidentifier'][not(@type = 'metanorma')]"/>
6375
6764
  </xsl:otherwise>
6376
6765
  </xsl:choose>
@@ -6412,6 +6801,70 @@
6412
6801
  <xsl:value-of select="substring(.,1,1)"/>
6413
6802
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
6414
6803
  <fo:inline><xsl:apply-templates/></fo:inline>
6804
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6805
+ <fo:block>
6806
+ <xsl:apply-templates/>
6807
+ </fo:block>
6808
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6809
+ <fo:inline><xsl:apply-templates/></fo:inline>
6810
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6811
+ <fo:inline>
6812
+ <xsl:call-template name="text_input"/>
6813
+ </fo:inline>
6814
+ </xsl:template><xsl:template name="text_input">
6815
+ <xsl:variable name="count">
6816
+ <xsl:choose>
6817
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6818
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6819
+ <xsl:otherwise>10</xsl:otherwise>
6820
+ </xsl:choose>
6821
+ </xsl:variable>
6822
+ <xsl:call-template name="repeat">
6823
+ <xsl:with-param name="char" select="'_'"/>
6824
+ <xsl:with-param name="count" select="$count"/>
6825
+ </xsl:call-template>
6826
+ <xsl:text> </xsl:text>
6827
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6828
+ <xsl:variable name="caption">
6829
+ <xsl:choose>
6830
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6831
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6832
+ </xsl:choose>
6833
+ </xsl:variable>
6834
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6835
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6836
+ <fo:inline padding-right="1mm">
6837
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6838
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6839
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6840
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6841
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6842
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6843
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6844
+ </svg>
6845
+ </fo:instream-foreign-object>
6846
+ </fo:inline>
6847
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6848
+ <fo:inline padding-right="1mm">
6849
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6850
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6851
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6852
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6853
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6854
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6855
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6856
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6857
+ </svg>
6858
+ </fo:instream-foreign-object>
6859
+ </fo:inline>
6860
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6861
+ <fo:inline>
6862
+ <xsl:call-template name="text_input"/>
6863
+ </fo:inline>
6864
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6865
+ <fo:block-container border="1pt solid black" width="50%">
6866
+ <fo:block> </fo:block>
6867
+ </fo:block-container>
6415
6868
  </xsl:template><xsl:template name="convertDate">
6416
6869
  <xsl:param name="date"/>
6417
6870
  <xsl:param name="format" select="'short'"/>
@@ -6619,6 +7072,9 @@
6619
7072
  <xsl:when test="parent::*[local-name() = 'preface']">
6620
7073
  <xsl:value-of select="$level_total - 1"/>
6621
7074
  </xsl:when>
7075
+ <xsl:when test="ancestor::*[local-name() = 'preface'] and not(ancestor::*[local-name() = 'foreword']) and not(ancestor::*[local-name() = 'introduction'])"> <!-- for preface/clause -->
7076
+ <xsl:value-of select="$level_total - 1"/>
7077
+ </xsl:when>
6622
7078
  <xsl:when test="ancestor::*[local-name() = 'preface']">
6623
7079
  <xsl:value-of select="$level_total - 2"/>
6624
7080
  </xsl:when>
@@ -6675,6 +7131,7 @@
6675
7131
  <xsl:variable name="XSLNS">
6676
7132
 
6677
7133
 
7134
+
6678
7135
  <xsl:value-of select="document('')//*/namespace::iec"/>
6679
7136
 
6680
7137
 
@@ -6743,17 +7200,29 @@
6743
7200
  </xsl:call-template>
6744
7201
  </xsl:if>
6745
7202
  </xsl:template><xsl:template name="getLocalizedString">
6746
- <xsl:param name="key"/>
7203
+ <xsl:param name="key"/>
6747
7204
 
6748
7205
  <xsl:variable name="curr_lang">
6749
7206
  <xsl:call-template name="getLang"/>
6750
7207
  </xsl:variable>
6751
7208
 
7209
+ <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
7210
+
6752
7211
  <xsl:choose>
7212
+ <xsl:when test="$data_value != ''">
7213
+ <xsl:value-of select="$data_value"/>
7214
+ </xsl:when>
6753
7215
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
6754
7216
  <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6755
7217
  </xsl:when>
6756
- <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
7218
+ <xsl:otherwise>
7219
+ <xsl:variable name="key_">
7220
+ <xsl:call-template name="capitalize">
7221
+ <xsl:with-param name="str" select="translate($key, '_', ' ')"/>
7222
+ </xsl:call-template>
7223
+ </xsl:variable>
7224
+ <xsl:value-of select="$key_"/>
7225
+ </xsl:otherwise>
6757
7226
  </xsl:choose>
6758
7227
 
6759
7228
  </xsl:template><xsl:template name="setTrackChangesStyles">
@@ -6796,4 +7265,14 @@
6796
7265
  <xsl:value-of select="$align"/>
6797
7266
  </xsl:when>
6798
7267
  </xsl:choose>
7268
+ </xsl:template><xsl:template name="setTextAlignment">
7269
+ <xsl:param name="default">left</xsl:param>
7270
+ <xsl:attribute name="text-align">
7271
+ <xsl:choose>
7272
+ <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
7273
+ <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
7274
+ <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
7275
+ <xsl:otherwise><xsl:value-of select="$default"/></xsl:otherwise>
7276
+ </xsl:choose>
7277
+ </xsl:attribute>
6799
7278
  </xsl:template></xsl:stylesheet>