metanorma-iso 1.7.2 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +11 -41
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +7 -1
  5. data/lib/asciidoctor/iso/base.rb +14 -11
  6. data/lib/asciidoctor/iso/biblio.rng +4 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +40 -24
  8. data/lib/asciidoctor/iso/front.rb +29 -17
  9. data/lib/asciidoctor/iso/front_id.rb +81 -60
  10. data/lib/asciidoctor/iso/isodoc.rng +327 -2
  11. data/lib/asciidoctor/iso/isostandard.rng +12 -97
  12. data/lib/asciidoctor/iso/section.rb +2 -1
  13. data/lib/asciidoctor/iso/validate.rb +22 -109
  14. data/lib/asciidoctor/iso/validate_image.rb +97 -0
  15. data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
  16. data/lib/asciidoctor/iso/validate_section.rb +39 -20
  17. data/lib/asciidoctor/iso/validate_style.rb +36 -24
  18. data/lib/asciidoctor/iso/validate_title.rb +23 -17
  19. data/lib/isodoc/iso/base_convert.rb +19 -2
  20. data/lib/isodoc/iso/html/style-human.css +7 -0
  21. data/lib/isodoc/iso/html/style-iso.css +7 -0
  22. data/lib/isodoc/iso/html_convert.rb +0 -1
  23. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  24. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  25. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  26. data/lib/isodoc/iso/index.rb +140 -0
  27. data/lib/isodoc/iso/iso.amendment.xsl +1157 -208
  28. data/lib/isodoc/iso/iso.international-standard.xsl +1157 -208
  29. data/lib/isodoc/iso/metadata.rb +1 -0
  30. data/lib/isodoc/iso/presentation_xml_convert.rb +45 -37
  31. data/lib/isodoc/iso/sts_convert.rb +10 -13
  32. data/lib/isodoc/iso/word_convert.rb +0 -1
  33. data/lib/isodoc/iso/xref.rb +46 -25
  34. data/lib/metanorma/iso/processor.rb +1 -0
  35. data/lib/metanorma/iso/version.rb +1 -1
  36. data/metanorma-iso.gemspec +8 -8
  37. data/spec/{asciidoctor-iso → asciidoctor}/amd_spec.rb +5 -5
  38. data/spec/asciidoctor/base_spec.rb +825 -0
  39. data/spec/{asciidoctor-iso → asciidoctor}/blocks_spec.rb +0 -0
  40. data/spec/{asciidoctor-iso → asciidoctor}/cleanup_spec.rb +383 -25
  41. data/spec/{asciidoctor-iso → asciidoctor}/inline_spec.rb +0 -0
  42. data/spec/{asciidoctor-iso → asciidoctor}/lists_spec.rb +0 -0
  43. data/spec/{asciidoctor-iso → asciidoctor}/refs_spec.rb +0 -0
  44. data/spec/{asciidoctor-iso → asciidoctor}/section_spec.rb +0 -14
  45. data/spec/{asciidoctor-iso → asciidoctor}/table_spec.rb +0 -0
  46. data/spec/{asciidoctor-iso → asciidoctor}/validate_spec.rb +188 -83
  47. data/spec/isodoc/postproc_spec.rb +481 -438
  48. data/spec/isodoc/section_spec.rb +219 -0
  49. data/spec/spec_helper.rb +2 -0
  50. metadata +65 -64
  51. data/lib/isodoc/iso/html/scripts.html +0 -178
  52. data/spec/asciidoctor-iso/base_spec.rb +0 -704
@@ -1,19 +1,34 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
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
 
10
12
  <xsl:key name="kfn" match="iso:p/iso:fn" use="@reference"/>
11
13
 
14
+ <xsl:key name="attachments" match="iso:eref[contains(@bibitemid, '.exp')]" use="@bibitemid"/>
15
+
12
16
 
13
17
 
14
18
  <xsl:variable name="debug">false</xsl:variable>
15
- <xsl:variable name="pageWidth" select="'210mm'"/>
16
- <xsl:variable name="pageHeight" select="'297mm'"/>
19
+ <xsl:variable name="pageWidth" select="210"/>
20
+ <xsl:variable name="pageHeight" select="297"/>
21
+ <xsl:variable name="marginLeftRight1" select="25"/>
22
+ <xsl:variable name="marginLeftRight2" select="12.5"/>
23
+ <xsl:variable name="marginTop" select="27.4"/>
24
+ <xsl:variable name="marginBottom" select="13"/>
25
+
26
+ <xsl:variable name="figure_name_height">14</xsl:variable>
27
+ <xsl:variable name="width_effective" select="$pageWidth - $marginLeftRight1 - $marginLeftRight2"/><!-- paper width minus margins -->
28
+ <xsl:variable name="height_effective" select="$pageHeight - $marginTop - $marginBottom - $figure_name_height"/><!-- paper height minus margins and title height -->
29
+ <xsl:variable name="image_dpi" select="96"/>
30
+ <xsl:variable name="width_effective_px" select="$width_effective div 25.4 * $image_dpi"/>
31
+ <xsl:variable name="height_effective_px" select="$height_effective div 25.4 * $image_dpi"/>
17
32
 
18
33
  <xsl:variable name="docidentifierISO" select="/iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'iso'] | /iso:iso-standard/iso:bibdata/iso:docidentifier[@type = 'ISO']"/>
19
34
 
@@ -157,6 +172,7 @@
157
172
  <contents>
158
173
  <xsl:call-template name="processPrefaceSectionsDefault_Contents"/>
159
174
  <xsl:call-template name="processMainSectionsDefault_Contents"/>
175
+ <xsl:apply-templates select="//iso:indexsect" mode="contents"/>
160
176
  </contents>
161
177
  </xsl:variable>
162
178
 
@@ -170,10 +186,11 @@
170
186
  <xsl:if test="$lang = 'zh'">
171
187
  <xsl:attribute name="font-family">Source Han Sans, Times New Roman, Cambria Math</xsl:attribute>
172
188
  </xsl:if>
189
+
173
190
  <fo:layout-master-set>
174
191
 
175
192
  <!-- cover page -->
176
- <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
193
+ <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
177
194
  <fo:region-body margin-top="25.4mm" margin-bottom="25.4mm" margin-left="31.7mm" margin-right="31.7mm"/>
178
195
  <fo:region-before region-name="cover-page-header" extent="25.4mm"/>
179
196
  <fo:region-after/>
@@ -181,7 +198,7 @@
181
198
  <fo:region-end region-name="cover-right-region" extent="31.7mm"/>
182
199
  </fo:simple-page-master>
183
200
 
184
- <fo:simple-page-master master-name="cover-page-published" page-width="{$pageWidth}" page-height="{$pageHeight}">
201
+ <fo:simple-page-master master-name="cover-page-published" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
185
202
  <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="78mm" margin-right="18.5mm"/>
186
203
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
187
204
  <fo:region-after region-name="cover-page-footer" extent="40mm" display-align="after"/>
@@ -190,19 +207,19 @@
190
207
  </fo:simple-page-master>
191
208
 
192
209
 
193
- <fo:simple-page-master master-name="cover-page-publishedISO-odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
194
- <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="25mm" margin-right="12.5mm"/>
210
+ <fo:simple-page-master master-name="cover-page-publishedISO-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
211
+ <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
195
212
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
196
213
  <fo:region-after region-name="cover-page-footer" extent="40mm" display-align="after"/>
197
- <fo:region-start region-name="cover-left-region" extent="25mm"/>
198
- <fo:region-end region-name="cover-right-region" extent="12.5mm"/>
214
+ <fo:region-start region-name="cover-left-region" extent="{$marginLeftRight1}mm"/>
215
+ <fo:region-end region-name="cover-right-region" extent="{$marginLeftRight2}mm"/>
199
216
  </fo:simple-page-master>
200
- <fo:simple-page-master master-name="cover-page-publishedISO-even" page-width="{$pageWidth}" page-height="{$pageHeight}">
201
- <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="12.5mm" margin-right="25mm"/>
217
+ <fo:simple-page-master master-name="cover-page-publishedISO-even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
218
+ <fo:region-body margin-top="12.7mm" margin-bottom="40mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
202
219
  <fo:region-before region-name="cover-page-header" extent="12.7mm"/>
203
220
  <fo:region-after region-name="cover-page-footer" extent="40mm" display-align="after"/>
204
- <fo:region-start region-name="cover-left-region" extent="12.5mm"/>
205
- <fo:region-end region-name="cover-right-region" extent="25mm"/>
221
+ <fo:region-start region-name="cover-left-region" extent="{$marginLeftRight2}mm"/>
222
+ <fo:region-end region-name="cover-right-region" extent="{$marginLeftRight1}mm"/>
206
223
  </fo:simple-page-master>
207
224
  <fo:page-sequence-master master-name="cover-page-publishedISO">
208
225
  <fo:repeatable-page-master-alternatives>
@@ -214,7 +231,7 @@
214
231
 
215
232
  <!-- contents pages -->
216
233
  <!-- odd pages -->
217
- <fo:simple-page-master master-name="odd" page-width="{$pageWidth}" page-height="{$pageHeight}">
234
+ <fo:simple-page-master master-name="odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
218
235
  <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="19mm" margin-right="19mm"/>
219
236
  <fo:region-before region-name="header-odd" extent="27.4mm"/> <!-- display-align="center" -->
220
237
  <fo:region-after region-name="footer-odd" extent="13mm"/>
@@ -222,7 +239,7 @@
222
239
  <fo:region-end region-name="right-region" extent="19mm"/>
223
240
  </fo:simple-page-master>
224
241
  <!-- even pages -->
225
- <fo:simple-page-master master-name="even" page-width="{$pageWidth}" page-height="{$pageHeight}">
242
+ <fo:simple-page-master master-name="even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
226
243
  <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="19mm" margin-right="19mm"/>
227
244
  <fo:region-before region-name="header-even" extent="27.4mm"/> <!-- display-align="center" -->
228
245
  <fo:region-after region-name="footer-even" extent="13mm"/>
@@ -244,35 +261,35 @@
244
261
 
245
262
 
246
263
  <!-- first page -->
