metanorma-itu 1.2.12 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -31,7 +33,7 @@
31
33
  <xsl:variable name="doctype" select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[not(@language) or @language = '']"/>
32
34
 
33
35
  <xsl:variable name="xSTR-ACRONYM">
34
- <xsl:variable name="x" select="substring(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']/itu:title, 1, 1)"/>
36
+ <xsl:variable name="x" select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']/itu:title[@type = 'abbrev']"/>
35
37
  <xsl:variable name="acronym" select="/itu:itu-standard/itu:bibdata/itu:docnumber"/>
36
38
  <xsl:value-of select="concat($x,'STR-', $acronym)"/>
37
39
  </xsl:variable>
@@ -100,6 +102,11 @@
100
102
  <xsl:text> </xsl:text>
101
103
  <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:structuredidentifier/itu:docnumber"/>
102
104
  </xsl:when>
105
+ <xsl:when test="$doctype = 'recommendation-supplement'">
106
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement-Short']"/>
107
+ <xsl:text> </xsl:text>
108
+ <xsl:value-of select="$docdate"/>
109
+ </xsl:when>
103
110
  <xsl:otherwise>
104
111
  <xsl:value-of select="concat($footerprefix, $docname, ' ', $docdate)"/>
105
112
  </xsl:otherwise>
@@ -182,7 +189,9 @@
182
189
  </fo:page-sequence-master>
183
190
  </fo:layout-master-set>
184
191
 
185
- <xsl:call-template name="addPDFUAmeta"/>
192
+ <fo:declarations>
193
+ <xsl:call-template name="addPDFUAmeta"/>
194
+ </fo:declarations>
186
195
 
187
196
  <xsl:call-template name="addBookmarks">
188
197
  <xsl:with-param name="contents" select="$contents"/>
@@ -378,10 +387,30 @@
378
387
  <xsl:text> </xsl:text>
379
388
  <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:doctype[@language = $lang]"/>
380
389
  </xsl:when>
390
+ <xsl:when test="$doctype = 'resolution'"/>
391
+ <xsl:when test="$doctype = 'recommendation-supplement'">
392
+ <!-- Series L -->
393
+ <xsl:variable name="title-series">
394
+ <xsl:call-template name="getLocalizedString">
395
+ <xsl:with-param name="key">series</xsl:with-param>
396
+ </xsl:call-template>
397
+ </xsl:variable>
398
+ <xsl:call-template name="capitalize">
399
+ <xsl:with-param name="str" select="$title-series"/>
400
+ </xsl:call-template>
401
+ <xsl:text> </xsl:text>
402
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type='main']/itu:title[@type='abbrev']"/>
403
+ <!-- Ex. Supplement 37 -->
404
+ <fo:block font-size="18pt">
405
+ <xsl:call-template name="getLocalizedString">
406
+ <xsl:with-param name="key">doctype_dict.recommendation-supplement</xsl:with-param>
407
+ </xsl:call-template>
408
+ <xsl:text> </xsl:text>
409
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docnumber"/>
410
+ </fo:block>
411
+ </xsl:when>
381
412
  <xsl:otherwise>
382
- <xsl:if test="$doctype != 'resolution'">
383
- <xsl:value-of select="substring-after(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/>
384
- </xsl:if>
413
+ <xsl:value-of select="substring-after(/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU'], ' ')"/>
385
414
  </xsl:otherwise>
386
415
  </xsl:choose>
387
416
  </fo:block>
@@ -488,25 +517,36 @@
488
517
  </fo:block>
489
518
  </xsl:if>
490
519
  <fo:block text-transform="uppercase">
491
- <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']) != ''">
520
+ <xsl:variable name="series_title" select="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']/itu:title[@type = 'full'])"/>
521
+ <xsl:if test="$series_title != ''">
492
522
  <xsl:variable name="title">
493
523
  <xsl:if test="$doctype != 'resolution'">
494
- <xsl:text>Series </xsl:text>
524
+ <!-- <xsl:text>Series </xsl:text> -->
525
+ <xsl:call-template name="getLocalizedString">
526
+ <xsl:with-param name="key">series</xsl:with-param>
527
+ </xsl:call-template>
528
+ <xsl:text> </xsl:text>
495
529
  </xsl:if>
496
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']"/>
530
+ <xsl:value-of select="$series_title"/>
497
531
  </xsl:variable>
498
532
  <xsl:value-of select="$title"/>
499
533
  </xsl:if>
500
534
  </fo:block>
501
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
502
- <fo:block margin-top="6pt">
503
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
504
- <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
505
- <xsl:text> — </xsl:text>
506
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
535
+ <xsl:choose>
536
+ <xsl:when test="$doctype = 'recommendation-supplement'"/>
537
+ <xsl:otherwise>
538
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
539
+ <fo:block margin-top="6pt">
540
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
541
+ <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
542
+ <xsl:text> — </xsl:text>
543
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
544
+ </xsl:if>
545
+ </fo:block>
507
546
  </xsl:if>
508
- </fo:block>
509
- </xsl:if>
547
+ </xsl:otherwise>
548
+ </xsl:choose>
549
+
510
550
  </fo:block>
511
551
  </fo:table-cell>
512
552
  </fo:table-row>
@@ -586,6 +626,9 @@
586
626
  <fo:block font-size="16pt" margin-top="3pt">
587
627
  <xsl:if test="/itu:itu-standard/itu:boilerplate/itu:legal-statement/itu:clause[@id='draft-warning']">
