metanorma-cc 1.6.4 → 1.6.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1598163a64162e53caac3fad9e444b169709a180baac8239ebab07c827d0c1e3
4
- data.tar.gz: cf3905482b2d739ae491234f3f172f5801c07ff33a0097d8884898e9f1619790
3
+ metadata.gz: bdb9f2761f3fac5e265f9ebcc494ccd85b950801217ae8da956108b1ee948437
4
+ data.tar.gz: 82a3946e628c8d9c566638723d02eacbe6d6c27f6e2bbec7108762e68d0803e3
5
5
  SHA512:
6
- metadata.gz: 992e610acf0eebbdf23afafc36e3e5aca18d18472120df981f2698461d8c8fb4555a150d27973d4197eaedcd74217f55e4d77e709caef8918cadbac0b4137764
7
- data.tar.gz: dac53f90de9da9e43e601c74d4cbde3985937b6b76f693c742b8766b2fd995a5fbf98b75909342f311c65e93108a2e6e0b8ffa3f56315ed9df0bf44b58706fa6
6
+ metadata.gz: fde04d9e0d59ba4f668613bbe8fe54688049a639ca666c7e88be4a114fad914d8a5de91c54dab29b329bd86202b9475ebe4fcd880dd566f6aa82a0c21f588c92
7
+ data.tar.gz: a5cec184e815699e46a2256a358dd04a7adf2a1acd5bdd0f46cc7e78f95cfe88c30799be839c06cd14b0f98c784b18d5bedc2973b14aeb7b1105b92c3b033590
@@ -4,7 +4,7 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master, main ]
7
+ branches: [ master, main ]
8
8
  tags: [ v* ]
9
9
  pull_request:
10
10
 
@@ -16,50 +16,27 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.6', '2.5', '2.4' ]
19
+ ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  include:
23
- - ruby: '2.7'
23
+ - ruby: '3.0'
24
24
  os: 'ubuntu-latest'
25
25
  experimental: true
26
- - ruby: '2.7'
26
+ - ruby: '3.0'
27
27
  os: 'windows-latest'
28
28
  experimental: true
29
- - ruby: '2.7'
29
+ - ruby: '3.0'
30
30
  os: 'macos-latest'
31
31
  experimental: true
32
32
  steps:
33
- - uses: actions/checkout@master
33
+ - uses: actions/checkout@v2
34
+ with:
35
+ submodules: true
34
36
 
35
37
  - uses: ruby/setup-ruby@v1
36
38
  with:
37
39
  ruby-version: ${{ matrix.ruby }}
38
-
39
- - if: matrix.os == 'macos-latest'
40
- run: brew install autoconf automake libtool
41
-
42
- - uses: actions/cache@v2
43
- with:
44
- path: vendor/bundle
45
- key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
46
- restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
47
-
48
- - run: bundle config set path 'vendor/bundle'
49
-
50
- - run: bundle install --jobs 4 --retry 3
40
+ bundler-cache: true
51
41
 
52
42
  - run: bundle exec rake
53
-
54
- tests-passed:
55
- needs: rake
56
- runs-on: ubuntu-latest
57
- steps:
58
- - name: Trigger tests passed event
59
- uses: Sibz/github-status-action@v1
60
- with:
61
- authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
62
- context: 'tests-passed-successfully'
63
- description: 'Tests passed successfully'
64
- state: 'success'
65
- sha: ${{ github.event.pull_request.head.sha || github.sha }}
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
1
  .DS_Store
2
+
3
+ .rubocop-https--*
data/.rubocop.yml CHANGED
@@ -1,10 +1,14 @@
1
1
  # This project follows the Ribose OSS style guide.
2
2
  # https://github.com/riboseinc/oss-guides
3
3
  # All project-specific additions and overrides should be specified in this file.
4
-
5
4
  inherit_from:
6
5
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
6
+
7
+ # local repo-specific modifications
8
+
7
9
  AllCops:
8
- TargetRubyVersion: 2.3
10
+ DisplayCopNames: false
11
+ StyleGuideCopsOnly: false
12
+ TargetRubyVersion: 2.4
9
13
  Rails:
10
14
  Enabled: true
@@ -729,9 +729,11 @@
729
729
  </define>
730
730
  <define name="index">
731
731
  <element name="index">
732
- <attribute name="to">
733
- <data type="IDREF"/>
734
- </attribute>
732
+ <optional>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
735
737
  <element name="primary">
736
738
  <oneOrMore>
737
739
  <ref name="PureTextElement"/>
@@ -124,7 +124,7 @@
124
124
  <value>application/tei+xml</value>
125
125
  <value>text/x-asciidoc</value>
126
126
  <value>text/markdown</value>
127
- <value>application/x-isodoc+xml</value>
127
+ <value>application/x-metanorma+xml</value>
128
128
  <text/>
129
129
  </choice>
130
130
  </attribute>
@@ -452,6 +452,7 @@
452
452
  <attribute name="type">
453
453
  <choice>
454
454
  <value>isni</value>
455
+ <value>orcid</value>
455
456
  <value>uri</value>
456
457
  </choice>
457
458
  </attribute>
@@ -461,10 +462,7 @@
461
462
  <define name="org-identifier">
462
463
  <element name="identifier">
463
464
  <attribute name="type">
464
- <choice>
465
- <value>orcid</value>
466
- <value>uri</value>
467
- </choice>
465
+ <data type="string" datatypeLibrary=""/>
468
466
  </attribute>
469
467
  <text/>
470
468
  </element>
@@ -1106,7 +1104,7 @@
1106
1104
  <value>complementOf</value>
1107
1105
  <value>obsoletes</value>
1108
1106
  <value>obsoletedBy</value>
1109
- <value>cited</value>
1107
+ <value>cites</value>
1110
1108
  <value>isCitedIn</value>
1111
1109
  </choice>
1112
1110
  </define>
@@ -107,6 +107,9 @@
107
107
  <zeroOrMore>
