metanorma-iec 1.2.14 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +9 -32
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +9 -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 +11 -0
  8. data/lib/asciidoctor/iec/isodoc.rng +172 -3
  9. data/lib/asciidoctor/iec/isostandard.rng +17 -97
  10. data/lib/isodoc/iec/html/htmlstyle.css +7 -0
  11. data/lib/isodoc/iec/html_convert.rb +0 -1
  12. data/lib/isodoc/iec/iec.international-standard.xsl +589 -127
  13. data/lib/metanorma/iec/version.rb +1 -1
  14. data/metanorma-iec.gemspec +6 -6
  15. data/spec/{asciidoctor-iec → asciidoctor}/base_spec.rb +0 -0
  16. data/spec/{asciidoctor-iec → asciidoctor}/blocks_spec.rb +0 -0
  17. data/spec/{asciidoctor-iec → asciidoctor}/cleanup_spec.rb +0 -0
  18. data/spec/{asciidoctor-iec → asciidoctor}/iev_spec.rb +0 -0
  19. data/spec/{asciidoctor-iec → asciidoctor}/inline_spec.rb +0 -0
  20. data/spec/{asciidoctor-iec → asciidoctor}/lists_spec.rb +0 -0
  21. data/spec/{asciidoctor-iec → asciidoctor}/section_spec.rb +0 -0
  22. data/spec/{asciidoctor-iec → asciidoctor}/validate_spec.rb +0 -0
  23. data/spec/isodoc/postproc_spec.rb +2 -20
  24. metadata +50 -59
  25. data/spec/examples/rice.adoc +0 -723
  26. data/spec/examples/rice.doc +0 -19162
  27. data/spec/examples/rice.html +0 -1787
  28. data/spec/examples/rice.xml +0 -1951
  29. data/spec/examples/rice_img/rice_image1.png +0 -0
  30. data/spec/examples/rice_img/rice_image2.png +0 -0
  31. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  32. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  33. 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>
@@ -333,6 +309,11 @@
333
309
  <optional>
334
310
  <attribute name="script"/>
335
311
  </optional>
312
+ <optional>
313
+ <attribute name="inline-header">
314
+ <data type="boolean"/>
315
+ </attribute>
316
+ </optional>
336
317
  <optional>
337
318
  <attribute name="obligation">
338
319
  <choice>
@@ -341,6 +322,12 @@
341
322
  </choice>
342
323
  </attribute>
343
324
  </optional>
325
+ <optional>
326
+ <attribute name="number"/>
327
+ </optional>
328
+ <optional>
329
+ <attribute name="type"/>
330
+ </optional>
344
331
  <optional>
345
332
  <ref name="section-title"/>
346
333
  </optional>
@@ -358,57 +345,6 @@
358
345
  </oneOrMore>
359
346
  </choice>
360
347
  </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
348
  </include>
413
349
  <!-- end overrides -->
414
350
  <!--
@@ -428,6 +364,9 @@
428
364
  <zeroOrMore>
429
365
  <ref name="termdocsource"/>
430
366
  </zeroOrMore>
367
+ <optional>
368
+ <ref name="misccontainer"/>
369
+ </optional>
431
370
  <optional>
432
371
  <ref name="boilerplate"/>
433
372
  </optional>
@@ -439,6 +378,9 @@
439
378
  <ref name="annex"/>
440
379
  </zeroOrMore>
441
380
  <ref name="bibliography"/>
381
+ <zeroOrMore>
382
+ <ref name="indexsect"/>
383
+ </zeroOrMore>
442
384
  </element>
443
385
  </define>
444
386
  <define name="horizontal">
@@ -527,28 +469,6 @@
527
469
  <ref name="Clause-Section"/>
528
470
  </element>
529
471
  </define>
530
- <define name="ul_li">
531
- <element name="li">
532
- <optional>
533
- <attribute name="id">
534
- <data type="ID"/>
535
- </attribute>
536
- </optional>
537
- <optional>
538
- <attribute name="uncheckedcheckbox">
539
- <data type="boolean"/>
540
- </attribute>
541
- </optional>
542
- <optional>
543
- <attribute name="checkedcheckbox">
544
- <data type="boolean"/>
545
- </attribute>
546
- </optional>
547
- <oneOrMore>
548
- <ref name="BasicBlock"/>
549
- </oneOrMore>
550
- </element>
551
- </define>
552
472
  <define name="stagename">
553
473
  <element name="stagename">
554
474
  <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"/>
@@ -2150,13 +2154,22 @@
2150
2154
  <xsl:otherwise> <!-- for ordered lists -->
2151
2155
  <xsl:choose>
2152
2156
  <xsl:when test="../@type = 'arabic'">
