metanorma-iec 1.2.13 → 1.3.0

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 +6 -2
  5. data/lib/asciidoctor/iec/biblio.rng +4 -6
  6. data/lib/asciidoctor/iec/iec.rng +11 -0
  7. data/lib/asciidoctor/iec/isodoc.rng +235 -3
  8. data/lib/asciidoctor/iec/isostandard.rng +17 -97
  9. data/lib/isodoc/iec/html/htmlstyle.css +7 -0
  10. data/lib/isodoc/iec/html_convert.rb +0 -1
  11. data/lib/isodoc/iec/iec.international-standard.xsl +552 -268
  12. data/lib/metanorma/iec/version.rb +1 -1
  13. data/metanorma-iec.gemspec +6 -6
  14. data/spec/{asciidoctor-iec → asciidoctor}/base_spec.rb +0 -0
  15. data/spec/{asciidoctor-iec → asciidoctor}/blocks_spec.rb +0 -0
  16. data/spec/{asciidoctor-iec → asciidoctor}/cleanup_spec.rb +0 -0
  17. data/spec/{asciidoctor-iec → asciidoctor}/iev_spec.rb +0 -0
  18. data/spec/{asciidoctor-iec → asciidoctor}/inline_spec.rb +0 -0
  19. data/spec/{asciidoctor-iec → asciidoctor}/lists_spec.rb +0 -0
  20. data/spec/{asciidoctor-iec → asciidoctor}/section_spec.rb +0 -0
  21. data/spec/{asciidoctor-iec → asciidoctor}/validate_spec.rb +22 -21
  22. data/spec/isodoc/postproc_spec.rb +2 -20
  23. data/spec/spec_helper.rb +6 -0
  24. metadata +51 -60
  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>
@@ -2727,6 +2740,7 @@
2727
2740
 
2728
2741
 
2729
2742
 
2743
+
2730
2744
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
2731
2745
 
2732
2746
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -2940,7 +2954,7 @@
2940
2954
 
2941
2955
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2942
2956
 
2943
-
2957
+
2944
2958
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2945
2959
 
2946
2960
  <xsl:attribute name="font-size">8pt</xsl:attribute>
@@ -2952,6 +2966,12 @@
2952
2966
 
2953
2967
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2954
2968
 
2969
+ </xsl:attribute-set><xsl:attribute-set name="add-style">
2970
+ <xsl:attribute name="color">red</xsl:attribute>
2971
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2972
+ </xsl:attribute-set><xsl:attribute-set name="del-style">
2973
+ <xsl:attribute name="color">red</xsl:attribute>
2974
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2955
2975
  </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2956
2976
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2957
2977
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2997,201 +3017,235 @@
2997
3017
  <xsl:call-template name="add-zero-spaces-java"/>
2998
3018
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2999
3019
 
3000
- <xsl:variable name="simple-table">
3001
- <xsl:call-template name="getSimpleTable"/>
3002
- </xsl:variable>
3020
+ <xsl:variable name="table">
3003
3021
 
3004
-
3005
-
3006
-
3007
-
3008
- <!-- <xsl:if test="$namespace = 'bipm'">
3009
- <fo:block>&#xA0;</fo:block>
3010
- </xsl:if> -->
3011
-
3012
- <!-- $namespace = 'iso' or -->
3013
-
3014
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3015
-
3016
-
3017
-
3018
- <xsl:call-template name="fn_name_display"/>
3022
+ <xsl:variable name="simple-table">
3023
+ <xsl:call-template name="getSimpleTable"/>
3024
+ </xsl:variable>
3019
3025
 
3020
3026
 
3021
-
3022
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3023
-
3024
- <!-- <xsl:variable name="cols-count">
3025
- <xsl:choose>
3026
- <xsl:when test="*[local-name()='thead']">
3027
- <xsl:call-template name="calculate-columns-numbers">
3028
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
3029
- </xsl:call-template>
3030
- </xsl:when>
3031
- <xsl:otherwise>
3032
- <xsl:call-template name="calculate-columns-numbers">
3033
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
3034
- </xsl:call-template>
3035
- </xsl:otherwise>
3036
- </xsl:choose>
3037
- </xsl:variable> -->
3038
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3039
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3040
-
3041
-
3042
-
3043
- <xsl:variable name="colwidths">
3044
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3045
- <xsl:call-template name="calculate-column-widths">
3046
- <xsl:with-param name="cols-count" select="$cols-count"/>
3047
- <xsl:with-param name="table" select="$simple-table"/>
3048
- </xsl:call-template>
3049
- </xsl:if>
3050
- </xsl:variable>
3051
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3052
-
3053
- <!-- <xsl:variable name="colwidths2">
3054
- <xsl:call-template name="calculate-column-widths">
3055
- <xsl:with-param name="cols-count" select="$cols-count"/>
3056
- </xsl:call-template>
3057
- </xsl:variable> -->
3058
-
3059
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
3060
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
3061
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
3062
-
3063
- <xsl:variable name="margin-left">
3064
- <xsl:choose>
3065
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
3066
- <xsl:otherwise>0</xsl:otherwise>
3067
- </xsl:choose>
3068
- </xsl:variable>
3069
-
3070
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3071
3027
 