108
108
  <ref name="termdocsource"/>
109
109
  </zeroOrMore>
110
+ <optional>
111
+ <ref name="misccontainer"/>
112
+ </optional>
110
113
  <optional>
111
114
  <ref name="boilerplate"/>
112
115
  </optional>
@@ -118,6 +121,9 @@
118
121
  <ref name="annex"/>
119
122
  </zeroOrMore>
120
123
  <ref name="bibliography"/>
124
+ <zeroOrMore>
125
+ <ref name="indexsect"/>
126
+ </zeroOrMore>
121
127
  </element>
122
128
  </define>
123
129
  </grammar>
@@ -102,7 +102,7 @@
102
102
  </attribute>
103
103
  </optional>
104
104
  <oneOrMore>
105
- <ref name="li"/>
105
+ <ref name="ul_li"/>
106
106
  </oneOrMore>
107
107
  <zeroOrMore>
108
108
  <ref name="note"/>
@@ -789,6 +789,9 @@
789
789
  <attribute name="width"/>
790
790
  </element>
791
791
  </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
792
795
  <define name="TextElement" combine="choice">
793
796
  <ref name="concept"/>
794
797
  </define>
@@ -809,6 +812,8 @@
809
812
  <ref name="requirement"/>
810
813
  <ref name="recommendation"/>
811
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
812
817
  </choice>
813
818
  </define>
814
819
  <define name="bibliography">
@@ -914,6 +919,9 @@
914
919
  </choice>
915
920
  </attribute>
916
921
  <ref name="bibdata"/>
922
+ <optional>
923
+ <ref name="misccontainer"/>
924
+ </optional>
917
925
  <optional>
918
926
  <ref name="boilerplate"/>
919
927
  </optional>
@@ -924,11 +932,21 @@
924
932
  <zeroOrMore>
925
933
  <ref name="annex"/>
926
934
  </zeroOrMore>
935
+ <optional>
936
+ <ref name="bibliography"/>
937
+ </optional>
927
938
  <zeroOrMore>
928
- <ref name="references"/>
939
+ <ref name="indexsect"/>
929
940
  </zeroOrMore>
930
941
  </element>
931
942
  </define>
943
+ <define name="misccontainer">
944
+ <element name="misc-container">
945
+ <oneOrMore>
946
+ <ref name="AnyElement"/>
947
+ </oneOrMore>
948
+ </element>
949
+ </define>
932
950
  <define name="preface">
933
951
  <element name="preface">
934
952
  <oneOrMore>
@@ -952,6 +970,11 @@
952
970
  <ref name="Content-Section"/>
953
971
  </element>
954
972
  </define>
973
+ <define name="indexsect">
974
+ <element name="indexsect">
975
+ <ref name="Content-Section"/>
976
+ </element>
977
+ </define>
955
978
  <define name="boilerplate">
956
979
  <element name="boilerplate">
957
980
  <optional>
@@ -1632,4 +1655,87 @@
1632
1655
  <text/>
1633
1656
  </element>
1634
1657
  </define>
1658
+ <define name="imagemap">
1659
+ <element name="imagemap">
1660
+ <ref name="figure"/>
1661
+ <zeroOrMore>
1662
+ <element name="area">
1663
+ <attribute name="type">
1664
+ <choice>
1665
+ <value>rect</value>
1666
+ <value>circle</value>
1667
+ <value>ellipse</value>
1668
+ <value>poly</value>
1669
+ </choice>
1670
+ </attribute>
1671
+ <choice>
1672
+ <ref name="xref"/>
1673
+ <ref name="hyperlink"/>
1674
+ <ref name="eref"/>
1675
+ </choice>
1676
+ <oneOrMore>
1677
+ <element name="coords">
1678
+ <attribute name="x">
1679
+ <data type="float"/>
1680
+ </attribute>
1681
+ <attribute name="y">
1682
+ <data type="float"/>
1683
+ </attribute>
1684
+ </element>
1685
+ </oneOrMore>
1686
+ <optional>
1687
+ <element name="radius">
1688
+ <attribute name="x">
1689
+ <data type="float"/>
1690
+ </attribute>
1691
+ <optional>
1692
+ <attribute name="y">
1693
+ <data type="float"/>
1694
+ </attribute>
1695
+ </optional>
1696
+ </element>
1697
+ </optional>
1698
+ </element>
1699
+ </zeroOrMore>
1700
+ </element>
1701
+ </define>
1702
+ <define name="svgmap">
1703
+ <element name="svgmap">
1704
+ <ref name="figure"/>
1705
+ <zeroOrMore>
1706
+ <element name="target">
1707
+ <attribute name="href">
1708
+ <data type="anyURI"/>
1709
+ </attribute>
1710
+ <choice>
1711
+ <ref name="xref"/>
1712
+ <ref name="hyperlink"/>
1713
+ <ref name="eref"/>
1714
+ </choice>
1715
+ </element>
1716
+ </zeroOrMore>
1717
+ </element>
1718
+ </define>
1719
+ <define name="ul_li">
1720
+ <element name="li">
1721
+ <optional>
1722
+ <attribute name="id">
1723
+ <data type="ID"/>
1724
+ </attribute>
1725
+ </optional>
1726
+ <optional>
1727
+ <attribute name="uncheckedcheckbox">
1728
+ <data type="boolean"/>
1729
+ </attribute>
1730
+ </optional>
1731
+ <optional>
1732
+ <attribute name="checkedcheckbox">
1733
+ <data type="boolean"/>
1734
+ </attribute>
1735
+ </optional>
1736
+ <oneOrMore>
1737
+ <ref name="BasicBlock"/>
1738
+ </oneOrMore>
1739
+ </element>
1740
+ </define>
1635
1741
  </grammar>
@@ -3,6 +3,7 @@
3
3
  <xsl:output version="1.0" 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)"/>
7
8
 
8
9
  <xsl:variable name="pageWidth" select="'210mm'"/>
@@ -107,7 +108,9 @@
107
108
 