2153
- <xsl:number format="a)" lang="en"/>
2157
+ <xsl:number format="1)"/>
2154
2158
  </xsl:when>
2155
2159
  <xsl:when test="../@type = 'alphabet'">
2156
2160
  <xsl:number format="a)" lang="en"/>
2157
2161
  </xsl:when>
2162
+ <xsl:when test="../@type = 'alphabet_upper'">
2163
+ <xsl:number format="A." lang="en"/>
2164
+ </xsl:when>
2165
+ <xsl:when test="../@type = 'roman'">
2166
+ <xsl:number format="i)" lang="en"/>
2167
+ </xsl:when>
2168
+ <xsl:when test="../@type = 'roman_upper'">
2169
+ <xsl:number format="I." lang="en"/>
2170
+ </xsl:when>
2158
2171
  <xsl:otherwise>
2159
- <xsl:number format="1)"/>
2172
+ <xsl:number format="a)" lang="en"/>
2160
2173
  </xsl:otherwise>
2161
2174
  </xsl:choose>
2162
2175
  </xsl:otherwise>
@@ -2623,6 +2636,7 @@
2623
2636
  </xsl:choose>
2624
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">
2625
2638
 
2639
+
2626
2640
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2627
2641
 
2628
2642
 
@@ -2727,6 +2741,7 @@
2727
2741
 
2728
2742
 
2729
2743
 
2744
+
2730
2745
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
2731
2746
 
2732
2747
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -2940,7 +2955,7 @@
2940
2955
 
2941
2956
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2942
2957
 
2943
-
2958
+
2944
2959
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2945
2960
 
2946
2961
  <xsl:attribute name="font-size">8pt</xsl:attribute>
@@ -2952,7 +2967,25 @@
2952
2967
 
2953
2968
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2954
2969
 
2955
- </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">
2956
2989
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2957
2990
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2958
2991
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2997,16 +3030,17 @@
2997
3030
  <xsl:call-template name="add-zero-spaces-java"/>
2998
3031
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2999
3032
 
3033
+ <xsl:variable name="table-preamble">
3034
+
3035
+
3036
+ </xsl:variable>
3037
+
3000
3038
  <xsl:variable name="table">
3001
3039
 
3002
3040
  <xsl:variable name="simple-table">
3003
3041
  <xsl:call-template name="getSimpleTable"/>
3004
3042
  </xsl:variable>
3005
3043
 
3006
-
3007
-
3008
-
3009
-
3010
3044
  <!-- <xsl:if test="$namespace = 'bipm'">
3011
3045
  <fo:block>&#xA0;</fo:block>
3012
3046
  </xsl:if> -->
@@ -3021,7 +3055,7 @@
3021
3055
 
3022
3056
 
3023
3057
 
3024
- <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)"/>
3025
3059
 
3026
3060
  <!-- <xsl:variable name="cols-count">
3027
3061
  <xsl:choose>
@@ -3040,8 +3074,6 @@
3040
3074
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3041
3075
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3042
3076
 
3043
-
3044
-
3045
3077
  <xsl:variable name="colwidths">
3046
3078
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3047
3079
  <xsl:call-template name="calculate-column-widths">
@@ -3069,6 +3101,7 @@
3069
3101
  </xsl:choose>
3070
3102
  </xsl:variable>
3071
3103
 
3104
+
3072
3105
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3073
3106
 
3074
3107
 
@@ -3104,6 +3137,7 @@
3104
3137
  <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3105
3138
 
3106
3139
 
3140
+
3107
3141
  <attribute name="border">0.5pt solid black</attribute>
3108
3142
 
3109
3143
 
@@ -3197,7 +3231,8 @@
3197
3231
  </fo:block-container>
3198
3232
  </xsl:variable>
3199
3233
 
3200
-
3234
+ <xsl:variable name="isAdded" select="@added"/>
3235
+ <xsl:variable name="isDeleted" select="@deleted"/>
3201
3236
 
3202
3237
  <xsl:choose>
3203
3238
  <xsl:when test="@width">
@@ -3211,7 +3246,14 @@
3211
3246
  <fo:table-body>
3212
3247
  <fo:table-row>
3213
3248
  <fo:table-cell column-number="2">
3214
- <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>
3215
3257
  </fo:table-cell>
3216
3258
  </fo:table-row>
3217
3259
  </fo:table-body>
@@ -3222,7 +3264,22 @@
3222
3264
 
3223
3265
  </xsl:when>
3224
3266
  <xsl:otherwise>
3225
- <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>
3226
3283
  </xsl:otherwise>
3227
3284
  </xsl:choose>
3228
3285
 
@@ -3283,7 +3340,7 @@
3283
3340
  </xsl:for-each>
3284
3341
  </xsl:when>
3285
3342
  <xsl:otherwise>
