metanorma-cc 1.6.6 → 1.7.1

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: f500db67325bf5ec4bbf645bfeafc69d10a13efc9b4eb6e57721b813daff15f4
4
- data.tar.gz: cd833b906e604cbf0f6d232b800aed778f036afc502f45d7ea1b7f432682c747
3
+ metadata.gz: c42376000b8e82f820c6fdd7f5c3ca85d0d810eb3de71705ac6df2269e50d2db
4
+ data.tar.gz: fa9bf780b497c2e67c07d83399b3d4ed9228b1a1731ab31eb4532ab16afd16f9
5
5
  SHA512:
6
- metadata.gz: e0ca4ea71960d72b87c1454c57ec50016d4cb2813e4cf21a57fc262d10c6ef6a52b7ec61d89ab425ca20b19cf0d472fc84b75cb3daf8df92850686625bd47f93
7
- data.tar.gz: 96ef529b12a8276e9d84189ac61bbf55849ae9363ed5dad85bf16b535c2041e844ece82cce25838fb1e6dbac809768aede15ea25cfc35dbe15b388bc446374d6
6
+ metadata.gz: 78f7007e3975b048c53b85573cb2e6668f9ac5d6eeb80c77becd9d51d7c0cdd2c30c3931c8b0c8aea049d1426b654788a0537631c32609c4b142431840155836
7
+ data.tar.gz: 83d8577f2edf35a56eea0e4ad8f467ab7102554f91cfa873e0aa40673c7e78146fced42f8ce8ac45a9e1984e7813d489405984724f7eab5fab780fbfb9eff853
@@ -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
@@ -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>
@@ -86,6 +86,35 @@
86
86
  <text/>
87
87
  </element>
88
88
  </define>
89
+ <define name="erefType">
90
+ <optional>
91
+ <attribute name="normative">
92
+ <data type="boolean"/>
93
+ </attribute>
94
+ </optional>
95
+ <attribute name="citeas"/>
96
+ <attribute name="type">
97
+ <ref name="ReferenceFormat"/>
98
+ </attribute>
99
+ <optional>
100
+ <attribute name="alt"/>
101
+ </optional>
102
+ <optional>
103
+ <attribute name="case">
104
+ <choice>
105
+ <value>capital</value>
106
+ <value>lowercase</value>
107
+ </choice>
108
+ </attribute>
109
+ </optional>
110
+ <optional>
111
+ <attribute name="droploc">
112
+ <data type="boolean"/>
113
+ </attribute>
114
+ </optional>
115
+ <ref name="CitationType"/>
116
+ <text/>
117
+ </define>
89
118
  <define name="ul">
90
119
  <element name="ul">
91
120
  <attribute name="id">
@@ -102,7 +131,7 @@
102
131
  </attribute>
103
132
  </optional>
104
133
  <oneOrMore>
105
- <ref name="li"/>
134
+ <ref name="ul_li"/>
106
135
  </oneOrMore>
107
136
  <zeroOrMore>
108
137
  <ref name="note"/>
@@ -775,6 +804,78 @@
775
804
  <ref name="paragraph"/>
776
805
  </element>
777
806
  </define>
807
+ <define name="em">
808
+ <element name="em">
809
+ <zeroOrMore>
810
+ <choice>
811
+ <ref name="PureTextElement"/>
812
+ <ref name="stem"/>
813
+ <ref name="index"/>
814
+ </choice>
815
+ </zeroOrMore>
816
+ </element>
817
+ </define>
818
+ <define name="strong">
819
+ <element name="strong">
820
+ <zeroOrMore>
821
+ <choice>
822
+ <ref name="PureTextElement"/>
823
+ <ref name="stem"/>
824
+ <ref name="index"/>
825
+ </choice>
826
+ </zeroOrMore>
827
+ </element>
828
+ </define>
829
+ <define name="tt">
830
+ <element name="tt">
831
+ <zeroOrMore>
832
+ <choice>
833
+ <ref name="PureTextElement"/>
834
+ <ref name="index"/>
835
+ </choice>
836
+ </zeroOrMore>
837
+ </element>
838
+ </define>
839
+ <define name="keyword">
840
+ <element name="keyword">
841
+ <zeroOrMore>
842
+ <choice>
843
+ <ref name="PureTextElement"/>
844
+ <ref name="index"/>
845
+ </choice>
846
+ </zeroOrMore>
847
+ </element>
848
+ </define>
849
+ <define name="strike">
850
+ <element name="strike">
851
+ <zeroOrMore>
852
+ <choice>
853
+ <ref name="PureTextElement"/>
854
+ <ref name="index"/>
855
+ </choice>
856
+ </zeroOrMore>
857
+ </element>
858
+ </define>
859
+ <define name="underline">
860
+ <element name="underline">
861
+ <zeroOrMore>
862
+ <choice>
863
+ <ref name="PureTextElement"/>
864
+ <ref name="index"/>
865
+ </choice>
866
+ </zeroOrMore>
867
+ </element>
868
+ </define>
869
+ <define name="smallcap">
870
+ <element name="smallcap">
871
+ <zeroOrMore>
872
+ <choice>
873
+ <ref name="PureTextElement"/>
874
+ <ref name="index"/>
875
+ </choice>
876
+ </zeroOrMore>
877
+ </element>
878
+ </define>
778
879
  </include>
779
880
  <!-- end overrides -->
780
881
  <define name="colgroup">
@@ -793,7 +894,35 @@
793
894
  <value>internal</value>