108
109
  </fo:layout-master-set>
109
110
 
110
- <xsl:call-template name="addPDFUAmeta"/>
111
+ <fo:declarations>
112
+ <xsl:call-template name="addPDFUAmeta"/>
113
+ </fo:declarations>
111
114
 
112
115
  <xsl:call-template name="addBookmarks">
113
116
  <xsl:with-param name="contents" select="$contents"/>
@@ -1068,6 +1071,7 @@
1068
1071
 
1069
1072
 
1070
1073
 
1074
+
1071
1075
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1072
1076
 
1073
1077
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -1194,6 +1198,7 @@
1194
1198
 
1195
1199
 
1196
1200
 
1201
+
1197
1202
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1198
1203
 
1199
1204
 
@@ -1329,197 +1334,231 @@
1329
1334
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1330
1335
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1331
1336
  <xsl:call-template name="add-zero-spaces-java"/>
1332
- </xsl:template><xsl:template match="*[local-name()='table']">
1337
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1333
1338
 
1334
- <xsl:variable name="simple-table">
1335
- <xsl:call-template name="getSimpleTable"/>
1336
- </xsl:variable>
1339
+ <xsl:variable name="table">
1337
1340
 
1338
-
1339
-
1340
-
1341
-
1342
- <!-- <xsl:if test="$namespace = 'bipm'">
1343
- <fo:block>&#xA0;</fo:block>
1344
- </xsl:if> -->
1345
-
1346
- <!-- $namespace = 'iso' or -->
1347
-
1348
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1349
-
1350
-
1351
-
1352
- <xsl:call-template name="fn_name_display"/>
1341
+ <xsl:variable name="simple-table">
1342
+ <xsl:call-template name="getSimpleTable"/>
1343
+ </xsl:variable>
1353
1344
 
1354
1345
 
1355
-
1356
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1357
-
1358
- <!-- <xsl:variable name="cols-count">
1359
- <xsl:choose>
1360
- <xsl:when test="*[local-name()='thead']">
1361
- <xsl:call-template name="calculate-columns-numbers">
1362
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1363
- </xsl:call-template>
1364
- </xsl:when>
1365
- <xsl:otherwise>
1366
- <xsl:call-template name="calculate-columns-numbers">
1367
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1368
- </xsl:call-template>
1369
- </xsl:otherwise>
1370
- </xsl:choose>
1371
- </xsl:variable> -->
1372
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1373
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1374
-
1375
-
1376
-
1377
- <xsl:variable name="colwidths">
1378
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1379
- <xsl:call-template name="calculate-column-widths">
1380
- <xsl:with-param name="cols-count" select="$cols-count"/>
1381
- <xsl:with-param name="table" select="$simple-table"/>
1382
- </xsl:call-template>
1383
- </xsl:if>
1384
- </xsl:variable>
1385
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1386
-
1387
- <!-- <xsl:variable name="colwidths2">
1388
- <xsl:call-template name="calculate-column-widths">
1389
- <xsl:with-param name="cols-count" select="$cols-count"/>
1390
- </xsl:call-template>
1391
- </xsl:variable> -->
1392
-
1393
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1394
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1395
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1396
-
1397
- <xsl:variable name="margin-left">
1398
- <xsl:choose>
1399
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1400
- <xsl:otherwise>0</xsl:otherwise>
1401
- </xsl:choose>
1402
- </xsl:variable>
1403
-
1404
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1405
1346
 
1406
- <xsl:attribute name="font-size">10pt</xsl:attribute>
1407
1347
 
1408
1348
 
1409
-
1410
-
1411
-
1349
+ <!-- <xsl:if test="$namespace = 'bipm'">
1350
+ <fo:block>&#xA0;</fo:block>
1351
+ </xsl:if> -->
1412
1352
 
1353
+ <!-- $namespace = 'iso' or -->
1413
1354
 
1414
-
1355
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1356
+
1357
+
1358
+
1359
+ <xsl:call-template name="fn_name_display"/>
1415
1360
 
1361
+
1362
+
1363
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1364
+
1365
+ <!-- <xsl:variable name="cols-count">
1366
+ <xsl:choose>
1367
+ <xsl:when test="*[local-name()='thead']">
1368
+ <xsl:call-template name="calculate-columns-numbers">
1369
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1370
+ </xsl:call-template>
1371
+ </xsl:when>
1372
+ <xsl:otherwise>
1373
+ <xsl:call-template name="calculate-columns-numbers">
1374
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1375
+ </xsl:call-template>
1376
+ </xsl:otherwise>
1377
+ </xsl:choose>
1378
+ </xsl:variable> -->
1379
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1380
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1416
1381
 
1417
1382
 
1418
1383
 
1384
+ <xsl:variable name="colwidths">
1385
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1386
+ <xsl:call-template name="calculate-column-widths">
1387
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1388
+ <xsl:with-param name="table" select="$simple-table"/>
1389
+ </xsl:call-template>
1390
+ </xsl:if>
1391
+ </xsl:variable>
1392
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1419
1393
 
1394
+ <!-- <xsl:variable name="colwidths2">
1395
+ <xsl:call-template name="calculate-column-widths">
1396
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1397
+ </xsl:call-template>
1398
+ </xsl:variable> -->
1420
1399
 
1400
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1401
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1402
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1421
1403
 
1422
- <xsl:variable name="table_attributes">
1423
- <attribute name="table-layout">fixed</attribute>
1424
- <attribute name="width">
1425
- <xsl:choose>
1426
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1427
- <xsl:otherwise>100%</xsl:otherwise>
1428
- </xsl:choose>
1429
- </attribute>
1430
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1431
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1404
+ <xsl:variable name="margin-left">
1405
+ <xsl:choose>
1406
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1407
+ <xsl:otherwise>0</xsl:otherwise>
1408
+ </xsl:choose>
1409
+ </xsl:variable>
1410
+
1411
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1432
1412
 
1413
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
1433
1414
 
