metanorma-mpfa 0.5.13 → 0.6.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: 7b1577410b152c3962957cca6f40310e2b208d2459b29eaafc4b65bc3312ce9a
4
- data.tar.gz: 60e2bf959a0b64e8cf7467bc27401796080e1acab16e6202eee66b1f013c4e7b
3
+ metadata.gz: 7cf80fd86c575baa2b2be05c6ec24b19208cb22bdc65f0ae3cfa45d91e4b3377
4
+ data.tar.gz: d50a921655abc971e49a66252129cddc97ba2087361e26266070ed6436374142
5
5
  SHA512:
6
- metadata.gz: f1d63a067e5478941717072dbae5f8cfbea45caf7855a80424afe8dc68b2a6e826da72c0eef49da09a2d171894709ef87686503cfa50a8f9f85ec943a1f50cd1
7
- data.tar.gz: 1d277cc228fea2a4d492d333f8b95e3d71086e518ebf715c1fabe919c3157d9a88014f1786cc11455ed86527402e79e04ff739cf0f59b235150fb47e374772a3
6
+ metadata.gz: a5ca83830fe46a0805e1fd26fcd919ce0cc5d35a3528c884298e113437ebea74fa280bf825eaecff4f0030b2cb3661bff4a118d9db54316b8190ec0e129f00df
7
+ data.tar.gz: 6926cb26f467c51f33d5e27ae9e152aa6fc3ce54031674e86ebdc4c3f739c81ecda9ea7a277e55be6903c03e04aa3cb7acb9632b3093c0a5229e076b9c84708e
@@ -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>
@@ -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>
@@ -70,6 +70,9 @@
70
70
  <zeroOrMore>
71
71
  <ref name="termdocsource"/>
72
72
  </zeroOrMore>
73
+ <optional>
74
+ <ref name="misccontainer"/>
75
+ </optional>
73
76
  <optional>
74
77
  <ref name="boilerplate"/>
75
78
  </optional>
@@ -81,6 +84,9 @@
81
84
  <ref name="annex"/>
82
85
  </zeroOrMore>
83
86
  <ref name="bibliography"/>
87
+ <zeroOrMore>
88
+ <ref name="indexsect"/>
89
+ </zeroOrMore>
84
90
  </element>
85
91
  </define>
86
92
  </grammar>
@@ -115,6 +115,13 @@ a.FootnoteRef + a.FootnoteRef:before {
115
115
  content: ", ";
116
116
  vertical-align: super; }
117
117
 
118
+ .addition {
119
+ color: blue; }
120
+
121
+ .deletion {
122
+ color: red;
123
+ text-decoration: line-through; }
124
+
118
125
  #standard-band {
119
126
  background-color: #0AC442; }
120
127
 
@@ -31,7 +31,6 @@ module IsoDoc
31
31
  htmlstylesheet: html_doc_path("htmlstyle.scss"),
32
32
  htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
33
33
  htmlintropage: html_doc_path("html_rsd_intro.html"),
34
- scripts: html_doc_path("scripts.html"),
35
34
  }
36
35
  end
37
36
 
@@ -3,7 +3,9 @@
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
+ <xsl:param name="basepath"/>
7
9
 
8
10
  <xsl:key name="kfn" match="mpfd:p/mpfd:fn" use="@reference"/>
9
11
 
@@ -94,7 +96,9 @@
94
96
 
95
97
  </fo:layout-master-set>
96
98
 
97
- <xsl:call-template name="addPDFUAmeta"/>
99
+ <fo:declarations>
100
+ <xsl:call-template name="addPDFUAmeta"/>
101
+ </fo:declarations>
98
102
 
99
103
  <xsl:call-template name="addBookmarks">
100
104
  <xsl:with-param name="contents" select="$contents"/>
@@ -933,6 +937,7 @@
933
937
  </xsl:choose>
934
938
  </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">
935
939
 
940
+
936
941
  </xsl:attribute-set><xsl:attribute-set name="link-style">
937
942
 
938
943
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -1039,6 +1044,7 @@
1039
1044
 
1040
1045
 
1041
1046
 
1047
+
1042
1048
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1043
1049
 
1044
1050
 
@@ -1230,13 +1236,31 @@
1230
1236
 
1231
1237
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1232
1238
 
1233
-
1239
+
1234
1240
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1235
1241
 
1236
1242
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1237
1243
 
1238
1244
 