588
628
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
629
+ <xsl:if test="$doctype = 'recommendation-supplement'">
630
+ <xsl:attribute name="margin-top">12pt</xsl:attribute>
631
+ </xsl:if>
589
632
  </xsl:if>
590
633
 
591
634
  <xsl:choose>
@@ -602,6 +645,11 @@
602
645
  </xsl:when>
603
646
  <xsl:when test="$doctype = 'implementers-guide'"/>
604
647
  <xsl:when test="$doctype = 'resolution'"/>
648
+ <xsl:when test="$doctype = 'recommendation-supplement'">
649
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:status/itu:stage = 'draft'">Draft </xsl:if>
650
+ <xsl:text>ITU-</xsl:text><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:ext/itu:editorialgroup/itu:bureau"/><xsl:text> </xsl:text>
651
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement']"/>
652
+ </xsl:when>
605
653
  <xsl:otherwise>
606
654
  <xsl:value-of select="$doctypeTitle"/>
607
655
  <xsl:text>  </xsl:text>
@@ -641,6 +689,11 @@
641
689
  <fo:block-container font-size="14pt" font-weight="bold">
642
690
  <xsl:choose>
643
691
  <xsl:when test="$doctype = 'implementers-guide'"/>
692
+ <xsl:when test="$doctype = 'recommendation-supplement'">
693
+ <fo:block>
694
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement-Internal']"/>
695
+ </fo:block>
696
+ </xsl:when>
644
697
  <xsl:otherwise>
645
698
  <fo:block>
646
699
  <xsl:value-of select="$doctypeTitle"/>
@@ -852,6 +905,12 @@
852
905
  <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type='resolution' and @language = $lang]"/>
853
906
  </fo:block>
854
907
  </xsl:when>
908
+ <xsl:when test="$doctype = 'implementers-guide'"/>
909
+ <xsl:when test="$doctype = 'recommendation-supplement'">
910
+ <fo:block font-weight="bold">
911
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement-Internal']"/>
912
+ </fo:block>
913
+ </xsl:when>
855
914
  <xsl:otherwise>
856
915
  <fo:block font-weight="bold">
857
916
  <xsl:value-of select="$doctypeTitle"/>
@@ -1526,6 +1585,7 @@
1526
1585
  <xsl:variable name="element-name">
1527
1586
  <xsl:choose>
1528
1587
  <xsl:when test="ancestor::itu:dd">fo:inline</xsl:when>
1588
+ <xsl:when test="ancestor::itu:title">fo:inline</xsl:when>
1529
1589
  <xsl:when test="normalize-space(ancestor::itu:p[1]//text()[not(parent::itu:tt)]) != ''">fo:inline</xsl:when>
1530
1590
  <xsl:otherwise>fo:block</xsl:otherwise>
1531
1591
  </xsl:choose>
@@ -1533,9 +1593,12 @@
1533
1593
  <xsl:element name="{$element-name}">
1534
1594
  <xsl:attribute name="font-family">Courier</xsl:attribute>
1535
1595
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1536
- <xsl:if test="local-name(..) != 'dt' and not(ancestor::itu:dd)">
1596
+ <xsl:if test="local-name(..) != 'dt' and not(ancestor::itu:dd) and not(ancestor::itu:title)">
1537
1597
  <xsl:attribute name="text-align">center</xsl:attribute>
1538
1598
  </xsl:if>
1599
+ <xsl:if test="ancestor::itu:title">
1600
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
1601
+ </xsl:if>
1539
1602
  <xsl:apply-templates/>
1540
1603
  </xsl:element>
1541
1604
  </xsl:template>
@@ -2074,6 +2137,7 @@
2074
2137
 
2075
2138
 
2076
2139
 
2140
+
2077
2141
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2078
2142
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
2079
2143
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -2291,12 +2355,18 @@
2291
2355
 
2292
2356
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
2293
2357
 
2294
-
2358
+
2295
2359
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
2296
2360
 
2297
2361
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
2298
2362
 
2299
2363
 
2364
+ </xsl:attribute-set><xsl:attribute-set name="add-style">
2365
+ <xsl:attribute name="color">red</xsl:attribute>
2366
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
2367
+ </xsl:attribute-set><xsl:attribute-set name="del-style">
2368
+ <xsl:attribute name="color">red</xsl:attribute>
2369
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
2300
2370
  </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
2301
2371
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
2302
2372
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
@@ -2342,206 +2412,240 @@
2342
2412
  <xsl:call-template name="add-zero-spaces-java"/>
2343
2413
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2344
2414
 
2345
- <xsl:variable name="simple-table">
2346
- <xsl:call-template name="getSimpleTable"/>
2347
- </xsl:variable>
2415
+ <xsl:variable name="table">
2348
2416
 
2349
-
2350
- <fo:block space-before="18pt"> </fo:block>
2351
-
2352
-
2353
-
2354
-
2355
- <!-- <xsl:if test="$namespace = 'bipm'">
2356
- <fo:block>&#xA0;</fo:block>
2357
- </xsl:if> -->
2358
-
2359
- <!-- $namespace = 'iso' or -->
2360
-
2361
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2362
-
2363
-
2364
-
2365
- <xsl:call-template name="fn_name_display"/>
2417
+ <xsl:variable name="simple-table">
2418
+ <xsl:call-template name="getSimpleTable"/>
2419
+ </xsl:variable>
2366
2420
 