1434
1415
 
1416
+
1417
+
1418
+
1435
1419
 
1436
-
1437
-
1438
-
1439
1420
 
1440
-
1421
+
1441
1422
 
1442
- </xsl:variable>
1443
-
1444
-
1445
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1446
1423
 
1447
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1448
- <xsl:attribute name="{@name}">
1449
- <xsl:value-of select="."/>
1450
- </xsl:attribute>
1451
- </xsl:for-each>
1452
1424
 
1453
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1454
- <xsl:if test="$isNoteOrFnExist = 'true'">
1455
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1456
- </xsl:if>
1457
1425
 
1458
- <xsl:choose>
1459
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1460
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1461
- <fo:table-column column-width="{@width}"/>
1462
- </xsl:for-each>
1463
- </xsl:when>
1464
- <xsl:otherwise>
1465
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1466
- <xsl:choose>
1467
- <xsl:when test=". = 1 or . = 0">
1468
- <fo:table-column column-width="proportional-column-width(2)"/>
1469
- </xsl:when>
1470
- <xsl:otherwise>
1471
- <fo:table-column column-width="proportional-column-width({.})"/>
1472
- </xsl:otherwise>
1473
- </xsl:choose>
1474
- </xsl:for-each>
1475
- </xsl:otherwise>
1476
- </xsl:choose>
1477
1426
 
1478
- <xsl:choose>
1479
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1480
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1481
- </xsl:when>
1482
- <xsl:otherwise>
1483
- <xsl:apply-templates/>
1484
- </xsl:otherwise>
1485
- </xsl:choose>
1486
1427
 
1487
- </fo:table>
1488
-
1489
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1490
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1491
- <xsl:call-template name="insertTableFooterInSeparateTable">
1492
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1493
- <xsl:with-param name="colwidths" select="$colwidths"/>
1494
- <xsl:with-param name="colgroup" select="$colgroup"/>
1495
- </xsl:call-template>
1496
- </xsl:for-each>
1497
-
1498
- <!-- insert footer as table -->
1499
- <!-- <fo:table>
1500
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1501
- <xsl:attribute name="{@name}">
1502
- <xsl:value-of select="."/>
1503
- </xsl:attribute>
1504
- </xsl:for-each>
1428
+ <xsl:variable name="table_width">
1429
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1430
+ 100%
1431
+
1432
+
1433
+ </xsl:variable>
1505
1434
 
1506
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1435
+ <xsl:variable name="table_attributes">
1436
+ <attribute name="table-layout">fixed</attribute>
1437
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1438
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1439
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1440
+
1441
+
1442
+
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1449
+
1450
+ </xsl:variable>
1451
+
1452
+
1453
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1454
+
1455
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1456
+ <xsl:attribute name="{@name}">
1457
+ <xsl:value-of select="."/>
1458
+ </xsl:attribute>
1459
+ </xsl:for-each>
1460
+
1461
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1462
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1463
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1464
+ </xsl:if>
1465
+
1507
1466
  <xsl:choose>
1508
- <xsl:when test=". = 1 or . = 0">
1509
- <fo:table-column column-width="proportional-column-width(2)"/>
1467
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1468
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1469
+ <fo:table-column column-width="{@width}"/>
1470
+ </xsl:for-each>
1510
1471
  </xsl:when>
1511
1472
  <xsl:otherwise>
1512
- <fo:table-column column-width="proportional-column-width({.})"/>
1473
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1474
+ <xsl:choose>
1475
+ <xsl:when test=". = 1 or . = 0">
1476
+ <fo:table-column column-width="proportional-column-width(2)"/>
1477
+ </xsl:when>
1478
+ <xsl:otherwise>
1479
+ <fo:table-column column-width="proportional-column-width({.})"/>
1480
+ </xsl:otherwise>
1481
+ </xsl:choose>
1482
+ </xsl:for-each>
1513
1483
  </xsl:otherwise>
1514
1484
  </xsl:choose>
1485
+
1486
+ <xsl:choose>
1487
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1488
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1489
+ </xsl:when>
1490
+ <xsl:otherwise>
1491
+ <xsl:apply-templates/>
1492
+ </xsl:otherwise>
1493
+ </xsl:choose>
1494
+
1495
+ </fo:table>
1496
+
1497
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1498
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1499
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1500
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1501
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1502
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1503
+ </xsl:call-template>
1515
1504
  </xsl:for-each>
1516
- </fo:table>-->
1517
-
1518
-
1519
-
1520
-
1521
-
1522
- </fo:block-container>
1505
+
1506
+ <!-- insert footer as table -->
1507
+ <!-- <fo:table>
1508
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1509
+ <xsl:attribute name="{@name}">
1510
+ <xsl:value-of select="."/>
1511
+ </xsl:attribute>
1512
+ </xsl:for-each>
1513
+
1514
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1515
+ <xsl:choose>
1516
+ <xsl:when test=". = 1 or . = 0">
1517
+ <fo:table-column column-width="proportional-column-width(2)"/>
1518
+ </xsl:when>
1519
+ <xsl:otherwise>
1520
+ <fo:table-column column-width="proportional-column-width({.})"/>
1521
+ </xsl:otherwise>
1522
+ </xsl:choose>
1523
+ </xsl:for-each>
1524
+ </fo:table>-->
1525
+
1526
+
1527
+
1528
+
1529
+
1530
+ </fo:block-container>
1531
+ </xsl:variable>
1532
+
1533
+
1534
+
1535
+ <xsl:choose>
1536
+ <xsl:when test="@width">
1537
+
1538
+ <!-- centered table when table name is centered (see table-name-style) -->
1539
+
1540
+ <fo:table table-layout="fixed" width="100%">
1541
+ <fo:table-column column-width="proportional-column-width(1)"/>
1542
+ <fo:table-column column-width="{@width}"/>
1543
+ <fo:table-column column-width="proportional-column-width(1)"/>
1544
+ <fo:table-body>
1545
+ <fo:table-row>
1546
+ <fo:table-cell column-number="2">
1547
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
1548
+ </fo:table-cell>
1549
+ </fo:table-row>
1550
+ </fo:table-body>
1551
+ </fo:table>
1552
+
1553
+
1554
+
1555
+
1556
+ </xsl:when>
1557
+ <xsl:otherwise>
1558
+ <xsl:copy-of select="$table"/>
1559
+ </xsl:otherwise>
1560
+ </xsl:choose>
1561
+
1523
1562
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1524
1563
  <xsl:if test="normalize-space() != ''">
