metanorma-iec 1.2.15 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +9 -32
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +7 -1
  5. data/lib/asciidoctor/iec/biblio.rng +4 -6
  6. data/lib/asciidoctor/iec/front.rb +11 -5
  7. data/lib/asciidoctor/iec/iec.rng +5 -0
  8. data/lib/asciidoctor/iec/iec_intro_en.xml +1 -1
  9. data/lib/asciidoctor/iec/isodoc.rng +327 -2
  10. data/lib/asciidoctor/iec/isostandard.rng +12 -97
  11. data/lib/isodoc/iec/html/htmlstyle.css +7 -0
  12. data/lib/isodoc/iec/html_convert.rb +0 -1
  13. data/lib/isodoc/iec/iec.international-standard.xsl +643 -125
  14. data/lib/metanorma/iec/version.rb +1 -1
  15. data/metanorma-iec.gemspec +6 -6
  16. data/spec/asciidoctor/base_spec.rb +1035 -0
  17. data/spec/{asciidoctor-iec → asciidoctor}/blocks_spec.rb +0 -0
  18. data/spec/{asciidoctor-iec → asciidoctor}/cleanup_spec.rb +0 -0
  19. data/spec/{asciidoctor-iec → asciidoctor}/iev_spec.rb +0 -0
  20. data/spec/{asciidoctor-iec → asciidoctor}/inline_spec.rb +0 -0
  21. data/spec/{asciidoctor-iec → asciidoctor}/lists_spec.rb +0 -0
  22. data/spec/{asciidoctor-iec → asciidoctor}/section_spec.rb +0 -38
  23. data/spec/{asciidoctor-iec → asciidoctor}/validate_spec.rb +0 -0
  24. data/spec/isodoc/postproc_spec.rb +2 -20
  25. metadata +50 -59
  26. data/spec/asciidoctor-iec/base_spec.rb +0 -1045
  27. data/spec/examples/rice.adoc +0 -723
  28. data/spec/examples/rice.doc +0 -19162
  29. data/spec/examples/rice.html +0 -1787
  30. data/spec/examples/rice.xml +0 -1951
  31. data/spec/examples/rice_img/rice_image1.png +0 -0
  32. data/spec/examples/rice_img/rice_image2.png +0 -0
  33. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  34. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  35. data/spec/examples/rice_img/rice_image3_3.png +0 -0
@@ -79,19 +79,6 @@
79
79
  </choice>
80
80
  </element>
81
81
  </define>
82
- <define name="ul">
83
- <element name="ul">
84
- <attribute name="id">
85
- <data type="ID"/>
86
- </attribute>
87
- <oneOrMore>
88
- <ref name="ul_li"/>
89
- </oneOrMore>
90
- <zeroOrMore>
91
- <ref name="note"/>
92
- </zeroOrMore>
93
- </element>
94
- </define>
95
82
  <define name="sections">
96
83
  <element name="sections">
97
84
  <zeroOrMore>
@@ -192,17 +179,6 @@
192
179
  </zeroOrMore>
193
180
  </element>
194
181
  </define>
195
- <define name="definition">
196
- <element name="definition">
197
- <oneOrMore>
198
- <choice>
199
- <ref name="paragraph"/>
200
- <ref name="figure"/>
201
- <ref name="formula"/>
202
- </choice>
203
- </oneOrMore>
204
- </element>
205
- </define>
206
182
  <define name="annex">
207
183
  <element name="annex">
208
184
  <optional>
@@ -280,6 +256,7 @@
280
256
  <value>guide</value>
281
257
  <value>amendment</value>
282
258
  <value>technical-corrigendum</value>
259
+ <value>directive</value>
283
260
  </choice>
284
261
  </define>
285
262
  <define name="structuredidentifier">
@@ -333,6 +310,11 @@
333
310
  <optional>
334
311
  <attribute name="script"/>
335
312
  </optional>
313
+ <optional>
314
+ <attribute name="inline-header">
315
+ <data type="boolean"/>
316
+ </attribute>
317
+ </optional>
336
318
  <optional>
337
319
  <attribute name="obligation">
338
320
  <choice>
@@ -341,6 +323,12 @@
341
323
  </choice>
342
324
  </attribute>
343
325
  </optional>
326
+ <optional>
327
+ <attribute name="number"/>
328
+ </optional>
329
+ <optional>
330
+ <attribute name="type"/>
331
+ </optional>
344
332
  <optional>
345
333
  <ref name="section-title"/>
346
334
  </optional>
@@ -358,57 +346,6 @@
358
346
  </oneOrMore>
359
347
  </choice>
360
348
  </define>
361
- <define name="table">
362
- <element name="table">
363
- <attribute name="id">
364
- <data type="ID"/>
365
- </attribute>
366
- <optional>
367
- <attribute name="width"/>
368
- </optional>
369
- <optional>
370
- <attribute name="unnumbered">
371
- <data type="boolean"/>
372
- </attribute>
373
- </optional>
374
- <optional>
375
- <attribute name="number"/>
376
- </optional>
377
- <optional>
378
- <attribute name="subsequence"/>
379
- </optional>
380
- <optional>
381
- <attribute name="alt"/>
382
- </optional>
383
- <optional>
384
- <attribute name="summary"/>
385
- </optional>
386
- <optional>
387
- <attribute name="uri">
388
- <data type="anyURI"/>
389
- </attribute>
390
- </optional>
391
- <optional>
392
- <ref name="colgroup"/>
393
- </optional>
394
- <optional>
395
- <ref name="tname"/>
396
- </optional>
397
- <optional>
398
- <ref name="thead"/>
399
- </optional>
400
- <ref name="tbody"/>
401
- <optional>
402
- <ref name="tfoot"/>
403
- </optional>
404
- <zeroOrMore>
405
- <ref name="table-note"/>
406
- </zeroOrMore>
407
- <optional>
408
- <ref name="dl"/>
409
- </optional>
410
- </element>
411
- </define>
412
349
  </include>