247
- <fo:simple-page-master master-name="first-publishedISO" page-width="{$pageWidth}" page-height="{$pageHeight}">
248
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="25mm" margin-right="12.5mm"/>
249
- <fo:region-before region-name="header-first" extent="27.4mm"/> <!-- display-align="center" -->
250
- <fo:region-after region-name="footer-odd" extent="13mm"/>
251
- <fo:region-start region-name="left-region" extent="25mm"/>
252
- <fo:region-end region-name="right-region" extent="12.5mm"/>
264
+ <fo:simple-page-master master-name="first-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
265
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
266
+ <fo:region-before region-name="header-first" extent="{$marginTop}mm"/> <!-- display-align="center" -->
267
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
268
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
269
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
253
270
  </fo:simple-page-master>
254
271
  <!-- odd pages -->
255
- <fo:simple-page-master master-name="odd-publishedISO" page-width="{$pageWidth}" page-height="{$pageHeight}">
256
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="25mm" margin-right="12.5mm"/>
257
- <fo:region-before region-name="header-odd" extent="27.4mm"/> <!-- display-align="center" -->
258
- <fo:region-after region-name="footer-odd" extent="13mm"/>
259
- <fo:region-start region-name="left-region" extent="25mm"/>
260
- <fo:region-end region-name="right-region" extent="12.5mm"/>
272
+ <fo:simple-page-master master-name="odd-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
273
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm"/>
274
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/> <!-- display-align="center" -->
275
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
276
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
277
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
261
278
  </fo:simple-page-master>
262
279
  <!-- even pages -->
263
- <fo:simple-page-master master-name="even-publishedISO" page-width="{$pageWidth}" page-height="{$pageHeight}">
264
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
265
- <fo:region-before region-name="header-even" extent="27.4mm"/>
266
- <fo:region-after region-name="footer-even" extent="13mm"/>
267
- <fo:region-start region-name="left-region" extent="12.5mm"/>
268
- <fo:region-end region-name="right-region" extent="25mm"/>
280
+ <fo:simple-page-master master-name="even-publishedISO" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
281
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
282
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
283
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
284
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
285
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
269
286
  </fo:simple-page-master>
270
- <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}" page-height="{$pageHeight}">
271
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
272
- <fo:region-before region-name="header" extent="27.4mm"/>
273
- <fo:region-after region-name="footer" extent="13mm"/>
274
- <fo:region-start region-name="left" extent="12.5mm"/>
275
- <fo:region-end region-name="right" extent="25mm"/>
287
+ <fo:simple-page-master master-name="blankpage" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
288
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
289
+ <fo:region-before region-name="header" extent="{$marginTop}mm"/>
290
+ <fo:region-after region-name="footer" extent="{$marginBottom}mm"/>
291
+ <fo:region-start region-name="left" extent="{$marginLeftRight2}mm"/>
292
+ <fo:region-end region-name="right" extent="{$marginLeftRight1}mm"/>
276
293
  </fo:simple-page-master>
277
294
  <fo:page-sequence-master master-name="preface-publishedISO">
278
295
  <fo:repeatable-page-master-alternatives>
@@ -291,17 +308,48 @@
291
308
  </fo:repeatable-page-master-alternatives>
292
309
  </fo:page-sequence-master>
293
310
 
294
- <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}" page-height="{$pageHeight}">
295
- <fo:region-body margin-top="27.4mm" margin-bottom="13mm" margin-left="12.5mm" margin-right="25mm"/>
296
- <fo:region-before region-name="header-even" extent="27.4mm"/>
297
- <fo:region-after region-name="last-page-footer" extent="13mm"/>
298
- <fo:region-start region-name="left-region" extent="12.5mm"/>
299
- <fo:region-end region-name="right-region" extent="25mm"/>
311
+ <fo:simple-page-master master-name="last-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
312
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm"/>
313
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
314
+ <fo:region-after region-name="last-page-footer" extent="{$marginBottom}mm"/>
315
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
316
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
317
+ </fo:simple-page-master>
318
+
319
+ <!-- Index pages -->
320
+ <fo:simple-page-master master-name="index-odd" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
321
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight1}mm" margin-right="{$marginLeftRight2}mm" column-count="2" column-gap="10mm"/>
322
+ <fo:region-before region-name="header-odd" extent="{$marginTop}mm"/>
323
+ <fo:region-after region-name="footer-odd" extent="{$marginBottom}mm"/>
324
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight1}mm"/>
325
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight2}mm"/>
326
+ </fo:simple-page-master>
327
+ <fo:simple-page-master master-name="index-even" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
328
+ <fo:region-body margin-top="{$marginTop}mm" margin-bottom="{$marginBottom}mm" margin-left="{$marginLeftRight2}mm" margin-right="{$marginLeftRight1}mm" column-count="2" column-gap="10mm"/>
329
+ <fo:region-before region-name="header-even" extent="{$marginTop}mm"/>
330
+ <fo:region-after region-name="footer-even" extent="{$marginBottom}mm"/>
331
+ <fo:region-start region-name="left-region" extent="{$marginLeftRight2}mm"/>
332
+ <fo:region-end region-name="right-region" extent="{$marginLeftRight1}mm"/>
300
333
  </fo:simple-page-master>
334
+ <fo:page-sequence-master master-name="index">
335
+ <fo:repeatable-page-master-alternatives>
336
+ <fo:conditional-page-master-reference odd-or-even="even" master-reference="index-even"/>
337
+ <fo:conditional-page-master-reference odd-or-even="odd" master-reference="index-odd"/>
338
+ </fo:repeatable-page-master-alternatives>
339
+ </fo:page-sequence-master>
340
+
301
341
 
302
342
  </fo:layout-master-set>
343
+
344
+ <fo:declarations>
345
+ <xsl:call-template name="addPDFUAmeta"/>
346
+ <xsl:for-each select="//*[local-name() = 'eref'][generate-id(.)=generate-id(key('attachments',@bibitemid)[1])]">
347
+ <xsl:variable name="url" select="concat('url(file:',$basepath, @bibitemid, ')')"/>
348
+ <pdf:embedded-file src="{$url}" filename="{@bibitemid}"/>
349
+ </xsl:for-each>
350
+ </fo:declarations>
303
351
 
304
- <xsl:call-template name="addPDFUAmeta"/>
352
+
305
353
 
306
354
  <xsl:call-template name="addBookmarks">
307
355
  <xsl:with-param name="contents" select="$contents"/>
@@ -900,22 +948,24 @@
900
948
  /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup/@type, ' ',
901
949
  /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup/@number)"/>
902
950
  -->
903
- <!-- ISO/TC 34/SC 4/WG 3 -->
904
- <fo:block margin-bottom="12pt">
905
- <xsl:text>ISO</xsl:text>
906
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[@number]">
907
- <xsl:text>/TC </xsl:text><xsl:value-of select="@number"/>
908
- </xsl:for-each>
909
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[@number]">
910
- <xsl:text>/SC </xsl:text>
911
- <xsl:value-of select="@number"/>
912
- </xsl:for-each>
913
- <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[@number]">
914
- <xsl:text>/WG </xsl:text>
915
- <xsl:value-of select="@number"/>
916
- </xsl:for-each>
917
- </fo:block>
918
-
951
+
952
+ <xsl:if test="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[normalize-space(@number) != ''] or /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[normalize-space(@number) != ''] or /iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[normalize-space(@number) != '']">
953
+ <!-- ISO/TC 34/SC 4/WG 3 -->
954
+ <fo:block margin-bottom="12pt">
955
+ <xsl:text>ISO</xsl:text>
956
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:technical-committee[normalize-space(@number) != '']">
957
+ <xsl:text>/TC </xsl:text><xsl:value-of select="@number"/>
958
+ </xsl:for-each>
959
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:subcommittee[normalize-space(@number) != '']">
960
+ <xsl:text>/SC </xsl:text>
961
+ <xsl:value-of select="@number"/>
962
+ </xsl:for-each>
963
+ <xsl:for-each select="/iso:iso-standard/iso:bibdata/iso:ext/iso:editorialgroup/iso:workgroup[normalize-space(@number) != '']">
964
+ <xsl:text>/WG </xsl:text>
965
+ <xsl:value-of select="@number"/>
966
+ </xsl:for-each>
967
+ </fo:block>
968
+ </xsl:if>
919
969
  <!-- Secretariat: AFNOR -->
920
970
 
921
971
  <fo:block margin-bottom="100pt">
@@ -977,7 +1027,15 @@
977
1027
  <fo:block font-size="11pt" margin-bottom="8pt"><xsl:value-of select="$linebreak"/></fo:block>
978
1028
  <fo:block-container font-size="40pt" text-align="center" margin-bottom="12pt" border="0.5pt solid black">
979
1029
  <xsl:variable name="stage-title" select="substring-after(substring-before($docidentifierISO, ' '), '/')"/>
980
- <fo:block padding-top="2mm"><xsl:value-of select="$stage-title"/><xsl:text> stage</xsl:text></fo:block>
1030
+ <xsl:choose>
1031
+ <xsl:when test="normalize-space($stage-title) != ''">
1032
+ <fo:block padding-top="2mm"><xsl:value-of select="$stage-title"/><xsl:text> stage</xsl:text></fo:block>
1033
+ </xsl:when>
1034
+ <xsl:otherwise>
1035
+ <xsl:attribute name="border">0pt solid white</xsl:attribute>
1036
+ <fo:block> </fo:block>
1037
+ </xsl:otherwise>
1038
+ </xsl:choose>
981
1039
  </fo:block-container>
982
1040
  <fo:block><xsl:value-of select="$linebreak"/></fo:block>
983
1041
 
@@ -1182,6 +1240,10 @@
1182
1240
  </fo:flow>
1183
1241
  </fo:page-sequence>
1184
1242
 
1243
+
1244
+ <!-- Index -->
1245
+ <xsl:apply-templates select="//iso:indexsect" mode="index"/>
1246
+
1185
1247
  <xsl:if test="$isPublished = 'true'">
1186
1248
  <fo:page-sequence master-reference="last-page" force-page-count="no-force">
1187
1249
  <xsl:call-template name="insertHeaderEven"/>
@@ -1314,7 +1376,10 @@
1314
1376
  </xsl:variable>
1315
1377
 
1316
1378
  <xsl:variable name="type">