1525
1564
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1647,7 +1686,15 @@
1647
1686
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1648
1687
  <xsl:value-of select="@target"/>
1649
1688
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1650
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1689
+ <xsl:variable name="mathml">
1690
+ <xsl:for-each select="*">
1691
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1692
+ <xsl:copy-of select="."/>
1693
+ </xsl:if>
1694
+ </xsl:for-each>
1695
+ </xsl:variable>
1696
+
1697
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1651
1698
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1652
1699
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1653
1700
  <xsl:param name="cols-count"/>
@@ -2332,7 +2379,7 @@
2332
2379
  <xsl:with-param name="table" select="$html-table"/>
2333
2380
  </xsl:call-template>
2334
2381
  </xsl:variable>
2335
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2382
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2336
2383
  <xsl:variable name="maxlength_dt">
2337
2384
  <xsl:call-template name="getMaxLength_dt"/>
2338
2385
  </xsl:variable>
@@ -2361,13 +2408,22 @@
2361
2408
  </xsl:when>
2362
2409
  <xsl:otherwise>
2363
2410
  <xsl:choose>
2411
+ <!-- to set width check most wide chars like `W` -->
2364
2412
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2365
- <fo:table-column column-width="5%"/>
2366
- <fo:table-column column-width="95%"/>
2413
+ <fo:table-column column-width="7%"/>
2414
+ <fo:table-column column-width="93%"/>
2367
2415
  </xsl:when>
2368
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2369
- <fo:table-column column-width="10%"/>
2370
- <fo:table-column column-width="90%"/>
2416
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2417
+ <fo:table-column column-width="15%"/>
2418
+ <fo:table-column column-width="85%"/>
2419
+ </xsl:when>
2420
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2421
+ <fo:table-column column-width="20%"/>
2422
+ <fo:table-column column-width="80%"/>
2423
+ </xsl:when>
2424
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2425
+ <fo:table-column column-width="25%"/>
2426
+ <fo:table-column column-width="75%"/>
2371
2427
  </xsl:when>
2372
2428
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2373
2429
  <fo:table-column column-width="60%"/>
@@ -2565,6 +2621,7 @@
2565
2621
 
2566
2622
 
2567
2623
 
2624
+
2568
2625
 
2569
2626
  </xsl:variable>
2570
2627
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2586,6 +2643,10 @@
2586
2643
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2587
2644
  <xsl:apply-templates/>
2588
2645
  </fo:inline>
2646
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2647
+ <fo:inline background-color="yellow">
2648
+ <xsl:apply-templates/>
2649
+ </fo:inline>
2589
2650
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2590
2651
  <xsl:variable name="text" select="normalize-space(.)"/>
2591
2652
  <fo:inline font-size="75%">
@@ -2675,6 +2736,10 @@
2675
2736
  <xsl:param name="text" select="."/>
2676
2737
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2677
2738
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2739
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
2740
+ <xsl:param name="text" select="."/>
2741
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2742
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2678
2743
  </xsl:template><xsl:template name="add-zero-spaces">
2679
2744
  <xsl:param name="text" select="."/>
2680
2745
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -2922,6 +2987,7 @@
2922
2987
  <xsl:apply-templates select="." mode="mathml"/>
2923
2988
  </xsl:variable>
2924
2989
  <fo:instream-foreign-object fox:alt-text="Math">
2990
+
2925
2991
  <!-- <xsl:copy-of select="."/> -->
2926
2992
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
2927
2993
  </fo:instream-foreign-object>
@@ -2935,7 +3001,12 @@
2935
3001
  <!-- replace start and end spaces to non-break space -->
2936
3002
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
2937
3003
  </xsl:copy>
2938
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3004
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3005
+ <xsl:copy>
3006
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3007
+ </xsl:copy>
3008
+ <mathml:mspace width="0.5ex"/>
3009
+ </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">
2939
3010
  <xsl:variable name="target">
2940
3011
  <xsl:choose>
2941
3012
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -2956,7 +3027,10 @@
2956
3027
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
2957
3028
  <xsl:choose>
2958
3029
  <xsl:when test="normalize-space(.) = ''">
2959
- <xsl:value-of select="$target"/>
3030
+ <!-- <xsl:value-of select="$target"/> -->
3031
+ <xsl:call-template name="add-zero-spaces-link-java">
3032
+ <xsl:with-param name="text" select="$target"/>
3033
+ </xsl:call-template>
2960
3034
  </xsl:when>
2961
3035
  <xsl:otherwise>
2962
3036
  <xsl:apply-templates/>
@@ -2966,8 +3040,6 @@
2966
3040
  </xsl:otherwise>
2967
3041
  </xsl:choose>
2968
3042
  </fo:inline>
2969
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
2970
- <fo:inline id="{@id}"/>
2971
3043
  </xsl:template><xsl:template match="*[local-name()='appendix']">
2972
3044
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
2973
3045
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3158,7 +3230,7 @@
3158
3230
  </xsl:if> -->
3159
3231
  </fo:inline>
3160
3232
  </xsl:if>
3161
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3233
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3162
3234
  <fo:block-container id="{@id}">
3163
3235
 
3164
3236
  <fo:block>
@@ -3174,6 +3246,7 @@
3174
3246
  <fo:block id="{@id}">
3175
3247
  <xsl:apply-templates/>
3176
3248
  </fo:block>
3249
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3177
3250
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3178
3251
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3179
3252
  <xsl:apply-templates/>