2367
2421
 
2368
-
2369
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2370
-
2371
- <!-- <xsl:variable name="cols-count">
2372
- <xsl:choose>
2373
- <xsl:when test="*[local-name()='thead']">
2374
- <xsl:call-template name="calculate-columns-numbers">
2375
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2376
- </xsl:call-template>
2377
- </xsl:when>
2378
- <xsl:otherwise>
2379
- <xsl:call-template name="calculate-columns-numbers">
2380
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2381
- </xsl:call-template>
2382
- </xsl:otherwise>
2383
- </xsl:choose>
2384
- </xsl:variable> -->
2385
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2386
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2387
-
2388
-
2389
-
2390
- <xsl:variable name="colwidths">
2391
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2392
- <xsl:call-template name="calculate-column-widths">
2393
- <xsl:with-param name="cols-count" select="$cols-count"/>
2394
- <xsl:with-param name="table" select="$simple-table"/>
2395
- </xsl:call-template>
2396
- </xsl:if>
2397
- </xsl:variable>
2398
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2399
-
2400
- <!-- <xsl:variable name="colwidths2">
2401
- <xsl:call-template name="calculate-column-widths">
2402
- <xsl:with-param name="cols-count" select="$cols-count"/>
2403
- </xsl:call-template>
2404
- </xsl:variable> -->
2405
-
2406
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2407
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
2408
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2409
-
2410
- <xsl:variable name="margin-left">
2411
- <xsl:choose>
2412
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2413
- <xsl:otherwise>0</xsl:otherwise>
2414
- </xsl:choose>
2415
- </xsl:variable>
2416
-
2417
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2422
+ <fo:block space-before="18pt"> </fo:block>
2418
2423
 
2419
- <xsl:attribute name="font-size">10pt</xsl:attribute>
2420
2424
 
2421
2425
 
2422
- <xsl:attribute name="space-after">6pt</xsl:attribute>
2423
2426
 
2424
-
2425
-
2426
-
2427
+ <!-- <xsl:if test="$namespace = 'bipm'">
2428
+ <fo:block>&#xA0;</fo:block>
2429
+ </xsl:if> -->
2427
2430
 
2428
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2429
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2430
- <xsl:attribute name="space-after">18pt</xsl:attribute>
2431
+ <!-- $namespace = 'iso' or -->
2431
2432
 
2433
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
2432
2434
 
2433
-
2435
+
2434
2436
 
2437
+ <xsl:call-template name="fn_name_display"/>
2435
2438
 
2439
+
2436
2440
 
2441
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
2437
2442
 
2443
+ <!-- <xsl:variable name="cols-count">
2444
+ <xsl:choose>
2445
+ <xsl:when test="*[local-name()='thead']">
2446
+ <xsl:call-template name="calculate-columns-numbers">
2447
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
2448
+ </xsl:call-template>
2449
+ </xsl:when>
2450
+ <xsl:otherwise>
2451
+ <xsl:call-template name="calculate-columns-numbers">
2452
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
2453
+ </xsl:call-template>
2454
+ </xsl:otherwise>
2455
+ </xsl:choose>
2456
+ </xsl:variable> -->
2457
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
2458
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
2438
2459
 
2439
2460
 
2440
2461
 
2441
- <xsl:variable name="table_attributes">
2442
- <attribute name="table-layout">fixed</attribute>
2443
- <attribute name="width">
2444
- <xsl:choose>
2445
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
2446
- <xsl:otherwise>100%</xsl:otherwise>
2447
- </xsl:choose>
2448
- </attribute>
2449
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2450
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2462
+ <xsl:variable name="colwidths">
2463
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2464
+ <xsl:call-template name="calculate-column-widths">
2465
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2466
+ <xsl:with-param name="table" select="$simple-table"/>
2467
+ </xsl:call-template>
2468
+ </xsl:if>
2469
+ </xsl:variable>
2470
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2471
+
2472
+ <!-- <xsl:variable name="colwidths2">
2473
+ <xsl:call-template name="calculate-column-widths">
2474
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2475
+ </xsl:call-template>
2476
+ </xsl:variable> -->
2477
+
2478
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
2479
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
2480
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
2481
+
2482
+ <xsl:variable name="margin-left">
2483
+ <xsl:choose>
2484
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
2485
+ <xsl:otherwise>0</xsl:otherwise>
2486
+ </xsl:choose>
2487
+ </xsl:variable>
2488
+
2489
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
2451
2490
 
2491
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2452
2492
 
2453
2493
 
2454
- <attribute name="margin-left">0mm</attribute>
2455
- <attribute name="margin-right">0mm</attribute>
2494
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
2456
2495
 
2496
+
2497
+
2498
+
2457
2499
 
2458
-
2459
-
2460
-
2500
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2501
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2502
+ <xsl:attribute name="space-after">18pt</xsl:attribute>
2461
2503
 
2462
-
2463
2504
 
2464
- </xsl:variable>
2465
-
2466
-
2467
- <fo:table id="{@id}" table-omit-footer-at-break="true">
2505
+
2468
2506
 
2469
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2470
- <xsl:attribute name="{@name}">
2471
- <xsl:value-of select="."/>
2472
- </xsl:attribute>
2473
- </xsl:for-each>
2474
2507
 
2475
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2476
- <xsl:if test="$isNoteOrFnExist = 'true'">
2477
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2478
- </xsl:if>
2479
2508
 