1317
- <xsl:value-of select="local-name()"/>
1379
+ <xsl:choose>
1380
+ <xsl:when test="local-name() = 'indexsect'">index</xsl:when>
1381
+ <xsl:otherwise><xsl:value-of select="local-name()"/></xsl:otherwise>
1382
+ </xsl:choose>
1318
1383
  </xsl:variable>
1319
1384
 
1320
1385
  <xsl:variable name="display">
@@ -1347,10 +1412,15 @@
1347
1412
  </xsl:variable>
1348
1413
 
1349
1414
  <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" root="{$root}" display="{$display}">
1415
+ <xsl:if test="$type = 'index'">
1416
+ <xsl:attribute name="level">1</xsl:attribute>
1417
+ </xsl:if>
1350
1418
  <title>
1351
1419
  <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
1352
1420
  </title>
1353
- <xsl:apply-templates mode="contents"/>
1421
+ <xsl:if test="$type != 'index'">
1422
+ <xsl:apply-templates mode="contents"/>
1423
+ </xsl:if>
1354
1424
  </item>
1355
1425
  </xsl:if>
1356
1426
  </xsl:template>
@@ -1588,6 +1658,15 @@
1588
1658
  </xsl:choose>
1589
1659
  </xsl:attribute>
1590
1660
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1661
+ <xsl:if test="@id">
1662
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1663
+ </xsl:if>
1664
+ <!-- bookmarks only in paragraph -->
1665
+ <xsl:if test="count(iso:bookmark) != 0 and count(*) = count(iso:bookmark) and normalize-space() = ''">
1666
+ <xsl:attribute name="font-size">0</xsl:attribute>
1667
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1668
+ <xsl:attribute name="line-height">0</xsl:attribute>
1669
+ </xsl:if>
1591
1670
  <xsl:apply-templates/>
1592
1671
  </xsl:element>
1593
1672
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
@@ -1737,7 +1816,7 @@
1737
1816
  </xsl:for-each>
1738
1817
  </xsl:template>
1739
1818
 
1740
- <xsl:template match="iso:ul//iso:note | iso:ol//iso:note" priority="2"/>
1819
+ <xsl:template match="iso:ul/iso:note | iso:ol/iso:note | iso:ul/iso:li/iso:note | iso:ol/iso:li/iso:note" priority="2"/>
1741
1820
 
1742
1821
  <xsl:template match="iso:li">
1743
1822
  <fo:list-item id="{@id}">
@@ -1749,7 +1828,10 @@
1749
1828
  <fo:list-item-body start-indent="body-start()">
1750
1829
  <fo:block>
1751
1830
  <xsl:apply-templates/>
1752
- <xsl:apply-templates select=".//iso:note" mode="process"/>
1831
+ <!-- <xsl:apply-templates select=".//iso:note" mode="process"/> -->
1832
+ <xsl:for-each select="./iso:note">
1833
+ <xsl:call-template name="note"/>
1834
+ </xsl:for-each>
1753
1835
  </fo:block>
1754
1836
  </fo:list-item-body>
1755
1837
  </fo:list-item>
@@ -1759,6 +1841,10 @@
1759
1841
  <xsl:call-template name="note"/>
1760
1842
  </xsl:template>
1761
1843
 
1844
+ <xsl:template match="*" mode="process">
1845
+ <xsl:apply-templates select="."/>
1846
+ </xsl:template>
1847
+
1762
1848
  <xsl:template match="iso:preferred">
1763
1849
  <fo:block line-height="1.1">
1764
1850
  <fo:block font-weight="bold" keep-with-next="always">
@@ -1840,20 +1926,6 @@
1840
1926
  </xsl:template>
1841
1927
 
1842
1928
 
1843
- <xsl:template match="mathml:math" priority="2">
1844
- <fo:inline font-family="Cambria Math">
1845
- <xsl:variable name="mathml">
1846
- <xsl:apply-templates select="." mode="mathml"/>
1847
- </xsl:variable>
1848
- <fo:instream-foreign-object fox:alt-text="Math">
1849
- <!-- <xsl:copy-of select="."/> -->
1850
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
1851
- </fo:instream-foreign-object>
1852
- </fo:inline>
1853
- </xsl:template>
1854
-
1855
-
1856
-
1857
1929
  <xsl:template match="iso:admonition">
1858
1930
  <fo:block margin-bottom="12pt" font-weight="bold"> <!-- text-align="center" -->
1859
1931
  <xsl:variable name="type">
@@ -1891,7 +1963,348 @@
1891
1963
  </fo:block>
1892
1964
  </xsl:template>
1893
1965
 