1239
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1245
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1246
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1247
+ </xsl:variable><xsl:attribute-set name="add-style">
1248
+ <xsl:attribute name="color">red</xsl:attribute>
1249
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1250
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1251
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1252
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1253
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1254
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1255
+ <xsl:text>red</xsl:text>
1256
+ </xsl:variable><xsl:attribute-set name="del-style">
1257
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1258
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1259
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1260
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1261
+
1262
+
1263
+ </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">
1240
1264
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1241
1265
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1242
1266
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1281,16 +1305,17 @@
1281
1305
  <xsl:call-template name="add-zero-spaces-java"/>
1282
1306
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1283
1307
 
1308
+ <xsl:variable name="table-preamble">
1309
+
1310
+
1311
+ </xsl:variable>
1312
+
1284
1313
  <xsl:variable name="table">
1285
1314
 
1286
1315
  <xsl:variable name="simple-table">
1287
1316
  <xsl:call-template name="getSimpleTable"/>
1288
1317
  </xsl:variable>
1289
1318
 
1290
-
1291
-
1292
-
1293
-
1294
1319
  <!-- <xsl:if test="$namespace = 'bipm'">
1295
1320
  <fo:block>&#xA0;</fo:block>
1296
1321
  </xsl:if> -->
@@ -1305,7 +1330,7 @@
1305
1330
 
1306
1331
 
1307
1332
 
1308
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1333
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1309
1334
 
1310
1335
  <!-- <xsl:variable name="cols-count">
1311
1336
  <xsl:choose>
@@ -1324,8 +1349,6 @@
1324
1349
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1325
1350
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1326
1351
 
1327
-
1328
-
1329
1352
  <xsl:variable name="colwidths">
1330
1353
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1331
1354
  <xsl:call-template name="calculate-column-widths">
@@ -1353,6 +1376,7 @@
1353
1376
  </xsl:choose>
1354
1377
  </xsl:variable>
1355
1378
 
1379
+
1356
1380
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1357
1381
 
1358
1382
 
@@ -1388,6 +1412,7 @@
1388
1412
 
1389
1413
 
1390
1414
 
1415
+
1391
1416
 
1392
1417
 
1393
1418
 
@@ -1480,7 +1505,8 @@
1480
1505
  </fo:block-container>
1481
1506
  </xsl:variable>
1482
1507
 
1483
-
1508
+ <xsl:variable name="isAdded" select="@added"/>
1509
+ <xsl:variable name="isDeleted" select="@deleted"/>
1484
1510
 
1485
1511
  <xsl:choose>
1486
1512
  <xsl:when test="@width">
@@ -1494,7 +1520,14 @@
1494
1520
  <fo:table-body>
1495
1521
  <fo:table-row>
1496
1522
  <fo:table-cell column-number="2">
1497
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1523
+ <xsl:copy-of select="$table-preamble"/>
1524
+ <fo:block>
1525
+ <xsl:call-template name="setTrackChangesStyles">
1526
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1527
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1528
+ </xsl:call-template>
1529
+ <xsl:copy-of select="$table"/>
1530
+ </fo:block>
1498
1531
  </fo:table-cell>
1499
1532
  </fo:table-row>
1500
1533
  </fo:table-body>
@@ -1505,7 +1538,22 @@
1505
1538
 
1506
1539
  </xsl:when>
1507
1540
  <xsl:otherwise>
1508
- <xsl:copy-of select="$table"/>
1541
+ <xsl:choose>
1542
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1543
+ <xsl:copy-of select="$table-preamble"/>
1544
+ <fo:block>
1545
+ <xsl:call-template name="setTrackChangesStyles">
1546
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1547
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1548
+ </xsl:call-template>
1549
+ <xsl:copy-of select="$table"/>
1550
+ </fo:block>
1551
+ </xsl:when>
1552
+ <xsl:otherwise>
1553
+ <xsl:copy-of select="$table-preamble"/>
1554
+ <xsl:copy-of select="$table"/>
1555
+ </xsl:otherwise>
1556
+ </xsl:choose>
1509
1557
  </xsl:otherwise>
1510
1558
  </xsl:choose>
1511
1559
 
@@ -1566,7 +1614,7 @@
1566
1614
  </xsl:for-each>
1567
1615
  </xsl:when>
1568
1616
  <xsl:otherwise>
1569
- <xsl:for-each select="xalan:nodeset($table)//tr">
1617
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1570
1618
  <xsl:variable name="td_text">
1571
1619
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1572
1620
 
@@ -1636,7 +1684,15 @@
1636
1684
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1637
1685
  <xsl:value-of select="@target"/>
1638
1686
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1639
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1687
+ <xsl:variable name="mathml">
1688
+ <xsl:for-each select="*">
1689
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1690
+ <xsl:copy-of select="."/>
1691
+ </xsl:if>
1692
+ </xsl:for-each>
1693
+ </xsl:variable>
1694
+
1695
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1640
1696
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1641
1697
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1642
1698
  <xsl:param name="cols-count"/>