794
895
  </define>
795
896
  <define name="TextElement" combine="choice">
796
- <ref name="concept"/>
897
+ <choice>
898
+ <ref name="concept"/>
899
+ <ref name="add"/>
900
+ <ref name="del"/>
901
+ </choice>
902
+ </define>
903
+ <define name="add">
904
+ <element name="add">
905
+ <choice>
906
+ <ref name="PureTextElement"/>
907
+ <ref name="eref"/>
908
+ <ref name="stem"/>
909
+ <ref name="keyword"/>
910
+ <ref name="xref"/>
911
+ <ref name="hyperlink"/>
912
+ </choice>
913
+ </element>
914
+ </define>
915
+ <define name="del">
916
+ <element name="del">
917
+ <choice>
918
+ <ref name="PureTextElement"/>
919
+ <ref name="eref"/>
920
+ <ref name="stem"/>
921
+ <ref name="keyword"/>
922
+ <ref name="xref"/>
923
+ <ref name="hyperlink"/>
924
+ </choice>
925
+ </element>
797
926
  </define>
798
927
  <define name="concept">
799
928
  <element name="concept">
@@ -919,6 +1048,9 @@
919
1048
  </choice>
920
1049
  </attribute>
921
1050
  <ref name="bibdata"/>
1051
+ <optional>
1052
+ <ref name="misccontainer"/>
1053
+ </optional>
922
1054
  <optional>
923
1055
  <ref name="boilerplate"/>
924
1056
  </optional>
@@ -929,11 +1061,21 @@
929
1061
  <zeroOrMore>
930
1062
  <ref name="annex"/>
931
1063
  </zeroOrMore>
1064
+ <optional>
1065
+ <ref name="bibliography"/>
1066
+ </optional>
932
1067
  <zeroOrMore>
933
- <ref name="references"/>
1068
+ <ref name="indexsect"/>
934
1069
  </zeroOrMore>
935
1070
  </element>
936
1071
  </define>
1072
+ <define name="misccontainer">
1073
+ <element name="misc-container">
1074
+ <oneOrMore>
1075
+ <ref name="AnyElement"/>
1076
+ </oneOrMore>
1077
+ </element>
1078
+ </define>
937
1079
  <define name="preface">
938
1080
  <element name="preface">
939
1081
  <oneOrMore>
@@ -957,6 +1099,11 @@
957
1099
  <ref name="Content-Section"/>
958
1100
  </element>
959
1101
  </define>
1102
+ <define name="indexsect">
1103
+ <element name="indexsect">
1104
+ <ref name="Content-Section"/>
1105
+ </element>
1106
+ </define>
960
1107
  <define name="boilerplate">
961
1108
  <element name="boilerplate">
962
1109
  <optional>
@@ -1698,4 +1845,26 @@
1698
1845
  </zeroOrMore>
1699
1846
  </element>
1700
1847
  </define>
1848
+ <define name="ul_li">
1849
+ <element name="li">
1850
+ <optional>
1851
+ <attribute name="id">
1852
+ <data type="ID"/>
1853
+ </attribute>
1854
+ </optional>
1855
+ <optional>
1856
+ <attribute name="uncheckedcheckbox">
1857
+ <data type="boolean"/>
1858
+ </attribute>
1859
+ </optional>
1860
+ <optional>
1861
+ <attribute name="checkedcheckbox">
1862
+ <data type="boolean"/>
1863
+ </attribute>
1864
+ </optional>
1865
+ <oneOrMore>
1866
+ <ref name="BasicBlock"/>
1867
+ </oneOrMore>
1868
+ </element>
1869
+ </define>
1701
1870
  </grammar>
@@ -3,7 +3,9 @@
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)"/>
8
+ <xsl:param name="basepath"/>
7
9
 
8
10
  <xsl:variable name="pageWidth" select="'210mm'"/>
9
11
  <xsl:variable name="pageHeight" select="'297mm'"/>
@@ -107,7 +109,9 @@
107
109
 
108
110
  </fo:layout-master-set>
109
111
 
110
- <xsl:call-template name="addPDFUAmeta"/>
112
+ <fo:declarations>
113
+ <xsl:call-template name="addPDFUAmeta"/>
114
+ </fo:declarations>
111
115
 
112
116
  <xsl:call-template name="addBookmarks">
113
117
  <xsl:with-param name="contents" select="$contents"/>
@@ -953,6 +957,7 @@
953
957
  </xsl:choose>
954
958
  </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
955
959
 
960
+
956
961
  </xsl:attribute-set><xsl:attribute-set name="link-style">
957
962
 
958
963
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -1068,6 +1073,7 @@
1068
1073
 
1069
1074
 
1070
1075
 
1076
+
1071
1077
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1072
1078
 
1073
1079
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -1279,7 +1285,7 @@
1279
1285
 
1280
1286
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1281
1287
 
1282
-
1288
+
1283
1289
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1284
1290
 
1285
1291
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
@@ -1287,7 +1293,25 @@
1287
1293
 
1288
1294
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1289
1295
 
1290
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1296
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1297
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1298
+ </xsl:variable><xsl:attribute-set name="add-style">
1299
+ <xsl:attribute name="color">red</xsl:attribute>
1300
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1301
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1302
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1303
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1304
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1305
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1306
+ <xsl:text>red</xsl:text>
1307
+ </xsl:variable><xsl:attribute-set name="del-style">
1308
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1309
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1310
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1311
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1312
+
1313
+
1314
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
1291
1315
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1292
1316
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1293
1317
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1332,16 +1356,17 @@
1332
1356
  <xsl:call-template name="add-zero-spaces-java"/>