1966
+ <!-- =================== -->
1967
+ <!-- SVG images processing -->
1968
+ <!-- =================== -->
1969
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image']) and *[local-name() = 'svg']]/*[local-name() = 'name']/*[local-name() = 'bookmark']" priority="2"/>
1970
+ <xsl:template match="*[local-name() = 'figure'][not(*[local-name() = 'image'])]/*[local-name() = 'svg']" priority="2" name="image_svg">
1971
+ <xsl:param name="name"/>
1972
+
1973
+ <xsl:variable name="svg_content">
1974
+ <xsl:apply-templates select="." mode="svg_update"/>
1975
+ </xsl:variable>
1976
+
1977
+ <xsl:variable name="alt-text">
1978
+ <xsl:choose>
1979
+ <xsl:when test="normalize-space(../*[local-name() = 'name']) != ''">
1980
+ <xsl:value-of select="../*[local-name() = 'name']"/>
1981
+ </xsl:when>
1982
+ <xsl:when test="normalize-space($name) != ''">
1983
+ <xsl:value-of select="$name"/>
1984
+ </xsl:when>
1985
+ <xsl:otherwise>Figure</xsl:otherwise>
1986
+ </xsl:choose>
1987
+ </xsl:variable>
1988
+
1989
+ <xsl:choose>
1990
+ <xsl:when test=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]">
1991
+ <fo:block>
1992
+ <xsl:variable name="width" select="@width"/>
1993
+ <xsl:variable name="height" select="@height"/>
1994
+
1995
+ <xsl:variable name="scale_x">
1996
+ <xsl:choose>
1997
+ <xsl:when test="$width &gt; $width_effective_px">
1998
+ <xsl:value-of select="$width_effective_px div $width"/>
1999
+ </xsl:when>
2000
+ <xsl:otherwise>1</xsl:otherwise>
2001
+ </xsl:choose>
2002
+ </xsl:variable>
2003
+
2004
+ <xsl:variable name="scale_y">
2005
+ <xsl:choose>
2006
+ <xsl:when test="$height * $scale_x &gt; $height_effective_px">
2007
+ <xsl:value-of select="$height_effective_px div ($height * $scale_x)"/>
2008
+ </xsl:when>
2009
+ <xsl:otherwise>1</xsl:otherwise>
2010
+ </xsl:choose>
2011
+ </xsl:variable>
2012
+
2013
+ <xsl:variable name="scale">
2014
+ <xsl:choose>
2015
+ <xsl:when test="$scale_y != 1">
2016
+ <xsl:value-of select="$scale_x * $scale_y"/>
2017
+ </xsl:when>
2018
+ <xsl:otherwise>
2019
+ <xsl:value-of select="$scale_x"/>
2020
+ </xsl:otherwise>
2021
+ </xsl:choose>
2022
+ </xsl:variable>
2023
+
2024
+ <xsl:variable name="width_scale" select="round($width * $scale)"/>
2025
+ <xsl:variable name="height_scale" select="round($height * $scale)"/>
2026
+
2027
+ <fo:table table-layout="fixed" width="100%">
2028
+ <fo:table-column column-width="proportional-column-width(1)"/>
2029
+ <fo:table-column column-width="{$width_scale}px"/>
2030
+ <fo:table-column column-width="proportional-column-width(1)"/>
2031
+ <fo:table-body>
2032
+ <fo:table-row>
2033
+ <fo:table-cell column-number="2">
2034
+ <fo:block>
2035
+ <fo:block-container width="{$width_scale}px" height="{$height_scale}px">
2036
+ <xsl:if test="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
2037
+ <fo:block line-height="0" font-size="0">
2038
+ <xsl:for-each select="../*[local-name() = 'name']/*[local-name() = 'bookmark']">
2039
+ <xsl:call-template name="bookmark"/>
2040
+ </xsl:for-each>
2041
+ </fo:block>
2042
+ </xsl:if>
2043
+ <fo:block text-depth="0" line-height="0" font-size="0">
2044
+
2045
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2046
+ <xsl:attribute name="width">100%</xsl:attribute>
2047
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2048
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2049
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2050
+
2051
+ <xsl:apply-templates select="xalan:nodeset($svg_content)" mode="svg_remove_a"/>
2052
+ </fo:instream-foreign-object>
2053
+ </fo:block>
2054
+
2055
+ <xsl:apply-templates select=".//*[local-name() = 'a'][*[local-name() = 'rect'] or *[local-name() = 'polygon'] or *[local-name() = 'circle'] or *[local-name() = 'ellipse']]" mode="svg_imagemap_links">
2056
+ <xsl:with-param name="scale" select="$scale"/>
2057
+ </xsl:apply-templates>
2058
+ </fo:block-container>
2059
+ </fo:block>
2060
+ </fo:table-cell>
2061
+ </fo:table-row>
2062
+ </fo:table-body>
2063
+ </fo:table>
2064
+ </fo:block>
2065
+
2066
+ </xsl:when>
2067
+ <xsl:otherwise>
2068
+ <fo:block xsl:use-attribute-sets="image-style">
2069
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
2070
+ <xsl:attribute name="width">100%</xsl:attribute>
2071
+ <xsl:attribute name="content-height">100%</xsl:attribute>
2072
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2073
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
2074
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
2075
+ <!-- effective height / width = 1.48, 1.4 - with title -->
2076
+ <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
2077
+ <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
2078
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
2079
+ </xsl:if>
2080
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2081
+ <xsl:copy-of select="$svg_content"/>
2082
+ </fo:instream-foreign-object>
2083
+ </fo:block>
2084
+ </xsl:otherwise>
2085
+ </xsl:choose>
2086
+ </xsl:template>
2087
+
2088
+ <xsl:template match="@*|node()" mode="svg_update">
2089
+ <xsl:copy>
2090
+ <xsl:apply-templates select="@*|node()" mode="svg_update"/>
2091
+ </xsl:copy>
2092
+ </xsl:template>
2093
+
2094
+ <xsl:template match="*[local-name() = 'image']/@href" mode="svg_update">
2095
+ <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
2096
+ <xsl:value-of select="."/>
2097
+ </xsl:attribute>
2098
+ </xsl:template>
2099
+
2100
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
2101
+ <xsl:variable name="svg_content" select="document(@src)"/>
2102
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
2103
+ <xsl:for-each select="xalan:nodeset($svg_content)/node()">
2104
+ <xsl:call-template name="image_svg">
2105
+ <xsl:with-param name="name" select="$name"/>
2106
+ </xsl:call-template>
2107
+ </xsl:for-each>
2108
+ </xsl:template>
2109
+
2110
+ <xsl:template match="@*|node()" mode="svg_remove_a">
2111
+ <xsl:copy>
2112
+ <xsl:apply-templates select="@*|node()" mode="svg_remove_a"/>
2113
+ </xsl:copy>
2114
+ </xsl:template>
2115
+
2116
+ <xsl:template match="*[local-name() = 'a']" mode="svg_remove_a">
2117
+ <xsl:apply-templates mode="svg_remove_a"/>
2118
+ </xsl:template>
2119
+
2120
+ <xsl:template match="*[local-name() = 'a']" mode="svg_imagemap_links">
2121
+ <xsl:param name="scale"/>
2122
+ <xsl:variable name="dest">
2123
+ <xsl:choose>
2124
+ <xsl:when test="starts-with(@href, '#')">
2125
+ <xsl:value-of select="substring-after(@href, '#')"/>
2126
+ </xsl:when>
2127
+ <xsl:otherwise>
2128
+ <xsl:value-of select="@href"/>
2129
+ </xsl:otherwise>
2130
+ </xsl:choose>
2131
+ </xsl:variable>
2132
+ <xsl:for-each select="./*[local-name() = 'rect']">
2133
+ <xsl:call-template name="insertSVGMapLink">
2134
+ <xsl:with-param name="left" select="floor(@x * $scale)"/>
2135
+ <xsl:with-param name="top" select="floor(@y * $scale)"/>
2136
+ <xsl:with-param name="width" select="floor(@width * $scale)"/>
2137
+ <xsl:with-param name="height" select="floor(@height * $scale)"/>
2138
+ <xsl:with-param name="dest" select="$dest"/>
2139
+ </xsl:call-template>
2140
+ </xsl:for-each>
2141
+
2142
+ <xsl:for-each select="./*[local-name() = 'polygon']">
2143
+ <xsl:variable name="points">
2144
+ <xsl:call-template name="split">
2145
+ <xsl:with-param name="pText" select="@points"/>
2146
+ </xsl:call-template>
2147
+ </xsl:variable>
2148
+ <xsl:variable name="x_coords">
2149
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 1]">
2150
+ <xsl:sort select="." data-type="number"/>
2151
+ <x><xsl:value-of select="."/></x>
2152
+ </xsl:for-each>
2153
+ </xsl:variable>
2154
+ <xsl:variable name="y_coords">
2155
+ <xsl:for-each select="xalan:nodeset($points)//item[position() mod 2 = 0]">
2156
+ <xsl:sort select="." data-type="number"/>
2157
+ <y><xsl:value-of select="."/></y>
2158
+ </xsl:for-each>
2159
+ </xsl:variable>
2160
+ <xsl:variable name="x" select="xalan:nodeset($x_coords)//x[1]"/>
2161
+ <xsl:variable name="y" select="xalan:nodeset($y_coords)//y[1]"/>
2162
+ <xsl:variable name="width" select="xalan:nodeset($x_coords)//x[last()] - $x"/>
2163
+ <xsl:variable name="height" select="xalan:nodeset($y_coords)//y[last()] - $y"/>
2164
+ <xsl:call-template name="insertSVGMapLink">
2165
+ <xsl:with-param name="left" select="floor($x * $scale)"/>
2166
+ <xsl:with-param name="top" select="floor($y * $scale)"/>
2167
+ <xsl:with-param name="width" select="floor($width * $scale)"/>
2168
+ <xsl:with-param name="height" select="floor($height * $scale)"/>
2169
+ <xsl:with-param name="dest" select="$dest"/>
2170
+ </xsl:call-template>
2171
+ </xsl:for-each>
2172
+
2173
+ <xsl:for-each select="./*[local-name() = 'circle']">
2174
+ <xsl:call-template name="insertSVGMapLink">
2175
+ <xsl:with-param name="left" select="floor((@cx - @r) * $scale)"/>
2176
+ <xsl:with-param name="top" select="floor((@cy - @r) * $scale)"/>
2177
+ <xsl:with-param name="width" select="floor(@r * 2 * $scale)"/>
2178
+ <xsl:with-param name="height" select="floor(@r * 2 * $scale)"/>
2179
+ <xsl:with-param name="dest" select="$dest"/>
2180
+ </xsl:call-template>
2181
+ </xsl:for-each>
2182
+ <xsl:for-each select="./*[local-name() = 'ellipse']">
2183
+ <xsl:call-template name="insertSVGMapLink">
2184
+ <xsl:with-param name="left" select="floor((@cx - @rx) * $scale)"/>
2185
+ <xsl:with-param name="top" select="floor((@cy - @ry) * $scale)"/>
2186
+ <xsl:with-param name="width" select="floor(@rx * 2 * $scale)"/>
2187
+ <xsl:with-param name="height" select="floor(@ry * 2 * $scale)"/>
2188
+ <xsl:with-param name="dest" select="$dest"/>
2189
+ </xsl:call-template>
2190
+ </xsl:for-each>
2191
+ </xsl:template>
2192
+
2193
+ <xsl:template name="insertSVGMapLink">
2194
+ <xsl:param name="left"/>
2195
+ <xsl:param name="top"/>
2196
+ <xsl:param name="width"/>
2197
+ <xsl:param name="height"/>
2198
+ <xsl:param name="dest"/>
2199
+ <fo:block-container position="absolute" left="{$left}px" top="{$top}px" width="{$width}px" height="{$height}px">
2200
+ <fo:block font-size="1pt">
2201
+ <fo:basic-link internal-destination="{$dest}" fox:alt-text="svg link">
2202
+ <fo:inline-container inline-progression-dimension="100%">
2203
+ <fo:block-container height="{$height - 1}px" width="100%">
2204
+ <!-- DEBUG <xsl:if test="local-name()='polygon'">
2205
+ <xsl:attribute name="background-color">magenta</xsl:attribute>
2206
+ </xsl:if> -->
2207
+ <fo:block> </fo:block></fo:block-container>
2208
+ </fo:inline-container>
2209
+ </fo:basic-link>
2210
+ </fo:block>
2211
+ </fo:block-container>
2212
+ </xsl:template>
2213
+
2214
+ <!-- =================== -->
2215
+ <!-- End SVG images processing -->
2216
+ <!-- =================== -->
2217
+
2218
+ <!-- For express listings PDF attachments -->
2219
+ <xsl:template match="*[local-name() = 'eref'][contains(@bibitemid, '.exp')]" priority="2">
2220
+ <fo:inline xsl:use-attribute-sets="eref-style">
2221
+ <xsl:variable name="url" select="concat('url(embedded-file:', @bibitemid, ')')"/>
2222
+ <fo:basic-link external-destination="{$url}" fox:alt-text="{@citeas}">
2223
+ <xsl:if test="normalize-space(@citeas) = ''">
2224
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
2225
+ </xsl:if>
2226
+ <xsl:apply-templates/>
2227
+ </fo:basic-link>
2228
+ </fo:inline>
2229
+ </xsl:template>
2230
+
1894
2231
 
2232
+ <!-- =================== -->
2233
+ <!-- Index processing -->
2234
+ <!-- =================== -->
2235
+
2236
+ <xsl:template match="iso:indexsect"/>
2237
+ <xsl:template match="iso:indexsect" mode="index">
2238
+
2239
+ <fo:page-sequence master-reference="index" force-page-count="no-force">
2240
+ <xsl:variable name="header-title">
2241
+ <xsl:choose>
2242
+ <xsl:when test="./iso:title[1]/*[local-name() = 'tab']">
2243
+ <xsl:apply-templates select="./iso:title[1]/*[local-name() = 'tab'][1]/following-sibling::node()" mode="header"/>
2244
+ </xsl:when>
2245
+ <xsl:otherwise>
2246
+ <xsl:apply-templates select="./iso:title[1]" mode="header"/>
2247
+ </xsl:otherwise>
2248
+ </xsl:choose>
2249
+ </xsl:variable>
2250
+ <xsl:call-template name="insertHeaderFooter">
2251
+ <xsl:with-param name="header-title" select="$header-title"/>
2252
+ </xsl:call-template>
2253
+
2254
+ <fo:flow flow-name="xsl-region-body">
2255
+ <fo:block id="{@id}" span="all">
2256
+ <xsl:apply-templates select="iso:title"/>
2257
+ </fo:block>
2258
+ <fo:block>
2259
+ <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
2260
+ </fo:block>
2261
+ </fo:flow>
2262
+ </fo:page-sequence>
2263
+ </xsl:template>
2264
+
2265
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:title" priority="4"> -->
2266
+ <xsl:template match="iso:indexsect/iso:title" priority="4">
2267
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt">
2268
+ <!-- Index -->
2269
+ <xsl:apply-templates/>
2270
+ </fo:block>
2271
+ </xsl:template>
2272
+
2273
+ <!-- <xsl:template match="iso:clause[@type = 'index']/iso:clause/iso:title" priority="4"> -->
2274
+ <xsl:template match="iso:indexsect/iso:clause/iso:title" priority="4">
2275
+ <!-- Letter A, B, C, ... -->
2276
+ <fo:block font-size="10pt" font-weight="bold" margin-bottom="3pt" keep-with-next="always">
2277
+ <xsl:apply-templates/>
2278
+ </fo:block>
2279
+ </xsl:template>
2280
+
2281
+ <xsl:template match="iso:indexsect//iso:li/text()">
2282
+ <!-- to split by '_' and other chars -->
2283
+ <xsl:call-template name="add-zero-spaces-java"/>
2284
+ </xsl:template>
2285
+
2286
+ <xsl:template match="iso:xref" priority="2">
2287
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
2288
+ <xsl:choose>
2289
+ <xsl:when test="@pagenumber='true'">
2290
+ <fo:inline>
2291
+ <xsl:if test="@id">
2292
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
2293
+ </xsl:if>
2294
+ <fo:page-number-citation ref-id="{@target}"/>
2295
+ </fo:inline>
2296
+ </xsl:when>
2297
+ <xsl:otherwise>
2298
+ <xsl:apply-templates/>
2299
+ </xsl:otherwise>
2300
+ </xsl:choose>
2301
+ </fo:basic-link>
2302
+ </xsl:template>
2303
+
2304
+ <!-- =================== -->
2305
+ <!-- End of Index processing -->
2306
+ <!-- =================== -->
2307
+
1895
2308
 