3286
- <xsl:for-each select="xalan:nodeset($table)//tr">
3343
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
3287
3344
  <xsl:variable name="td_text">
3288
3345
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
3289
3346
 
@@ -3353,7 +3410,15 @@
3353
3410
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3354
3411
  <xsl:value-of select="@target"/>
3355
3412
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3356
- <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))"/>
3357
3422
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3358
3423
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3359
3424
  <xsl:param name="cols-count"/>
@@ -3645,7 +3710,8 @@
3645
3710
  <xsl:attribute name="text-align">
3646
3711
  <xsl:choose>
3647
3712
  <xsl:when test="@align">
3648
- <xsl:value-of select="@align"/>
3713
+ <xsl:call-template name="setAlignment"/>
3714
+ <!-- <xsl:value-of select="@align"/> -->
3649
3715
  </xsl:when>
3650
3716
  <xsl:otherwise>center</xsl:otherwise>
3651
3717
  </xsl:choose>
@@ -3669,6 +3735,9 @@
3669
3735
 
3670
3736
 
3671
3737
 
3738
+ <xsl:if test="$lang = 'ar'">
3739
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3740
+ </xsl:if>
3672
3741
  <xsl:if test="@colspan">
3673
3742
  <xsl:attribute name="number-columns-spanned">
3674
3743
  <xsl:value-of select="@colspan"/>
@@ -3700,11 +3769,15 @@
3700
3769
  <xsl:attribute name="text-align">
3701
3770
  <xsl:choose>
3702
3771
  <xsl:when test="@align">
3703
- <xsl:value-of select="@align"/>
3772
+ <xsl:call-template name="setAlignment"/>
3773
+ <!-- <xsl:value-of select="@align"/> -->
3704
3774
  </xsl:when>
3705
3775
  <xsl:otherwise>left</xsl:otherwise>
3706
3776
  </xsl:choose>
3707
3777
  </xsl:attribute>
3778
+ <xsl:if test="$lang = 'ar'">
3779
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3780
+ </xsl:if>
3708
3781
  <!-- and ancestor::*[local-name() = 'thead'] -->
3709
3782
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3710
3783
 
@@ -3727,6 +3800,9 @@
3727
3800
 
3728
3801
 
3729
3802
 
3803
+ <xsl:if test=".//*[local-name() = 'table']">
3804
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3805
+ </xsl:if>
3730
3806
  <xsl:if test="@colspan">
3731
3807
  <xsl:attribute name="number-columns-spanned">
3732
3808
  <xsl:value-of select="@colspan"/>
@@ -3863,13 +3939,13 @@
3863
3939
  </xsl:choose>
3864
3940
  </xsl:variable>
3865
3941
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3866
- <xsl:element name="{$ns}:table">
3942
+ <!-- <xsl:element name="{$ns}:table"> -->
3867
3943
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3868
3944
  <tbody>
3869
3945
  <xsl:apply-templates mode="dl"/>
3870
3946
  </tbody>
3871
3947
  </xsl:for-each>
3872
- </xsl:element>
3948
+ <!-- </xsl:element> -->
3873
3949
  </xsl:variable>
3874
3950
 
3875
3951
  <xsl:call-template name="calculate-column-widths">
@@ -3975,6 +4051,8 @@
3975
4051
  <xsl:apply-templates/>
3976
4052
  </fo:inline>
3977
4053
  </xsl:template><xsl:template match="*[local-name()='dl']">
4054
+ <xsl:variable name="isAdded" select="@added"/>
4055
+ <xsl:variable name="isDeleted" select="@deleted"/>
3978
4056
  <fo:block-container>
3979
4057
 
3980
4058
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -3991,6 +4069,12 @@
3991
4069
  </xsl:attribute>
3992
4070
 
3993
4071
  </xsl:if>
4072
+
4073
+ <xsl:call-template name="setTrackChangesStyles">
4074
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4075
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4076
+ </xsl:call-template>
4077
+
3994
4078
  <fo:block-container>
3995
4079
 
3996
4080
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -4114,11 +4198,11 @@
4114
4198
  </xsl:choose>
4115
4199
  </xsl:variable>
4116
4200
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
4117
- <xsl:element name="{$ns}:table">
4201
+ <!-- <xsl:element name="{$ns}:table"> -->
4118
4202
  <tbody>
4119
4203
  <xsl:apply-templates mode="dl"/>
4120
4204
  </tbody>
4121
- </xsl:element>
4205
+ <!-- </xsl:element> -->
4122
4206
  </xsl:variable>
4123
4207
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
4124
4208
  <xsl:variable name="colwidths">
@@ -4389,8 +4473,78 @@
4389
4473
  <fo:inline text-decoration="underline">
4390
4474
  <xsl:apply-templates/>