1333
1357
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1334
1358
 
1359
+ <xsl:variable name="table-preamble">
1360
+
1361
+
1362
+ </xsl:variable>
1363
+
1335
1364
  <xsl:variable name="table">
1336
1365
 
1337
1366
  <xsl:variable name="simple-table">
1338
1367
  <xsl:call-template name="getSimpleTable"/>
1339
1368
  </xsl:variable>
1340
1369
 
1341
-
1342
-
1343
-
1344
-
1345
1370
  <!-- <xsl:if test="$namespace = 'bipm'">
1346
1371
  <fo:block>&#xA0;</fo:block>
1347
1372
  </xsl:if> -->
@@ -1356,7 +1381,7 @@
1356
1381
 
1357
1382
 
1358
1383
 
1359
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1384
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1360
1385
 
1361
1386
  <!-- <xsl:variable name="cols-count">
1362
1387
  <xsl:choose>
@@ -1375,8 +1400,6 @@
1375
1400
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1376
1401
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1377
1402
 
1378
-
1379
-
1380
1403
  <xsl:variable name="colwidths">
1381
1404
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1382
1405
  <xsl:call-template name="calculate-column-widths">
@@ -1404,6 +1427,7 @@
1404
1427
  </xsl:choose>
1405
1428
  </xsl:variable>
1406
1429
 
1430
+
1407
1431
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1408
1432
 
1409
1433
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -1437,6 +1461,7 @@
1437
1461
 
1438
1462
 
1439
1463
 
1464
+
1440
1465
 
1441
1466
 
1442
1467
 
@@ -1526,7 +1551,8 @@
1526
1551
  </fo:block-container>
1527
1552
  </xsl:variable>
1528
1553
 
1529
-
1554
+ <xsl:variable name="isAdded" select="@added"/>
1555
+ <xsl:variable name="isDeleted" select="@deleted"/>
1530
1556
 
1531
1557
  <xsl:choose>
1532
1558
  <xsl:when test="@width">
@@ -1540,7 +1566,14 @@
1540
1566
  <fo:table-body>
1541
1567
  <fo:table-row>
1542
1568
  <fo:table-cell column-number="2">
1543
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1569
+ <xsl:copy-of select="$table-preamble"/>
1570
+ <fo:block>
1571
+ <xsl:call-template name="setTrackChangesStyles">
1572
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1573
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1574
+ </xsl:call-template>
1575
+ <xsl:copy-of select="$table"/>
1576
+ </fo:block>
1544
1577
  </fo:table-cell>
1545
1578
  </fo:table-row>
1546
1579
  </fo:table-body>
@@ -1551,7 +1584,22 @@
1551
1584
 
1552
1585
  </xsl:when>
1553
1586
  <xsl:otherwise>
1554
- <xsl:copy-of select="$table"/>
1587
+ <xsl:choose>
1588
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1589
+ <xsl:copy-of select="$table-preamble"/>
1590
+ <fo:block>
1591
+ <xsl:call-template name="setTrackChangesStyles">
1592
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1593
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1594
+ </xsl:call-template>
1595
+ <xsl:copy-of select="$table"/>
1596
+ </fo:block>
1597
+ </xsl:when>
1598
+ <xsl:otherwise>
1599
+ <xsl:copy-of select="$table-preamble"/>
1600
+ <xsl:copy-of select="$table"/>
1601
+ </xsl:otherwise>
1602
+ </xsl:choose>
1555
1603
  </xsl:otherwise>
1556
1604
  </xsl:choose>
1557
1605
 
@@ -1612,7 +1660,7 @@
1612
1660
  </xsl:for-each>
1613
1661
  </xsl:when>
1614
1662
  <xsl:otherwise>
1615
- <xsl:for-each select="xalan:nodeset($table)//tr">
1663
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1616
1664
  <xsl:variable name="td_text">
1617
1665
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1618
1666
 
@@ -1682,7 +1730,15 @@
1682
1730
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1683
1731
  <xsl:value-of select="@target"/>
1684
1732
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1685
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1733
+ <xsl:variable name="mathml">
1734
+ <xsl:for-each select="*">
1735
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1736
+ <xsl:copy-of select="."/>
1737
+ </xsl:if>
1738
+ </xsl:for-each>
1739
+ </xsl:variable>
1740
+
1741
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1686
1742
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1687
1743
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1688
1744
  <xsl:param name="cols-count"/>
@@ -1944,7 +2000,8 @@
1944
2000
  <xsl:attribute name="text-align">
1945
2001
  <xsl:choose>
1946
2002
  <xsl:when test="@align">
1947
- <xsl:value-of select="@align"/>
2003
+ <xsl:call-template name="setAlignment"/>
2004
+ <!-- <xsl:value-of select="@align"/> -->
1948
2005
  </xsl:when>
1949
2006
  <xsl:otherwise>center</xsl:otherwise>
1950
2007
  </xsl:choose>
@@ -1960,6 +2017,9 @@
1960
2017
 
1961
2018
 
1962
2019
 
2020
+ <xsl:if test="$lang = 'ar'">
2021
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2022
+ </xsl:if>
1963
2023
  <xsl:if test="@colspan">
1964
2024
  <xsl:attribute name="number-columns-spanned">