3072
3028
 
3073
3029
 
3074
- <xsl:attribute name="font-size">8pt</xsl:attribute>
3075
- <xsl:attribute name="space-after">12pt</xsl:attribute>
3076
- <xsl:if test="ancestor::*[local-name() = 'preface']">
3077
- <xsl:attribute name="space-after">16pt</xsl:attribute>
3078
- </xsl:if>
3079
-
3080
-
3081
-
3030
+ <!-- <xsl:if test="$namespace = 'bipm'">
3031
+ <fo:block>&#xA0;</fo:block>
3032
+ </xsl:if> -->
3082
3033
 
3034
+ <!-- $namespace = 'iso' or -->
3083
3035
 
3084
-
3036
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
3085
3037
 
3038
+
3039
+
3040
+ <xsl:call-template name="fn_name_display"/>
3086
3041
 
3042
+
3087
3043
 
3044
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3088
3045
 
3046
+ <!-- <xsl:variable name="cols-count">
3047
+ <xsl:choose>
3048
+ <xsl:when test="*[local-name()='thead']">
3049
+ <xsl:call-template name="calculate-columns-numbers">
3050
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
3051
+ </xsl:call-template>
3052
+ </xsl:when>
3053
+ <xsl:otherwise>
3054
+ <xsl:call-template name="calculate-columns-numbers">
3055
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
3056
+ </xsl:call-template>
3057
+ </xsl:otherwise>
3058
+ </xsl:choose>
3059
+ </xsl:variable> -->
3060
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
3061
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
3089
3062
 
3090
3063
 
3091
3064
 
3092
- <xsl:variable name="table_attributes">
3093
- <attribute name="table-layout">fixed</attribute>
3094
- <attribute name="width">
3095
- <xsl:choose>
3096
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
3097
- <xsl:otherwise>100%</xsl:otherwise>
3098
- </xsl:choose>
3099
- </attribute>
3100
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
3101
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3065
+ <xsl:variable name="colwidths">
3066
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3067
+ <xsl:call-template name="calculate-column-widths">
3068
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3069
+ <xsl:with-param name="table" select="$simple-table"/>
3070
+ </xsl:call-template>
3071
+ </xsl:if>
3072
+ </xsl:variable>
3073
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3074
+
3075
+ <!-- <xsl:variable name="colwidths2">
3076
+ <xsl:call-template name="calculate-column-widths">
3077
+ <xsl:with-param name="cols-count" select="$cols-count"/>
3078
+ </xsl:call-template>
3079
+ </xsl:variable> -->
3080
+
3081
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
3082
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
3083
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
3084
+
3085
+ <xsl:variable name="margin-left">
3086
+ <xsl:choose>
3087
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
3088
+ <xsl:otherwise>0</xsl:otherwise>
3089
+ </xsl:choose>
3090
+ </xsl:variable>
3091
+
3092
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
3102
3093
 
3103
3094
 
3104
- <attribute name="border">0.5pt solid black</attribute>
3105
3095
 
3096
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
3097
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
3098
+ <xsl:if test="ancestor::*[local-name() = 'preface']">
3099
+ <xsl:attribute name="space-after">16pt</xsl:attribute>
3100
+ </xsl:if>
3101
+
3102
+
3103
+
3106
3104
 
3107
3105
 
3108
-
3109
-
3110
-
3106
+
3111
3107
 
3112
-
3113
3108
 
3114
- </xsl:variable>
3115
-
3116
-
3117
- <fo:table id="{@id}" table-omit-footer-at-break="true">
3118
3109
 
3119
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
3120
- <xsl:attribute name="{@name}">
3121
- <xsl:value-of select="."/>
3122
- </xsl:attribute>
3123
- </xsl:for-each>
3124
3110
 