2480
- <xsl:choose>
2481
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2482
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2483
- <fo:table-column column-width="{@width}"/>
2484
- </xsl:for-each>
2485
- </xsl:when>
2486
- <xsl:otherwise>
2487
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2488
- <xsl:choose>
2489
- <xsl:when test=". = 1 or . = 0">
2490
- <fo:table-column column-width="proportional-column-width(2)"/>
2491
- </xsl:when>
2492
- <xsl:otherwise>
2493
- <fo:table-column column-width="proportional-column-width({.})"/>
2494
- </xsl:otherwise>
2495
- </xsl:choose>
2496
- </xsl:for-each>
2497
- </xsl:otherwise>
2498
- </xsl:choose>
2499
2509
 
2500
- <xsl:choose>
2501
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2502
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2503
- </xsl:when>
2504
- <xsl:otherwise>
2505
- <xsl:apply-templates/>
2506
- </xsl:otherwise>
2507
- </xsl:choose>
2508
2510
 
2509
- </fo:table>
2510
-
2511
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2512
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2513
- <xsl:call-template name="insertTableFooterInSeparateTable">
2514
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
2515
- <xsl:with-param name="colwidths" select="$colwidths"/>
2516
- <xsl:with-param name="colgroup" select="$colgroup"/>
2517
- </xsl:call-template>
2518
- </xsl:for-each>
2519
-
2520
- <!-- insert footer as table -->
2521
- <!-- <fo:table>
2522
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2523
- <xsl:attribute name="{@name}">
2524
- <xsl:value-of select="."/>
2525
- </xsl:attribute>
2526
- </xsl:for-each>
2527
2511
 
2528
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2512
+ <xsl:variable name="table_width">
2513
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
2514
+ 100%
2515
+
2516
+
2517
+ </xsl:variable>
2518
+
2519
+ <xsl:variable name="table_attributes">
2520
+ <attribute name="table-layout">fixed</attribute>
2521
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
2522
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
2523
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
2524
+
2525
+
2526
+
2527
+ <attribute name="margin-left">0mm</attribute>
2528
+ <attribute name="margin-right">0mm</attribute>
2529
+
2530
+
2531
+
2532
+
2533
+
2534
+
2535
+
2536
+
2537
+ </xsl:variable>
2538
+
2539
+
2540
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
2541
+
2542
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
2543
+ <xsl:attribute name="{@name}">
2544
+ <xsl:value-of select="."/>
2545
+ </xsl:attribute>
2546
+ </xsl:for-each>
2547
+
2548
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
2549
+ <xsl:if test="$isNoteOrFnExist = 'true'">
2550
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2551
+ </xsl:if>
2552
+
2529
2553
  <xsl:choose>
2530
- <xsl:when test=". = 1 or . = 0">
2531
- <fo:table-column column-width="proportional-column-width(2)"/>
2554
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
2555
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
2556
+ <fo:table-column column-width="{@width}"/>
2557
+ </xsl:for-each>
2532
2558
  </xsl:when>
2533
2559
  <xsl:otherwise>
2534
- <fo:table-column column-width="proportional-column-width({.})"/>
2560
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2561
+ <xsl:choose>
2562
+ <xsl:when test=". = 1 or . = 0">
2563
+ <fo:table-column column-width="proportional-column-width(2)"/>
2564
+ </xsl:when>
2565
+ <xsl:otherwise>
2566
+ <fo:table-column column-width="proportional-column-width({.})"/>
2567
+ </xsl:otherwise>
2568
+ </xsl:choose>
2569
+ </xsl:for-each>
2535
2570
  </xsl:otherwise>
2536
2571
  </xsl:choose>
2572
+
2573
+ <xsl:choose>
2574
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
2575
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
2576
+ </xsl:when>
2577
+ <xsl:otherwise>
2578
+ <xsl:apply-templates/>
2579
+ </xsl:otherwise>
2580
+ </xsl:choose>
2581
+
2582
+ </fo:table>
2583
+
2584
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
2585
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
2586
+ <xsl:call-template name="insertTableFooterInSeparateTable">
2587
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
2588
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2589
+ <xsl:with-param name="colgroup" select="$colgroup"/>
2590
+ </xsl:call-template>
2537
2591
  </xsl:for-each>
2538
- </fo:table>-->
2539
-
2540
-
2541
-
2542
-
2543
-
2544
- </fo:block-container>
2592
+
2593
+ <!-- insert footer as table -->
2594
+ <!-- <fo:table>
2595
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
2596
+ <xsl:attribute name="{@name}">
2597
+ <xsl:value-of select="."/>
2598
+ </xsl:attribute>
2599
+ </xsl:for-each>
2600
+
2601
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
2602
+ <xsl:choose>
2603
+ <xsl:when test=". = 1 or . = 0">
2604
+ <fo:table-column column-width="proportional-column-width(2)"/>
2605
+ </xsl:when>
2606
+ <xsl:otherwise>
2607
+ <fo:table-column column-width="proportional-column-width({.})"/>
2608
+ </xsl:otherwise>
2609
+ </xsl:choose>
2610
+ </xsl:for-each>
2611
+ </fo:table>-->
2612
+
2613
+
2614
+
2615
+
2616
+
2617
+ </fo:block-container>
2618
+ </xsl:variable>
2619
+
2620
+
2621
+
2622
+ <xsl:choose>
2623
+ <xsl:when test="@width">
2624
+
2625
+ <!-- centered table when table name is centered (see table-name-style) -->
2626
+
2627
+ <fo:table table-layout="fixed" width="100%">
2628
+ <fo:table-column column-width="proportional-column-width(1)"/>
2629
+ <fo:table-column column-width="{@width}"/>
2630
+ <fo:table-column column-width="proportional-column-width(1)"/>
2631
+ <fo:table-body>
2632
+ <fo:table-row>
2633
+ <fo:table-cell column-number="2">
2634
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
2635
+ </fo:table-cell>
2636
+ </fo:table-row>
2637
+ </fo:table-body>
2638
+ </fo:table>
2639
+
2640
+
2641
+
2642
+
2643
+ </xsl:when>
2644
+ <xsl:otherwise>
2645
+ <xsl:copy-of select="$table"/>
2646
+ </xsl:otherwise>
2647
+ </xsl:choose>
2648
+
2545
2649
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
2546
2650
  <xsl:if test="normalize-space() != ''">