@@ -3365,6 +3438,12 @@
3365
3438
  <!-- <xsl:text> </xsl:text> -->
3366
3439
  </xsl:template><xsl:template name="getSection">
3367
3440
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3441
+ <!--
3442
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3443
+ <xsl:value-of select="."/>
3444
+ </xsl:for-each>
3445
+ -->
3446
+
3368
3447
  </xsl:template><xsl:template name="getName">
3369
3448
  <xsl:choose>
3370
3449
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3417,6 +3496,12 @@
3417
3496
  <xsl:copy>
3418
3497
  <xsl:apply-templates mode="contents_item"/>
3419
3498
  </xsl:copy>
3499
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3500
+ <xsl:copy>
3501
+ <xsl:apply-templates mode="contents_item"/>
3502
+ </xsl:copy>
3503
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3504
+ <xsl:copy-of select="."/>
3420
3505
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3421
3506
  <xsl:text> </xsl:text>
3422
3507
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3442,6 +3527,7 @@
3442
3527
 
3443
3528
 
3444
3529
 
3530
+
3445
3531
 
3446
3532
 
3447
3533
 
@@ -3744,10 +3830,11 @@
3744
3830
  </xsl:choose>
3745
3831
 
3746
3832
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3747
-
3833
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3748
3834
  <xsl:variable name="element">
3749
3835
  block
3750
3836
 
3837
+
3751
3838
  </xsl:variable>
3752
3839
  <xsl:choose>
3753
3840
  <xsl:when test="normalize-space($element) = 'block'">
@@ -3822,11 +3909,13 @@
3822
3909
  </xsl:if>
3823
3910
  </xsl:if>
3824
3911
 
3912
+
3825
3913
  <fo:block-container margin-left="0mm">
3826
3914
 
3827
3915
  <fo:block xsl:use-attribute-sets="quote-style">
3828
3916
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
3829
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3917
+
3918
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3830
3919
  </fo:block>
3831
3920
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3832
3921
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -3849,32 +3938,50 @@
3849
3938
  <xsl:text>— </xsl:text>
3850
3939
  <xsl:apply-templates/>
3851
3940
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
3852
- <fo:inline xsl:use-attribute-sets="eref-style">
3853
- <xsl:if test="@type = 'footnote'">
3854
-
3855
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3856
- <xsl:attribute name="font-size">80%</xsl:attribute>
3857
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3858
- <xsl:attribute name="vertical-align">super</xsl:attribute>
3859
-
3860
-
3861
- </xsl:if>
3862
-
3863
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3864
-
3865
- <xsl:if test="@type = 'inline'">
3866
-
3867
- <xsl:attribute name="color">blue</xsl:attribute>
3868
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
3869
-
3870
-
3871
-
3872
- </xsl:if>
3873
-
3874
-
3875
- <xsl:apply-templates/>
3876
- </fo:basic-link>
3877
- </fo:inline>
3941
+
3942
+ <xsl:variable name="bibitemid">
3943
+ <xsl:choose>
3944
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
3945
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
3946
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
3947
+ </xsl:choose>
3948
+ </xsl:variable>
3949
+
3950
+ <xsl:choose>
3951
+ <xsl:when test="normalize-space($bibitemid) != ''">
3952
+ <fo:inline xsl:use-attribute-sets="eref-style">
3953
+ <xsl:if test="@type = 'footnote'">
3954
+
3955
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3956
+ <xsl:attribute name="font-size">80%</xsl:attribute>
3957
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3958
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
3959
+
3960
+
3961
+ </xsl:if>
3962
+
3963
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3964
+ <xsl:if test="normalize-space(@citeas) = ''">
3965
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
3966
+ </xsl:if>
3967
+ <xsl:if test="@type = 'inline'">
3968
+
3969
+ <xsl:attribute name="color">blue</xsl:attribute>
3970
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3971
+
3972
+
3973
+
3974
+ </xsl:if>
3975
+
3976
+ <xsl:apply-templates/>
3977
+ </fo:basic-link>
3978
+
3979
+ </fo:inline>
3980
+ </xsl:when>
3981
+ <xsl:otherwise>
3982
+ <fo:inline><xsl:apply-templates/></fo:inline>
3983
+ </xsl:otherwise>
3984
+ </xsl:choose>
3878
3985
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
3879
3986
  <!-- zero-space char -->
3880
3987
  <xsl:variable name="depth">
@@ -3986,6 +4093,7 @@
3986
4093
 
3987
4094
 
3988
4095
 
4096
+
3989
4097
 
3990
4098
 
3991
4099
 
@@ -3997,7 +4105,7 @@
3997
4105
 
3998
4106
 
3999
4107
 
4000
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4108
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4001
4109
  <fo:block break-after="page"/>
4002
4110
  <fo:block>
4003
4111
  <xsl:call-template name="setId"/>
@@ -4005,7 +4113,8 @@
4005
4113
  </fo:block>
4006
4114
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4007
4115
  <fo:block>
4008
- <xsl:call-template name="setId"/>
4116
+ <xsl:call-template name="setId"/>
4117
+
4009
4118
 
4010
4119
  <xsl:apply-templates/>
4011
4120
  </fo:block>
@@ -4056,6 +4165,153 @@
4056
4165
  </fo:block>
4057
4166
  </xsl:otherwise>
4058
4167
  </xsl:choose>