3125
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
3126
- <xsl:if test="$isNoteOrFnExist = 'true'">
3127
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3128
- </xsl:if>
3129
3111
 
3130
- <xsl:choose>
3131
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3132
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3133
- <fo:table-column column-width="{@width}"/>
3134
- </xsl:for-each>
3135
- </xsl:when>
3136
- <xsl:otherwise>
3137
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3138
- <xsl:choose>
3139
- <xsl:when test=". = 1 or . = 0">
3140
- <fo:table-column column-width="proportional-column-width(2)"/>
3141
- </xsl:when>
3142
- <xsl:otherwise>
3143
- <fo:table-column column-width="proportional-column-width({.})"/>
3144
- </xsl:otherwise>
3145
- </xsl:choose>
3146
- </xsl:for-each>
3147
- </xsl:otherwise>
3148
- </xsl:choose>
3149
3112
 
3150
- <xsl:choose>
3151
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3152
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3153
- </xsl:when>
3154
- <xsl:otherwise>
3155
- <xsl:apply-templates/>
3156
- </xsl:otherwise>
3157
- </xsl:choose>
3113
+ <xsl:variable name="table_width">
3114
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
3115
+ 100%
3116
+
3117
+
3118
+ </xsl:variable>
3119
+
3120
+ <xsl:variable name="table_attributes">
3121
+ <attribute name="table-layout">fixed</attribute>
3122
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
3123
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
3124
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
3125
+
3126
+
3127
+ <attribute name="border">0.5pt solid black</attribute>
3128
+
3129
+
3130
+
3131
+
3132
+
3133
+
3134
+
3135
+
3136
+
3137
+ </xsl:variable>
3158
3138
 
3159
- </fo:table>
3160
-
3161
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3162
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3163
- <xsl:call-template name="insertTableFooterInSeparateTable">
3164
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
3165
- <xsl:with-param name="colwidths" select="$colwidths"/>
3166
- <xsl:with-param name="colgroup" select="$colgroup"/>
3167
- </xsl:call-template>
3168
- </xsl:for-each>
3169
-
3170
- <!-- insert footer as table -->
3171
- <!-- <fo:table>
3172
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
3173
- <xsl:attribute name="{@name}">
3174
- <xsl:value-of select="."/>
3175
- </xsl:attribute>
3176
- </xsl:for-each>
3177
3139
 
3178
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3140
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
3141
+
3142
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
3143
+ <xsl:attribute name="{@name}">
3144
+ <xsl:value-of select="."/>
3145
+ </xsl:attribute>
3146
+ </xsl:for-each>
3147
+
3148
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
3149
+ <xsl:if test="$isNoteOrFnExist = 'true'">
3150
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3151
+ </xsl:if>
3152
+
3153
+ <xsl:choose>
3154
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
3155
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
3156
+ <fo:table-column column-width="{@width}"/>
3157
+ </xsl:for-each>
3158
+ </xsl:when>
3159
+ <xsl:otherwise>
3160
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3161
+ <xsl:choose>
3162
+ <xsl:when test=". = 1 or . = 0">
3163
+ <fo:table-column column-width="proportional-column-width(2)"/>
3164
+ </xsl:when>
3165
+ <xsl:otherwise>
3166
+ <fo:table-column column-width="proportional-column-width({.})"/>
3167
+ </xsl:otherwise>
3168
+ </xsl:choose>
3169
+ </xsl:for-each>
3170
+ </xsl:otherwise>
3171
+ </xsl:choose>
3172
+
3179
3173
  <xsl:choose>
3180
- <xsl:when test=". = 1 or . = 0">
3181
- <fo:table-column column-width="proportional-column-width(2)"/>
3174
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
3175
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
3182
3176
  </xsl:when>
3183
3177
  <xsl:otherwise>
3184
- <fo:table-column column-width="proportional-column-width({.})"/>
3178
+ <xsl:apply-templates/>
3185
3179
  </xsl:otherwise>
3186
3180
  </xsl:choose>
3181
+
3182
+ </fo:table>
3183
+
3184
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
3185
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
3186
+ <xsl:call-template name="insertTableFooterInSeparateTable">
3187
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
3188
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3189
+ <xsl:with-param name="colgroup" select="$colgroup"/>
3190
+ </xsl:call-template>
3187
3191
  </xsl:for-each>