@@ -1898,7 +1954,8 @@
1898
1954
  <xsl:attribute name="text-align">
1899
1955
  <xsl:choose>
1900
1956
  <xsl:when test="@align">
1901
- <xsl:value-of select="@align"/>
1957
+ <xsl:call-template name="setAlignment"/>
1958
+ <!-- <xsl:value-of select="@align"/> -->
1902
1959
  </xsl:when>
1903
1960
  <xsl:otherwise>center</xsl:otherwise>
1904
1961
  </xsl:choose>
@@ -1917,6 +1974,9 @@
1917
1974
  <xsl:attribute name="border-bottom">solid black 2pt</xsl:attribute>
1918
1975
 
1919
1976
 
1977
+ <xsl:if test="$lang = 'ar'">
1978
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
1979
+ </xsl:if>
1920
1980
  <xsl:if test="@colspan">
1921
1981
  <xsl:attribute name="number-columns-spanned">
1922
1982
  <xsl:value-of select="@colspan"/>
@@ -1948,11 +2008,15 @@
1948
2008
  <xsl:attribute name="text-align">
1949
2009
  <xsl:choose>
1950
2010
  <xsl:when test="@align">
1951
- <xsl:value-of select="@align"/>
2011
+ <xsl:call-template name="setAlignment"/>
2012
+ <!-- <xsl:value-of select="@align"/> -->
1952
2013
  </xsl:when>
1953
2014
  <xsl:otherwise>left</xsl:otherwise>
1954
2015
  </xsl:choose>
1955
2016
  </xsl:attribute>
2017
+ <xsl:if test="$lang = 'ar'">
2018
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2019
+ </xsl:if>
1956
2020
 
1957
2021
 
1958
2022
 
@@ -1964,6 +2028,9 @@
1964
2028
 
1965
2029
 
1966
2030
 
2031
+ <xsl:if test=".//*[local-name() = 'table']">
2032
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2033
+ </xsl:if>
1967
2034
  <xsl:if test="@colspan">
1968
2035
  <xsl:attribute name="number-columns-spanned">
1969
2036
  <xsl:value-of select="@colspan"/>
@@ -2089,13 +2156,13 @@
2089
2156
  </xsl:choose>
2090
2157
  </xsl:variable>
2091
2158
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2092
- <xsl:element name="{$ns}:table">
2159
+ <!-- <xsl:element name="{$ns}:table"> -->
2093
2160
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2094
2161
  <tbody>
2095
2162
  <xsl:apply-templates mode="dl"/>
2096
2163
  </tbody>
2097
2164
  </xsl:for-each>
2098
- </xsl:element>
2165
+ <!-- </xsl:element> -->
2099
2166
  </xsl:variable>
2100
2167
 
2101
2168
  <xsl:call-template name="calculate-column-widths">
@@ -2186,6 +2253,8 @@
2186
2253
  <xsl:apply-templates/>
2187
2254
  </fo:inline>
2188
2255
  </xsl:template><xsl:template match="*[local-name()='dl']">
2256
+ <xsl:variable name="isAdded" select="@added"/>
2257
+ <xsl:variable name="isDeleted" select="@deleted"/>
2189
2258
  <fo:block-container>
2190
2259
 
2191
2260
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2202,6 +2271,12 @@
2202
2271
  </xsl:attribute>
2203
2272
 
2204
2273
  </xsl:if>
2274
+
2275
+ <xsl:call-template name="setTrackChangesStyles">
2276
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2277
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2278
+ </xsl:call-template>
2279
+
2205
2280
  <fo:block-container>
2206
2281
 
2207
2282
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2309,11 +2384,11 @@
2309
2384
  </xsl:choose>
2310
2385
  </xsl:variable>
2311
2386
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2312
- <xsl:element name="{$ns}:table">
2387
+ <!-- <xsl:element name="{$ns}:table"> -->
2313
2388
  <tbody>
2314
2389
  <xsl:apply-templates mode="dl"/>
2315
2390
  </tbody>
2316
- </xsl:element>
2391
+ <!-- </xsl:element> -->
2317
2392
  </xsl:variable>
2318
2393
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2319
2394
  <xsl:variable name="colwidths">
@@ -2580,8 +2655,78 @@
2580
2655
  <fo:inline text-decoration="underline">
2581
2656
  <xsl:apply-templates/>
2582
2657
  </fo:inline>