2547
2651
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -2669,7 +2773,15 @@
2669
2773
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2670
2774
  <xsl:value-of select="@target"/>
2671
2775
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2672
- <xsl:variable name="math_text" select="normalize-space(.)"/>
2776
+ <xsl:variable name="mathml">
2777
+ <xsl:for-each select="*">
2778
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2779
+ <xsl:copy-of select="."/>
2780
+ </xsl:if>
2781
+ </xsl:for-each>
2782
+ </xsl:variable>
2783
+
2784
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2673
2785
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2674
2786
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2675
2787
  <xsl:param name="cols-count"/>
@@ -3399,7 +3511,7 @@
3399
3511
  <xsl:with-param name="table" select="$html-table"/>
3400
3512
  </xsl:call-template>
3401
3513
  </xsl:variable>
3402
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
3514
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
3403
3515
  <xsl:variable name="maxlength_dt">
3404
3516
  <xsl:call-template name="getMaxLength_dt"/>
3405
3517
  </xsl:variable>
@@ -3428,13 +3540,22 @@
3428
3540
  </xsl:when>
3429
3541
  <xsl:otherwise>
3430
3542
  <xsl:choose>
3543
+ <!-- to set width check most wide chars like `W` -->
3431
3544
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3432
- <fo:table-column column-width="5%"/>
3433
- <fo:table-column column-width="95%"/>
3545
+ <fo:table-column column-width="7%"/>
3546
+ <fo:table-column column-width="93%"/>
3547
+ </xsl:when>
3548
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
3549
+ <fo:table-column column-width="15%"/>
3550
+ <fo:table-column column-width="85%"/>
3551
+ </xsl:when>
3552
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
3553
+ <fo:table-column column-width="20%"/>
3554
+ <fo:table-column column-width="80%"/>
3434
3555
  </xsl:when>
3435
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
3436
- <fo:table-column column-width="10%"/>
3437
- <fo:table-column column-width="90%"/>
3556
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
3557
+ <fo:table-column column-width="25%"/>
3558
+ <fo:table-column column-width="75%"/>
3438
3559
  </xsl:when>
3439
3560
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
3440
3561
  <fo:table-column column-width="60%"/>
@@ -3658,8 +3779,16 @@
3658
3779
  <fo:inline text-decoration="underline">
3659
3780
  <xsl:apply-templates/>
3660
3781
  </fo:inline>
3782
+ </xsl:template><xsl:template match="*[local-name()='add']">
3783
+ <fo:inline xsl:use-attribute-sets="add-style">
3784
+ <xsl:apply-templates/>
3785
+ </fo:inline>
3661
3786
  </xsl:template><xsl:template match="*[local-name()='del']">
3662
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3787
+ <fo:inline xsl:use-attribute-sets="del-style">
3788
+ <xsl:apply-templates/>
3789
+ </fo:inline>
3790
+ </xsl:template><xsl:template match="*[local-name()='hi']">
3791
+ <fo:inline background-color="yellow">
3663
3792
  <xsl:apply-templates/>
3664
3793
  </fo:inline>
3665
3794
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -3751,6 +3880,10 @@
3751
3880
  <xsl:param name="text" select="."/>
3752
3881
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3753
3882
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3883
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
3884
+ <xsl:param name="text" select="."/>
3885
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3886
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
3754
3887
  </xsl:template><xsl:template name="add-zero-spaces">
3755
3888
  <xsl:param name="text" select="."/>
3756
3889
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3998,6 +4131,7 @@
3998
4131
  <xsl:apply-templates select="." mode="mathml"/>
3999
4132
  </xsl:variable>
4000
4133
  <fo:instream-foreign-object fox:alt-text="Math">
4134
+
4001
4135
  <!-- <xsl:copy-of select="."/> -->
4002
4136
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
4003
4137
  </fo:instream-foreign-object>
@@ -4011,7 +4145,12 @@
4011
4145
  <!-- replace start and end spaces to non-break space -->
4012
4146
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
4013
4147
  </xsl:copy>
4014
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
4148
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
4149
+ <xsl:copy>
4150
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
4151
+ </xsl:copy>
4152
+ <mathml:mspace width="0.5ex"/>
4153
+ </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">
4015
4154
  <xsl:variable name="target">
4016
4155
  <xsl:choose>
4017
4156
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -4032,7 +4171,10 @@
4032
4171
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
4033
4172
  <xsl:choose>