1896
2309
  <xsl:template name="insertHeaderFooter">
1897
2310
  <xsl:param name="font-weight" select="'bold'"/>
@@ -2285,6 +2698,7 @@
2285
2698
  </xsl:choose>
2286
2699
  </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">
2287
2700
 
2701
+
2288
2702
  </xsl:attribute-set><xsl:attribute-set name="link-style">
2289
2703
 
2290
2704
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -2367,6 +2781,7 @@
2367
2781
 
2368
2782
 
2369
2783
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
2784
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
2370
2785
 
2371
2786
 
2372
2787
 
@@ -2393,6 +2808,9 @@
2393
2808
 
2394
2809
 
2395
2810
 
2811
+ <xsl:attribute name="text-align">justify</xsl:attribute>
2812
+
2813
+
2396
2814
 
2397
2815
 
2398
2816
 
@@ -2620,7 +3038,7 @@
2620
3038
 
2621
3039
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2622
3040
 
2623
-
3041
+
2624
3042
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2625
3043
 
2626
3044
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
@@ -2628,7 +3046,27 @@
2628
3046
 
2629
3047
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2630
3048
 
2631
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
3049
+ </xsl:attribute-set><xsl:variable name="color-added-text">
3050
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
3051
+ </xsl:variable><xsl:attribute-set name="add-style">
3052
+ <xsl:attribute name="color">red</xsl:attribute>
3053
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3054
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
3055
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
3056
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
3057
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
3058
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
3059
+ <xsl:text>red</xsl:text>
3060
+ </xsl:variable><xsl:attribute-set name="del-style">
3061
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
3062
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
3063
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
3064
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
3065
+
3066
+ <xsl:attribute name="font-family">Cambria Math</xsl:attribute>
3067
+
3068
+
3069
+ </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">
2632
3070
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2633
3071
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
2634
3072
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -2673,16 +3111,17 @@
2673
3111
  <xsl:call-template name="add-zero-spaces-java"/>
2674
3112
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2675
3113
 
3114
+ <xsl:variable name="table-preamble">
3115
+
3116
+
3117
+ </xsl:variable>
3118
+
2676
3119
  <xsl:variable name="table">
2677
3120
 
2678
3121
  <xsl:variable name="simple-table">
2679
3122
  <xsl:call-template name="getSimpleTable"/>
2680
3123
  </xsl:variable>
2681
3124
 
2682
-
2683
-
2684
-
2685
-
2686
3125
  <!-- <xsl:if test="$namespace = 'bipm'">
2687
3126
  <fo:block>&#xA0;</fo:block>
2688
3127
  </xsl:if> -->
@@ -2693,7 +3132,7 @@
2693
3132
 
2694
3133
 
2695
3134
 
2696
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
3135
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2697
3136
 
2698
3137
  <!-- <xsl:variable name="cols-count">
2699
3138
  <xsl:choose>
@@ -2712,8 +3151,6 @@
2712
3151
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2713
3152
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2714
3153
 
2715
-
2716
-
2717
3154
  <xsl:variable name="colwidths">
2718
3155
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2719
3156
  <xsl:call-template name="calculate-column-widths">
@@ -2741,6 +3178,7 @@
2741
3178
  </xsl:choose>
2742
3179
  </xsl:variable>
2743
3180
 
3181
+
2744
3182
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2745
3183
 
2746
3184
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -2782,6 +3220,12 @@
2782
3220
  </xsl:if>
2783
3221
 
2784
3222
 
3223
+ <xsl:if test="ancestor::*[local-name() = 'table']">
3224
+ <!-- for internal table in table cell -->
3225
+ <attribute name="border">0.5pt solid black</attribute>
3226
+ </xsl:if>
3227
+
3228
+
2785
3229
 
2786
3230
 
2787
3231
  <attribute name="margin-left">0mm</attribute>
@@ -2876,7 +3320,8 @@
2876
3320
  </fo:block-container>
2877
3321
  </xsl:variable>
2878
3322
 
2879
-
3323
+ <xsl:variable name="isAdded" select="@added"/>
3324
+ <xsl:variable name="isDeleted" select="@deleted"/>
2880
3325
 
2881
3326
  <xsl:choose>
2882
3327
  <xsl:when test="@width">
@@ -2890,7 +3335,14 @@
2890
3335
  <fo:table-body>
2891
3336
  <fo:table-row>
2892
3337
  <fo:table-cell column-number="2">
2893
- <fo:block><xsl:copy-of select="$table"/></fo:block>
3338
+ <xsl:copy-of select="$table-preamble"/>
3339
+ <fo:block>
3340
+ <xsl:call-template name="setTrackChangesStyles">
3341
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3342
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3343
+ </xsl:call-template>
3344
+ <xsl:copy-of select="$table"/>
3345
+ </fo:block>
2894
3346
  </fo:table-cell>
2895
3347
  </fo:table-row>
2896
3348
  </fo:table-body>
@@ -2901,7 +3353,22 @@
2901
3353
 
2902
3354
  </xsl:when>
2903
3355
  <xsl:otherwise>
2904
- <xsl:copy-of select="$table"/>
3356
+ <xsl:choose>
3357
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
3358
+ <xsl:copy-of select="$table-preamble"/>
3359
+ <fo:block>
3360
+ <xsl:call-template name="setTrackChangesStyles">
3361
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3362
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3363
+ </xsl:call-template>
3364
+ <xsl:copy-of select="$table"/>
3365
+ </fo:block>
3366
+ </xsl:when>
3367
+ <xsl:otherwise>
3368
+ <xsl:copy-of select="$table-preamble"/>
3369
+ <xsl:copy-of select="$table"/>
3370
+ </xsl:otherwise>
3371
+ </xsl:choose>
2905
3372
  </xsl:otherwise>
2906
3373
  </xsl:choose>
2907
3374
 
@@ -2964,7 +3431,7 @@
2964
3431
  </xsl:for-each>
2965
3432
  </xsl:when>
2966
3433
  <xsl:otherwise>
2967
- <xsl:for-each select="xalan:nodeset($table)//tr">
3434
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
2968
3435
  <xsl:variable name="td_text">
2969
3436
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2970
3437
 
@@ -3034,7 +3501,15 @@
3034
3501
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
3035
3502
  <xsl:value-of select="@target"/>
3036
3503
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
3037
- <xsl:variable name="math_text" select="normalize-space(.)"/>
3504
+ <xsl:variable name="mathml">
3505
+ <xsl:for-each select="*">
3506
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
3507
+ <xsl:copy-of select="."/>
3508
+ </xsl:if>
3509
+ </xsl:for-each>
3510
+ </xsl:variable>
3511
+
3512
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
3038
3513
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
3039
3514
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
3040
3515
  <xsl:param name="cols-count"/>
@@ -3354,7 +3829,8 @@
3354
3829
  <xsl:attribute name="text-align">
3355
3830
  <xsl:choose>
3356
3831
  <xsl:when test="@align">
3357
- <xsl:value-of select="@align"/>
3832
+ <xsl:call-template name="setAlignment"/>
3833
+ <!-- <xsl:value-of select="@align"/> -->
3358
3834
  </xsl:when>
3359
3835
  <xsl:otherwise>center</xsl:otherwise>
3360
3836
  </xsl:choose>
@@ -3372,6 +3848,9 @@
3372
3848
 
3373
3849
 
3374
3850
 
3851
+ <xsl:if test="$lang = 'ar'">
3852
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3853
+ </xsl:if>
3375
3854
  <xsl:if test="@colspan">
3376
3855
  <xsl:attribute name="number-columns-spanned">
3377
3856
  <xsl:value-of select="@colspan"/>
@@ -3403,16 +3882,21 @@
3403
3882
  <xsl:attribute name="text-align">
3404
3883
  <xsl:choose>
3405
3884
  <xsl:when test="@align">
3406
- <xsl:value-of select="@align"/>
3885
+ <xsl:call-template name="setAlignment"/>
3886
+ <!-- <xsl:value-of select="@align"/> -->
3407
3887
  </xsl:when>
3408
3888
  <xsl:otherwise>left</xsl:otherwise>
3409
3889
  </xsl:choose>
3410
3890
  </xsl:attribute>
3891
+ <xsl:if test="$lang = 'ar'">
3892
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3893
+ </xsl:if>
3411
3894
  <!-- and ancestor::*[local-name() = 'thead'] -->
3412
3895
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
3413
3896
 
3414
3897
 
3415
3898
 
3899
+
3416
3900
  <xsl:if test="ancestor::*[local-name() = 'tfoot']">
3417
3901
  <xsl:attribute name="border">solid black 0</xsl:attribute>
3418
3902
  </xsl:if>
@@ -3425,6 +3909,9 @@
3425
3909
 
3426
3910
 
3427
3911
 
3912
+ <xsl:if test=".//*[local-name() = 'table']">
3913
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
3914
+ </xsl:if>
3428
3915
  <xsl:if test="@colspan">
3429
3916
  <xsl:attribute name="number-columns-spanned">
3430
3917
  <xsl:value-of select="@colspan"/>
@@ -3558,13 +4045,13 @@
3558
4045
  </xsl:choose>
3559
4046
  </xsl:variable>
3560
4047
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3561
- <xsl:element name="{$ns}:table">
4048
+ <!-- <xsl:element name="{$ns}:table"> -->
3562
4049
  <xsl:for-each select="*[local-name() = 'dl'][1]">