2658
+ </xsl:template><xsl:template match="*[local-name()='add']">
2659
+ <xsl:choose>
2660
+ <xsl:when test="@amendment">
2661
+ <fo:inline>
2662
+ <xsl:call-template name="insertTag">
2663
+ <xsl:with-param name="kind">A</xsl:with-param>
2664
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2665
+ </xsl:call-template>
2666
+ <xsl:apply-templates/>
2667
+ <xsl:call-template name="insertTag">
2668
+ <xsl:with-param name="type">closing</xsl:with-param>
2669
+ <xsl:with-param name="kind">A</xsl:with-param>
2670
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2671
+ </xsl:call-template>
2672
+ </fo:inline>
2673
+ </xsl:when>
2674
+ <xsl:when test="@corrigenda">
2675
+ <fo:inline>
2676
+ <xsl:call-template name="insertTag">
2677
+ <xsl:with-param name="kind">C</xsl:with-param>
2678
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2679
+ </xsl:call-template>
2680
+ <xsl:apply-templates/>
2681
+ <xsl:call-template name="insertTag">
2682
+ <xsl:with-param name="type">closing</xsl:with-param>
2683
+ <xsl:with-param name="kind">C</xsl:with-param>
2684
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2685
+ </xsl:call-template>
2686
+ </fo:inline>
2687
+ </xsl:when>
2688
+ <xsl:otherwise>
2689
+ <fo:inline xsl:use-attribute-sets="add-style">
2690
+ <xsl:apply-templates/>
2691
+ </fo:inline>
2692
+ </xsl:otherwise>
2693
+ </xsl:choose>
2694
+
2695
+ </xsl:template><xsl:template name="insertTag">
2696
+ <xsl:param name="type"/>
2697
+ <xsl:param name="kind"/>
2698
+ <xsl:param name="value"/>
2699
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2700
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2701
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2702
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2703
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2704
+ <xsl:attribute name="height">5mm</xsl:attribute>
2705
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2706
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2707
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2708
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2709
+ <g>
2710
+ <xsl:if test="$type = 'closing'">
2711
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2712
+ </xsl:if>
2713
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2714
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2715
+ </g>
2716
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2717
+ <xsl:if test="$type = 'closing'">
2718
+ <xsl:attribute name="x">25</xsl:attribute>
2719
+ </xsl:if>
2720
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2721
+ </text>
2722
+ </svg>
2723
+ </fo:instream-foreign-object>
2583
2724
  </xsl:template><xsl:template match="*[local-name()='del']">
2584
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2725
+ <fo:inline xsl:use-attribute-sets="del-style">
2726
+ <xsl:apply-templates/>
2727
+ </fo:inline>
2728
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2729
+ <fo:inline background-color="yellow">
2585
2730
  <xsl:apply-templates/>
2586
2731
  </fo:inline>
2587
2732
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -2918,12 +3063,23 @@
2918
3063
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
2919
3064
  <xsl:value-of select="substring($str, 2)"/>
2920
3065
  </xsl:template><xsl:template match="mathml:math">
2921
- <fo:inline font-family="STIX Two Math"> <!-- -->
3066
+ <xsl:variable name="isAdded" select="@added"/>
3067
+ <xsl:variable name="isDeleted" select="@deleted"/>
3068
+
3069
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3070
+
3071
+
3072
+ <xsl:call-template name="setTrackChangesStyles">
3073
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3074
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3075
+ </xsl:call-template>
2922
3076
 
2923
3077
  <xsl:variable name="mathml">
2924
3078
  <xsl:apply-templates select="." mode="mathml"/>
2925
3079
  </xsl:variable>
2926
3080
  <fo:instream-foreign-object fox:alt-text="Math">
3081
+
3082
+
2927
3083
  <!-- <xsl:copy-of select="."/> -->
2928
3084
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
2929
3085
  </fo:instream-foreign-object>
@@ -2942,7 +3098,7 @@
2942
3098
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
2943
3099
  </xsl:copy>
2944
3100
  <mathml:mspace width="0.5ex"/>
2945
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3101
+ </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">
2946
3102
  <xsl:variable name="target">
2947
3103
  <xsl:choose>
2948
3104
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -2976,8 +3132,6 @@
2976
3132
  </xsl:otherwise>
2977
3133
  </xsl:choose>
2978
3134
  </fo:inline>
2979
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
2980
- <fo:inline id="{@id}"/>
2981
3135
  </xsl:template><xsl:template match="*[local-name()='appendix']">
2982
3136
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
2983
3137
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3169,8 +3323,15 @@
3169
3323
  </fo:inline>
3170
3324
  </xsl:if>
3171
3325
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3326
+ <xsl:variable name="isAdded" select="@added"/>
3327
+ <xsl:variable name="isDeleted" select="@deleted"/>
3172
3328
  <fo:block-container id="{@id}">