413
350
  <!-- end overrides -->
414
351
  <!--
@@ -533,28 +470,6 @@
533
470
  <ref name="Clause-Section"/>
534
471
  </element>
535
472
  </define>
536
- <define name="ul_li">
537
- <element name="li">
538
- <optional>
539
- <attribute name="id">
540
- <data type="ID"/>
541
- </attribute>
542
- </optional>
543
- <optional>
544
- <attribute name="uncheckedcheckbox">
545
- <data type="boolean"/>
546
- </attribute>
547
- </optional>
548
- <optional>
549
- <attribute name="checkedcheckbox">
550
- <data type="boolean"/>
551
- </attribute>
552
- </optional>
553
- <oneOrMore>
554
- <ref name="BasicBlock"/>
555
- </oneOrMore>
556
- </element>
557
- </define>
558
473
  <define name="stagename">
559
474
  <element name="stagename">
560
475
  <text/>
@@ -115,6 +115,13 @@ a.FootnoteRef + a.FootnoteRef:before {
115
115
  content: ", ";
116
116
  vertical-align: super; }
117
117
 
118
+ .addition {
119
+ color: blue; }
120
+
121
+ .deletion {
122
+ color: red;
123
+ text-decoration: line-through; }
124
+
118
125
  #standard-band {
119
126
  background-color: #0AC442; }
120
127
 
@@ -27,7 +27,6 @@ module IsoDoc
27
27
  htmlstylesheet: html_doc_path("htmlstyle.scss"),
28
28
  htmlcoverpage: html_doc_path("html_iec_titlepage.html"),
29
29
  htmlintropage: html_doc_path("html_iec_intro.html"),
30
- scripts: html_doc_path("scripts.html"),
31
30
  }
32
31
  end
33
32
 
@@ -3,7 +3,9 @@
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
+ <xsl:param name="basepath"/>
7
9
 
8
10
 
9
11
 
@@ -215,7 +217,9 @@
215
217
  </fo:simple-page-master>
216
218
  </fo:layout-master-set>
217
219
 
218
- <xsl:call-template name="addPDFUAmeta"/>
220
+ <fo:declarations>
221
+ <xsl:call-template name="addPDFUAmeta"/>
222
+ </fo:declarations>
219
223
 
220
224
  <xsl:call-template name="addBookmarks">
221
225
  <xsl:with-param name="contents" select="$contents"/>
@@ -2632,6 +2636,7 @@
2632
2636
  </xsl:choose>
2633
2637
  </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">
2634
2638
 
2639
+
2635
2640
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2636
2641
 
2637
2642
 
@@ -2736,6 +2741,7 @@
2736
2741
 
2737
2742
 
2738
2743
 
2744
+
2739
2745
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
2740
2746
 
2741
2747
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -2949,7 +2955,7 @@
2949
2955
 
2950
2956
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2951
2957
 
2952
-
2958
+
2953
2959
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2954
2960
 
2955
2961
  <xsl:attribute name="font-size">8pt</xsl:attribute>
@@ -2961,7 +2967,25 @@
2961
2967
 
2962
2968
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2963
2969
 
2964
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2970
+ </xsl:attribute-set><xsl:variable name="color-added-text">
2971
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
2972
+ </xsl:variable><xsl:attribute-set name="add-style">
2973
+ <xsl:attribute name="color">red</xsl:attribute>
2974
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2975
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
2976
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
2977
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
2978
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
2979
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
2980
+ <xsl:text>red</xsl:text>
2981
+ </xsl:variable><xsl:attribute-set name="del-style">
2982
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
2983
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2984
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
2985
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
2986
+
2987
+
2988
+ </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">
2965
2989
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2966
2990
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2967
2991
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -3006,16 +3030,17 @@
3006
3030
  <xsl:call-template name="add-zero-spaces-java"/>
3007
3031
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3008
3032
 
3033
+ <xsl:variable name="table-preamble">
3034
+
3035
+
3036
+ </xsl:variable>
3037
+
3009
3038
  <xsl:variable name="table">
3010
3039
 
3011
3040
  <xsl:variable name="simple-table">
3012
3041
  <xsl:call-template name="getSimpleTable"/>
3013
3042
  </xsl:variable>
3014
3043
 
3015
-
3016
-
3017
-
3018
-
3019
3044
  <!-- <xsl:if test="$namespace = 'bipm'">
3020
3045
  <fo:block>&#xA0;</fo:block>
3021
3046
  </xsl:if> -->
@@ -3030,7 +3055,7 @@
3030
3055
 
3031
3056
 
3032
3057
 
3033
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3058
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
3034
3059
 
3035
3060
  <!-- <xsl:variable name="cols-count">
3036
3061
  <xsl:choose>
@@ -3049,8 +3074,6 @@
3049
3074
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3050
3075
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3051
3076
 
3052
-
3053
-
3054
3077
  <xsl:variable name="colwidths">
3055
3078
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3056
3079
  <xsl:call-template name="calculate-column-widths">
@@ -3078,6 +3101,7 @@
3078
3101
  </xsl:choose>
3079
3102
  </xsl:variable>
3080
3103
 
3104
+
3081
3105
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3082
3106
 
3083
3107
 