4391
4475
  </fo:inline>
4476
+ </xsl:template><xsl:template match="*[local-name()='add']">
4477
+ <xsl:choose>
4478
+ <xsl:when test="@amendment">
4479
+ <fo:inline>
4480
+ <xsl:call-template name="insertTag">
4481
+ <xsl:with-param name="kind">A</xsl:with-param>
4482
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4483
+ </xsl:call-template>
4484
+ <xsl:apply-templates/>
4485
+ <xsl:call-template name="insertTag">
4486
+ <xsl:with-param name="type">closing</xsl:with-param>
4487
+ <xsl:with-param name="kind">A</xsl:with-param>
4488
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4489
+ </xsl:call-template>
4490
+ </fo:inline>
4491
+ </xsl:when>
4492
+ <xsl:when test="@corrigenda">
4493
+ <fo:inline>
4494
+ <xsl:call-template name="insertTag">
4495
+ <xsl:with-param name="kind">C</xsl:with-param>
4496
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4497
+ </xsl:call-template>
4498
+ <xsl:apply-templates/>
4499
+ <xsl:call-template name="insertTag">
4500
+ <xsl:with-param name="type">closing</xsl:with-param>
4501
+ <xsl:with-param name="kind">C</xsl:with-param>
4502
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4503
+ </xsl:call-template>
4504
+ </fo:inline>
4505
+ </xsl:when>
4506
+ <xsl:otherwise>
4507
+ <fo:inline xsl:use-attribute-sets="add-style">
4508
+ <xsl:apply-templates/>
4509
+ </fo:inline>
4510
+ </xsl:otherwise>
4511
+ </xsl:choose>
4512
+
4513
+ </xsl:template><xsl:template name="insertTag">
4514
+ <xsl:param name="type"/>
4515
+ <xsl:param name="kind"/>
4516
+ <xsl:param name="value"/>
4517
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4518
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4519
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4520
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4521
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4522
+ <xsl:attribute name="height">5mm</xsl:attribute>
4523
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4524
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4525
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4526
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4527
+ <g>
4528
+ <xsl:if test="$type = 'closing'">
4529
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4530
+ </xsl:if>
4531
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4532
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4533
+ </g>
4534
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4535
+ <xsl:if test="$type = 'closing'">
4536
+ <xsl:attribute name="x">25</xsl:attribute>
4537
+ </xsl:if>
4538
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4539
+ </text>
4540
+ </svg>
4541
+ </fo:instream-foreign-object>
4392
4542
  </xsl:template><xsl:template match="*[local-name()='del']">
4393
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4543
+ <fo:inline xsl:use-attribute-sets="del-style">
4544
+ <xsl:apply-templates/>
4545
+ </fo:inline>
4546
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4547
+ <fo:inline background-color="yellow">
4394
4548
  <xsl:apply-templates/>
4395
4549
  </fo:inline>
4396
4550
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -4727,12 +4881,23 @@
4727
4881
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4728
4882
  <xsl:value-of select="substring($str, 2)"/>
4729
4883
  </xsl:template><xsl:template match="mathml:math">
4730
- <fo:inline font-family="STIX Two Math"> <!-- -->
4884
+ <xsl:variable name="isAdded" select="@added"/>
4885
+ <xsl:variable name="isDeleted" select="@deleted"/>
4886
+
4887
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4888
+
4889
+
4890
+ <xsl:call-template name="setTrackChangesStyles">
4891
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4892
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4893
+ </xsl:call-template>
4731
4894
 
4732
4895
  <xsl:variable name="mathml">
4733
4896
  <xsl:apply-templates select="." mode="mathml"/>
4734
4897
  </xsl:variable>
4735
4898
  <fo:instream-foreign-object fox:alt-text="Math">
4899
+
4900
+
4736
4901
  <!-- <xsl:copy-of select="."/> -->
4737
4902
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4738
4903
  </fo:instream-foreign-object>
@@ -4751,7 +4916,7 @@
4751
4916
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4752
4917
  </xsl:copy>
4753
4918
  <mathml:mspace width="0.5ex"/>
4754
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4919
+ </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">
4755
4920
  <xsl:variable name="target">
4756
4921
  <xsl:choose>
4757
4922
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4789,8 +4954,6 @@
4789
4954
  </xsl:otherwise>
4790
4955
  </xsl:choose>
4791
4956
  </fo:inline>
4792
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4793
- <fo:inline id="{@id}"/>
4794
4957
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4795
4958
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4796
4959
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4984,8 +5147,15 @@
4984
5147
  </fo:inline>
4985
5148
  </xsl:if>
4986
5149
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
5150
+ <xsl:variable name="isAdded" select="@added"/>
5151
+ <xsl:variable name="isDeleted" select="@deleted"/>
4987
5152
  <fo:block-container id="{@id}">