3173
3329
 
3330
+ <xsl:call-template name="setTrackChangesStyles">
3331
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3332
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3333
+ </xsl:call-template>
3334
+
3174
3335
  <fo:block>
3175
3336
  <xsl:apply-templates/>
3176
3337
  </fo:block>
@@ -3184,27 +3345,113 @@
3184
3345
  <fo:block id="{@id}">
3185
3346
  <xsl:apply-templates/>
3186
3347
  </fo:block>
3348
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3187
3349
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3188
3350
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3189
3351
  <xsl:apply-templates/>
3190
3352
  </fo:block>
3191
3353
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3192
- <fo:block xsl:use-attribute-sets="image-style">
3193
-
3194
-
3195
- <xsl:variable name="src">
3196
- <xsl:choose>
3197
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3198
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3199
- </xsl:when>
3200
- <xsl:otherwise>
3201
- <xsl:value-of select="@src"/>
3202
- </xsl:otherwise>
3203
- </xsl:choose>
3204
- </xsl:variable>
3205
-
3206
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3207
- </fo:block>
3354
+ <xsl:variable name="isAdded" select="../@added"/>
3355
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3356
+ <xsl:choose>
3357
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3358
+ <fo:inline padding-left="1mm" padding-right="1mm">
3359
+ <xsl:variable name="src">
3360
+ <xsl:call-template name="image_src"/>
3361
+ </xsl:variable>
3362
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3363
+ </fo:inline>
3364
+ </xsl:when>
3365
+ <xsl:otherwise>
3366
+ <fo:block xsl:use-attribute-sets="image-style">
3367
+
3368
+ <xsl:variable name="src">
3369
+ <xsl:call-template name="image_src"/>
3370
+ </xsl:variable>
3371
+
3372
+ <xsl:choose>
3373
+ <xsl:when test="$isDeleted = 'true'">
3374
+ <!-- enclose in svg -->
3375
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3376
+ <xsl:attribute name="width">100%</xsl:attribute>
3377
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3378
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3379
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3380
+
3381
+
3382
+ <xsl:apply-templates select="." mode="cross_image"/>
3383
+
3384
+ </fo:instream-foreign-object>
3385
+ </xsl:when>
3386
+ <xsl:otherwise>
3387
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3388
+ </xsl:otherwise>
3389
+ </xsl:choose>
3390
+
3391
+ </fo:block>
3392
+ </xsl:otherwise>
3393
+ </xsl:choose>
3394
+ </xsl:template><xsl:template name="image_src">
3395
+ <xsl:choose>
3396
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3397
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3398
+ </xsl:when>
3399
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3400
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3401
+ </xsl:when>
3402
+ <xsl:otherwise>
3403
+ <xsl:value-of select="@src"/>
3404
+ </xsl:otherwise>
3405
+ </xsl:choose>
3406
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3407
+ <xsl:choose>
3408
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3409
+ <xsl:variable name="src">
3410
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3411
+ </xsl:variable>
3412
+ <xsl:variable name="width" select="document($src)/@width"/>
3413
+ <xsl:variable name="height" select="document($src)/@height"/>
3414
+ <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">
3415
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3416
+ </svg>
3417
+ </xsl:when>
3418
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3419
+ <xsl:variable name="src">
3420
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3421
+ </xsl:variable>
3422
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3423
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3424
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3425
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3426
+ <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">
3427
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3428
+ </svg>
3429
+ </xsl:when>
3430
+ <xsl:otherwise>
3431
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3432
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3433
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3434
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3435
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3436
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3437
+ <!-- width=<xsl:value-of select="$width"/> -->
3438
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3439
+ <!-- height=<xsl:value-of select="$height"/> -->
3440
+ <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">
3441
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3442
+ <xsl:call-template name="svg_cross">
3443
+ <xsl:with-param name="width" select="$width"/>
3444
+ <xsl:with-param name="height" select="$height"/>
3445
+ </xsl:call-template>
3446
+ </svg>
3447
+ </xsl:otherwise>
3448
+ </xsl:choose>
3449
+
3450
+ </xsl:template><xsl:template name="svg_cross">
3451
+ <xsl:param name="width"/>
3452
+ <xsl:param name="height"/>
3453
+ <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; "/>
3454
+ <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; "/>
3208
3455
  </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">
3209
3456
  <xsl:apply-templates mode="contents"/>
3210
3457
  <xsl:text> </xsl:text>
@@ -3747,6 +3994,7 @@
3747
3994
  <xsl:variable name="element">
3748
3995
  block
3749
3996
 
3997
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3750
3998
  </xsl:variable>
3751
3999
  <xsl:choose>