@@ -3113,6 +3137,7 @@
3113
3137
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3114
3138
 
3115
3139
 
3140
+
3116
3141
  <attribute name="border">0.5pt solid black</attribute>
3117
3142
 
3118
3143
 
@@ -3206,7 +3231,8 @@
3206
3231
  </fo:block-container>
3207
3232
  </xsl:variable>
3208
3233
 
3209
-
3234
+ <xsl:variable name="isAdded" select="@added"/>
3235
+ <xsl:variable name="isDeleted" select="@deleted"/>
3210
3236
 
3211
3237
  <xsl:choose>
3212
3238
  <xsl:when test="@width">
@@ -3220,7 +3246,14 @@
3220
3246
  <fo:table-body>
3221
3247
  <fo:table-row>
3222
3248
  <fo:table-cell column-number="2">
3223
- <fo:block><xsl:copy-of select="$table"/></fo:block>
3249
+ <xsl:copy-of select="$table-preamble"/>
3250
+ <fo:block>
3251
+ <xsl:call-template name="setTrackChangesStyles">
3252
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3253
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3254
+ </xsl:call-template>
3255
+ <xsl:copy-of select="$table"/>
3256
+ </fo:block>
3224
3257
  </fo:table-cell>
3225
3258
  </fo:table-row>
3226
3259
  </fo:table-body>
@@ -3231,7 +3264,22 @@
3231
3264
 
3232
3265
  </xsl:when>
3233
3266
  <xsl:otherwise>
3234
- <xsl:copy-of select="$table"/>
3267
+ <xsl:choose>
3268
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
3269
+ <xsl:copy-of select="$table-preamble"/>
3270
+ <fo:block>
3271
+ <xsl:call-template name="setTrackChangesStyles">
3272
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3273
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3274
+ </xsl:call-template>
3275
+ <xsl:copy-of select="$table"/>
3276
+ </fo:block>
3277
+ </xsl:when>
3278
+ <xsl:otherwise>
3279
+ <xsl:copy-of select="$table-preamble"/>
3280
+ <xsl:copy-of select="$table"/>
3281
+ </xsl:otherwise>
3282
+ </xsl:choose>
3235
3283
  </xsl:otherwise>
3236
3284
  </xsl:choose>
3237
3285
 
@@ -3292,7 +3340,7 @@
3292
3340
  </xsl:for-each>
3293
3341
  </xsl:when>
3294
3342
  <xsl:otherwise>
3295
- <xsl:for-each select="xalan:nodeset($table)//tr">
3343
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
3296
3344
  <xsl:variable name="td_text">
3297
3345
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3298
3346
 
@@ -3362,7 +3410,15 @@
3362
3410
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3363
3411
  <xsl:value-of select="@target"/>
3364
3412
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3365
- <xsl:variable name="math_text" select="normalize-space(.)"/>
3413
+ <xsl:variable name="mathml">
3414
+ <xsl:for-each select="*">
3415
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3416
+ <xsl:copy-of select="."/>
3417
+ </xsl:if>
3418
+ </xsl:for-each>
3419
+ </xsl:variable>
3420
+
3421
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3366
3422
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3367
3423
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3368
3424
  <xsl:param name="cols-count"/>
@@ -3654,7 +3710,8 @@
3654
3710
  <xsl:attribute name="text-align">
3655
3711
  <xsl:choose>
3656
3712
  <xsl:when test="@align">
3657
- <xsl:value-of select="@align"/>
3713
+ <xsl:call-template name="setAlignment"/>
3714
+ <!-- <xsl:value-of select="@align"/> -->
3658
3715
  </xsl:when>
3659
3716
  <xsl:otherwise>center</xsl:otherwise>
3660
3717
  </xsl:choose>
@@ -3678,6 +3735,9 @@
3678
3735
 
3679
3736
 
3680
3737
 
3738
+ <xsl:if test="$lang = 'ar'">
3739
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3740
+ </xsl:if>
3681
3741
  <xsl:if test="@colspan">
3682
3742
  <xsl:attribute name="number-columns-spanned">
3683
3743
  <xsl:value-of select="@colspan"/>
@@ -3709,16 +3769,21 @@
3709
3769
  <xsl:attribute name="text-align">
3710
3770
  <xsl:choose>
3711
3771
  <xsl:when test="@align">
3712
- <xsl:value-of select="@align"/>
3772
+ <xsl:call-template name="setAlignment"/>
3773
+ <!-- <xsl:value-of select="@align"/> -->
3713
3774
  </xsl:when>
3714
3775
  <xsl:otherwise>left</xsl:otherwise>
3715
3776
  </xsl:choose>
3716
3777
  </xsl:attribute>
3778
+ <xsl:if test="$lang = 'ar'">
3779
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3780
+ </xsl:if>
3717
3781
  <!-- and ancestor::*[local-name() = 'thead'] -->
3718
3782
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3719
3783
 
3720
3784
 
3721
3785
 
3786
+
3722
3787
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3723
3788
  <xsl:attribute name="border">solid black 0</xsl:attribute>
3724
3789
  </xsl:if>
@@ -3736,6 +3801,9 @@
3736
3801
 
3737
3802
 
3738
3803
 
3804
+ <xsl:if test=".//*[local-name() = 'table']">
3805
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3806
+ </xsl:if>
3739
3807
  <xsl:if test="@colspan">
3740
3808
  <xsl:attribute name="number-columns-spanned">
3741
3809
  <xsl:value-of select="@colspan"/>
@@ -3872,13 +3940,13 @@
3872
3940
  </xsl:choose>
3873
3941
  </xsl:variable>