4988
5153
 
5154
+ <xsl:call-template name="setTrackChangesStyles">
5155
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5156
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5157
+ </xsl:call-template>
5158
+
4989
5159
  <fo:block>
4990
5160
  <xsl:apply-templates/>
4991
5161
  </fo:block>
@@ -4999,27 +5169,113 @@
4999
5169
  <fo:block id="{@id}">
5000
5170
  <xsl:apply-templates/>
5001
5171
  </fo:block>
5172
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
5002
5173
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
5003
5174
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
5004
5175
  <xsl:apply-templates/>
5005
5176
  </fo:block>
5006
5177
  </xsl:template><xsl:template match="*[local-name() = 'image']">
5007
- <fo:block xsl:use-attribute-sets="image-style">
5008
-
5009
-
5010
- <xsl:variable name="src">
5011
- <xsl:choose>
5012
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5013
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5014
- </xsl:when>
5015
- <xsl:otherwise>
5016
- <xsl:value-of select="@src"/>
5017
- </xsl:otherwise>
5018
- </xsl:choose>
5019
- </xsl:variable>
5020
-
5021
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5022
- </fo:block>
5178
+ <xsl:variable name="isAdded" select="../@added"/>
5179
+ <xsl:variable name="isDeleted" select="../@deleted"/>
5180
+ <xsl:choose>
5181
+ <xsl:when test="ancestor::*[local-name() = 'title']">
5182
+ <fo:inline padding-left="1mm" padding-right="1mm">
5183
+ <xsl:variable name="src">
5184
+ <xsl:call-template name="image_src"/>
5185
+ </xsl:variable>
5186
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
5187
+ </fo:inline>
5188
+ </xsl:when>
5189
+ <xsl:otherwise>
5190
+ <fo:block xsl:use-attribute-sets="image-style">
5191
+
5192
+ <xsl:variable name="src">
5193
+ <xsl:call-template name="image_src"/>
5194
+ </xsl:variable>
5195
+
5196
+ <xsl:choose>
5197
+ <xsl:when test="$isDeleted = 'true'">
5198
+ <!-- enclose in svg -->
5199
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
5200
+ <xsl:attribute name="width">100%</xsl:attribute>
5201
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5202
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5203
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5204
+
5205
+
5206
+ <xsl:apply-templates select="." mode="cross_image"/>
5207
+
5208
+ </fo:instream-foreign-object>
5209
+ </xsl:when>
5210
+ <xsl:otherwise>
5211
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5212
+ </xsl:otherwise>
5213
+ </xsl:choose>
5214
+
5215
+ </fo:block>
5216
+ </xsl:otherwise>
5217
+ </xsl:choose>
5218
+ </xsl:template><xsl:template name="image_src">
5219
+ <xsl:choose>
5220
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5221
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5222
+ </xsl:when>
5223
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5224
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5225
+ </xsl:when>
5226
+ <xsl:otherwise>
5227
+ <xsl:value-of select="@src"/>
5228
+ </xsl:otherwise>
5229
+ </xsl:choose>
5230
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
5231
+ <xsl:choose>
5232
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5233
+ <xsl:variable name="src">
5234
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5235
+ </xsl:variable>
5236
+ <xsl:variable name="width" select="document($src)/@width"/>
5237
+ <xsl:variable name="height" select="document($src)/@height"/>
5238
+ <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">
5239
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
5240
+ </svg>
5241
+ </xsl:when>
5242
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5243
+ <xsl:variable name="src">
5244
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5245
+ </xsl:variable>
5246
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
5247
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
5248
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5249
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5250
+ <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">
5251
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
5252
+ </svg>
5253
+ </xsl:when>
5254
+ <xsl:otherwise>
5255
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
5256
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
5257
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
5258
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
5259
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
5260
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5261
+ <!-- width=<xsl:value-of select="$width"/> -->
5262
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5263
+ <!-- height=<xsl:value-of select="$height"/> -->
5264
+ <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">
5265
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
5266
+ <xsl:call-template name="svg_cross">
5267
+ <xsl:with-param name="width" select="$width"/>
5268
+ <xsl:with-param name="height" select="$height"/>
5269
+ </xsl:call-template>
5270
+ </svg>
5271
+ </xsl:otherwise>
5272
+ </xsl:choose>
5273
+
5274
+ </xsl:template><xsl:template name="svg_cross">
5275
+ <xsl:param name="width"/>
5276
+ <xsl:param name="height"/>
5277
+ <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
+ <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; "/>
5023
5279
  </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">
5024
5280
  <xsl:apply-templates mode="contents"/>
5025
5281
  <xsl:text> </xsl:text>
@@ -5562,6 +5818,7 @@
5562
5818
  <xsl:variable name="element">