1965
2025
  <xsl:value-of select="@colspan"/>
@@ -1991,11 +2051,15 @@
1991
2051
  <xsl:attribute name="text-align">
1992
2052
  <xsl:choose>
1993
2053
  <xsl:when test="@align">
1994
- <xsl:value-of select="@align"/>
2054
+ <xsl:call-template name="setAlignment"/>
2055
+ <!-- <xsl:value-of select="@align"/> -->
1995
2056
  </xsl:when>
1996
2057
  <xsl:otherwise>left</xsl:otherwise>
1997
2058
  </xsl:choose>
1998
2059
  </xsl:attribute>
2060
+ <xsl:if test="$lang = 'ar'">
2061
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2062
+ </xsl:if>
1999
2063
 
2000
2064
 
2001
2065
 
@@ -2007,6 +2071,9 @@
2007
2071
 
2008
2072
 
2009
2073
 
2074
+ <xsl:if test=".//*[local-name() = 'table']">
2075
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2076
+ </xsl:if>
2010
2077
  <xsl:if test="@colspan">
2011
2078
  <xsl:attribute name="number-columns-spanned">
2012
2079
  <xsl:value-of select="@colspan"/>
@@ -2134,13 +2201,13 @@
2134
2201
  </xsl:choose>
2135
2202
  </xsl:variable>
2136
2203
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2137
- <xsl:element name="{$ns}:table">
2204
+ <!-- <xsl:element name="{$ns}:table"> -->
2138
2205
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2139
2206
  <tbody>
2140
2207
  <xsl:apply-templates mode="dl"/>
2141
2208
  </tbody>
2142
2209
  </xsl:for-each>
2143
- </xsl:element>
2210
+ <!-- </xsl:element> -->
2144
2211
  </xsl:variable>
2145
2212
 
2146
2213
  <xsl:call-template name="calculate-column-widths">
@@ -2231,6 +2298,8 @@
2231
2298
  <xsl:apply-templates/>
2232
2299
  </fo:inline>
2233
2300
  </xsl:template><xsl:template match="*[local-name()='dl']">
2301
+ <xsl:variable name="isAdded" select="@added"/>
2302
+ <xsl:variable name="isDeleted" select="@deleted"/>
2234
2303
  <fo:block-container>
2235
2304
 
2236
2305
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2247,6 +2316,12 @@
2247
2316
  </xsl:attribute>
2248
2317
 
2249
2318
  </xsl:if>
2319
+
2320
+ <xsl:call-template name="setTrackChangesStyles">
2321
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2322
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2323
+ </xsl:call-template>
2324
+
2250
2325
  <fo:block-container>
2251
2326
 
2252
2327
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2354,11 +2429,11 @@
2354
2429
  </xsl:choose>
2355
2430
  </xsl:variable>
2356
2431
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2357
- <xsl:element name="{$ns}:table">
2432
+ <!-- <xsl:element name="{$ns}:table"> -->
2358
2433
  <tbody>
2359
2434
  <xsl:apply-templates mode="dl"/>
2360
2435
  </tbody>
2361
- </xsl:element>
2436
+ <!-- </xsl:element> -->
2362
2437
  </xsl:variable>
2363
2438
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2364
2439
  <xsl:variable name="colwidths">
@@ -2627,8 +2702,78 @@
2627
2702
  <fo:inline text-decoration="underline">
2628
2703
  <xsl:apply-templates/>
2629
2704
  </fo:inline>
2705
+ </xsl:template><xsl:template match="*[local-name()='add']">
2706
+ <xsl:choose>
2707
+ <xsl:when test="@amendment">
2708
+ <fo:inline>
2709
+ <xsl:call-template name="insertTag">
2710
+ <xsl:with-param name="kind">A</xsl:with-param>
2711
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2712
+ </xsl:call-template>
2713
+ <xsl:apply-templates/>
2714
+ <xsl:call-template name="insertTag">
2715
+ <xsl:with-param name="type">closing</xsl:with-param>
2716
+ <xsl:with-param name="kind">A</xsl:with-param>
2717
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2718
+ </xsl:call-template>
2719
+ </fo:inline>
2720
+ </xsl:when>
2721
+ <xsl:when test="@corrigenda">
2722
+ <fo:inline>
2723
+ <xsl:call-template name="insertTag">
2724
+ <xsl:with-param name="kind">C</xsl:with-param>
2725
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2726
+ </xsl:call-template>
2727
+ <xsl:apply-templates/>
2728
+ <xsl:call-template name="insertTag">
2729
+ <xsl:with-param name="type">closing</xsl:with-param>
2730
+ <xsl:with-param name="kind">C</xsl:with-param>
2731
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2732
+ </xsl:call-template>
2733
+ </fo:inline>
2734
+ </xsl:when>
2735
+ <xsl:otherwise>
2736
+ <fo:inline xsl:use-attribute-sets="add-style">
2737
+ <xsl:apply-templates/>
2738
+ </fo:inline>
2739
+ </xsl:otherwise>
2740
+ </xsl:choose>
2741
+
2742
+ </xsl:template><xsl:template name="insertTag">
2743
+ <xsl:param name="type"/>
2744
+ <xsl:param name="kind"/>
2745
+ <xsl:param name="value"/>
2746
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2747
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2748
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2749
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2750
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2751
+ <xsl:attribute name="height">5mm</xsl:attribute>
2752
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2753
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2754
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2755
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2756
+ <g>
2757
+ <xsl:if test="$type = 'closing'">
2758
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2759
+ </xsl:if>
2760
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2761
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2762
+ </g>
2763
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2764
+ <xsl:if test="$type = 'closing'">
2765
+ <xsl:attribute name="x">25</xsl:attribute>
2766
+ </xsl:if>
2767
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2768
+ </text>
2769
+ </svg>
2770
+ </fo:instream-foreign-object>
2630
2771
  </xsl:template><xsl:template match="*[local-name()='del']">