3874
3942
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3875
- <xsl:element name="{$ns}:table">
3943
+ <!-- <xsl:element name="{$ns}:table"> -->
3876
3944
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3877
3945
  <tbody>
3878
3946
  <xsl:apply-templates mode="dl"/>
3879
3947
  </tbody>
3880
3948
  </xsl:for-each>
3881
- </xsl:element>
3949
+ <!-- </xsl:element> -->
3882
3950
  </xsl:variable>
3883
3951
 
3884
3952
  <xsl:call-template name="calculate-column-widths">
@@ -3984,6 +4052,8 @@
3984
4052
  <xsl:apply-templates/>
3985
4053
  </fo:inline>
3986
4054
  </xsl:template><xsl:template match="*[local-name()='dl']">
4055
+ <xsl:variable name="isAdded" select="@added"/>
4056
+ <xsl:variable name="isDeleted" select="@deleted"/>
3987
4057
  <fo:block-container>
3988
4058
 
3989
4059
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -4000,6 +4070,12 @@
4000
4070
  </xsl:attribute>
4001
4071
 
4002
4072
  </xsl:if>
4073
+
4074
+ <xsl:call-template name="setTrackChangesStyles">
4075
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4076
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4077
+ </xsl:call-template>
4078
+
4003
4079
  <fo:block-container>
4004
4080
 
4005
4081
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -4123,11 +4199,11 @@
4123
4199
  </xsl:choose>
4124
4200
  </xsl:variable>
4125
4201
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
4126
- <xsl:element name="{$ns}:table">
4202
+ <!-- <xsl:element name="{$ns}:table"> -->
4127
4203
  <tbody>
4128
4204
  <xsl:apply-templates mode="dl"/>
4129
4205
  </tbody>
4130
- </xsl:element>
4206
+ <!-- </xsl:element> -->
4131
4207
  </xsl:variable>
4132
4208
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
4133
4209
  <xsl:variable name="colwidths">
@@ -4398,8 +4474,78 @@
4398
4474
  <fo:inline text-decoration="underline">
4399
4475
  <xsl:apply-templates/>
4400
4476
  </fo:inline>
4477
+ </xsl:template><xsl:template match="*[local-name()='add']">
4478
+ <xsl:choose>
4479
+ <xsl:when test="@amendment">
4480
+ <fo:inline>
4481
+ <xsl:call-template name="insertTag">
4482
+ <xsl:with-param name="kind">A</xsl:with-param>
4483
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4484
+ </xsl:call-template>
4485
+ <xsl:apply-templates/>
4486
+ <xsl:call-template name="insertTag">
4487
+ <xsl:with-param name="type">closing</xsl:with-param>
4488
+ <xsl:with-param name="kind">A</xsl:with-param>
4489
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4490
+ </xsl:call-template>
4491
+ </fo:inline>
4492
+ </xsl:when>
4493
+ <xsl:when test="@corrigenda">
4494
+ <fo:inline>
4495
+ <xsl:call-template name="insertTag">
4496
+ <xsl:with-param name="kind">C</xsl:with-param>
4497
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4498
+ </xsl:call-template>
4499
+ <xsl:apply-templates/>
4500
+ <xsl:call-template name="insertTag">
4501
+ <xsl:with-param name="type">closing</xsl:with-param>
4502
+ <xsl:with-param name="kind">C</xsl:with-param>
4503
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4504
+ </xsl:call-template>
4505
+ </fo:inline>
4506
+ </xsl:when>
4507
+ <xsl:otherwise>
4508
+ <fo:inline xsl:use-attribute-sets="add-style">
4509
+ <xsl:apply-templates/>
4510
+ </fo:inline>
4511
+ </xsl:otherwise>
4512
+ </xsl:choose>
4513
+
4514
+ </xsl:template><xsl:template name="insertTag">
4515
+ <xsl:param name="type"/>
4516
+ <xsl:param name="kind"/>
4517
+ <xsl:param name="value"/>
4518
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4519
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4520
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4521
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4522
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4523
+ <xsl:attribute name="height">5mm</xsl:attribute>
4524
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4525
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4526
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4527
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4528
+ <g>
4529
+ <xsl:if test="$type = 'closing'">
4530
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4531
+ </xsl:if>
4532
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4533
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4534
+ </g>
4535
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4536
+ <xsl:if test="$type = 'closing'">
4537
+ <xsl:attribute name="x">25</xsl:attribute>
4538
+ </xsl:if>
4539
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4540
+ </text>
4541
+ </svg>
4542
+ </fo:instream-foreign-object>
4401
4543
  </xsl:template><xsl:template match="*[local-name()='del']">
4402
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4544
+ <fo:inline xsl:use-attribute-sets="del-style">
4545
+ <xsl:apply-templates/>
4546
+ </fo:inline>
4547
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4548
+ <fo:inline background-color="yellow">
4403
4549
  <xsl:apply-templates/>
4404
4550
  </fo:inline>
4405
4551
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -4736,12 +4882,23 @@
4736
4882
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4737
4883
  <xsl:value-of select="substring($str, 2)"/>
4738
4884
  </xsl:template><xsl:template match="mathml:math">
4739
- <fo:inline font-family="STIX Two Math"> <!-- -->
4885
+ <xsl:variable name="isAdded" select="@added"/>
4886
+ <xsl:variable name="isDeleted" select="@deleted"/>
4887
+
4888
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4889
+
4890
+
4891
+ <xsl:call-template name="setTrackChangesStyles">
4892
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4893
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4894
+ </xsl:call-template>
4740
4895
 
4741
4896
  <xsl:variable name="mathml">