3752
4000
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3754,7 +4002,7 @@
3754
4002
  <xsl:apply-templates/>
3755
4003
  </fo:inline>
3756
4004
  </xsl:when>
3757
- <xsl:when test="normalize-space($element) = 'block'">
4005
+ <xsl:when test="contains(normalize-space($element), 'block')">
3758
4006
  <fo:block xsl:use-attribute-sets="example-name-style">
3759
4007
  <xsl:apply-templates/>
3760
4008
  </fo:block>
@@ -3767,10 +4015,11 @@
3767
4015
  </xsl:choose>
3768
4016
 
3769
4017
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3770
-
4018
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3771
4019
  <xsl:variable name="element">
3772
4020
  block
3773
4021
 
4022
+
3774
4023
  </xsl:variable>
3775
4024
  <xsl:choose>
3776
4025
  <xsl:when test="normalize-space($element) = 'block'">
@@ -3870,32 +4119,50 @@
3870
4119
  <xsl:text>— </xsl:text>
3871
4120
  <xsl:apply-templates/>
3872
4121
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
3873
- <fo:inline xsl:use-attribute-sets="eref-style">
3874
- <xsl:if test="@type = 'footnote'">
3875
-
3876
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3877
- <xsl:attribute name="font-size">80%</xsl:attribute>
3878
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3879
- <xsl:attribute name="vertical-align">super</xsl:attribute>
3880
-
3881
-
3882
- </xsl:if>
3883
-
3884
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3885
-
3886
- <xsl:if test="@type = 'inline'">
3887
-
3888
- <xsl:attribute name="color">blue</xsl:attribute>
3889
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
3890
-
3891
-
3892
-
3893
- </xsl:if>
3894
-
3895
-
3896
- <xsl:apply-templates/>
3897
- </fo:basic-link>
3898
- </fo:inline>
4122
+
4123
+ <xsl:variable name="bibitemid">
4124
+ <xsl:choose>
4125
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4126
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4127
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4128
+ </xsl:choose>
4129
+ </xsl:variable>
4130
+
4131
+ <xsl:choose>
4132
+ <xsl:when test="normalize-space($bibitemid) != ''">
4133
+ <fo:inline xsl:use-attribute-sets="eref-style">
4134
+ <xsl:if test="@type = 'footnote'">
4135
+
4136
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4137
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4138
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4139
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4140
+
4141
+
4142
+ </xsl:if>
4143
+
4144
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4145
+ <xsl:if test="normalize-space(@citeas) = ''">
4146
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4147
+ </xsl:if>
4148
+ <xsl:if test="@type = 'inline'">
4149
+
4150
+ <xsl:attribute name="color">blue</xsl:attribute>
4151
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4152
+
4153
+
4154
+
4155
+ </xsl:if>
4156
+
4157
+ <xsl:apply-templates/>
4158
+ </fo:basic-link>
4159
+
4160
+ </fo:inline>
4161
+ </xsl:when>
4162
+ <xsl:otherwise>
4163
+ <fo:inline><xsl:apply-templates/></fo:inline>
4164
+ </xsl:otherwise>
4165
+ </xsl:choose>
3899
4166
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
3900
4167
  <!-- zero-space char -->
3901
4168
  <xsl:variable name="depth">
@@ -3948,7 +4215,8 @@
3948
4215
  </fo:inline>
3949
4216
  </xsl:when>
3950
4217
  <xsl:otherwise>
3951
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4218
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4219
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
3952
4220
  </xsl:otherwise>
3953
4221
  </xsl:choose>
3954
4222
 
@@ -4068,6 +4336,153 @@
4068
4336
  </fo:block>
4069
4337
  </xsl:otherwise>
4070
4338
  </xsl:choose>