2631
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2772
+ <fo:inline xsl:use-attribute-sets="del-style">
2773
+ <xsl:apply-templates/>
2774
+ </fo:inline>
2775
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2776
+ <fo:inline background-color="yellow">
2632
2777
  <xsl:apply-templates/>
2633
2778
  </fo:inline>
2634
2779
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -2965,12 +3110,23 @@
2965
3110
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2966
3111
  <xsl:value-of select="substring($str, 2)"/>
2967
3112
  </xsl:template><xsl:template match="mathml:math">
2968
- <fo:inline font-family="STIX Two Math"> <!-- -->
3113
+ <xsl:variable name="isAdded" select="@added"/>
3114
+ <xsl:variable name="isDeleted" select="@deleted"/>
3115
+
3116
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3117
+
3118
+
3119
+ <xsl:call-template name="setTrackChangesStyles">
3120
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3121
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3122
+ </xsl:call-template>
2969
3123
 
2970
3124
  <xsl:variable name="mathml">
2971
3125
  <xsl:apply-templates select="." mode="mathml"/>
2972
3126
  </xsl:variable>
2973
3127
  <fo:instream-foreign-object fox:alt-text="Math">
3128
+
3129
+
2974
3130
  <!-- <xsl:copy-of select="."/> -->
2975
3131
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
2976
3132
  </fo:instream-foreign-object>
@@ -2989,7 +3145,7 @@
2989
3145
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
2990
3146
  </xsl:copy>
2991
3147
  <mathml:mspace width="0.5ex"/>
2992
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3148
+ </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">
2993
3149
  <xsl:variable name="target">
2994
3150
  <xsl:choose>
2995
3151
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3023,8 +3179,6 @@
3023
3179
  </xsl:otherwise>
3024
3180
  </xsl:choose>
3025
3181
  </fo:inline>
3026
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3027
- <fo:inline id="{@id}"/>
3028
3182
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3029
3183
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3030
3184
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3216,8 +3370,15 @@
3216
3370
  </fo:inline>
3217
3371
  </xsl:if>
3218
3372
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3373
+ <xsl:variable name="isAdded" select="@added"/>
3374
+ <xsl:variable name="isDeleted" select="@deleted"/>
3219
3375
  <fo:block-container id="{@id}">
3220
3376
 
3377
+ <xsl:call-template name="setTrackChangesStyles">
3378
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3379
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3380
+ </xsl:call-template>
3381
+
3221
3382
  <fo:block>
3222
3383
  <xsl:apply-templates/>
3223
3384
  </fo:block>
@@ -3231,27 +3392,113 @@
3231
3392
  <fo:block id="{@id}">
3232
3393
  <xsl:apply-templates/>
3233
3394
  </fo:block>
3395
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3234
3396
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3235
3397
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3236
3398
  <xsl:apply-templates/>
3237
3399
  </fo:block>
3238
3400
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3239
- <fo:block xsl:use-attribute-sets="image-style">
3240
-
3241
-
3242
- <xsl:variable name="src">
3243
- <xsl:choose>
3244
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3245
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3246
- </xsl:when>
3247
- <xsl:otherwise>
3248
- <xsl:value-of select="@src"/>
3249
- </xsl:otherwise>
3250
- </xsl:choose>
3251
- </xsl:variable>
3252
-
3253
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3254
- </fo:block>
3401
+ <xsl:variable name="isAdded" select="../@added"/>
3402
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3403
+ <xsl:choose>
3404
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3405
+ <fo:inline padding-left="1mm" padding-right="1mm">
3406
+ <xsl:variable name="src">
3407
+ <xsl:call-template name="image_src"/>
3408
+ </xsl:variable>
3409
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3410
+ </fo:inline>
3411
+ </xsl:when>
3412
+ <xsl:otherwise>
3413
+ <fo:block xsl:use-attribute-sets="image-style">
3414
+
3415
+ <xsl:variable name="src">
3416
+ <xsl:call-template name="image_src"/>
3417
+ </xsl:variable>
3418
+
3419
+ <xsl:choose>
3420
+ <xsl:when test="$isDeleted = 'true'">
3421
+ <!-- enclose in svg -->
3422
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3423
+ <xsl:attribute name="width">100%</xsl:attribute>
3424
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3425
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3426
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3427
+
3428
+
3429
+ <xsl:apply-templates select="." mode="cross_image"/>
3430
+
3431
+ </fo:instream-foreign-object>
3432
+ </xsl:when>
3433
+ <xsl:otherwise>
3434
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3435
+ </xsl:otherwise>
3436
+ </xsl:choose>
3437
+
3438
+ </fo:block>
3439
+ </xsl:otherwise>
3440
+ </xsl:choose>
3441
+ </xsl:template><xsl:template name="image_src">
3442
+ <xsl:choose>
3443
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3444
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3445
+ </xsl:when>
3446
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3447
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3448
+ </xsl:when>
3449
+ <xsl:otherwise>
3450
+ <xsl:value-of select="@src"/>
3451
+ </xsl:otherwise>
3452
+ </xsl:choose>
3453
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3454
+ <xsl:choose>
3455
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3456
+ <xsl:variable name="src">
3457
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3458
+ </xsl:variable>
3459
+ <xsl:variable name="width" select="document($src)/@width"/>
3460
+ <xsl:variable name="height" select="document($src)/@height"/>
3461
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3462
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3463
+ </svg>
3464
+ </xsl:when>
3465
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3466
+ <xsl:variable name="src">
3467
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3468
+ </xsl:variable>
3469
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3470
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3471
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3472
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3473
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3474
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3475
+ </svg>
3476
+ </xsl:when>
3477
+ <xsl:otherwise>
3478
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3479
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3480
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3481
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3482
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3483
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3484
+ <!-- width=<xsl:value-of select="$width"/> -->
3485
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3486
+ <!-- height=<xsl:value-of select="$height"/> -->
3487
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="enable-background:new 0 0 595.28 841.89;" height="{$height}" width="{$width}" viewBox="0 0 {$width} {$height}" y="0px" x="0px" id="Layer_1" version="1.1">
3488
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3489
+ <xsl:call-template name="svg_cross">
3490
+ <xsl:with-param name="width" select="$width"/>
3491
+ <xsl:with-param name="height" select="$height"/>
3492
+ </xsl:call-template>
3493
+ </svg>
3494
+ </xsl:otherwise>
3495
+ </xsl:choose>
3496
+
3497
+ </xsl:template><xsl:template name="svg_cross">
3498
+ <xsl:param name="width"/>
3499
+ <xsl:param name="height"/>
3500
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="0" x2="{$width}" y2="{$height}" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3501
+ <line xmlns="http://www.w3.org/2000/svg" x1="0" y1="{$height}" x2="{$width}" y2="0" style="stroke: rgb(255, 0, 0); stroke-width:4px; "/>
3255
3502
  </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">