5563
5819
 
5564
5820
  inline
5821
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5565
5822
  </xsl:variable>
5566
5823
  <xsl:choose>
5567
5824
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5569,7 +5826,7 @@
5569
5826
  <xsl:apply-templates/>
5570
5827
  </fo:inline>
5571
5828
  </xsl:when>
5572
- <xsl:when test="normalize-space($element) = 'block'">
5829
+ <xsl:when test="contains(normalize-space($element), 'block')">
5573
5830
  <fo:block xsl:use-attribute-sets="example-name-style">
5574
5831
  <xsl:apply-templates/>
5575
5832
  </fo:block>
@@ -5582,10 +5839,11 @@
5582
5839
  </xsl:choose>
5583
5840
 
5584
5841
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5585
-
5842
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5586
5843
  <xsl:variable name="element">
5587
5844
  block
5588
5845
 
5846
+
5589
5847
  </xsl:variable>
5590
5848
  <xsl:choose>
5591
5849
  <xsl:when test="normalize-space($element) = 'block'">
@@ -5689,29 +5947,47 @@
5689
5947
  <xsl:text>— </xsl:text>
5690
5948
  <xsl:apply-templates/>
5691
5949
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5692
- <fo:inline xsl:use-attribute-sets="eref-style">
5693
- <xsl:if test="@type = 'footnote'">
5694
-
5695
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5696
- <xsl:attribute name="font-size">80%</xsl:attribute>
5697
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5698
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5699
-
5700
-
5701
- </xsl:if>
5702
-
5703
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5704
-
5705
- <xsl:if test="@type = 'inline'">
5706
-
5707
-
5708
-
5709
- </xsl:if>
5710
-
5711
-
5712
- <xsl:apply-templates/>
5713
- </fo:basic-link>
5714
- </fo:inline>
5950
+
5951
+ <xsl:variable name="bibitemid">
5952
+ <xsl:choose>
5953
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5954
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5955
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5956
+ </xsl:choose>
5957
+ </xsl:variable>
5958
+
5959
+ <xsl:choose>
5960
+ <xsl:when test="normalize-space($bibitemid) != ''">
5961
+ <fo:inline xsl:use-attribute-sets="eref-style">
5962
+ <xsl:if test="@type = 'footnote'">
5963
+
5964
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5965
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5966
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5967
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5968
+
5969
+
5970
+ </xsl:if>
5971
+
5972
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5973
+ <xsl:if test="normalize-space(@citeas) = ''">
5974
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5975
+ </xsl:if>
5976
+ <xsl:if test="@type = 'inline'">
5977
+
5978
+
5979
+
5980
+ </xsl:if>
5981
+
5982
+ <xsl:apply-templates/>
5983
+ </fo:basic-link>
5984
+
5985
+ </fo:inline>
5986
+ </xsl:when>
5987
+ <xsl:otherwise>
5988
+ <fo:inline><xsl:apply-templates/></fo:inline>
5989
+ </xsl:otherwise>
5990
+ </xsl:choose>
5715
5991
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5716
5992
  <!-- zero-space char -->
5717
5993
  <xsl:variable name="depth">
@@ -5771,7 +6047,8 @@
5771
6047
  </fo:inline>
5772
6048
  </xsl:when>
5773
6049
  <xsl:otherwise>
5774
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
6050
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
6051
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5775
6052
  </xsl:otherwise>
5776
6053
  </xsl:choose>
5777
6054
 
@@ -5891,6 +6168,153 @@
5891
6168
  </fo:block>
5892
6169
  </xsl:otherwise>
5893
6170
  </xsl:choose>