4339
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4340
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4341
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4342
+ </xsl:for-each>
4343
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4344
+ <xsl:copy>
4345
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4346
+ </xsl:copy>
4347
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4348
+ <xsl:variable name="id">
4349
+ <xsl:call-template name="generateIndexXrefId"/>
4350
+ </xsl:variable>
4351
+ <xsl:copy> <!-- add id to xref -->
4352
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4353
+ <xsl:attribute name="id">
4354
+ <xsl:value-of select="$id"/>
4355
+ </xsl:attribute>
4356
+ <xsl:apply-templates mode="index_add_id"/>
4357
+ </xsl:copy>
4358
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4359
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4360
+ <xsl:if test="@to">
4361
+ <xsl:value-of select="$dash"/>
4362
+ <xsl:copy>
4363
+ <xsl:copy-of select="@*"/>
4364
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4365
+ <xsl:attribute name="id">
4366
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4367
+ </xsl:attribute>
4368
+ <xsl:apply-templates mode="index_add_id"/>
4369
+ </xsl:copy>
4370
+ </xsl:if>
4371
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4372
+ <xsl:copy>
4373
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4374
+ </xsl:copy>
4375
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4376
+ <xsl:copy>
4377
+ <xsl:apply-templates select="@*" mode="index_update"/>
4378
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4379
+ </xsl:copy>
4380
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4381
+ <xsl:param name="element"/>
4382
+ <xsl:param name="remove" select="'false'"/>
4383
+ <xsl:param name="target"/>
4384
+ <!-- <node></node> -->
4385
+ <xsl:choose>
4386
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4387
+ <!-- skip text (i.e. remove it) and process next element -->
4388
+ <!-- [removed_<xsl:value-of select="."/>] -->
4389
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4390
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4391
+ </xsl:apply-templates>
4392
+ </xsl:when>
4393
+ <xsl:when test="self::text()">
4394
+ <xsl:value-of select="."/>
4395
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4396
+ </xsl:when>
4397
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4398
+ <xsl:variable name="id" select="@id"/>
4399
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4400
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4401
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4402
+
4403
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4404
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4405
+
4406
+ <xsl:choose>
4407
+ <!-- 2nd pass -->
4408
+ <!-- if page is equal to page for next and page is not the end of range -->
4409
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4410
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4411
+ <!-- [removed_xref] -->
4412
+
4413
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4414
+ <xsl:with-param name="remove">true</xsl:with-param>
4415
+ <xsl:with-param name="target">
4416
+ <xsl:choose>
4417
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4418
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4419
+ </xsl:choose>
4420
+ </xsl:with-param>
4421
+ </xsl:apply-templates>
4422
+ </xsl:when>
4423
+
4424
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4425
+ <!-- remove xref -->
4426
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4427
+ <xsl:with-param name="remove">true</xsl:with-param>
4428
+ </xsl:apply-templates>
4429
+ </xsl:when>
4430
+
4431
+ <xsl:otherwise>
4432
+ <xsl:apply-templates select="." mode="xref_copy">
4433
+ <xsl:with-param name="target" select="$target"/>
4434
+ </xsl:apply-templates>
4435
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4436
+ </xsl:otherwise>
4437
+ </xsl:choose>
4438
+ </xsl:when>
4439
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4440
+ <!-- ul -->
4441
+ <xsl:apply-templates select="." mode="index_update"/>
4442
+ </xsl:when>
4443
+ <xsl:otherwise>
4444
+ <xsl:apply-templates select="." mode="xref_copy">
4445
+ <xsl:with-param name="target" select="$target"/>
4446
+ </xsl:apply-templates>
4447
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4448
+ </xsl:otherwise>
4449
+ </xsl:choose>
4450
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4451
+ <xsl:param name="target"/>
4452
+ <xsl:copy>
4453
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4454
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4455
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4456
+ </xsl:if>
4457
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4458
+ </xsl:copy>
4459
+ </xsl:template><xsl:template name="generateIndexXrefId">
4460
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4461
+
4462
+ <xsl:variable name="docid">
4463
+ <xsl:call-template name="getDocumentId"/>
4464
+ </xsl:variable>
4465
+ <xsl:variable name="item_number">
4466
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4467
+ </xsl:variable>
4468
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4469
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4470
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4471
+ <xsl:apply-templates/>
4472
+ <fo:block>
4473
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4474
+ <fo:block> </fo:block>
4475
+ </xsl:if>
4476
+ </fo:block>
4477
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4478
+ <xsl:apply-templates/>
4479
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4480
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4481
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4482
+ <xsl:apply-templates/>
4483
+ </fo:block>
4484
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4485
+ <fo:inline id="{@id}" font-size="1pt"/>
4071
4486
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4072
4487
  <!-- <row>
4073
4488
  <date>05-07-2013</date>
@@ -4284,63 +4699,61 @@
4284
4699
  <xsl:variable name="lang">
4285
4700
  <xsl:call-template name="getLang"/>
4286
4701
  </xsl:variable>