3256
3503
  <xsl:apply-templates mode="contents"/>
3257
3504
  <xsl:text> </xsl:text>
@@ -3794,6 +4041,7 @@
3794
4041
  <xsl:variable name="element">
3795
4042
  block
3796
4043
 
4044
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3797
4045
  </xsl:variable>
3798
4046
  <xsl:choose>
3799
4047
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3801,7 +4049,7 @@
3801
4049
  <xsl:apply-templates/>
3802
4050
  </fo:inline>
3803
4051
  </xsl:when>
3804
- <xsl:when test="normalize-space($element) = 'block'">
4052
+ <xsl:when test="contains(normalize-space($element), 'block')">
3805
4053
  <fo:block xsl:use-attribute-sets="example-name-style">
3806
4054
  <xsl:apply-templates/>
3807
4055
  </fo:block>
@@ -3814,10 +4062,11 @@
3814
4062
  </xsl:choose>
3815
4063
 
3816
4064
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3817
-
4065
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3818
4066
  <xsl:variable name="element">
3819
4067
  block
3820
4068
 
4069
+
3821
4070
  </xsl:variable>
3822
4071
  <xsl:choose>
3823
4072
  <xsl:when test="normalize-space($element) = 'block'">
@@ -3921,32 +4170,50 @@
3921
4170
  <xsl:text>— </xsl:text>
3922
4171
  <xsl:apply-templates/>
3923
4172
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
3924
- <fo:inline xsl:use-attribute-sets="eref-style">
3925
- <xsl:if test="@type = 'footnote'">
3926
-
3927
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3928
- <xsl:attribute name="font-size">80%</xsl:attribute>
3929
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3930
- <xsl:attribute name="vertical-align">super</xsl:attribute>
3931
-
3932
-
3933
- </xsl:if>
3934
-
3935
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3936
-
3937
- <xsl:if test="@type = 'inline'">
3938
-
3939
- <xsl:attribute name="color">blue</xsl:attribute>
3940
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
3941
-
3942
-
3943
-
3944
- </xsl:if>
3945
-
3946
-
3947
- <xsl:apply-templates/>
3948
- </fo:basic-link>
3949
- </fo:inline>
4173
+
4174
+ <xsl:variable name="bibitemid">
4175
+ <xsl:choose>
4176
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4177
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4178
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4179
+ </xsl:choose>
4180
+ </xsl:variable>
4181
+
4182
+ <xsl:choose>
4183
+ <xsl:when test="normalize-space($bibitemid) != ''">
4184
+ <fo:inline xsl:use-attribute-sets="eref-style">
4185
+ <xsl:if test="@type = 'footnote'">
4186
+
4187
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4188
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4189
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4190
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4191
+
4192
+
4193
+ </xsl:if>
4194
+
4195
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4196
+ <xsl:if test="normalize-space(@citeas) = ''">
4197
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4198
+ </xsl:if>
4199
+ <xsl:if test="@type = 'inline'">
4200
+
4201
+ <xsl:attribute name="color">blue</xsl:attribute>
4202
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4203
+
4204
+
4205
+
4206
+ </xsl:if>
4207
+
4208
+ <xsl:apply-templates/>
4209
+ </fo:basic-link>
4210
+
4211
+ </fo:inline>
4212
+ </xsl:when>
4213
+ <xsl:otherwise>
4214
+ <fo:inline><xsl:apply-templates/></fo:inline>
4215
+ </xsl:otherwise>
4216
+ </xsl:choose>
3950
4217
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
3951
4218
  <!-- zero-space char -->