4168
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4169
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4170
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4171
+ </xsl:for-each>
4172
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4173
+ <xsl:copy>
4174
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4175
+ </xsl:copy>
4176
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4177
+ <xsl:variable name="id">
4178
+ <xsl:call-template name="generateIndexXrefId"/>
4179
+ </xsl:variable>
4180
+ <xsl:copy> <!-- add id to xref -->
4181
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4182
+ <xsl:attribute name="id">
4183
+ <xsl:value-of select="$id"/>
4184
+ </xsl:attribute>
4185
+ <xsl:apply-templates mode="index_add_id"/>
4186
+ </xsl:copy>
4187
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4188
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4189
+ <xsl:if test="@to">
4190
+ <xsl:value-of select="$dash"/>
4191
+ <xsl:copy>
4192
+ <xsl:copy-of select="@*"/>
4193
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4194
+ <xsl:attribute name="id">
4195
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4196
+ </xsl:attribute>
4197
+ <xsl:apply-templates mode="index_add_id"/>
4198
+ </xsl:copy>
4199
+ </xsl:if>
4200
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4201
+ <xsl:copy>
4202
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4203
+ </xsl:copy>
4204
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4205
+ <xsl:copy>
4206
+ <xsl:apply-templates select="@*" mode="index_update"/>
4207
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4208
+ </xsl:copy>
4209
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4210
+ <xsl:param name="element"/>
4211
+ <xsl:param name="remove" select="'false'"/>
4212
+ <xsl:param name="target"/>
4213
+ <!-- <node></node> -->
4214
+ <xsl:choose>
4215
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4216
+ <!-- skip text (i.e. remove it) and process next element -->
4217
+ <!-- [removed_<xsl:value-of select="."/>] -->
4218
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4219
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4220
+ </xsl:apply-templates>
4221
+ </xsl:when>
4222
+ <xsl:when test="self::text()">
4223
+ <xsl:value-of select="."/>
4224
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4225
+ </xsl:when>
4226
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4227
+ <xsl:variable name="id" select="@id"/>
4228
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4229
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4230
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4231
+
4232
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4233
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4234
+
4235
+ <xsl:choose>
4236
+ <!-- 2nd pass -->
4237
+ <!-- if page is equal to page for next and page is not the end of range -->
4238
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4239
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4240
+ <!-- [removed_xref] -->
4241
+
4242
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4243
+ <xsl:with-param name="remove">true</xsl:with-param>
4244
+ <xsl:with-param name="target">
4245
+ <xsl:choose>
4246
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4247
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4248
+ </xsl:choose>
4249
+ </xsl:with-param>
4250
+ </xsl:apply-templates>
4251
+ </xsl:when>
4252
+
4253
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4254
+ <!-- remove xref -->
4255
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4256
+ <xsl:with-param name="remove">true</xsl:with-param>
4257
+ </xsl:apply-templates>
4258
+ </xsl:when>
4259
+
4260
+ <xsl:otherwise>
4261
+ <xsl:apply-templates select="." mode="xref_copy">
4262
+ <xsl:with-param name="target" select="$target"/>
4263
+ </xsl:apply-templates>
4264
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4265
+ </xsl:otherwise>
4266
+ </xsl:choose>
4267
+ </xsl:when>
4268
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4269
+ <!-- ul -->
4270
+ <xsl:apply-templates select="." mode="index_update"/>
4271
+ </xsl:when>
4272
+ <xsl:otherwise>
4273
+ <xsl:apply-templates select="." mode="xref_copy">
4274
+ <xsl:with-param name="target" select="$target"/>
4275
+ </xsl:apply-templates>
4276
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4277
+ </xsl:otherwise>
4278
+ </xsl:choose>
4279
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4280
+ <xsl:param name="target"/>
4281
+ <xsl:copy>
4282
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4283
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4284
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4285
+ </xsl:if>
4286
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4287
+ </xsl:copy>
4288
+ </xsl:template><xsl:template name="generateIndexXrefId">
4289
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4290
+
4291
+ <xsl:variable name="docid">
4292
+ <xsl:call-template name="getDocumentId"/>
4293
+ </xsl:variable>
4294
+ <xsl:variable name="item_number">
4295
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4296
+ </xsl:variable>
4297
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4298
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4299
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4300
+ <xsl:apply-templates/>
4301
+ <fo:block>
4302
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4303
+ <fo:block> </fo:block>
4304
+ </xsl:if>
4305
+ </fo:block>
4306
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4307
+ <xsl:apply-templates/>
4308
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4309
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4310
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4311
+ <xsl:apply-templates/>
4312
+ </fo:block>
4313
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4314
+ <fo:inline id="{@id}" font-size="1pt"/>
4059
4315
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4060
4316
  <!-- <row>
4061
4317
  <date>05-07-2013</date>
@@ -4177,6 +4433,57 @@
4177
4433
  </xsl:variable>
4178
4434
  <xsl:variable name="result">
4179
4435
  <xsl:choose>
4436
+ <xsl:when test="$format = 'ddMMyyyy'">
4437
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4438
+ <xsl:text> </xsl:text>
4439
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4440
+ </xsl:when>
4441
+ <xsl:when test="$format = 'ddMM'">
4442
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4443
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4444
+ </xsl:when>
4445
+ <xsl:when test="$format = 'short' or $day = ''">
4446
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4447
+ </xsl:when>
4448
+ <xsl:otherwise>
4449
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4450
+ </xsl:otherwise>
4451
+ </xsl:choose>
4452
+ </xsl:variable>
4453
+ <xsl:value-of select="$result"/>
4454
+ </xsl:template><xsl:template name="convertDateLocalized">
4455
+ <xsl:param name="date"/>
4456
+ <xsl:param name="format" select="'short'"/>
4457
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4458
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4459
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4460
+ <xsl:variable name="monthStr">
4461
+ <xsl:choose>
4462
+ <xsl:when test="$month = '01'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_january</xsl:with-param></xsl:call-template></xsl:when>
4463
+ <xsl:when test="$month = '02'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_february</xsl:with-param></xsl:call-template></xsl:when>
4464
+ <xsl:when test="$month = '03'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_march</xsl:with-param></xsl:call-template></xsl:when>
4465
+ <xsl:when test="$month = '04'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_april</xsl:with-param></xsl:call-template></xsl:when>
4466
+ <xsl:when test="$month = '05'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_may</xsl:with-param></xsl:call-template></xsl:when>
4467
+ <xsl:when test="$month = '06'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_june</xsl:with-param></xsl:call-template></xsl:when>
4468
+ <xsl:when test="$month = '07'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_july</xsl:with-param></xsl:call-template></xsl:when>
4469
+ <xsl:when test="$month = '08'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_august</xsl:with-param></xsl:call-template></xsl:when>
4470
+ <xsl:when test="$month = '09'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_september</xsl:with-param></xsl:call-template></xsl:when>
4471
+ <xsl:when test="$month = '10'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_october</xsl:with-param></xsl:call-template></xsl:when>
4472
+ <xsl:when test="$month = '11'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_november</xsl:with-param></xsl:call-template></xsl:when>
4473
+ <xsl:when test="$month = '12'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_december</xsl:with-param></xsl:call-template></xsl:when>
4474
+ </xsl:choose>
4475
+ </xsl:variable>
4476
+ <xsl:variable name="result">
4477
+ <xsl:choose>
4478
+ <xsl:when test="$format = 'ddMMyyyy'">
4479
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4480
+ <xsl:text> </xsl:text>
4481
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4482
+ </xsl:when>
4483
+ <xsl:when test="$format = 'ddMM'">
4484
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4485
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4486
+ </xsl:when>
4180
4487
  <xsl:when test="$format = 'short' or $day = ''">