4034
4173
  <xsl:when test="normalize-space(.) = ''">
4035
- <xsl:value-of select="$target"/>
4174
+ <!-- <xsl:value-of select="$target"/> -->
4175
+ <xsl:call-template name="add-zero-spaces-link-java">
4176
+ <xsl:with-param name="text" select="$target"/>
4177
+ </xsl:call-template>
4036
4178
  </xsl:when>
4037
4179
  <xsl:otherwise>
4038
4180
  <xsl:apply-templates/>
@@ -4042,8 +4184,6 @@
4042
4184
  </xsl:otherwise>
4043
4185
  </xsl:choose>
4044
4186
  </fo:inline>
4045
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
4046
- <fo:inline id="{@id}"/>
4047
4187
  </xsl:template><xsl:template match="*[local-name()='appendix']">
4048
4188
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
4049
4189
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -4258,27 +4398,43 @@
4258
4398
  <fo:block id="{@id}">
4259
4399
  <xsl:apply-templates/>
4260
4400
  </fo:block>
4401
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
4261
4402
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
4262
4403
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
4263
4404
  <xsl:apply-templates/>
4264
4405
  </fo:block>
4265
4406
  </xsl:template><xsl:template match="*[local-name() = 'image']">
4266
- <fo:block xsl:use-attribute-sets="image-style">
4267
-
4268
-
4269
- <xsl:variable name="src">
4270
- <xsl:choose>
4271
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4272
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4273
- </xsl:when>
4274
- <xsl:otherwise>
4275
- <xsl:value-of select="@src"/>
4276
- </xsl:otherwise>
4277
- </xsl:choose>
4278
- </xsl:variable>
4279
-
4280
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4281
- </fo:block>
4407
+ <xsl:choose>
4408
+ <xsl:when test="ancestor::*[local-name() = 'title']">
4409
+ <fo:inline padding-left="1mm" padding-right="1mm">
4410
+ <xsl:variable name="src">
4411
+ <xsl:call-template name="image_src"/>
4412
+ </xsl:variable>
4413
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
4414
+ </fo:inline>
4415
+ </xsl:when>
4416
+ <xsl:otherwise>
4417
+ <fo:block xsl:use-attribute-sets="image-style">
4418
+
4419
+ <xsl:variable name="src">
4420
+ <xsl:call-template name="image_src"/>
4421
+ </xsl:variable>
4422
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
4423
+ </fo:block>
4424
+ </xsl:otherwise>
4425
+ </xsl:choose>
4426
+ </xsl:template><xsl:template name="image_src">
4427
+ <xsl:choose>
4428
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
4429
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
4430
+ </xsl:when>
4431
+ <xsl:when test="not(starts-with(@src, 'data:'))">
4432
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
4433
+ </xsl:when>
4434
+ <xsl:otherwise>
4435
+ <xsl:value-of select="@src"/>
4436
+ </xsl:otherwise>
4437
+ </xsl:choose>
4282
4438
  </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">
4283
4439
  <xsl:apply-templates mode="contents"/>
4284
4440
  <xsl:text> </xsl:text>
@@ -4511,6 +4667,8 @@
4511
4667
  <xsl:copy>
4512
4668
  <xsl:apply-templates mode="contents_item"/>
4513
4669
  </xsl:copy>
4670
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
4671
+ <xsl:copy-of select="."/>
4514
4672
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
4515
4673
  <xsl:text> </xsl:text>
4516
4674
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -4839,10 +4997,11 @@
4839
4997
  </xsl:choose>
4840
4998
 
4841
4999
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4842
-
5000
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4843
5001
  <xsl:variable name="element">
4844
5002
  block
4845
5003
 
5004
+
4846
5005
  </xsl:variable>
4847
5006
  <xsl:choose>
4848
5007
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4904,11 +5063,13 @@
4904
5063
  </xsl:if>
4905
5064
  </xsl:if>
4906
5065
 
5066
+
4907
5067
  <fo:block-container margin-left="0mm">
4908
5068
 
4909
5069
  <fo:block xsl:use-attribute-sets="quote-style">
4910
5070
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4911
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
5071
+
5072
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4912
5073
  </fo:block>
4913
5074
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4914
5075
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4931,29 +5092,47 @@
4931
5092
  <xsl:text>— </xsl:text>
4932
5093
  <xsl:apply-templates/>
4933
5094
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4934
- <fo:inline xsl:use-attribute-sets="eref-style">
4935
- <xsl:if test="@type = 'footnote'">
4936
-
4937
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4938
- <xsl:attribute name="font-size">80%</xsl:attribute>
4939
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4940
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4941
-
4942
-
4943
- </xsl:if>
4944
-
4945
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4946
-
4947
- <xsl:if test="@type = 'inline'">
4948
-
4949
-
4950
-
4951
- </xsl:if>
4952
-
4953
-
4954
- <xsl:apply-templates/>
4955
- </fo:basic-link>
4956
- </fo:inline>
5095
+
5096
+ <xsl:variable name="bibitemid">
5097
+ <xsl:choose>
5098
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
5099
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
5100
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
5101
+ </xsl:choose>
5102
+ </xsl:variable>
5103
+
5104
+ <xsl:choose>
5105
+ <xsl:when test="normalize-space($bibitemid) != ''">
5106
+ <fo:inline xsl:use-attribute-sets="eref-style">
5107
+ <xsl:if test="@type = 'footnote'">
5108
+
5109
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
5110
+ <xsl:attribute name="font-size">80%</xsl:attribute>
5111
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
5112
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
5113
+
5114
+
5115
+ </xsl:if>
5116
+
5117
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
5118
+ <xsl:if test="normalize-space(@citeas) = ''">
5119
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
5120
+ </xsl:if>
5121
+ <xsl:if test="@type = 'inline'">
5122
+
5123
+
5124
+
5125
+ </xsl:if>
5126
+
5127
+ <xsl:apply-templates/>
5128
+ </fo:basic-link>
5129
+
5130
+ </fo:inline>
5131
+ </xsl:when>
5132
+ <xsl:otherwise>
5133
+ <fo:inline><xsl:apply-templates/></fo:inline>
5134
+ </xsl:otherwise>
5135
+ </xsl:choose>
4957
5136
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4958
5137
  <!-- zero-space char -->