3188
- </fo:table>-->
3189
-
3190
-
3191
-
3192
-
3193
-
3194
- </fo:block-container>
3192
+
3193
+ <!-- insert footer as table -->
3194
+ <!-- <fo:table>
3195
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
3196
+ <xsl:attribute name="{@name}">
3197
+ <xsl:value-of select="."/>
3198
+ </xsl:attribute>
3199
+ </xsl:for-each>
3200
+
3201
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3202
+ <xsl:choose>
3203
+ <xsl:when test=". = 1 or . = 0">
3204
+ <fo:table-column column-width="proportional-column-width(2)"/>
3205
+ </xsl:when>
3206
+ <xsl:otherwise>
3207
+ <fo:table-column column-width="proportional-column-width({.})"/>
3208
+ </xsl:otherwise>
3209
+ </xsl:choose>
3210
+ </xsl:for-each>
3211
+ </fo:table>-->
3212
+
3213
+
3214
+
3215
+
3216
+
3217
+ </fo:block-container>
3218
+ </xsl:variable>
3219
+
3220
+
3221
+
3222
+ <xsl:choose>
3223
+ <xsl:when test="@width">
3224
+
3225
+ <!-- centered table when table name is centered (see table-name-style) -->
3226
+
3227
+ <fo:table table-layout="fixed" width="100%">
3228
+ <fo:table-column column-width="proportional-column-width(1)"/>
3229
+ <fo:table-column column-width="{@width}"/>
3230
+ <fo:table-column column-width="proportional-column-width(1)"/>
3231
+ <fo:table-body>
3232
+ <fo:table-row>
3233
+ <fo:table-cell column-number="2">
3234
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
3235
+ </fo:table-cell>
3236
+ </fo:table-row>
3237
+ </fo:table-body>
3238
+ </fo:table>
3239
+
3240
+
3241
+
3242
+
3243
+ </xsl:when>
3244
+ <xsl:otherwise>
3245
+ <xsl:copy-of select="$table"/>
3246
+ </xsl:otherwise>
3247
+ </xsl:choose>
3248
+
3195
3249
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
3196
3250
  <xsl:if test="normalize-space() != ''">
3197
3251
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -3319,7 +3373,15 @@
3319
3373
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3320
3374
  <xsl:value-of select="@target"/>
3321
3375
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3322
- <xsl:variable name="math_text" select="normalize-space(.)"/>
3376
+ <xsl:variable name="mathml">
3377
+ <xsl:for-each select="*">
3378
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3379
+ <xsl:copy-of select="."/>
3380
+ </xsl:if>
3381
+ </xsl:for-each>
3382
+ </xsl:variable>
3383
+
3384
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3323
3385
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3324
3386
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3325
3387
  <xsl:param name="cols-count"/>
@@ -4093,7 +4155,7 @@
4093
4155
  <xsl:with-param name="table" select="$html-table"/>
4094
4156
  </xsl:call-template>
4095
4157
  </xsl:variable>
4096
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
4158
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
4097
4159
  <xsl:variable name="maxlength_dt">
4098
4160
  <xsl:call-template name="getMaxLength_dt"/>
4099
4161
  </xsl:variable>
@@ -4122,13 +4184,22 @@
4122
4184
  </xsl:when>
4123
4185
  <xsl:otherwise>
4124
4186
  <xsl:choose>
4187
+ <!-- to set width check most wide chars like `W` -->
4125
4188
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4126
- <fo:table-column column-width="5%"/>
4127
- <fo:table-column column-width="95%"/>
4189
+ <fo:table-column column-width="7%"/>
4190
+ <fo:table-column column-width="93%"/>
4191
+ </xsl:when>
4192
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
4193
+ <fo:table-column column-width="15%"/>
4194
+ <fo:table-column column-width="85%"/>
4128
4195
  </xsl:when>
4129
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
4130
- <fo:table-column column-width="10%"/>
4131
- <fo:table-column column-width="90%"/>
4196
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
4197
+ <fo:table-column column-width="20%"/>
4198
+ <fo:table-column column-width="80%"/>
4199
+ </xsl:when>
4200
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
4201
+ <fo:table-column column-width="25%"/>
4202
+ <fo:table-column column-width="75%"/>
4132
4203
  </xsl:when>
4133
4204
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
4134
4205
  <fo:table-column column-width="60%"/>
@@ -4346,8 +4417,16 @@
4346
4417
  <fo:inline text-decoration="underline">
4347
4418
  <xsl:apply-templates/>
4348
4419
  </fo:inline>