4742
4897
  <xsl:apply-templates select="." mode="mathml"/>
4743
4898
  </xsl:variable>
4744
4899
  <fo:instream-foreign-object fox:alt-text="Math">
4900
+
4901
+
4745
4902
  <!-- <xsl:copy-of select="."/> -->
4746
4903
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4747
4904
  </fo:instream-foreign-object>
@@ -4760,7 +4917,7 @@
4760
4917
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4761
4918
  </xsl:copy>
4762
4919
  <mathml:mspace width="0.5ex"/>
4763
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4920
+ </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">
4764
4921
  <xsl:variable name="target">
4765
4922
  <xsl:choose>
4766
4923
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4798,8 +4955,6 @@
4798
4955
  </xsl:otherwise>
4799
4956
  </xsl:choose>
4800
4957
  </fo:inline>
4801
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4802
- <fo:inline id="{@id}"/>
4803
4958
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4804
4959
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4805
4960
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4993,8 +5148,15 @@
4993
5148
  </fo:inline>
4994
5149
  </xsl:if>
4995
5150
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
5151
+ <xsl:variable name="isAdded" select="@added"/>
5152
+ <xsl:variable name="isDeleted" select="@deleted"/>
4996
5153
  <fo:block-container id="{@id}">
4997
5154
 
5155
+ <xsl:call-template name="setTrackChangesStyles">
5156
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5157
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5158
+ </xsl:call-template>
5159
+
4998
5160
  <fo:block>
4999
5161
  <xsl:apply-templates/>
5000
5162
  </fo:block>
@@ -5008,27 +5170,113 @@
5008
5170
  <fo:block id="{@id}">
5009
5171
  <xsl:apply-templates/>
5010
5172
  </fo:block>
5173
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5011
5174
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
5012
5175
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
5013
5176
  <xsl:apply-templates/>
5014
5177
  </fo:block>
5015
5178
  </xsl:template><xsl:template match="*[local-name() = 'image']">
5016
- <fo:block xsl:use-attribute-sets="image-style">
5017
-
5018
-
5019
- <xsl:variable name="src">
5020
- <xsl:choose>
5021
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5022
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5023
- </xsl:when>
5024
- <xsl:otherwise>
5025
- <xsl:value-of select="@src"/>
5026
- </xsl:otherwise>
5027
- </xsl:choose>
5028
- </xsl:variable>
5029
-
5030
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5031
- </fo:block>
5179
+ <xsl:variable name="isAdded" select="../@added"/>
5180
+ <xsl:variable name="isDeleted" select="../@deleted"/>
5181
+ <xsl:choose>
5182
+ <xsl:when test="ancestor::*[local-name() = 'title']">
5183
+ <fo:inline padding-left="1mm" padding-right="1mm">
5184
+ <xsl:variable name="src">
5185
+ <xsl:call-template name="image_src"/>
5186
+ </xsl:variable>
5187
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
5188
+ </fo:inline>
5189
+ </xsl:when>
5190
+ <xsl:otherwise>
5191
+ <fo:block xsl:use-attribute-sets="image-style">
5192
+
5193
+ <xsl:variable name="src">
5194
+ <xsl:call-template name="image_src"/>
5195
+ </xsl:variable>
5196
+
5197
+ <xsl:choose>
5198
+ <xsl:when test="$isDeleted = 'true'">
5199
+ <!-- enclose in svg -->
5200
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
5201
+ <xsl:attribute name="width">100%</xsl:attribute>
5202
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5203
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5204
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5205
+
5206
+
5207
+ <xsl:apply-templates select="." mode="cross_image"/>
5208
+
5209
+ </fo:instream-foreign-object>
5210
+ </xsl:when>
5211
+ <xsl:otherwise>
5212
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5213
+ </xsl:otherwise>
5214
+ </xsl:choose>
5215
+
5216
+ </fo:block>
5217
+ </xsl:otherwise>
5218
+ </xsl:choose>
5219
+ </xsl:template><xsl:template name="image_src">
5220
+ <xsl:choose>
5221
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5222
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5223
+ </xsl:when>
5224
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5225
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5226
+ </xsl:when>
5227
+ <xsl:otherwise>
5228
+ <xsl:value-of select="@src"/>
5229
+ </xsl:otherwise>
5230
+ </xsl:choose>
5231
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
5232
+ <xsl:choose>
5233
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5234
+ <xsl:variable name="src">
5235
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5236
+ </xsl:variable>
5237
+ <xsl:variable name="width" select="document($src)/@width"/>
5238
+ <xsl:variable name="height" select="document($src)/@height"/>
5239
+ <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">
5240
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
5241
+ </svg>
5242
+ </xsl:when>
5243
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5244
+ <xsl:variable name="src">
5245
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5246
+ </xsl:variable>
5247
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
5248
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
5249
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5250
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5251
+ <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">
5252
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
5253
+ </svg>
5254
+ </xsl:when>
5255
+ <xsl:otherwise>
5256
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
5257
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
5258
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
5259
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
5260
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
5261
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5262
+ <!-- width=<xsl:value-of select="$width"/> -->
5263
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5264
+ <!-- height=<xsl:value-of select="$height"/> -->
5265
+ <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">
5266
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
5267
+ <xsl:call-template name="svg_cross">
5268
+ <xsl:with-param name="width" select="$width"/>
5269
+ <xsl:with-param name="height" select="$height"/>
5270
+ </xsl:call-template>
5271
+ </svg>
5272
+ </xsl:otherwise>
5273
+ </xsl:choose>
5274
+
5275
+ </xsl:template><xsl:template name="svg_cross">
5276
+ <xsl:param name="width"/>
5277
+ <xsl:param name="height"/>
5278
+ <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; "/>
5279
+ <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; "/>
5032
5280
  </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">