3563
4050
  <tbody>
3564
4051
  <xsl:apply-templates mode="dl"/>
3565
4052
  </tbody>
3566
4053
  </xsl:for-each>
3567
- </xsl:element>
4054
+ <!-- </xsl:element> -->
3568
4055
  </xsl:variable>
3569
4056
 
3570
4057
  <xsl:call-template name="calculate-column-widths">
@@ -3661,6 +4148,8 @@
3661
4148
  <xsl:apply-templates/>
3662
4149
  </fo:inline>
3663
4150
  </xsl:template><xsl:template match="*[local-name()='dl']">
4151
+ <xsl:variable name="isAdded" select="@added"/>
4152
+ <xsl:variable name="isDeleted" select="@deleted"/>
3664
4153
  <fo:block-container>
3665
4154
 
3666
4155
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -3677,6 +4166,12 @@
3677
4166
  </xsl:attribute>
3678
4167
 
3679
4168
  </xsl:if>
4169
+
4170
+ <xsl:call-template name="setTrackChangesStyles">
4171
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4172
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4173
+ </xsl:call-template>
4174
+
3680
4175
  <fo:block-container>
3681
4176
 
3682
4177
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -3798,11 +4293,11 @@
3798
4293
  </xsl:choose>
3799
4294
  </xsl:variable>
3800
4295
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
3801
- <xsl:element name="{$ns}:table">
4296
+ <!-- <xsl:element name="{$ns}:table"> -->
3802
4297
  <tbody>
3803
4298
  <xsl:apply-templates mode="dl"/>
3804
4299
  </tbody>
3805
- </xsl:element>
4300
+ <!-- </xsl:element> -->
3806
4301
  </xsl:variable>
3807
4302
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
3808
4303
  <xsl:variable name="colwidths">
@@ -4071,8 +4566,78 @@
4071
4566
  <fo:inline text-decoration="underline">
4072
4567
  <xsl:apply-templates/>
4073
4568
  </fo:inline>
4569
+ </xsl:template><xsl:template match="*[local-name()='add']">
4570
+ <xsl:choose>
4571
+ <xsl:when test="@amendment">
4572
+ <fo:inline>
4573
+ <xsl:call-template name="insertTag">
4574
+ <xsl:with-param name="kind">A</xsl:with-param>
4575
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4576
+ </xsl:call-template>
4577
+ <xsl:apply-templates/>
4578
+ <xsl:call-template name="insertTag">
4579
+ <xsl:with-param name="type">closing</xsl:with-param>
4580
+ <xsl:with-param name="kind">A</xsl:with-param>
4581
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
4582
+ </xsl:call-template>
4583
+ </fo:inline>
4584
+ </xsl:when>
4585
+ <xsl:when test="@corrigenda">
4586
+ <fo:inline>
4587
+ <xsl:call-template name="insertTag">
4588
+ <xsl:with-param name="kind">C</xsl:with-param>
4589
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4590
+ </xsl:call-template>
4591
+ <xsl:apply-templates/>
4592
+ <xsl:call-template name="insertTag">
4593
+ <xsl:with-param name="type">closing</xsl:with-param>
4594
+ <xsl:with-param name="kind">C</xsl:with-param>
4595
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
4596
+ </xsl:call-template>
4597
+ </fo:inline>
4598
+ </xsl:when>
4599
+ <xsl:otherwise>
4600
+ <fo:inline xsl:use-attribute-sets="add-style">
4601
+ <xsl:apply-templates/>
4602
+ </fo:inline>
4603
+ </xsl:otherwise>
4604
+ </xsl:choose>
4605
+
4606
+ </xsl:template><xsl:template name="insertTag">
4607
+ <xsl:param name="type"/>
4608
+ <xsl:param name="kind"/>
4609
+ <xsl:param name="value"/>
4610
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
4611
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
4612
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
4613
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
4614
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
4615
+ <xsl:attribute name="height">5mm</xsl:attribute>
4616
+ <xsl:attribute name="content-width">100%</xsl:attribute>
4617
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4618
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4619
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
4620
+ <g>
4621
+ <xsl:if test="$type = 'closing'">
4622
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
4623
+ </xsl:if>
4624
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
4625
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
4626
+ </g>
4627
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
4628
+ <xsl:if test="$type = 'closing'">
4629
+ <xsl:attribute name="x">25</xsl:attribute>
4630
+ </xsl:if>
4631
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
4632
+ </text>
4633
+ </svg>
4634
+ </fo:instream-foreign-object>
4074
4635
  </xsl:template><xsl:template match="*[local-name()='del']">
4075
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
4636
+ <fo:inline xsl:use-attribute-sets="del-style">
4637
+ <xsl:apply-templates/>
4638
+ </fo:inline>
4639
+ </xsl:template><xsl:template match="*[local-name()='hi']">
4640
+ <fo:inline background-color="yellow">
4076
4641
  <xsl:apply-templates/>
4077
4642
  </fo:inline>
4078
4643
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -4409,12 +4974,30 @@
4409
4974
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
4410
4975
  <xsl:value-of select="substring($str, 2)"/>
4411
4976
  </xsl:template><xsl:template match="mathml:math">
4412
- <fo:inline font-family="STIX Two Math"> <!-- -->
4977
+ <xsl:variable name="isAdded" select="@added"/>
4978
+ <xsl:variable name="isDeleted" select="@deleted"/>
4979
+
4980
+ <fo:inline xsl:use-attribute-sets="mathml-style">
4981
+
4982
+
4983
+ <xsl:call-template name="setTrackChangesStyles">
4984
+ <xsl:with-param name="isAdded" select="$isAdded"/>
4985
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
4986
+ </xsl:call-template>
4413
4987
 
4414
4988
  <xsl:variable name="mathml">
4415
4989
  <xsl:apply-templates select="." mode="mathml"/>
4416
4990
  </xsl:variable>
4417
4991
  <fo:instream-foreign-object fox:alt-text="Math">
4992
+
4993
+
4994
+ <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
4995
+ <xsl:attribute name="width">95%</xsl:attribute>
4996
+ <xsl:attribute name="content-height">100%</xsl:attribute>
4997
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4998
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
4999
+ </xsl:if>
5000
+
4418
5001
  <!-- <xsl:copy-of select="."/> -->
4419
5002
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4420
5003
  </fo:instream-foreign-object>
@@ -4433,7 +5016,7 @@
4433
5016
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
4434
5017
  </xsl:copy>
4435
5018
  <mathml:mspace width="0.5ex"/>
4436
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
5019
+ </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">
4437
5020
  <xsl:variable name="target">
4438
5021
  <xsl:choose>
4439
5022
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4467,8 +5050,6 @@
4467
5050
  </xsl:otherwise>
4468
5051
  </xsl:choose>
4469
5052
  </fo:inline>
4470
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4471
- <fo:inline id="{@id}"/>
4472
5053
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4473
5054
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4474
5055
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4662,8 +5243,15 @@
4662
5243
  </fo:inline>
4663
5244
  </xsl:if>
4664
5245
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
5246
+ <xsl:variable name="isAdded" select="@added"/>
5247
+ <xsl:variable name="isDeleted" select="@deleted"/>
4665
5248
  <fo:block-container id="{@id}">
4666
5249
 
5250
+ <xsl:call-template name="setTrackChangesStyles">
5251
+ <xsl:with-param name="isAdded" select="$isAdded"/>
5252
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
5253
+ </xsl:call-template>
5254
+
4667
5255
  <fo:block>
4668
5256
  <xsl:apply-templates/>
4669
5257
  </fo:block>
@@ -4677,27 +5265,113 @@
4677
5265
  <fo:block id="{@id}">
4678
5266
  <xsl:apply-templates/>
4679
5267
  </fo:block>
5268
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4680
5269
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4681
5270
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4682
5271
  <xsl:apply-templates/>
4683
5272
  </fo:block>
4684
5273
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4685
- <fo:block xsl:use-attribute-sets="image-style">
4686
-
4687
-
4688
- <xsl:variable name="src">
4689
- <xsl:choose>
4690
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4691
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4692
- </xsl:when>
4693
- <xsl:otherwise>
4694
- <xsl:value-of select="@src"/>
4695
- </xsl:otherwise>
4696
- </xsl:choose>
4697
- </xsl:variable>
4698
-
4699
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4700
- </fo:block>
5274
+ <xsl:variable name="isAdded" select="../@added"/>
5275
+ <xsl:variable name="isDeleted" select="../@deleted"/>
5276
+ <xsl:choose>
5277
+ <xsl:when test="ancestor::*[local-name() = 'title']">
5278
+ <fo:inline padding-left="1mm" padding-right="1mm">
5279
+ <xsl:variable name="src">
5280
+ <xsl:call-template name="image_src"/>
5281
+ </xsl:variable>
5282
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
5283
+ </fo:inline>
5284
+ </xsl:when>
5285
+ <xsl:otherwise>
5286
+ <fo:block xsl:use-attribute-sets="image-style">
5287
+
5288
+ <xsl:variable name="src">
5289
+ <xsl:call-template name="image_src"/>
5290
+ </xsl:variable>
5291
+
5292
+ <xsl:choose>
5293
+ <xsl:when test="$isDeleted = 'true'">
5294
+ <!-- enclose in svg -->
5295
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
5296
+ <xsl:attribute name="width">100%</xsl:attribute>
5297
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5298
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5299
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5300
+
5301
+
5302
+ <xsl:apply-templates select="." mode="cross_image"/>
5303
+
5304
+ </fo:instream-foreign-object>
5305
+ </xsl:when>
5306
+ <xsl:otherwise>
5307
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
5308
+ </xsl:otherwise>
5309
+ </xsl:choose>
5310
+
5311
+ </fo:block>
5312
+ </xsl:otherwise>
5313
+ </xsl:choose>
5314
+ </xsl:template><xsl:template name="image_src">
5315
+ <xsl:choose>
5316
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5317
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5318
+ </xsl:when>
5319
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5320
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5321
+ </xsl:when>
5322
+ <xsl:otherwise>
5323
+ <xsl:value-of select="@src"/>
5324
+ </xsl:otherwise>
5325
+ </xsl:choose>
5326
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
5327
+ <xsl:choose>
5328
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
5329
+ <xsl:variable name="src">
5330
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
5331
+ </xsl:variable>
5332
+ <xsl:variable name="width" select="document($src)/@width"/>
5333
+ <xsl:variable name="height" select="document($src)/@height"/>
5334
+ <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">
5335
+ <image xlink:href="{$src}" style="overflow:visible;"/>
5336
+ </svg>
5337
+ </xsl:when>
5338
+ <xsl:when test="not(starts-with(@src, 'data:'))">
5339
+ <xsl:variable name="src">
5340
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
5341
+ </xsl:variable>
5342
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
5343
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
5344
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5345
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5346
+ <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">
5347
+ <image xlink:href="{$src}" style="overflow:visible;"/>
5348
+ </svg>
5349
+ </xsl:when>
5350
+ <xsl:otherwise>
5351
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
5352
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
5353
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
5354
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
5355
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
5356
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
5357
+ <!-- width=<xsl:value-of select="$width"/> -->
5358
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
5359
+ <!-- height=<xsl:value-of select="$height"/> -->
5360
+ <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">
5361
+ <image xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
5362
+ <xsl:call-template name="svg_cross">
5363
+ <xsl:with-param name="width" select="$width"/>
5364
+ <xsl:with-param name="height" select="$height"/>
5365
+ </xsl:call-template>
5366
+ </svg>
5367
+ </xsl:otherwise>
5368
+ </xsl:choose>
5369
+
5370
+ </xsl:template><xsl:template name="svg_cross">
5371
+ <xsl:param name="width"/>
5372
+ <xsl:param name="height"/>
5373
+ <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; "/>
5374
+ <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; "/>
4701
5375
  </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">