4420
+ </xsl:template><xsl:template match="*[local-name()='add']">
4421
+ <fo:inline xsl:use-attribute-sets="add-style">
4422
+ <xsl:apply-templates/>
4423
+ </fo:inline>
4349
4424
  </xsl:template><xsl:template match="*[local-name()='del']">
4350
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4425
+ <fo:inline xsl:use-attribute-sets="del-style">
4426
+ <xsl:apply-templates/>
4427
+ </fo:inline>
4428
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4429
+ <fo:inline background-color="yellow">
4351
4430
  <xsl:apply-templates/>
4352
4431
  </fo:inline>
4353
4432
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -4439,6 +4518,10 @@
4439
4518
  <xsl:param name="text" select="."/>
4440
4519
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4441
4520
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4521
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
4522
+ <xsl:param name="text" select="."/>
4523
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4524
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4442
4525
  </xsl:template><xsl:template name="add-zero-spaces">
4443
4526
  <xsl:param name="text" select="."/>
4444
4527
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -4686,6 +4769,7 @@
4686
4769
  <xsl:apply-templates select="." mode="mathml"/>
4687
4770
  </xsl:variable>
4688
4771
  <fo:instream-foreign-object fox:alt-text="Math">
4772
+
4689
4773
  <!-- <xsl:copy-of select="."/> -->
4690
4774
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4691
4775
  </fo:instream-foreign-object>
@@ -4699,7 +4783,12 @@
4699
4783
  <!-- replace start and end spaces to non-break space -->
4700
4784
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4701
4785
  </xsl:copy>
4702
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4786
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
4787
+ <xsl:copy>
4788
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
4789
+ </xsl:copy>
4790
+ <mathml:mspace width="0.5ex"/>
4791
+ </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">
4703
4792
  <xsl:variable name="target">
4704
4793
  <xsl:choose>
4705
4794
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4724,7 +4813,10 @@
4724
4813
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4725
4814
  <xsl:choose>
4726
4815
  <xsl:when test="normalize-space(.) = ''">
4727
- <xsl:value-of select="$target"/>
4816
+ <!-- <xsl:value-of select="$target"/> -->
4817
+ <xsl:call-template name="add-zero-spaces-link-java">
4818
+ <xsl:with-param name="text" select="$target"/>
4819
+ </xsl:call-template>
4728
4820
  </xsl:when>
4729
4821
  <xsl:otherwise>
4730
4822
  <xsl:apply-templates/>
@@ -4734,8 +4826,6 @@
4734
4826
  </xsl:otherwise>
4735
4827
  </xsl:choose>
4736
4828
  </fo:inline>
4737
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4738
- <fo:inline id="{@id}"/>
4739
4829
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4740
4830
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4741
4831
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4944,27 +5034,43 @@
4944
5034
  <fo:block id="{@id}">
4945
5035
  <xsl:apply-templates/>
4946
5036
  </fo:block>
5037
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4947
5038
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4948
5039
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4949
5040
  <xsl:apply-templates/>
4950
5041
  </fo:block>
4951
5042
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4952
- <fo:block xsl:use-attribute-sets="image-style">
4953
-
4954
-
4955
- <xsl:variable name="src">
4956
- <xsl:choose>
4957
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4958
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4959
- </xsl:when>
4960
- <xsl:otherwise>
4961
- <xsl:value-of select="@src"/>
4962
- </xsl:otherwise>
4963
- </xsl:choose>
4964
- </xsl:variable>
4965
-
4966
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4967
- </fo:block>
5043
+ <xsl:choose>
5044
+ <xsl:when test="ancestor::*[local-name() = 'title']">
5045
+ <fo:inline padding-left="1mm" padding-right="1mm">
5046
+ <xsl:variable name="src">
5047
+ <xsl:call-template name="image_src"/>
5048
+ </xsl:variable>
5049
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
5050
+ </fo:inline>
5051
+ </xsl:when>
5052
+ <xsl:otherwise>
5053
+ <fo:block xsl:use-attribute-sets="image-style">
5054
+
5055
+ <xsl:variable name="src">
5056
+ <xsl:call-template name="image_src"/>
5057
+ </xsl:variable>
5058
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5059
+ </fo:block>
5060
+ </xsl:otherwise>
5061
+ </xsl:choose>
5062
+ </xsl:template><xsl:template name="image_src">
5063
+ <xsl:choose>
5064
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5065
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5066
+ </xsl:when>
5067
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5068
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5069
+ </xsl:when>
5070
+ <xsl:otherwise>
5071
+ <xsl:value-of select="@src"/>
5072
+ </xsl:otherwise>
5073
+ </xsl:choose>
4968
5074
  </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">