3952
4219
  <xsl:variable name="depth">
@@ -4005,7 +4272,8 @@
4005
4272
  </fo:inline>
4006
4273
  </xsl:when>
4007
4274
  <xsl:otherwise>
4008
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4275
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4276
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4009
4277
  </xsl:otherwise>
4010
4278
  </xsl:choose>
4011
4279
 
@@ -4130,6 +4398,153 @@
4130
4398
  </fo:block>
4131
4399
  </xsl:otherwise>
4132
4400
  </xsl:choose>
4401
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4402
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4403
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4404
+ </xsl:for-each>
4405
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4406
+ <xsl:copy>
4407
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4408
+ </xsl:copy>
4409
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4410
+ <xsl:variable name="id">
4411
+ <xsl:call-template name="generateIndexXrefId"/>
4412
+ </xsl:variable>
4413
+ <xsl:copy> <!-- add id to xref -->
4414
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4415
+ <xsl:attribute name="id">
4416
+ <xsl:value-of select="$id"/>
4417
+ </xsl:attribute>
4418
+ <xsl:apply-templates mode="index_add_id"/>
4419
+ </xsl:copy>
4420
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4421
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4422
+ <xsl:if test="@to">
4423
+ <xsl:value-of select="$dash"/>
4424
+ <xsl:copy>
4425
+ <xsl:copy-of select="@*"/>
4426
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4427
+ <xsl:attribute name="id">
4428
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4429
+ </xsl:attribute>
4430
+ <xsl:apply-templates mode="index_add_id"/>
4431
+ </xsl:copy>
4432
+ </xsl:if>
4433
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4434
+ <xsl:copy>
4435
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4436
+ </xsl:copy>
4437
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4438
+ <xsl:copy>
4439
+ <xsl:apply-templates select="@*" mode="index_update"/>
4440
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4441
+ </xsl:copy>
4442
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4443
+ <xsl:param name="element"/>
4444
+ <xsl:param name="remove" select="'false'"/>
4445
+ <xsl:param name="target"/>
4446
+ <!-- <node></node> -->
4447
+ <xsl:choose>
4448
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4449
+ <!-- skip text (i.e. remove it) and process next element -->
4450
+ <!-- [removed_<xsl:value-of select="."/>] -->
4451
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4452
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4453
+ </xsl:apply-templates>
4454
+ </xsl:when>
4455
+ <xsl:when test="self::text()">
4456
+ <xsl:value-of select="."/>
4457
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4458
+ </xsl:when>
4459
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4460
+ <xsl:variable name="id" select="@id"/>
4461
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4462
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4463
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4464
+
4465
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4466
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4467
+
4468
+ <xsl:choose>
4469
+ <!-- 2nd pass -->
4470
+ <!-- if page is equal to page for next and page is not the end of range -->
4471
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4472
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4473
+ <!-- [removed_xref] -->
4474
+
4475
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4476
+ <xsl:with-param name="remove">true</xsl:with-param>
4477
+ <xsl:with-param name="target">
4478
+ <xsl:choose>
4479
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4480
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4481
+ </xsl:choose>
4482
+ </xsl:with-param>
4483
+ </xsl:apply-templates>
4484
+ </xsl:when>
4485
+
4486
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4487
+ <!-- remove xref -->
4488
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4489
+ <xsl:with-param name="remove">true</xsl:with-param>
4490
+ </xsl:apply-templates>
4491
+ </xsl:when>
4492
+
4493
+ <xsl:otherwise>
4494
+ <xsl:apply-templates select="." mode="xref_copy">
4495
+ <xsl:with-param name="target" select="$target"/>
4496
+ </xsl:apply-templates>
4497
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4498
+ </xsl:otherwise>
4499
+ </xsl:choose>
4500
+ </xsl:when>
4501
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4502
+ <!-- ul -->
4503
+ <xsl:apply-templates select="." mode="index_update"/>
4504
+ </xsl:when>
4505
+ <xsl:otherwise>
4506
+ <xsl:apply-templates select="." mode="xref_copy">
4507
+ <xsl:with-param name="target" select="$target"/>
4508
+ </xsl:apply-templates>
4509
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4510
+ </xsl:otherwise>
4511
+ </xsl:choose>
4512
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4513
+ <xsl:param name="target"/>
4514
+ <xsl:copy>
4515
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4516
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4517
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4518
+ </xsl:if>
4519
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4520
+ </xsl:copy>
4521
+ </xsl:template><xsl:template name="generateIndexXrefId">
4522
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4523
+
4524
+ <xsl:variable name="docid">
4525
+ <xsl:call-template name="getDocumentId"/>
4526
+ </xsl:variable>
4527
+ <xsl:variable name="item_number">
4528
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4529
+ </xsl:variable>
4530
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4531
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4532
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4533
+ <xsl:apply-templates/>
4534
+ <fo:block>
4535
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4536
+ <fo:block> </fo:block>
4537
+ </xsl:if>
4538
+ </fo:block>
4539
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4540
+ <xsl:apply-templates/>
4541
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4542
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4543
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4544
+ <xsl:apply-templates/>
4545
+ </fo:block>
4546
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4547
+ <fo:inline id="{@id}" font-size="1pt"/>
4133
4548
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4134
4549
  <!-- <row>
4135
4550
  <date>05-07-2013</date>
@@ -4346,70 +4761,68 @@
4346
4761
  <xsl:variable name="lang">
4347
4762
  <xsl:call-template name="getLang"/>