6171
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
6172
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
6173
+ <bookmark><xsl:value-of select="@id"/></bookmark>
6174
+ </xsl:for-each>
6175
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
6176
+ <xsl:copy>
6177
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
6178
+ </xsl:copy>
6179
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
6180
+ <xsl:variable name="id">
6181
+ <xsl:call-template name="generateIndexXrefId"/>
6182
+ </xsl:variable>
6183
+ <xsl:copy> <!-- add id to xref -->
6184
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
6185
+ <xsl:attribute name="id">
6186
+ <xsl:value-of select="$id"/>
6187
+ </xsl:attribute>
6188
+ <xsl:apply-templates mode="index_add_id"/>
6189
+ </xsl:copy>
6190
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6191
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6192
+ <xsl:if test="@to">
6193
+ <xsl:value-of select="$dash"/>
6194
+ <xsl:copy>
6195
+ <xsl:copy-of select="@*"/>
6196
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
6197
+ <xsl:attribute name="id">
6198
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
6199
+ </xsl:attribute>
6200
+ <xsl:apply-templates mode="index_add_id"/>
6201
+ </xsl:copy>
6202
+ </xsl:if>
6203
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
6204
+ <xsl:copy>
6205
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
6206
+ </xsl:copy>
6207
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
6208
+ <xsl:copy>
6209
+ <xsl:apply-templates select="@*" mode="index_update"/>
6210
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
6211
+ </xsl:copy>
6212
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
6213
+ <xsl:param name="element"/>
6214
+ <xsl:param name="remove" select="'false'"/>
6215
+ <xsl:param name="target"/>
6216
+ <!-- <node></node> -->
6217
+ <xsl:choose>
6218
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6219
+ <!-- skip text (i.e. remove it) and process next element -->
6220
+ <!-- [removed_<xsl:value-of select="."/>] -->
6221
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6222
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
6223
+ </xsl:apply-templates>
6224
+ </xsl:when>
6225
+ <xsl:when test="self::text()">
6226
+ <xsl:value-of select="."/>
6227
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6228
+ </xsl:when>
6229
+ <xsl:when test="self::* and local-name(.) = 'xref'">
6230
+ <xsl:variable name="id" select="@id"/>
6231
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
6232
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
6233
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
6234
+
6235
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
6236
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
6237
+
6238
+ <xsl:choose>
6239
+ <!-- 2nd pass -->
6240
+ <!-- if page is equal to page for next and page is not the end of range -->
6241
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
6242
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
6243
+ <!-- [removed_xref] -->
6244
+
6245
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6246
+ <xsl:with-param name="remove">true</xsl:with-param>
6247
+ <xsl:with-param name="target">
6248
+ <xsl:choose>
6249
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
6250
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
6251
+ </xsl:choose>
6252
+ </xsl:with-param>
6253
+ </xsl:apply-templates>
6254
+ </xsl:when>
6255
+
6256
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
6257
+ <!-- remove xref -->
6258
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6259
+ <xsl:with-param name="remove">true</xsl:with-param>
6260
+ </xsl:apply-templates>
6261
+ </xsl:when>
6262
+
6263
+ <xsl:otherwise>
6264
+ <xsl:apply-templates select="." mode="xref_copy">
6265
+ <xsl:with-param name="target" select="$target"/>
6266
+ </xsl:apply-templates>
6267
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6268
+ </xsl:otherwise>
6269
+ </xsl:choose>
6270
+ </xsl:when>
6271
+ <xsl:when test="self::* and local-name(.) = 'ul'">
6272
+ <!-- ul -->
6273
+ <xsl:apply-templates select="." mode="index_update"/>
6274
+ </xsl:when>
6275
+ <xsl:otherwise>
6276
+ <xsl:apply-templates select="." mode="xref_copy">
6277
+ <xsl:with-param name="target" select="$target"/>
6278
+ </xsl:apply-templates>
6279
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6280
+ </xsl:otherwise>
6281
+ </xsl:choose>
6282
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
6283
+ <xsl:param name="target"/>
6284
+ <xsl:copy>
6285
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
6286
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
6287
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
6288
+ </xsl:if>
6289
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
6290
+ </xsl:copy>
6291
+ </xsl:template><xsl:template name="generateIndexXrefId">
6292
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6293
+
6294
+ <xsl:variable name="docid">
6295
+ <xsl:call-template name="getDocumentId"/>
6296
+ </xsl:variable>
6297
+ <xsl:variable name="item_number">
6298
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
6299
+ </xsl:variable>
6300
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6301
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6302
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6303
+ <xsl:apply-templates/>
6304
+ <fo:block>
6305
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6306
+ <fo:block> </fo:block>
6307
+ </xsl:if>
6308
+ </fo:block>
6309
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6310
+ <xsl:apply-templates/>
6311
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6312
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6313
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6314
+ <xsl:apply-templates/>
6315
+ </fo:block>
6316
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6317
+ <fo:inline id="{@id}" font-size="1pt"/>
5894
6318
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5895
6319
  <!-- <row>
5896
6320
  <date>05-07-2013</date>
@@ -6107,70 +6531,68 @@
6107
6531
  <xsl:variable name="lang">
6108
6532
  <xsl:call-template name="getLang"/>
6109
6533
  </xsl:variable>