4969
5075
  <xsl:apply-templates mode="contents"/>
4970
5076
  <xsl:text> </xsl:text>
@@ -5197,6 +5303,8 @@
5197
5303
  <xsl:copy>
5198
5304
  <xsl:apply-templates mode="contents_item"/>
5199
5305
  </xsl:copy>
5306
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
5307
+ <xsl:copy-of select="."/>
5200
5308
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
5201
5309
  <xsl:text> </xsl:text>
5202
5310
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -5525,10 +5633,11 @@
5525
5633
  </xsl:choose>
5526
5634
 
5527
5635
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5528
-
5636
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5529
5637
  <xsl:variable name="element">
5530
5638
  block
5531
5639
 
5640
+
5532
5641
  </xsl:variable>
5533
5642
  <xsl:choose>
5534
5643
  <xsl:when test="normalize-space($element) = 'block'">
@@ -5603,11 +5712,13 @@
5603
5712
  </xsl:if>
5604
5713
  </xsl:if>
5605
5714
 
5715
+
5606
5716
  <fo:block-container margin-left="0mm">
5607
5717
 
5608
5718
  <fo:block xsl:use-attribute-sets="quote-style">
5609
5719
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
5610
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5720
+
5721
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5611
5722
  </fo:block>
5612
5723
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
5613
5724
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -5630,29 +5741,47 @@
5630
5741
  <xsl:text>— </xsl:text>
5631
5742
  <xsl:apply-templates/>
5632
5743
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5633
- <fo:inline xsl:use-attribute-sets="eref-style">
5634
- <xsl:if test="@type = 'footnote'">
5635
-
5636
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5637
- <xsl:attribute name="font-size">80%</xsl:attribute>
5638
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5639
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5640
-
5641
-
5642
- </xsl:if>
5643
-
5644
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5645
-
5646
- <xsl:if test="@type = 'inline'">
5647
-
5648
-
5649
-
5650
- </xsl:if>
5651
-
5652
-
5653
- <xsl:apply-templates/>
5654
- </fo:basic-link>
5655
- </fo:inline>
5744
+
5745
+ <xsl:variable name="bibitemid">
5746
+ <xsl:choose>
5747
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5748
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5749
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5750
+ </xsl:choose>
5751
+ </xsl:variable>
5752
+
5753
+ <xsl:choose>
5754
+ <xsl:when test="normalize-space($bibitemid) != ''">
5755
+ <fo:inline xsl:use-attribute-sets="eref-style">
5756
+ <xsl:if test="@type = 'footnote'">
5757
+
5758
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5759
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5760
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5761
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5762
+
5763
+
5764
+ </xsl:if>
5765
+
5766
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5767
+ <xsl:if test="normalize-space(@citeas) = ''">
5768
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5769
+ </xsl:if>
5770
+ <xsl:if test="@type = 'inline'">
5771
+
5772
+
5773
+
5774
+ </xsl:if>
5775
+
5776
+ <xsl:apply-templates/>
5777
+ </fo:basic-link>
5778
+
5779
+ </fo:inline>
5780
+ </xsl:when>
5781
+ <xsl:otherwise>
5782
+ <fo:inline><xsl:apply-templates/></fo:inline>
5783
+ </xsl:otherwise>
5784
+ </xsl:choose>
5656
5785
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5657
5786
  <!-- zero-space char -->
5658
5787
  <xsl:variable name="depth">
@@ -5832,6 +5961,153 @@
5832
5961
  </fo:block>
5833
5962
  </xsl:otherwise>
5834
5963
  </xsl:choose>