4181
4488
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4182
4489
  </xsl:when>
@@ -4192,7 +4499,7 @@
4192
4499
  <xsl:param name="charDelim" select="', '"/>
4193
4500
  <xsl:choose>
4194
4501
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4195
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4502
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4196
4503
  <xsl:sort data-type="text" order="ascending"/>
4197
4504
  <xsl:call-template name="insertKeyword">
4198
4505
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4201,7 +4508,7 @@
4201
4508
  </xsl:for-each>
4202
4509
  </xsl:when>
4203
4510
  <xsl:otherwise>
4204
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4511
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4205
4512
  <xsl:call-template name="insertKeyword">
4206
4513
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4207
4514
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4218,63 +4525,71 @@
4218
4525
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4219
4526
  </xsl:choose>
4220
4527
  </xsl:template><xsl:template name="addPDFUAmeta">
4221
- <fo:declarations>
4222
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4223
- <pdf:dictionary type="normal" key="ViewerPreferences">
4224
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4225
- </pdf:dictionary>
4226
- </pdf:catalog>
4227
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4228
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4229
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4230
- <!-- Dublin Core properties go here -->
4231
- <dc:title>
4232
- <xsl:variable name="title">
4528
+ <xsl:variable name="lang">
4529
+ <xsl:call-template name="getLang"/>
4530
+ </xsl:variable>
4531
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4532
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4533
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4534
+ </pdf:dictionary>
4535
+ </pdf:catalog>
4536
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4537
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4538
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4539
+ <!-- Dublin Core properties go here -->
4540
+ <dc:title>
4541
+ <xsl:variable name="title">
4542
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4543
+
4233
4544
 
4234
4545
 
4235
4546
 
4236
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
4547
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4237
4548
 
4238
4549
 
4239
4550
 
4240
- </xsl:variable>
4241
- <xsl:choose>
4242
- <xsl:when test="normalize-space($title) != ''">
4243
- <xsl:value-of select="$title"/>
4244
- </xsl:when>
4245
- <xsl:otherwise>
4246
- <xsl:text> </xsl:text>
4247
- </xsl:otherwise>
4248
- </xsl:choose>
4249
- </dc:title>
4250
- <dc:creator>
4551
+ </xsl:for-each>
4552
+ </xsl:variable>
4553
+ <xsl:choose>
4554
+ <xsl:when test="normalize-space($title) != ''">
4555
+ <xsl:value-of select="$title"/>
4556
+ </xsl:when>
4557
+ <xsl:otherwise>
4558
+ <xsl:text> </xsl:text>
4559
+ </xsl:otherwise>
4560
+ </xsl:choose>
4561
+ </dc:title>
4562
+ <dc:creator>
4563
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4251
4564
 
4565
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4566
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4567
+ <xsl:if test="position() != last()">; </xsl:if>
4568
+ </xsl:for-each>
4252
4569
 
4253
4570
 
4254
- </dc:creator>
4255
- <dc:description>
4256
- <xsl:variable name="abstract">
4257
-
4258
- <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
4259
-
4260
-
4261
-
4262
-
4263
-
4264
- </xsl:variable>
4265
- <xsl:value-of select="normalize-space($abstract)"/>
4266
- </dc:description>
4267
- <pdf:Keywords>
4268
- <xsl:call-template name="insertKeywords"/>
4269
- </pdf:Keywords>
4270
- </rdf:Description>
4271
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4272
- <!-- XMP properties go here -->
4273
- <xmp:CreatorTool/>
4274
- </rdf:Description>
4275
- </rdf:RDF>
4276
- </x:xmpmeta>
4277
- </fo:declarations>
4571
+
4572
+ </xsl:for-each>
4573
+ </dc:creator>
4574
+ <dc:description>
4575
+ <xsl:variable name="abstract">
4576
+
4577
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4578
+
4579
+
4580
+ </xsl:variable>
4581
+ <xsl:value-of select="normalize-space($abstract)"/>
4582
+ </dc:description>
4583
+ <pdf:Keywords>
4584
+ <xsl:call-template name="insertKeywords"/>
4585
+ </pdf:Keywords>
4586
+ </rdf:Description>
4587
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4588
+ <!-- XMP properties go here -->
4589
+ <xmp:CreatorTool/>
4590
+ </rdf:Description>
4591
+ </rdf:RDF>
4592
+ </x:xmpmeta>
4278
4593
  </xsl:template><xsl:template name="getId">
4279
4594
  <xsl:choose>
4280
4595
  <xsl:when test="../@id">
@@ -4371,6 +4686,7 @@
4371
4686
 
4372
4687
 
4373
4688
 
4689
+
4374
4690
  </xsl:variable>
4375
4691
  <xsl:if test="$documentNS != $XSLNS">
4376
4692
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>