4959
5138
  <xsl:variable name="depth">
@@ -5145,6 +5324,153 @@
5145
5324
  </fo:block>
5146
5325
  </xsl:otherwise>
5147
5326
  </xsl:choose>
5327
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
5328
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
5329
+ <bookmark><xsl:value-of select="@id"/></bookmark>
5330
+ </xsl:for-each>
5331
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
5332
+ <xsl:copy>
5333
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
5334
+ </xsl:copy>
5335
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
5336
+ <xsl:variable name="id">
5337
+ <xsl:call-template name="generateIndexXrefId"/>
5338
+ </xsl:variable>
5339
+ <xsl:copy> <!-- add id to xref -->
5340
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
5341
+ <xsl:attribute name="id">
5342
+ <xsl:value-of select="$id"/>
5343
+ </xsl:attribute>
5344
+ <xsl:apply-templates mode="index_add_id"/>
5345
+ </xsl:copy>
5346
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
5347
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
5348
+ <xsl:if test="@to">
5349
+ <xsl:value-of select="$dash"/>
5350
+ <xsl:copy>
5351
+ <xsl:copy-of select="@*"/>
5352
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
5353
+ <xsl:attribute name="id">
5354
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
5355
+ </xsl:attribute>
5356
+ <xsl:apply-templates mode="index_add_id"/>
5357
+ </xsl:copy>
5358
+ </xsl:if>
5359
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
5360
+ <xsl:copy>
5361
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
5362
+ </xsl:copy>
5363
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
5364
+ <xsl:copy>
5365
+ <xsl:apply-templates select="@*" mode="index_update"/>
5366
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
5367
+ </xsl:copy>
5368
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
5369
+ <xsl:param name="element"/>
5370
+ <xsl:param name="remove" select="'false'"/>
5371
+ <xsl:param name="target"/>
5372
+ <!-- <node></node> -->
5373
+ <xsl:choose>
5374
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
5375
+ <!-- skip text (i.e. remove it) and process next element -->
5376
+ <!-- [removed_<xsl:value-of select="."/>] -->
5377
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5378
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
5379
+ </xsl:apply-templates>
5380
+ </xsl:when>
5381
+ <xsl:when test="self::text()">
5382
+ <xsl:value-of select="."/>
5383
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5384
+ </xsl:when>
5385
+ <xsl:when test="self::* and local-name(.) = 'xref'">
5386
+ <xsl:variable name="id" select="@id"/>
5387
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
5388
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
5389
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
5390
+
5391
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
5392
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
5393
+
5394
+ <xsl:choose>
5395
+ <!-- 2nd pass -->
5396
+ <!-- if page is equal to page for next and page is not the end of range -->
5397
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
5398
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
5399
+ <!-- [removed_xref] -->
5400
+
5401
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5402
+ <xsl:with-param name="remove">true</xsl:with-param>
5403
+ <xsl:with-param name="target">
5404
+ <xsl:choose>
5405
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
5406
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
5407
+ </xsl:choose>
5408
+ </xsl:with-param>
5409
+ </xsl:apply-templates>
5410
+ </xsl:when>
5411
+
5412
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
5413
+ <!-- remove xref -->
5414
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
5415
+ <xsl:with-param name="remove">true</xsl:with-param>
5416
+ </xsl:apply-templates>
5417
+ </xsl:when>
5418
+
5419
+ <xsl:otherwise>
5420
+ <xsl:apply-templates select="." mode="xref_copy">
5421
+ <xsl:with-param name="target" select="$target"/>
5422
+ </xsl:apply-templates>
5423
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5424
+ </xsl:otherwise>
5425
+ </xsl:choose>
5426
+ </xsl:when>
5427
+ <xsl:when test="self::* and local-name(.) = 'ul'">
5428
+ <!-- ul -->
5429
+ <xsl:apply-templates select="." mode="index_update"/>
5430
+ </xsl:when>
5431
+ <xsl:otherwise>
5432
+ <xsl:apply-templates select="." mode="xref_copy">
5433
+ <xsl:with-param name="target" select="$target"/>
5434
+ </xsl:apply-templates>
5435
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
5436
+ </xsl:otherwise>
5437
+ </xsl:choose>
5438
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
5439
+ <xsl:param name="target"/>
5440
+ <xsl:copy>
5441
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
5442
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
5443
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
5444
+ </xsl:if>
5445
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
5446
+ </xsl:copy>
5447
+ </xsl:template><xsl:template name="generateIndexXrefId">
5448
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5449
+
5450
+ <xsl:variable name="docid">
5451
+ <xsl:call-template name="getDocumentId"/>
5452
+ </xsl:variable>
5453
+ <xsl:variable name="item_number">
5454
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
5455
+ </xsl:variable>
5456
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
5457
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
5458
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
5459
+ <xsl:apply-templates/>
5460
+ <fo:block>
5461
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
5462
+ <fo:block> </fo:block>
5463
+ </xsl:if>
5464
+ </fo:block>
5465
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
5466
+ <xsl:apply-templates/>
5467
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5468
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5469
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5470
+ <xsl:apply-templates/>
5471
+ </fo:block>
5472
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
5473
+ <fo:inline id="{@id}" font-size="1pt"/>
5148
5474
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
5149
5475
  <!-- <row>