4287
- <fo:declarations>
4288
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4289
- <pdf:dictionary type="normal" key="ViewerPreferences">
4290
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4291
- </pdf:dictionary>
4292
- </pdf:catalog>
4293
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4294
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4295
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4296
- <!-- Dublin Core properties go here -->
4297
- <dc:title>
4298
- <xsl:variable name="title">
4299
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4300
-
4301
-
4302
-
4303
-
4304
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4305
-
4306
-
4307
-
4308
- </xsl:for-each>
4309
- </xsl:variable>
4310
- <xsl:choose>
4311
- <xsl:when test="normalize-space($title) != ''">
4312
- <xsl:value-of select="$title"/>
4313
- </xsl:when>
4314
- <xsl:otherwise>
4315
- <xsl:text> </xsl:text>
4316
- </xsl:otherwise>
4317
- </xsl:choose>
4318
- </dc:title>
4319
- <dc:creator>
4702
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4703
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4704
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4705
+ </pdf:dictionary>
4706
+ </pdf:catalog>
4707
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4708
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4709
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4710
+ <!-- Dublin Core properties go here -->
4711
+ <dc:title>
4712
+ <xsl:variable name="title">
4320
4713
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4321
4714
 
4322
4715
 
4323
4716
 
4324
- </xsl:for-each>
4325
- </dc:creator>
4326
- <dc:description>
4327
- <xsl:variable name="abstract">
4717
+
4718
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4328
4719
 
4329
4720
 
4330
- </xsl:variable>
4331
- <xsl:value-of select="normalize-space($abstract)"/>
4332
- </dc:description>
4333
- <pdf:Keywords>
4334
- <xsl:call-template name="insertKeywords"/>
4335
- </pdf:Keywords>
4336
- </rdf:Description>
4337
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4338
- <!-- XMP properties go here -->
4339
- <xmp:CreatorTool/>
4340
- </rdf:Description>
4341
- </rdf:RDF>
4342
- </x:xmpmeta>
4343
- </fo:declarations>
4721
+
4722
+ </xsl:for-each>
4723
+ </xsl:variable>
4724
+ <xsl:choose>
4725
+ <xsl:when test="normalize-space($title) != ''">
4726
+ <xsl:value-of select="$title"/>
4727
+ </xsl:when>
4728
+ <xsl:otherwise>
4729
+ <xsl:text> </xsl:text>
4730
+ </xsl:otherwise>
4731
+ </xsl:choose>
4732
+ </dc:title>
4733
+ <dc:creator>
4734
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4735
+
4736
+
4737
+
4738
+ </xsl:for-each>
4739
+ </dc:creator>
4740
+ <dc:description>
4741
+ <xsl:variable name="abstract">
4742
+
4743
+
4744
+ </xsl:variable>
4745
+ <xsl:value-of select="normalize-space($abstract)"/>
4746
+ </dc:description>
4747
+ <pdf:Keywords>
4748
+ <xsl:call-template name="insertKeywords"/>
4749
+ </pdf:Keywords>
4750
+ </rdf:Description>
4751
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4752
+ <!-- XMP properties go here -->
4753
+ <xmp:CreatorTool/>
4754
+ </rdf:Description>
4755
+ </rdf:RDF>
4756
+ </x:xmpmeta>
4344
4757
  </xsl:template><xsl:template name="getId">
4345
4758
  <xsl:choose>
4346
4759
  <xsl:when test="../@id">
@@ -4504,4 +4917,44 @@
4504
4917
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4505
4918
  </xsl:choose>
4506
4919
 
4920
+ </xsl:template><xsl:template name="setTrackChangesStyles">
4921
+ <xsl:param name="isAdded"/>
4922
+ <xsl:param name="isDeleted"/>
4923
+ <xsl:choose>
4924
+ <xsl:when test="local-name() = 'math'">
4925
+ <xsl:if test="$isAdded = 'true'">
4926
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
4927
+ </xsl:if>
4928
+ <xsl:if test="$isDeleted = 'true'">
4929
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
4930
+ </xsl:if>
4931
+ </xsl:when>
4932
+ <xsl:otherwise>
4933
+ <xsl:if test="$isAdded = 'true'">
4934
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
4935
+ <xsl:attribute name="padding">2mm</xsl:attribute>
4936
+ </xsl:if>
4937
+ <xsl:if test="$isDeleted = 'true'">
4938
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
4939
+ <xsl:if test="local-name() = 'table'">
4940
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
4941
+ </xsl:if>
4942
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
4943
+ <xsl:attribute name="padding">2mm</xsl:attribute>
4944
+ </xsl:if>
4945
+ </xsl:otherwise>
4946
+ </xsl:choose>
4947
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
4948
+ <xsl:if test="$lang = 'ar'">
4949
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
4950
+ </xsl:if>
4951
+ </xsl:template><xsl:template name="setAlignment">
4952
+ <xsl:param name="align" select="normalize-space(@align)"/>
4953
+ <xsl:choose>
4954
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
4955
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
4956
+ <xsl:when test="$align != ''">
4957
+ <xsl:value-of select="$align"/>
4958
+ </xsl:when>
4959
+ </xsl:choose>
4507
4960
  </xsl:template></xsl:stylesheet>