6110
- <fo:declarations>
6111
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6112
- <pdf:dictionary type="normal" key="ViewerPreferences">
6113
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6114
- </pdf:dictionary>
6115
- </pdf:catalog>
6116
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
6117
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6118
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6119
- <!-- Dublin Core properties go here -->
6120
- <dc:title>
6121
- <xsl:variable name="title">
6122
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6123
-
6124
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
6125
-
6126
-
6127
-
6128
-
6129
-
6130
-
6131
- </xsl:for-each>
6132
- </xsl:variable>
6133
- <xsl:choose>
6134
- <xsl:when test="normalize-space($title) != ''">
6135
- <xsl:value-of select="$title"/>
6136
- </xsl:when>
6137
- <xsl:otherwise>
6138
- <xsl:text> </xsl:text>
6139
- </xsl:otherwise>
6140
- </xsl:choose>
6141
- </dc:title>
6142
- <dc:creator>
6534
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6535
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6536
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6537
+ </pdf:dictionary>
6538
+ </pdf:catalog>
6539
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6540
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6541
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6542
+ <!-- Dublin Core properties go here -->
6543
+ <dc:title>
6544
+ <xsl:variable name="title">
6143
6545
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6144
6546
 
6145
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6146
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6147
- <xsl:if test="position() != last()">; </xsl:if>
6148
- </xsl:for-each>
6149
-
6547
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
6150
6548
 
6151
6549
 
6152
- </xsl:for-each>
6153
- </dc:creator>
6154
- <dc:description>
6155
- <xsl:variable name="abstract">
6156
6550
 
6157
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6158
6551
 
6159
6552
 
6160
- </xsl:variable>
6161
- <xsl:value-of select="normalize-space($abstract)"/>
6162
- </dc:description>
6163
- <pdf:Keywords>
6164
- <xsl:call-template name="insertKeywords"/>
6165
- </pdf:Keywords>
6166
- </rdf:Description>
6167
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6168
- <!-- XMP properties go here -->
6169
- <xmp:CreatorTool/>
6170
- </rdf:Description>
6171
- </rdf:RDF>
6172
- </x:xmpmeta>
6173
- </fo:declarations>
6553
+
6554
+ </xsl:for-each>
6555
+ </xsl:variable>
6556
+ <xsl:choose>
6557
+ <xsl:when test="normalize-space($title) != ''">
6558
+ <xsl:value-of select="$title"/>
6559
+ </xsl:when>
6560
+ <xsl:otherwise>
6561
+ <xsl:text> </xsl:text>
6562
+ </xsl:otherwise>
6563
+ </xsl:choose>
6564
+ </dc:title>
6565
+ <dc:creator>
6566
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6567
+
6568
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6569
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6570
+ <xsl:if test="position() != last()">; </xsl:if>
6571
+ </xsl:for-each>
6572
+
6573
+
6574
+
6575
+ </xsl:for-each>
6576
+ </dc:creator>
6577
+ <dc:description>
6578
+ <xsl:variable name="abstract">
6579
+
6580
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6581
+
6582
+
6583
+ </xsl:variable>
6584
+ <xsl:value-of select="normalize-space($abstract)"/>
6585
+ </dc:description>
6586
+ <pdf:Keywords>
6587
+ <xsl:call-template name="insertKeywords"/>
6588
+ </pdf:Keywords>
6589
+ </rdf:Description>
6590
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6591
+ <!-- XMP properties go here -->
6592
+ <xmp:CreatorTool/>
6593
+ </rdf:Description>
6594
+ </rdf:RDF>
6595
+ </x:xmpmeta>
6174
6596
  </xsl:template><xsl:template name="getId">
6175
6597
  <xsl:choose>
6176
6598
  <xsl:when test="../@id">
@@ -6334,4 +6756,44 @@
6334
6756
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6335
6757
  </xsl:choose>
6336
6758
 
6759
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6760
+ <xsl:param name="isAdded"/>
6761
+ <xsl:param name="isDeleted"/>
6762
+ <xsl:choose>
6763
+ <xsl:when test="local-name() = 'math'">
6764
+ <xsl:if test="$isAdded = 'true'">
6765
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6766
+ </xsl:if>
6767
+ <xsl:if test="$isDeleted = 'true'">
6768
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6769
+ </xsl:if>
6770
+ </xsl:when>
6771
+ <xsl:otherwise>
6772
+ <xsl:if test="$isAdded = 'true'">
6773
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6774
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6775
+ </xsl:if>
6776
+ <xsl:if test="$isDeleted = 'true'">
6777
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6778
+ <xsl:if test="local-name() = 'table'">
6779
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6780
+ </xsl:if>
6781
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6782
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6783
+ </xsl:if>
6784
+ </xsl:otherwise>
6785
+ </xsl:choose>
6786
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6787
+ <xsl:if test="$lang = 'ar'">
6788
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6789
+ </xsl:if>
6790
+ </xsl:template><xsl:template name="setAlignment">
6791
+ <xsl:param name="align" select="normalize-space(@align)"/>
6792
+ <xsl:choose>
6793
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6794
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6795
+ <xsl:when test="$align != ''">
6796
+ <xsl:value-of select="$align"/>
6797
+ </xsl:when>
6798
+ </xsl:choose>
6337
6799
  </xsl:template></xsl:stylesheet>