5150
5476
  <date>05-07-2013</date>
@@ -5332,7 +5658,7 @@
5332
5658
  <xsl:param name="charDelim" select="', '"/>
5333
5659
  <xsl:choose>
5334
5660
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
5335
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5661
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5336
5662
  <xsl:sort data-type="text" order="ascending"/>
5337
5663
  <xsl:call-template name="insertKeyword">
5338
5664
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -5341,7 +5667,7 @@
5341
5667
  </xsl:for-each>
5342
5668
  </xsl:when>
5343
5669
  <xsl:otherwise>
5344
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5670
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
5345
5671
  <xsl:call-template name="insertKeyword">
5346
5672
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
5347
5673
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -5358,65 +5684,71 @@
5358
5684
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
5359
5685
  </xsl:choose>
5360
5686
  </xsl:template><xsl:template name="addPDFUAmeta">
5361
- <fo:declarations>
5362
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5363
- <pdf:dictionary type="normal" key="ViewerPreferences">
5364
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5365
- </pdf:dictionary>
5366
- </pdf:catalog>
5367
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
5368
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5369
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5370
- <!-- Dublin Core properties go here -->
5371
- <dc:title>
5372
- <xsl:variable name="title">
5687
+ <xsl:variable name="lang">
5688
+ <xsl:call-template name="getLang"/>
5689
+ </xsl:variable>
5690
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5691
+ <pdf:dictionary type="normal" key="ViewerPreferences">
5692
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5693
+ </pdf:dictionary>
5694
+ </pdf:catalog>
5695
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
5696
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5697
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5698
+ <!-- Dublin Core properties go here -->
5699
+ <dc:title>
5700
+ <xsl:variable name="title">
5701
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5702
+
5373
5703
 
5374
5704
 
5375
5705
 
5376
5706
 
5377
5707
 
5378
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@type='main']"/>
5708
+ <xsl:value-of select="*[local-name() = 'title'][@type='main']"/>
5379
5709
 
5380
- </xsl:variable>
5381
- <xsl:choose>
5382
- <xsl:when test="normalize-space($title) != ''">
5383
- <xsl:value-of select="$title"/>
5384
- </xsl:when>
5385
- <xsl:otherwise>
5386
- <xsl:text> </xsl:text>
5387
- </xsl:otherwise>
5388
- </xsl:choose>
5389
- </dc:title>
5390
- <dc:creator>
5710
+ </xsl:for-each>
5711
+ </xsl:variable>
5712
+ <xsl:choose>
5713
+ <xsl:when test="normalize-space($title) != ''">
5714
+ <xsl:value-of select="$title"/>
5715
+ </xsl:when>
5716
+ <xsl:otherwise>
5717
+ <xsl:text> </xsl:text>
5718
+ </xsl:otherwise>
5719
+ </xsl:choose>
5720
+ </dc:title>
5721
+ <dc:creator>
5722
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5391
5723
 
5392
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
5724
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5725
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
5726
+ <xsl:if test="position() != last()">; </xsl:if>
5727
+ </xsl:for-each>
5393
5728
 
5394
5729
 
5395
5730
 
5396
- </dc:creator>
5397
- <dc:description>
5398
- <xsl:variable name="abstract">
5399
-
5400
-
5401
-
5402
-
5403
- <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
5404
-
5405
-
5406
- </xsl:variable>
5407
- <xsl:value-of select="normalize-space($abstract)"/>
5408
- </dc:description>
5409
- <pdf:Keywords>
5410
- <xsl:call-template name="insertKeywords"/>
5411
- </pdf:Keywords>
5412
- </rdf:Description>
5413
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5414
- <!-- XMP properties go here -->
5415
- <xmp:CreatorTool/>
5416
- </rdf:Description>
5417
- </rdf:RDF>
5418
- </x:xmpmeta>
5419
- </fo:declarations>
5731
+ </xsl:for-each>
5732
+ </dc:creator>
5733
+ <dc:description>
5734
+ <xsl:variable name="abstract">
5735
+
5736
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5737
+
5738
+
5739
+ </xsl:variable>
5740
+ <xsl:value-of select="normalize-space($abstract)"/>
5741
+ </dc:description>
5742
+ <pdf:Keywords>
5743
+ <xsl:call-template name="insertKeywords"/>
5744
+ </pdf:Keywords>
5745
+ </rdf:Description>
5746
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5747
+ <!-- XMP properties go here -->
5748
+ <xmp:CreatorTool/>
5749
+ </rdf:Description>
5750
+ </rdf:RDF>
5751
+ </x:xmpmeta>
5420
5752
  </xsl:template><xsl:template name="getId">
5421
5753
  <xsl:choose>
5422
5754
  <xsl:when test="../@id">