5033
5281
  <xsl:apply-templates mode="contents"/>
5034
5282
  <xsl:text> </xsl:text>
@@ -5571,6 +5819,7 @@
5571
5819
  <xsl:variable name="element">
5572
5820
 
5573
5821
  inline
5822
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5574
5823
  </xsl:variable>
5575
5824
  <xsl:choose>
5576
5825
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5578,7 +5827,7 @@
5578
5827
  <xsl:apply-templates/>
5579
5828
  </fo:inline>
5580
5829
  </xsl:when>
5581
- <xsl:when test="normalize-space($element) = 'block'">
5830
+ <xsl:when test="contains(normalize-space($element), 'block')">
5582
5831
  <fo:block xsl:use-attribute-sets="example-name-style">
5583
5832
  <xsl:apply-templates/>
5584
5833
  </fo:block>
@@ -5591,10 +5840,11 @@
5591
5840
  </xsl:choose>
5592
5841
 
5593
5842
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5594
-
5843
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5595
5844
  <xsl:variable name="element">
5596
5845
  block
5597
5846
 
5847
+
5598
5848
  </xsl:variable>
5599
5849
  <xsl:choose>
5600
5850
  <xsl:when test="normalize-space($element) = 'block'">
@@ -5698,29 +5948,47 @@
5698
5948
  <xsl:text>— </xsl:text>
5699
5949
  <xsl:apply-templates/>
5700
5950
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5701
- <fo:inline xsl:use-attribute-sets="eref-style">
5702
- <xsl:if test="@type = 'footnote'">
5703
-
5704
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5705
- <xsl:attribute name="font-size">80%</xsl:attribute>
5706
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5707
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5708
-
5709
-
5710
- </xsl:if>
5711
-
5712
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5713
-
5714
- <xsl:if test="@type = 'inline'">
5715
-
5716
-
5717
-
5718
- </xsl:if>
5719
-
5720
-
5721
- <xsl:apply-templates/>
5722
- </fo:basic-link>
5723
- </fo:inline>
5951
+
5952
+ <xsl:variable name="bibitemid">
5953
+ <xsl:choose>
5954
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5955
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5956
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5957
+ </xsl:choose>
5958
+ </xsl:variable>
5959
+
5960
+ <xsl:choose>
5961
+ <xsl:when test="normalize-space($bibitemid) != ''">
5962
+ <fo:inline xsl:use-attribute-sets="eref-style">
5963
+ <xsl:if test="@type = 'footnote'">
5964
+
5965
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5966
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5967
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5968
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5969
+
5970
+
5971
+ </xsl:if>
5972
+
5973
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5974
+ <xsl:if test="normalize-space(@citeas) = ''">
5975
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5976
+ </xsl:if>
5977
+ <xsl:if test="@type = 'inline'">
5978
+
5979
+
5980
+
5981
+ </xsl:if>
5982
+
5983
+ <xsl:apply-templates/>
5984
+ </fo:basic-link>
5985
+
5986
+ </fo:inline>
5987
+ </xsl:when>
5988
+ <xsl:otherwise>
5989
+ <fo:inline><xsl:apply-templates/></fo:inline>
5990
+ </xsl:otherwise>
5991
+ </xsl:choose>
5724
5992
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5725
5993
  <!-- zero-space char -->
5726
5994
  <xsl:variable name="depth">
@@ -5780,7 +6048,8 @@
5780
6048
  </fo:inline>
5781
6049
  </xsl:when>
5782
6050
  <xsl:otherwise>
5783
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
6051
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
6052
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5784
6053
  </xsl:otherwise>
5785
6054
  </xsl:choose>
5786
6055
 
@@ -5900,6 +6169,153 @@
5900
6169
  </fo:block>
5901
6170
  </xsl:otherwise>
5902
6171
  </xsl:choose>