4702
5376
  <xsl:apply-templates mode="contents"/>
4703
5377
  <xsl:text> </xsl:text>
@@ -5216,8 +5890,8 @@
5216
5890
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
5217
5891
 
5218
5892
  <xsl:variable name="element">
5219
- block
5220
-
5893
+
5894
+ inline
5221
5895
  <xsl:if test=".//*[local-name() = 'table']">block</xsl:if>
5222
5896
  </xsl:variable>
5223
5897
 
@@ -5240,6 +5914,7 @@
5240
5914
  <xsl:variable name="element">
5241
5915
 
5242
5916
  inline
5917
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
5243
5918
  </xsl:variable>
5244
5919
  <xsl:choose>
5245
5920
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -5247,7 +5922,7 @@
5247
5922
  <xsl:apply-templates/>
5248
5923
  </fo:inline>
5249
5924
  </xsl:when>
5250
- <xsl:when test="normalize-space($element) = 'block'">
5925
+ <xsl:when test="contains(normalize-space($element), 'block')">
5251
5926
  <fo:block xsl:use-attribute-sets="example-name-style">
5252
5927
  <xsl:apply-templates/>
5253
5928
  </fo:block>
@@ -5260,9 +5935,15 @@
5260
5935
  </xsl:choose>
5261
5936
 
5262
5937
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
5263
-
5938
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
5264
5939
  <xsl:variable name="element">
5265
- block
5940
+
5941
+
5942
+ <xsl:choose>
5943
+ <xsl:when test="$num = 1">inline</xsl:when>
5944
+ <xsl:otherwise>block</xsl:otherwise>
5945
+ </xsl:choose>
5946
+
5266
5947
 
5267
5948
  </xsl:variable>
5268
5949
  <xsl:choose>
@@ -5367,29 +6048,47 @@
5367
6048
  <xsl:text>— </xsl:text>
5368
6049
  <xsl:apply-templates/>
5369
6050
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
5370
- <fo:inline xsl:use-attribute-sets="eref-style">
5371
- <xsl:if test="@type = 'footnote'">
5372
-
5373
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5374
- <xsl:attribute name="font-size">80%</xsl:attribute>
5375
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5376
- <xsl:attribute name="vertical-align">super</xsl:attribute>
5377
-
5378
-
5379
- </xsl:if>
5380
-
5381
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5382
-
5383
- <xsl:if test="@type = 'inline'">
5384
-
5385
-
5386
-
5387
- </xsl:if>
5388
-
5389
-
5390
- <xsl:apply-templates/>
5391
- </fo:basic-link>
5392
- </fo:inline>
6051
+
6052
+ <xsl:variable name="bibitemid">
6053
+ <xsl:choose>
6054
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
6055
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
6056
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
6057
+ </xsl:choose>
6058
+ </xsl:variable>
6059
+
6060
+ <xsl:choose>
6061
+ <xsl:when test="normalize-space($bibitemid) != ''">
6062
+ <fo:inline xsl:use-attribute-sets="eref-style">
6063
+ <xsl:if test="@type = 'footnote'">
6064
+
6065
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6066
+ <xsl:attribute name="font-size">80%</xsl:attribute>
6067
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
6068
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
6069
+
6070
+
6071
+ </xsl:if>
6072
+
6073
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
6074
+ <xsl:if test="normalize-space(@citeas) = ''">
6075
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
6076
+ </xsl:if>
6077
+ <xsl:if test="@type = 'inline'">
6078
+
6079
+
6080
+
6081
+ </xsl:if>
6082
+
6083
+ <xsl:apply-templates/>
6084
+ </fo:basic-link>
6085
+
6086
+ </fo:inline>
6087
+ </xsl:when>
6088
+ <xsl:otherwise>
6089
+ <fo:inline><xsl:apply-templates/></fo:inline>
6090
+ </xsl:otherwise>
6091
+ </xsl:choose>
5393
6092
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
5394
6093
  <!-- zero-space char -->
5395
6094
  <xsl:variable name="depth">
@@ -5447,7 +6146,8 @@
5447
6146
  </fo:inline>
5448
6147
  </xsl:when>
5449
6148
  <xsl:otherwise>
5450
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
6149
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
6150
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
5451
6151
  </xsl:otherwise>
5452
6152
  </xsl:choose>
5453
6153
 
@@ -5572,6 +6272,153 @@
5572
6272
  </fo:block>
5573
6273
  </xsl:otherwise>
5574
6274
  </xsl:choose>
6275
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
6276
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
6277
+ <bookmark><xsl:value-of select="@id"/></bookmark>
6278
+ </xsl:for-each>
6279
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
6280
+ <xsl:copy>
6281
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
6282
+ </xsl:copy>
6283
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
6284
+ <xsl:variable name="id">
6285
+ <xsl:call-template name="generateIndexXrefId"/>
6286
+ </xsl:variable>
6287
+ <xsl:copy> <!-- add id to xref -->
6288
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
6289
+ <xsl:attribute name="id">
6290
+ <xsl:value-of select="$id"/>
6291
+ </xsl:attribute>
6292
+ <xsl:apply-templates mode="index_add_id"/>
6293
+ </xsl:copy>
6294
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
6295
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
6296
+ <xsl:if test="@to">
6297
+ <xsl:value-of select="$dash"/>
6298
+ <xsl:copy>
6299
+ <xsl:copy-of select="@*"/>
6300
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
6301
+ <xsl:attribute name="id">
6302
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
6303
+ </xsl:attribute>
6304
+ <xsl:apply-templates mode="index_add_id"/>
6305
+ </xsl:copy>
6306
+ </xsl:if>
6307
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
6308
+ <xsl:copy>
6309
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
6310
+ </xsl:copy>
6311
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
6312
+ <xsl:copy>
6313
+ <xsl:apply-templates select="@*" mode="index_update"/>
6314
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
6315
+ </xsl:copy>
6316
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
6317
+ <xsl:param name="element"/>
6318
+ <xsl:param name="remove" select="'false'"/>
6319
+ <xsl:param name="target"/>
6320
+ <!-- <node></node> -->
6321
+ <xsl:choose>
6322
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
6323
+ <!-- skip text (i.e. remove it) and process next element -->
6324
+ <!-- [removed_<xsl:value-of select="."/>] -->
6325
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6326
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
6327
+ </xsl:apply-templates>
6328
+ </xsl:when>
6329
+ <xsl:when test="self::text()">
6330
+ <xsl:value-of select="."/>
6331
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6332
+ </xsl:when>
6333
+ <xsl:when test="self::* and local-name(.) = 'xref'">
6334
+ <xsl:variable name="id" select="@id"/>
6335
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
6336
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
6337
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
6338
+
6339
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
6340
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
6341
+
6342
+ <xsl:choose>
6343
+ <!-- 2nd pass -->
6344
+ <!-- if page is equal to page for next and page is not the end of range -->
6345
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
6346
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
6347
+ <!-- [removed_xref] -->
6348
+
6349
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6350
+ <xsl:with-param name="remove">true</xsl:with-param>
6351
+ <xsl:with-param name="target">
6352
+ <xsl:choose>
6353
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
6354
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
6355
+ </xsl:choose>
6356
+ </xsl:with-param>
6357
+ </xsl:apply-templates>
6358
+ </xsl:when>
6359
+
6360
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
6361
+ <!-- remove xref -->
6362
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
6363
+ <xsl:with-param name="remove">true</xsl:with-param>
6364
+ </xsl:apply-templates>
6365
+ </xsl:when>
6366
+
6367
+ <xsl:otherwise>
6368
+ <xsl:apply-templates select="." mode="xref_copy">
6369
+ <xsl:with-param name="target" select="$target"/>
6370
+ </xsl:apply-templates>
6371
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6372
+ </xsl:otherwise>
6373
+ </xsl:choose>
6374
+ </xsl:when>
6375
+ <xsl:when test="self::* and local-name(.) = 'ul'">
6376
+ <!-- ul -->
6377
+ <xsl:apply-templates select="." mode="index_update"/>
6378
+ </xsl:when>
6379
+ <xsl:otherwise>
6380
+ <xsl:apply-templates select="." mode="xref_copy">
6381
+ <xsl:with-param name="target" select="$target"/>
6382
+ </xsl:apply-templates>
6383
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
6384
+ </xsl:otherwise>
6385
+ </xsl:choose>
6386
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
6387
+ <xsl:param name="target"/>
6388
+ <xsl:copy>
6389
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
6390
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
6391
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
6392
+ </xsl:if>
6393
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
6394
+ </xsl:copy>
6395
+ </xsl:template><xsl:template name="generateIndexXrefId">
6396
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6397
+
6398
+ <xsl:variable name="docid">
6399
+ <xsl:call-template name="getDocumentId"/>
6400
+ </xsl:variable>
6401
+ <xsl:variable name="item_number">
6402
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
6403
+ </xsl:variable>
6404
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
6405
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
6406
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
6407
+ <xsl:apply-templates/>
6408
+ <fo:block>
6409
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
6410
+ <fo:block> </fo:block>
6411
+ </xsl:if>
6412
+ </fo:block>
6413
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
6414
+ <xsl:apply-templates/>
6415
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
6416
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
6417
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
6418
+ <xsl:apply-templates/>
6419
+ </fo:block>
6420
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
6421
+ <fo:inline id="{@id}" font-size="1pt"/>
5575
6422
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5576
6423
  <!-- <row>