4348
4763
  </xsl:variable>
4349
- <fo:declarations>
4350
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4351
- <pdf:dictionary type="normal" key="ViewerPreferences">
4352
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4353
- </pdf:dictionary>
4354
- </pdf:catalog>
4355
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4356
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4357
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4358
- <!-- Dublin Core properties go here -->
4359
- <dc:title>
4360
- <xsl:variable name="title">
4361
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4362
-
4363
-
4364
-
4365
-
4366
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4367
-
4368
-
4369
-
4370
- </xsl:for-each>
4371
- </xsl:variable>
4372
- <xsl:choose>
4373
- <xsl:when test="normalize-space($title) != ''">
4374
- <xsl:value-of select="$title"/>
4375
- </xsl:when>
4376
- <xsl:otherwise>
4377
- <xsl:text> </xsl:text>
4378
- </xsl:otherwise>
4379
- </xsl:choose>
4380
- </dc:title>
4381
- <dc:creator>
4764
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4765
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4766
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4767
+ </pdf:dictionary>
4768
+ </pdf:catalog>
4769
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4770
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4771
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4772
+ <!-- Dublin Core properties go here -->
4773
+ <dc:title>
4774
+ <xsl:variable name="title">
4382
4775
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4383
4776
 
4384
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4385
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4386
- <xsl:if test="position() != last()">; </xsl:if>
4387
- </xsl:for-each>
4388
-
4389
-
4390
4777
 
4391
- </xsl:for-each>
4392
- </dc:creator>
4393
- <dc:description>
4394
- <xsl:variable name="abstract">
4395
4778
 
4396
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4779
+
4780
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4397
4781
 
4398
4782
 
4399
- </xsl:variable>
4400
- <xsl:value-of select="normalize-space($abstract)"/>
4401
- </dc:description>
4402
- <pdf:Keywords>
4403
- <xsl:call-template name="insertKeywords"/>
4404
- </pdf:Keywords>
4405
- </rdf:Description>
4406
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4407
- <!-- XMP properties go here -->
4408
- <xmp:CreatorTool/>
4409
- </rdf:Description>
4410
- </rdf:RDF>
4411
- </x:xmpmeta>
4412
- </fo:declarations>
4783
+
4784
+ </xsl:for-each>
4785
+ </xsl:variable>
4786
+ <xsl:choose>
4787
+ <xsl:when test="normalize-space($title) != ''">
4788
+ <xsl:value-of select="$title"/>
4789
+ </xsl:when>
4790
+ <xsl:otherwise>
4791
+ <xsl:text> </xsl:text>
4792
+ </xsl:otherwise>
4793
+ </xsl:choose>
4794
+ </dc:title>
4795
+ <dc:creator>
4796
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4797
+
4798
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4799
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4800
+ <xsl:if test="position() != last()">; </xsl:if>
4801
+ </xsl:for-each>
4802
+
4803
+
4804
+
4805
+ </xsl:for-each>
4806
+ </dc:creator>
4807
+ <dc:description>
4808
+ <xsl:variable name="abstract">
4809
+
4810
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4811
+
4812
+
4813
+ </xsl:variable>
4814
+ <xsl:value-of select="normalize-space($abstract)"/>
4815
+ </dc:description>
4816
+ <pdf:Keywords>
4817
+ <xsl:call-template name="insertKeywords"/>
4818
+ </pdf:Keywords>
4819
+ </rdf:Description>
4820
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4821
+ <!-- XMP properties go here -->
4822
+ <xmp:CreatorTool/>
4823
+ </rdf:Description>
4824
+ </rdf:RDF>
4825
+ </x:xmpmeta>
4413
4826
  </xsl:template><xsl:template name="getId">
4414
4827
  <xsl:choose>
4415
4828
  <xsl:when test="../@id">
@@ -4573,4 +4986,44 @@
4573
4986
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4574
4987
  </xsl:choose>
4575
4988
 
4989
+ </xsl:template><xsl:template name="setTrackChangesStyles">
4990
+ <xsl:param name="isAdded"/>
4991
+ <xsl:param name="isDeleted"/>
4992
+ <xsl:choose>
4993
+ <xsl:when test="local-name() = 'math'">
4994
+ <xsl:if test="$isAdded = 'true'">
4995
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
4996
+ </xsl:if>
4997
+ <xsl:if test="$isDeleted = 'true'">
4998
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
4999
+ </xsl:if>
5000
+ </xsl:when>
5001
+ <xsl:otherwise>
5002
+ <xsl:if test="$isAdded = 'true'">
5003
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5004
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5005
+ </xsl:if>
5006
+ <xsl:if test="$isDeleted = 'true'">
5007
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5008
+ <xsl:if test="local-name() = 'table'">
5009
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5010
+ </xsl:if>
5011
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5012
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5013
+ </xsl:if>
5014
+ </xsl:otherwise>
5015
+ </xsl:choose>
5016
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5017
+ <xsl:if test="$lang = 'ar'">
5018
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5019
+ </xsl:if>
5020
+ </xsl:template><xsl:template name="setAlignment">
5021
+ <xsl:param name="align" select="normalize-space(@align)"/>
5022
+ <xsl:choose>
5023
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5024
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5025
+ <xsl:when test="$align != ''">
5026
+ <xsl:value-of select="$align"/>
5027
+ </xsl:when>
5028
+ </xsl:choose>
4576
5029
  </xsl:template></xsl:stylesheet>