6172
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
6173
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
6174
+ <bookmark><xsl:value-of select="@id"/></bookmark>
6175
+ </xsl:for-each>
6176
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
6177
+ <xsl:copy>
6178
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
6179
+ </xsl:copy>
6180
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
6181
+ <xsl:variable name="id">
6182
+ <xsl:call-template name="generateIndexXrefId"/>
6183
+ </xsl:variable>
6184
+ <xsl:copy> <!-- add id to xref -->
6185
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
6186
+ <xsl:attribute name="id">
6187
+ <xsl:value-of select="$id"/>
6188
+ </xsl:attribute>
6189
+ <xsl:apply-templates mode="index_add_id"/>
6190
+ </xsl:copy>
6191
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6192
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6193
+ <xsl:if test="@to">
6194
+ <xsl:value-of select="$dash"/>
6195
+ <xsl:copy>
6196
+ <xsl:copy-of select="@*"/>
6197
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
6198
+ <xsl:attribute name="id">
6199
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
6200
+ </xsl:attribute>
6201
+ <xsl:apply-templates mode="index_add_id"/>
6202
+ </xsl:copy>
6203
+ </xsl:if>
6204
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
6205
+ <xsl:copy>
6206
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
6207
+ </xsl:copy>
6208
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
6209
+ <xsl:copy>
6210
+ <xsl:apply-templates select="@*" mode="index_update"/>
6211
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
6212
+ </xsl:copy>
6213
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
6214
+ <xsl:param name="element"/>
6215
+ <xsl:param name="remove" select="'false'"/>
6216
+ <xsl:param name="target"/>
6217
+ <!-- <node></node> -->
6218
+ <xsl:choose>
6219
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6220
+ <!-- skip text (i.e. remove it) and process next element -->
6221
+ <!-- [removed_<xsl:value-of select="."/>] -->
6222
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6223
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
6224
+ </xsl:apply-templates>
6225
+ </xsl:when>
6226
+ <xsl:when test="self::text()">
6227
+ <xsl:value-of select="."/>
6228
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6229
+ </xsl:when>
6230
+ <xsl:when test="self::* and local-name(.) = 'xref'">
6231
+ <xsl:variable name="id" select="@id"/>
6232
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
6233
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
6234
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
6235
+
6236
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
6237
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
6238
+
6239
+ <xsl:choose>
6240
+ <!-- 2nd pass -->
6241
+ <!-- if page is equal to page for next and page is not the end of range -->
6242
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
6243
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
6244
+ <!-- [removed_xref] -->
6245
+
6246
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6247
+ <xsl:with-param name="remove">true</xsl:with-param>
6248
+ <xsl:with-param name="target">
6249
+ <xsl:choose>
6250
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
6251
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
6252
+ </xsl:choose>
6253
+ </xsl:with-param>
6254
+ </xsl:apply-templates>
6255
+ </xsl:when>
6256
+
6257
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
6258
+ <!-- remove xref -->
6259
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6260
+ <xsl:with-param name="remove">true</xsl:with-param>
6261
+ </xsl:apply-templates>
6262
+ </xsl:when>
6263
+
6264
+ <xsl:otherwise>
6265
+ <xsl:apply-templates select="." mode="xref_copy">
6266
+ <xsl:with-param name="target" select="$target"/>
6267
+ </xsl:apply-templates>
6268
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6269
+ </xsl:otherwise>
6270
+ </xsl:choose>
6271
+ </xsl:when>
6272
+ <xsl:when test="self::* and local-name(.) = 'ul'">
6273
+ <!-- ul -->
6274
+ <xsl:apply-templates select="." mode="index_update"/>
6275
+ </xsl:when>
6276
+ <xsl:otherwise>
6277
+ <xsl:apply-templates select="." mode="xref_copy">
6278
+ <xsl:with-param name="target" select="$target"/>
6279
+ </xsl:apply-templates>
6280
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6281
+ </xsl:otherwise>
6282
+ </xsl:choose>
6283
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
6284
+ <xsl:param name="target"/>
6285
+ <xsl:copy>
6286
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
6287
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
6288
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
6289
+ </xsl:if>
6290
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
6291
+ </xsl:copy>
6292
+ </xsl:template><xsl:template name="generateIndexXrefId">
6293
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6294
+
6295
+ <xsl:variable name="docid">
6296
+ <xsl:call-template name="getDocumentId"/>
6297
+ </xsl:variable>
6298
+ <xsl:variable name="item_number">
6299
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
6300
+ </xsl:variable>
6301
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6302
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6303
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6304
+ <xsl:apply-templates/>
6305
+ <fo:block>
6306
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6307
+ <fo:block> </fo:block>
6308
+ </xsl:if>
6309
+ </fo:block>
6310
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6311
+ <xsl:apply-templates/>
6312
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6313
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6314
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6315
+ <xsl:apply-templates/>
6316
+ </fo:block>
6317
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6318
+ <fo:inline id="{@id}" font-size="1pt"/>
5903
6319
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5904
6320
  <!-- <row>
5905
6321
  <date>05-07-2013</date>
@@ -5997,6 +6413,70 @@
5997
6413
  <xsl:value-of select="substring(.,1,1)"/>
5998
6414
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5999
6415
  <fo:inline><xsl:apply-templates/></fo:inline>
6416
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6417
+ <fo:block>
6418
+ <xsl:apply-templates/>
6419
+ </fo:block>
6420
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6421
+ <fo:inline><xsl:apply-templates/></fo:inline>
6422
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6423
+ <fo:inline>
6424
+ <xsl:call-template name="text_input"/>
6425
+ </fo:inline>
6426
+ </xsl:template><xsl:template name="text_input">
6427
+ <xsl:variable name="count">
6428
+ <xsl:choose>
6429
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6430
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6431
+ <xsl:otherwise>10</xsl:otherwise>
6432
+ </xsl:choose>
6433
+ </xsl:variable>
6434
+ <xsl:call-template name="repeat">
6435
+ <xsl:with-param name="char" select="'_'"/>
6436
+ <xsl:with-param name="count" select="$count"/>
6437
+ </xsl:call-template>
6438
+ <xsl:text> </xsl:text>
6439
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6440
+ <xsl:variable name="caption">
6441
+ <xsl:choose>
6442
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6443
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6444
+ </xsl:choose>
6445
+ </xsl:variable>
6446
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6447
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6448
+ <fo:inline padding-right="1mm">
6449
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6450
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6451
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6452
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6453
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6454
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6455
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6456
+ </svg>
6457
+ </fo:instream-foreign-object>
6458
+ </fo:inline>
6459
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6460
+ <fo:inline padding-right="1mm">
6461
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6462
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6463
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6464
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6465
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6466
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6467
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6468
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6469
+ </svg>
6470
+ </fo:instream-foreign-object>
6471
+ </fo:inline>
6472
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6473
+ <fo:inline>
6474
+ <xsl:call-template name="text_input"/>
6475
+ </fo:inline>
6476
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6477
+ <fo:block-container border="1pt solid black" width="50%">
6478
+ <fo:block> </fo:block>
6479
+ </fo:block-container>
6000
6480
  </xsl:template><xsl:template name="convertDate">