5577
6424
  <date>05-07-2013</date>
@@ -5669,6 +6516,70 @@
5669
6516
  <xsl:value-of select="substring(.,1,1)"/>
5670
6517
  </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
5671
6518
  <fo:inline><xsl:apply-templates/></fo:inline>
6519
+ </xsl:template><xsl:template match="*[local-name() = 'form']">
6520
+ <fo:block>
6521
+ <xsl:apply-templates/>
6522
+ </fo:block>
6523
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'label']">
6524
+ <fo:inline><xsl:apply-templates/></fo:inline>
6525
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'text' or @type = 'date' or @type = 'file' or @type = 'password']">
6526
+ <fo:inline>
6527
+ <xsl:call-template name="text_input"/>
6528
+ </fo:inline>
6529
+ </xsl:template><xsl:template name="text_input">
6530
+ <xsl:variable name="count">
6531
+ <xsl:choose>
6532
+ <xsl:when test="normalize-space(@maxlength) != ''"><xsl:value-of select="@maxlength"/></xsl:when>
6533
+ <xsl:when test="normalize-space(@size) != ''"><xsl:value-of select="@size"/></xsl:when>
6534
+ <xsl:otherwise>10</xsl:otherwise>
6535
+ </xsl:choose>
6536
+ </xsl:variable>
6537
+ <xsl:call-template name="repeat">
6538
+ <xsl:with-param name="char" select="'_'"/>
6539
+ <xsl:with-param name="count" select="$count"/>
6540
+ </xsl:call-template>
6541
+ <xsl:text> </xsl:text>
6542
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'button']">
6543
+ <xsl:variable name="caption">
6544
+ <xsl:choose>
6545
+ <xsl:when test="normalize-space(@value) != ''"><xsl:value-of select="@value"/></xsl:when>
6546
+ <xsl:otherwise>BUTTON</xsl:otherwise>
6547
+ </xsl:choose>
6548
+ </xsl:variable>
6549
+ <fo:inline>[<xsl:value-of select="$caption"/>]</fo:inline>
6550
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'checkbox']">
6551
+ <fo:inline padding-right="1mm">
6552
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6553
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6554
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6555
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6556
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6557
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6558
+ <polyline points="0,0 80,0 80,80 0,80 0,0" stroke="black" stroke-width="5" fill="white"/>
6559
+ </svg>
6560
+ </fo:instream-foreign-object>
6561
+ </fo:inline>
6562
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'input'][@type = 'radio']">
6563
+ <fo:inline padding-right="1mm">
6564
+ <fo:instream-foreign-object fox:alt-text="Box" baseline-shift="-10%">
6565
+ <xsl:attribute name="height">3.5mm</xsl:attribute>
6566
+ <xsl:attribute name="content-width">100%</xsl:attribute>
6567
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6568
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
6569
+ <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80">
6570
+ <circle cx="40" cy="40" r="30" stroke="black" stroke-width="5" fill="white"/>
6571
+ <circle cx="40" cy="40" r="15" stroke="black" stroke-width="5" fill="white"/>
6572
+ </svg>
6573
+ </fo:instream-foreign-object>
6574
+ </fo:inline>
6575
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'select']">
6576
+ <fo:inline>
6577
+ <xsl:call-template name="text_input"/>
6578
+ </fo:inline>
6579
+ </xsl:template><xsl:template match="*[local-name() = 'form']//*[local-name() = 'textarea']">
6580
+ <fo:block-container border="1pt solid black" width="50%">
6581
+ <fo:block> </fo:block>
6582
+ </fo:block-container>
5672
6583
  </xsl:template><xsl:template name="convertDate">
5673
6584
  <xsl:param name="date"/>
5674
6585
  <xsl:param name="format" select="'short'"/>
@@ -5788,70 +6699,68 @@
5788
6699
  <xsl:variable name="lang">
5789
6700
  <xsl:call-template name="getLang"/>
5790
6701
  </xsl:variable>
5791
- <fo:declarations>
5792
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5793
- <pdf:dictionary type="normal" key="ViewerPreferences">
5794
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5795
- </pdf:dictionary>
5796
- </pdf:catalog>
5797
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5798
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5799
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5800
- <!-- Dublin Core properties go here -->
5801
- <dc:title>
5802
- <xsl:variable name="title">
5803
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5804
-
5805
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5806
-
5807
-
5808
-
5809
-
5810
-
5811
-
5812
- </xsl:for-each>
5813
- </xsl:variable>
5814
- <xsl:choose>
5815
- <xsl:when test="normalize-space($title) != ''">
5816
- <xsl:value-of select="$title"/>
5817
- </xsl:when>
5818
- <xsl:otherwise>
5819
- <xsl:text> </xsl:text>
5820
- </xsl:otherwise>
5821
- </xsl:choose>
5822
- </dc:title>
5823
- <dc:creator>
6702
+ <pdf:catalog>
6703
+ <pdf:dictionary type="normal" key="ViewerPreferences">
6704
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
6705
+ </pdf:dictionary>
6706
+ </pdf:catalog>
6707
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
6708
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
6709
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
6710
+ <!-- Dublin Core properties go here -->
6711
+ <dc:title>
6712
+ <xsl:variable name="title">
5824
6713
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5825
6714
 
5826
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5827
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
5828
- <xsl:if test="position() != last()">; </xsl:if>
5829
- </xsl:for-each>
6715
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
5830
6716
 
5831
6717
 
5832
6718
 
5833
- </xsl:for-each>
5834
- </dc:creator>
5835
- <dc:description>
5836
- <xsl:variable name="abstract">
5837
-
5838
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5839
6719
 
5840
6720
 
5841
- </xsl:variable>
5842
- <xsl:value-of select="normalize-space($abstract)"/>
5843
- </dc:description>
5844
- <pdf:Keywords>
5845
- <xsl:call-template name="insertKeywords"/>
5846
- </pdf:Keywords>
5847
- </rdf:Description>
5848
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5849
- <!-- XMP properties go here -->
5850
- <xmp:CreatorTool/>
5851
- </rdf:Description>
5852
- </rdf:RDF>
5853
- </x:xmpmeta>
5854
- </fo:declarations>
6721
+
6722
+ </xsl:for-each>
6723
+ </xsl:variable>
6724
+ <xsl:choose>
6725
+ <xsl:when test="normalize-space($title) != ''">
6726
+ <xsl:value-of select="$title"/>
6727
+ </xsl:when>
6728
+ <xsl:otherwise>
6729
+ <xsl:text> </xsl:text>
6730
+ </xsl:otherwise>
6731
+ </xsl:choose>
6732
+ </dc:title>
6733
+ <dc:creator>
6734
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
6735
+
6736
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
6737
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
6738
+ <xsl:if test="position() != last()">; </xsl:if>
6739
+ </xsl:for-each>
6740
+
6741
+
6742
+
6743
+ </xsl:for-each>
6744
+ </dc:creator>
6745
+ <dc:description>
6746
+ <xsl:variable name="abstract">
6747
+
6748
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
6749
+
6750
+
6751
+ </xsl:variable>
6752
+ <xsl:value-of select="normalize-space($abstract)"/>
6753
+ </dc:description>
6754
+ <pdf:Keywords>
6755
+ <xsl:call-template name="insertKeywords"/>
6756
+ </pdf:Keywords>
6757
+ </rdf:Description>
6758
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
6759
+ <!-- XMP properties go here -->
6760
+ <xmp:CreatorTool/>
6761
+ </rdf:Description>
6762
+ </rdf:RDF>
6763
+ </x:xmpmeta>
5855
6764
  </xsl:template><xsl:template name="getId">
5856
6765
  <xsl:choose>
5857
6766
  <xsl:when test="../@id">
@@ -6015,4 +6924,44 @@
6015
6924
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
6016
6925
  </xsl:choose>
6017
6926
 
6927
+ </xsl:template><xsl:template name="setTrackChangesStyles">
6928
+ <xsl:param name="isAdded"/>
6929
+ <xsl:param name="isDeleted"/>
6930
+ <xsl:choose>
6931
+ <xsl:when test="local-name() = 'math'">
6932
+ <xsl:if test="$isAdded = 'true'">
6933
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
6934
+ </xsl:if>
6935
+ <xsl:if test="$isDeleted = 'true'">
6936
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
6937
+ </xsl:if>
6938
+ </xsl:when>
6939
+ <xsl:otherwise>
6940
+ <xsl:if test="$isAdded = 'true'">
6941
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
6942
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6943
+ </xsl:if>
6944
+ <xsl:if test="$isDeleted = 'true'">
6945
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
6946
+ <xsl:if test="local-name() = 'table'">
6947
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
6948
+ </xsl:if>
6949
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
6950
+ <xsl:attribute name="padding">2mm</xsl:attribute>
6951
+ </xsl:if>
6952
+ </xsl:otherwise>
6953
+ </xsl:choose>
6954
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
6955
+ <xsl:if test="$lang = 'ar'">
6956
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
6957
+ </xsl:if>
6958
+ </xsl:template><xsl:template name="setAlignment">
6959
+ <xsl:param name="align" select="normalize-space(@align)"/>
6960
+ <xsl:choose>
6961
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
6962
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
6963
+ <xsl:when test="$align != ''">
6964
+ <xsl:value-of select="$align"/>
6965
+ </xsl:when>
6966
+ </xsl:choose>
6018
6967
  </xsl:template></xsl:stylesheet>