5964
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5965
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5966
+ <bookmark><xsl:value-of select="@id"/></bookmark>
5967
+ </xsl:for-each>
5968
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
5969
+ <xsl:copy>
5970
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
5971
+ </xsl:copy>
5972
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
5973
+ <xsl:variable name="id">
5974
+ <xsl:call-template name="generateIndexXrefId"/>
5975
+ </xsl:variable>
5976
+ <xsl:copy> <!-- add id to xref -->
5977
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
5978
+ <xsl:attribute name="id">
5979
+ <xsl:value-of select="$id"/>
5980
+ </xsl:attribute>
5981
+ <xsl:apply-templates mode="index_add_id"/>
5982
+ </xsl:copy>
5983
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5984
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5985
+ <xsl:if test="@to">
5986
+ <xsl:value-of select="$dash"/>
5987
+ <xsl:copy>
5988
+ <xsl:copy-of select="@*"/>
5989
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
5990
+ <xsl:attribute name="id">
5991
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
5992
+ </xsl:attribute>
5993
+ <xsl:apply-templates mode="index_add_id"/>
5994
+ </xsl:copy>
5995
+ </xsl:if>
5996
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
5997
+ <xsl:copy>
5998
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
5999
+ </xsl:copy>
6000
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
6001
+ <xsl:copy>
6002
+ <xsl:apply-templates select="@*" mode="index_update"/>
6003
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
6004
+ </xsl:copy>
6005
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
6006
+ <xsl:param name="element"/>
6007
+ <xsl:param name="remove" select="'false'"/>
6008
+ <xsl:param name="target"/>
6009
+ <!-- <node></node> -->
6010
+ <xsl:choose>
6011
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6012
+ <!-- skip text (i.e. remove it) and process next element -->
6013
+ <!-- [removed_<xsl:value-of select="."/>] -->
6014
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6015
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
6016
+ </xsl:apply-templates>
6017
+ </xsl:when>
6018
+ <xsl:when test="self::text()">
6019
+ <xsl:value-of select="."/>
6020
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6021
+ </xsl:when>
6022
+ <xsl:when test="self::* and local-name(.) = 'xref'">
6023
+ <xsl:variable name="id" select="@id"/>
6024
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
6025
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
6026
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
6027
+
6028
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
6029
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
6030
+
6031
+ <xsl:choose>
6032
+ <!-- 2nd pass -->
6033
+ <!-- if page is equal to page for next and page is not the end of range -->
6034
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
6035
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
6036
+ <!-- [removed_xref] -->
6037
+
6038
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6039
+ <xsl:with-param name="remove">true</xsl:with-param>
6040
+ <xsl:with-param name="target">
6041
+ <xsl:choose>
6042
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
6043
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
6044
+ </xsl:choose>
6045
+ </xsl:with-param>
6046
+ </xsl:apply-templates>
6047
+ </xsl:when>
6048
+
6049
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
6050
+ <!-- remove xref -->
6051
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6052
+ <xsl:with-param name="remove">true</xsl:with-param>
6053
+ </xsl:apply-templates>
6054
+ </xsl:when>
6055
+
6056
+ <xsl:otherwise>
6057
+ <xsl:apply-templates select="." mode="xref_copy">
6058
+ <xsl:with-param name="target" select="$target"/>
6059
+ </xsl:apply-templates>
6060
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6061
+ </xsl:otherwise>
6062
+ </xsl:choose>
6063
+ </xsl:when>
6064
+ <xsl:when test="self::* and local-name(.) = 'ul'">
6065
+ <!-- ul -->
6066
+ <xsl:apply-templates select="." mode="index_update"/>
6067
+ </xsl:when>
6068
+ <xsl:otherwise>
6069
+ <xsl:apply-templates select="." mode="xref_copy">
6070
+ <xsl:with-param name="target" select="$target"/>
6071
+ </xsl:apply-templates>
6072
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6073
+ </xsl:otherwise>
6074
+ </xsl:choose>
6075
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
6076
+ <xsl:param name="target"/>
6077
+ <xsl:copy>
6078
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
6079
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
6080
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
6081
+ </xsl:if>
6082
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
6083
+ </xsl:copy>
6084
+ </xsl:template><xsl:template name="generateIndexXrefId">
6085
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6086
+
6087
+ <xsl:variable name="docid">
6088
+ <xsl:call-template name="getDocumentId"/>
6089
+ </xsl:variable>
6090
+ <xsl:variable name="item_number">
6091
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
6092
+ </xsl:variable>
6093
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6094
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6095
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6096
+ <xsl:apply-templates/>
6097
+ <fo:block>
6098
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6099
+ <fo:block> </fo:block>
6100
+ </xsl:if>
6101
+ </fo:block>
6102
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6103
+ <xsl:apply-templates/>
6104
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6105
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6106
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6107
+ <xsl:apply-templates/>
6108
+ </fo:block>
6109
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6110
+ <fo:inline id="{@id}" font-size="1pt"/>
5835
6111
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5836
6112
  <!-- <row>
5837
6113
  <date>05-07-2013</date>
@@ -6019,7 +6295,7 @@
6019
6295
  <xsl:param name="charDelim" select="', '"/>