6001
6481
  <xsl:param name="date"/>
6002
6482
  <xsl:param name="format" select="'short'"/>
@@ -6116,70 +6596,68 @@
6116
6596
  <xsl:variable name="lang">
6117
6597
  <xsl:call-template name="getLang"/>
6118
6598
  </xsl:variable>
6119
- <fo:declarations>
6120
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6121
- <pdf:dictionary type="normal" key="ViewerPreferences">
6122
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6123
- </pdf:dictionary>
6124
- </pdf:catalog>
6125
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
6126
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6127
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6128
- <!-- Dublin Core properties go here -->
6129
- <dc:title>
6130
- <xsl:variable name="title">
6131
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6132
-
6133
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
6134
-
6135
-
6136
-
6137
-
6138
-
6139
-
6140
- </xsl:for-each>
6141
- </xsl:variable>
6142
- <xsl:choose>
6143
- <xsl:when test="normalize-space($title) != ''">
6144
- <xsl:value-of select="$title"/>
6145
- </xsl:when>
6146
- <xsl:otherwise>
6147
- <xsl:text> </xsl:text>
6148
- </xsl:otherwise>
6149
- </xsl:choose>
6150
- </dc:title>
6151
- <dc:creator>
6599
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6600
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6601
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6602
+ </pdf:dictionary>
6603
+ </pdf:catalog>
6604
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6605
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6606
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6607
+ <!-- Dublin Core properties go here -->
6608
+ <dc:title>
6609
+ <xsl:variable name="title">
6152
6610
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6153
6611
 
6154
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6155
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6156
- <xsl:if test="position() != last()">; </xsl:if>
6157
- </xsl:for-each>
6612
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
6158
6613
 
6159
6614
 
6160
6615
 
6161
- </xsl:for-each>
6162
- </dc:creator>
6163
- <dc:description>
6164
- <xsl:variable name="abstract">
6165
6616
 
6166
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6167
6617
 
6168
-
6169
- </xsl:variable>
6170
- <xsl:value-of select="normalize-space($abstract)"/>
6171
- </dc:description>
6172
- <pdf:Keywords>
6173
- <xsl:call-template name="insertKeywords"/>
6174
- </pdf:Keywords>
6175
- </rdf:Description>
6176
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6177
- <!-- XMP properties go here -->
6178
- <xmp:CreatorTool/>
6179
- </rdf:Description>
6180
- </rdf:RDF>
6181
- </x:xmpmeta>
6182
- </fo:declarations>
6618
+
6619
+ </xsl:for-each>
6620
+ </xsl:variable>
6621
+ <xsl:choose>
6622
+ <xsl:when test="normalize-space($title) != ''">
6623
+ <xsl:value-of select="$title"/>
6624
+ </xsl:when>
6625
+ <xsl:otherwise>
6626
+ <xsl:text> </xsl:text>
6627
+ </xsl:otherwise>
6628
+ </xsl:choose>
6629
+ </dc:title>
6630
+ <dc:creator>
6631
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6632
+
6633
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6634
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6635
+ <xsl:if test="position() != last()">; </xsl:if>
6636
+ </xsl:for-each>
6637
+
6638
+
6639
+
6640
+ </xsl:for-each>
6641
+ </dc:creator>
6642
+ <dc:description>
6643
+ <xsl:variable name="abstract">
6644
+
6645
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6646
+
6647
+
6648
+ </xsl:variable>
6649
+ <xsl:value-of select="normalize-space($abstract)"/>
6650
+ </dc:description>
6651
+ <pdf:Keywords>
6652
+ <xsl:call-template name="insertKeywords"/>
6653
+ </pdf:Keywords>
6654
+ </rdf:Description>
6655
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6656
+ <!-- XMP properties go here -->
6657
+ <xmp:CreatorTool/>
6658
+ </rdf:Description>
6659
+ </rdf:RDF>
6660
+ </x:xmpmeta>
6183
6661
  </xsl:template><xsl:template name="getId">
6184
6662
  <xsl:choose>
6185
6663
  <xsl:when test="../@id">
@@ -6343,4 +6821,44 @@
6343
6821
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6344
6822
  </xsl:choose>
6345
6823
 
6824
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6825
+ <xsl:param name="isAdded"/>
6826
+ <xsl:param name="isDeleted"/>
6827
+ <xsl:choose>
6828
+ <xsl:when test="local-name() = 'math'">
6829
+ <xsl:if test="$isAdded = 'true'">
6830
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6831
+ </xsl:if>
6832
+ <xsl:if test="$isDeleted = 'true'">
6833
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6834
+ </xsl:if>
6835
+ </xsl:when>
6836
+ <xsl:otherwise>
6837
+ <xsl:if test="$isAdded = 'true'">
6838
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6839
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6840
+ </xsl:if>
6841
+ <xsl:if test="$isDeleted = 'true'">
6842
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6843
+ <xsl:if test="local-name() = 'table'">
6844
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6845
+ </xsl:if>
6846
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6847
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6848
+ </xsl:if>
6849
+ </xsl:otherwise>
6850
+ </xsl:choose>
6851
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6852
+ <xsl:if test="$lang = 'ar'">
6853
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6854
+ </xsl:if>
6855
+ </xsl:template><xsl:template name="setAlignment">
6856
+ <xsl:param name="align" select="normalize-space(@align)"/>
6857
+ <xsl:choose>
6858
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6859
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6860
+ <xsl:when test="$align != ''">
6861
+ <xsl:value-of select="$align"/>
6862
+ </xsl:when>
6863
+ </xsl:choose>
6346
6864
  </xsl:template></xsl:stylesheet>