6020
6296
  <xsl:choose>
6021
6297
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
6022
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
6298
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
6023
6299
  <xsl:sort data-type="text" order="ascending"/>
6024
6300
  <xsl:call-template name="insertKeyword">
6025
6301
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -6028,7 +6304,7 @@
6028
6304
  </xsl:for-each>
6029
6305
  </xsl:when>
6030
6306
  <xsl:otherwise>
6031
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
6307
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
6032
6308
  <xsl:call-template name="insertKeyword">
6033
6309
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
6034
6310
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -6045,63 +6321,71 @@
6045
6321
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
6046
6322
  </xsl:choose>
6047
6323
  </xsl:template><xsl:template name="addPDFUAmeta">
6048
- <fo:declarations>
6049
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6050
- <pdf:dictionary type="normal" key="ViewerPreferences">
6051
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6052
- </pdf:dictionary>
6053
- </pdf:catalog>
6054
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
6055
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6056
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6057
- <!-- Dublin Core properties go here -->
6058
- <dc:title>
6059
- <xsl:variable name="title">
6324
+ <xsl:variable name="lang">
6325
+ <xsl:call-template name="getLang"/>
6326
+ </xsl:variable>
6327
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
6328
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6329
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6330
+ </pdf:dictionary>
6331
+ </pdf:catalog>
6332
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6333
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6334
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6335
+ <!-- Dublin Core properties go here -->
6336
+ <dc:title>
6337
+ <xsl:variable name="title">
6338
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6339
+
6340
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
6060
6341
 
6061
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
6062
6342
 
6063
6343
 
6064
6344
 
6065
6345
 
6066
6346
 
6067
- </xsl:variable>
6068
- <xsl:choose>
6069
- <xsl:when test="normalize-space($title) != ''">
6070
- <xsl:value-of select="$title"/>
6071
- </xsl:when>
6072
- <xsl:otherwise>
6073
- <xsl:text> </xsl:text>
6074
- </xsl:otherwise>
6075
- </xsl:choose>
6076
- </dc:title>
6077
- <dc:creator>
6347
+ </xsl:for-each>
6348
+ </xsl:variable>
6349
+ <xsl:choose>
6350
+ <xsl:when test="normalize-space($title) != ''">
6351
+ <xsl:value-of select="$title"/>
6352
+ </xsl:when>
6353
+ <xsl:otherwise>
6354
+ <xsl:text> </xsl:text>
6355
+ </xsl:otherwise>
6356
+ </xsl:choose>
6357
+ </dc:title>
6358
+ <dc:creator>
6359
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6078
6360
 
6361
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6362
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6363
+ <xsl:if test="position() != last()">; </xsl:if>
6364
+ </xsl:for-each>
6079
6365
 
6080
6366
 
6081
- </dc:creator>
6082
- <dc:description>
6083
- <xsl:variable name="abstract">
6084
-
6085
-
6086
- <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract'][@language = 'en']//text()"/>
6087
-
6088
-
6089
-
6090
-
6091
- </xsl:variable>
6092
- <xsl:value-of select="normalize-space($abstract)"/>
6093
- </dc:description>
6094
- <pdf:Keywords>
6095
- <xsl:call-template name="insertKeywords"/>
6096
- </pdf:Keywords>
6097
- </rdf:Description>
6098
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6099
- <!-- XMP properties go here -->
6100
- <xmp:CreatorTool/>
6101
- </rdf:Description>
6102
- </rdf:RDF>
6103
- </x:xmpmeta>
6104
- </fo:declarations>
6367
+
6368
+ </xsl:for-each>
6369
+ </dc:creator>
6370
+ <dc:description>
6371
+ <xsl:variable name="abstract">
6372
+
6373
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6374
+
6375
+
6376
+ </xsl:variable>
6377
+ <xsl:value-of select="normalize-space($abstract)"/>
6378
+ </dc:description>
6379
+ <pdf:Keywords>
6380
+ <xsl:call-template name="insertKeywords"/>
6381
+ </pdf:Keywords>
6382
+ </rdf:Description>
6383
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6384
+ <!-- XMP properties go here -->
6385
+ <xmp:CreatorTool/>
6386
+ </rdf:Description>
6387
+ </rdf:RDF>
6388
+ </x:xmpmeta>
6105
6389
  </xsl:template><xsl:template name="getId">
6106
6390
  <xsl:choose>
6107
6391
  <xsl:when test="../@id">