metanorma-m3aawg 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: bcd3ba861b70713d5782bc66f4e12a8c6f4c327ab4eb16d43232121d01236dc4
4
- data.tar.gz: 6546e0efcec8cd0680d673272fc0567e4a77c8adad1abfb0c2996ff7b43b64c4
3
+ metadata.gz: 8713634a17c1e5da0b53d534fa82875c8cb83480880e35b41ed8073ac1bde2bd
4
+ data.tar.gz: 6ae993cb255898d47eb6a452e04d8fae76c1340479041f85b1bbc54d5cc184de
5
5
  SHA512:
6
- metadata.gz: 5e49aef4506a2c960771a0adf10c8be34722c24f195645e333e807529841ddbe3967ca608780bfb7edfa1d443177a96851c2964c86e348ac99d392c79b747418
7
- data.tar.gz: e10a71799bad6095866ccf96f2a2544d761a2069572c577d3fbc999d6ff02f63e02d80a357028f8ad5576366082046411a364c7a8ef086b56d1deb4730254e52
6
+ metadata.gz: 7731ee969ce546b73ed07e7b7c463c14d9f48c5ddd04c2da15111db53b7871f0176bde79424027e7c1c19e249207ea9e04a15cd108a0e6dfc2cf5a544ed8e8ca
7
+ data.tar.gz: 1bf752b19b4937dedd9eff68d4f30df8921da484c0e9fbdc7cb7bb14c0fb2a9bed8b9223d47a577704c708e8315641d2ad11f863149e1b390a4ccf2cfc047cf9
@@ -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,6 +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
+
9
+ AllCops:
10
+ DisplayCopNames: false
11
+ StyleGuideCopsOnly: false
12
+ TargetRubyVersion: 2.4
13
+ Rails:
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>
@@ -100,6 +100,9 @@
100
100
  <zeroOrMore>
101
101
  <ref name="termdocsource"/>
102
102
  </zeroOrMore>
103
+ <optional>
104
+ <ref name="misccontainer"/>
105
+ </optional>
103
106
  <optional>
104
107
  <ref name="boilerplate"/>
105
108
  </optional>
@@ -111,6 +114,9 @@
111
114
  <ref name="annex"/>
112
115
  </zeroOrMore>
113
116
  <ref name="bibliography"/>
117
+ <zeroOrMore>
118
+ <ref name="indexsect"/>
119
+ </zeroOrMore>
114
120
  </element>
115
121
  </define>
116
122
  </grammar>
@@ -122,6 +122,13 @@ a.FootnoteRef + a.FootnoteRef:before {
122
122
  content: ", ";
123
123
  vertical-align: super; }
124
124
 
125
+ .addition {
126
+ color: blue; }
127
+
128
+ .deletion {
129
+ color: red;
130
+ text-decoration: line-through; }
131
+
125
132
  #standard-band {
126
133
  background-color: #0AC442; }
127
134
 
@@ -3,7 +3,9 @@
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
+ <xsl:param name="basepath"/>
7
9
 
8
10
 
9
11
 
@@ -73,7 +75,9 @@
73
75
 
74
76
  </fo:layout-master-set>
75
77
 
76
- <xsl:call-template name="addPDFUAmeta"/>
78
+ <fo:declarations>
79
+ <xsl:call-template name="addPDFUAmeta"/>
80
+ </fo:declarations>
77
81
 
78
82
  <xsl:call-template name="addBookmarks">
79
83
  <xsl:with-param name="contents" select="$contents"/>
@@ -1042,6 +1046,7 @@
1042
1046
  </xsl:choose>
1043
1047
  </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">
1044
1048
 
1049
+
1045
1050
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1046
1051
 
1047
1052
  <xsl:attribute name="color">blue</xsl:attribute>
@@ -1146,6 +1151,7 @@
1146
1151
 
1147
1152
 
1148
1153
 
1154
+
1149
1155
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
1150
1156
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1151
1157
 
@@ -1363,13 +1369,31 @@
1363
1369
 
1364
1370
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1365
1371
 
1366
-
1372
+
1367
1373
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1368
1374
 
1369
1375
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1370
1376
 
1371
1377
 
1372
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1378
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1379
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1380
+ </xsl:variable><xsl:attribute-set name="add-style">
1381
+ <xsl:attribute name="color">red</xsl:attribute>
1382
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1383
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1384
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1385
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1386
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1387
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1388
+ <xsl:text>red</xsl:text>
1389
+ </xsl:variable><xsl:attribute-set name="del-style">
1390
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1391
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1392
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1393
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1394
+
1395
+
1396
+ </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">
1373
1397
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1374
1398
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1375
1399
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1418,16 +1442,17 @@
1418
1442
  <xsl:call-template name="add-zero-spaces-java"/>
1419
1443
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1420
1444
 
1445
+ <xsl:variable name="table-preamble">
1446
+
1447
+
1448
+ </xsl:variable>
1449
+
1421
1450
  <xsl:variable name="table">
1422
1451
 
1423
1452
  <xsl:variable name="simple-table">
1424
1453
  <xsl:call-template name="getSimpleTable"/>
1425
1454
  </xsl:variable>
1426
1455
 
1427
-
1428
-
1429
-
1430
-
1431
1456
  <!-- <xsl:if test="$namespace = 'bipm'">
1432
1457
  <fo:block>&#xA0;</fo:block>
1433
1458
  </xsl:if> -->
@@ -1442,7 +1467,7 @@
1442
1467
 
1443
1468
 
1444
1469
 
1445
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1470
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1446
1471
 
1447
1472
  <!-- <xsl:variable name="cols-count">
1448
1473
  <xsl:choose>
@@ -1461,8 +1486,6 @@
1461
1486
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1462
1487
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1463
1488
 
1464
-
1465
-
1466
1489
  <xsl:variable name="colwidths">
1467
1490
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1468
1491
  <xsl:call-template name="calculate-column-widths">
@@ -1490,6 +1513,7 @@
1490
1513
  </xsl:choose>
1491
1514
  </xsl:variable>
1492
1515
 
1516
+
1493
1517
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1494
1518
 
1495
1519
 
@@ -1521,6 +1545,7 @@
1521
1545
 
1522
1546
 
1523
1547
 
1548
+
1524
1549
 
1525
1550
 
1526
1551
 
@@ -1610,7 +1635,8 @@
1610
1635
  </fo:block-container>
1611
1636
  </xsl:variable>
1612
1637
 
1613
-
1638
+ <xsl:variable name="isAdded" select="@added"/>
1639
+ <xsl:variable name="isDeleted" select="@deleted"/>
1614
1640
 
1615
1641
  <xsl:choose>
1616
1642
  <xsl:when test="@width">
@@ -1624,7 +1650,14 @@
1624
1650
  <fo:table-body>
1625
1651
  <fo:table-row>
1626
1652
  <fo:table-cell column-number="2">
1627
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1653
+ <xsl:copy-of select="$table-preamble"/>
1654
+ <fo:block>
1655
+ <xsl:call-template name="setTrackChangesStyles">
1656
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1657
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1658
+ </xsl:call-template>
1659
+ <xsl:copy-of select="$table"/>
1660
+ </fo:block>
1628
1661
  </fo:table-cell>
1629
1662
  </fo:table-row>
1630
1663
  </fo:table-body>
@@ -1635,7 +1668,22 @@
1635
1668
 
1636
1669
  </xsl:when>
1637
1670
  <xsl:otherwise>
1638
- <xsl:copy-of select="$table"/>
1671
+ <xsl:choose>
1672
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1673
+ <xsl:copy-of select="$table-preamble"/>
1674
+ <fo:block>
1675
+ <xsl:call-template name="setTrackChangesStyles">
1676
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1677
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1678
+ </xsl:call-template>
1679
+ <xsl:copy-of select="$table"/>
1680
+ </fo:block>
1681
+ </xsl:when>
1682
+ <xsl:otherwise>
1683
+ <xsl:copy-of select="$table-preamble"/>
1684
+ <xsl:copy-of select="$table"/>
1685
+ </xsl:otherwise>
1686
+ </xsl:choose>
1639
1687
  </xsl:otherwise>
1640
1688
  </xsl:choose>
1641
1689
 
@@ -1696,7 +1744,7 @@
1696
1744
  </xsl:for-each>
1697
1745
  </xsl:when>
1698
1746
  <xsl:otherwise>
1699
- <xsl:for-each select="xalan:nodeset($table)//tr">
1747
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1700
1748
  <xsl:variable name="td_text">
1701
1749
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1702
1750
 
@@ -1766,7 +1814,15 @@
1766
1814
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1767
1815
  <xsl:value-of select="@target"/>
1768
1816
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1769
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1817
+ <xsl:variable name="mathml">
1818
+ <xsl:for-each select="*">
1819
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1820
+ <xsl:copy-of select="."/>
1821
+ </xsl:if>
1822
+ </xsl:for-each>
1823
+ </xsl:variable>
1824
+
1825
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1770
1826
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1771
1827
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1772
1828
  <xsl:param name="cols-count"/>
@@ -2028,7 +2084,8 @@
2028
2084
  <xsl:attribute name="text-align">
2029
2085
  <xsl:choose>
2030
2086
  <xsl:when test="@align">
2031
- <xsl:value-of select="@align"/>
2087
+ <xsl:call-template name="setAlignment"/>
2088
+ <!-- <xsl:value-of select="@align"/> -->
2032
2089
  </xsl:when>
2033
2090
  <xsl:otherwise>center</xsl:otherwise>
2034
2091
  </xsl:choose>
@@ -2044,6 +2101,9 @@
2044
2101
 
2045
2102
 
2046
2103
 
2104
+ <xsl:if test="$lang = 'ar'">
2105
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2106
+ </xsl:if>
2047
2107
  <xsl:if test="@colspan">
2048
2108
  <xsl:attribute name="number-columns-spanned">
2049
2109
  <xsl:value-of select="@colspan"/>
@@ -2075,11 +2135,15 @@
2075
2135
  <xsl:attribute name="text-align">
2076
2136
  <xsl:choose>
2077
2137
  <xsl:when test="@align">
2078
- <xsl:value-of select="@align"/>
2138
+ <xsl:call-template name="setAlignment"/>
2139
+ <!-- <xsl:value-of select="@align"/> -->
2079
2140
  </xsl:when>
2080
2141
  <xsl:otherwise>left</xsl:otherwise>
2081
2142
  </xsl:choose>
2082
2143
  </xsl:attribute>
2144
+ <xsl:if test="$lang = 'ar'">
2145
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2146
+ </xsl:if>
2083
2147
 
2084
2148
 
2085
2149
 
@@ -2091,6 +2155,9 @@
2091
2155
 
2092
2156
 
2093
2157
 
2158
+ <xsl:if test=".//*[local-name() = 'table']">
2159
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2160
+ </xsl:if>
2094
2161
  <xsl:if test="@colspan">
2095
2162
  <xsl:attribute name="number-columns-spanned">
2096
2163
  <xsl:value-of select="@colspan"/>
@@ -2218,13 +2285,13 @@
2218
2285
  </xsl:choose>
2219
2286
  </xsl:variable>
2220
2287
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2221
- <xsl:element name="{$ns}:table">
2288
+ <!-- <xsl:element name="{$ns}:table"> -->
2222
2289
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2223
2290
  <tbody>
2224
2291
  <xsl:apply-templates mode="dl"/>
2225
2292
  </tbody>
2226
2293
  </xsl:for-each>
2227
- </xsl:element>
2294
+ <!-- </xsl:element> -->
2228
2295
  </xsl:variable>
2229
2296
 
2230
2297
  <xsl:call-template name="calculate-column-widths">
@@ -2315,6 +2382,8 @@
2315
2382
  <xsl:apply-templates/>
2316
2383
  </fo:inline>
2317
2384
  </xsl:template><xsl:template match="*[local-name()='dl']">
2385
+ <xsl:variable name="isAdded" select="@added"/>
2386
+ <xsl:variable name="isDeleted" select="@deleted"/>
2318
2387
  <fo:block-container>
2319
2388
 
2320
2389
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2331,6 +2400,12 @@
2331
2400
  </xsl:attribute>
2332
2401
 
2333
2402
  </xsl:if>
2403
+
2404
+ <xsl:call-template name="setTrackChangesStyles">
2405
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2406
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2407
+ </xsl:call-template>
2408
+
2334
2409
  <fo:block-container>
2335
2410
 
2336
2411
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2438,11 +2513,11 @@
2438
2513
  </xsl:choose>
2439
2514
  </xsl:variable>
2440
2515
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2441
- <xsl:element name="{$ns}:table">
2516
+ <!-- <xsl:element name="{$ns}:table"> -->
2442
2517
  <tbody>
2443
2518
  <xsl:apply-templates mode="dl"/>
2444
2519
  </tbody>
2445
- </xsl:element>
2520
+ <!-- </xsl:element> -->
2446
2521
  </xsl:variable>
2447
2522
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2448
2523
  <xsl:variable name="colwidths">
@@ -2714,8 +2789,78 @@
2714
2789
  <fo:inline text-decoration="underline">
2715
2790
  <xsl:apply-templates/>
2716
2791
  </fo:inline>
2792
+ </xsl:template><xsl:template match="*[local-name()='add']">
2793
+ <xsl:choose>
2794
+ <xsl:when test="@amendment">
2795
+ <fo:inline>
2796
+ <xsl:call-template name="insertTag">
2797
+ <xsl:with-param name="kind">A</xsl:with-param>
2798
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2799
+ </xsl:call-template>
2800
+ <xsl:apply-templates/>
2801
+ <xsl:call-template name="insertTag">
2802
+ <xsl:with-param name="type">closing</xsl:with-param>
2803
+ <xsl:with-param name="kind">A</xsl:with-param>
2804
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2805
+ </xsl:call-template>
2806
+ </fo:inline>
2807
+ </xsl:when>
2808
+ <xsl:when test="@corrigenda">
2809
+ <fo:inline>
2810
+ <xsl:call-template name="insertTag">
2811
+ <xsl:with-param name="kind">C</xsl:with-param>
2812
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2813
+ </xsl:call-template>
2814
+ <xsl:apply-templates/>
2815
+ <xsl:call-template name="insertTag">
2816
+ <xsl:with-param name="type">closing</xsl:with-param>
2817
+ <xsl:with-param name="kind">C</xsl:with-param>
2818
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2819
+ </xsl:call-template>
2820
+ </fo:inline>
2821
+ </xsl:when>
2822
+ <xsl:otherwise>
2823
+ <fo:inline xsl:use-attribute-sets="add-style">
2824
+ <xsl:apply-templates/>
2825
+ </fo:inline>
2826
+ </xsl:otherwise>
2827
+ </xsl:choose>
2828
+
2829
+ </xsl:template><xsl:template name="insertTag">
2830
+ <xsl:param name="type"/>
2831
+ <xsl:param name="kind"/>
2832
+ <xsl:param name="value"/>
2833
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2834
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2835
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2836
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2837
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2838
+ <xsl:attribute name="height">5mm</xsl:attribute>
2839
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2840
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2841
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2842
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2843
+ <g>
2844
+ <xsl:if test="$type = 'closing'">
2845
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2846
+ </xsl:if>
2847
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2848
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2849
+ </g>
2850
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2851
+ <xsl:if test="$type = 'closing'">
2852
+ <xsl:attribute name="x">25</xsl:attribute>
2853
+ </xsl:if>
2854
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2855
+ </text>
2856
+ </svg>
2857
+ </fo:instream-foreign-object>
2717
2858
  </xsl:template><xsl:template match="*[local-name()='del']">
2718
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2859
+ <fo:inline xsl:use-attribute-sets="del-style">
2860
+ <xsl:apply-templates/>
2861
+ </fo:inline>
2862
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2863
+ <fo:inline background-color="yellow">
2719
2864
  <xsl:apply-templates/>
2720
2865
  </fo:inline>
2721
2866
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -3052,12 +3197,23 @@
3052
3197
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3053
3198
  <xsl:value-of select="substring($str, 2)"/>
3054
3199
  </xsl:template><xsl:template match="mathml:math">
3055
- <fo:inline font-family="STIX Two Math"> <!-- -->
3200
+ <xsl:variable name="isAdded" select="@added"/>
3201
+ <xsl:variable name="isDeleted" select="@deleted"/>
3202
+
3203
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3204
+
3205
+
3206
+ <xsl:call-template name="setTrackChangesStyles">
3207
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3208
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3209
+ </xsl:call-template>
3056
3210
 
3057
3211
  <xsl:variable name="mathml">
3058
3212
  <xsl:apply-templates select="." mode="mathml"/>
3059
3213
  </xsl:variable>
3060
3214
  <fo:instream-foreign-object fox:alt-text="Math">
3215
+
3216
+
3061
3217
  <!-- <xsl:copy-of select="."/> -->
3062
3218
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3063
3219
  </fo:instream-foreign-object>
@@ -3076,7 +3232,7 @@
3076
3232
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3077
3233
  </xsl:copy>
3078
3234
  <mathml:mspace width="0.5ex"/>
3079
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3235
+ </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">
3080
3236
  <xsl:variable name="target">
3081
3237
  <xsl:choose>
3082
3238
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3110,8 +3266,6 @@
3110
3266
  </xsl:otherwise>
3111
3267
  </xsl:choose>
3112
3268
  </fo:inline>
3113
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3114
- <fo:inline id="{@id}"/>
3115
3269
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3116
3270
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3117
3271
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3309,8 +3463,15 @@
3309
3463
  </fo:inline>
3310
3464
  </xsl:if>
3311
3465
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3466
+ <xsl:variable name="isAdded" select="@added"/>
3467
+ <xsl:variable name="isDeleted" select="@deleted"/>
3312
3468
  <fo:block-container id="{@id}">
3313
3469
 
3470
+ <xsl:call-template name="setTrackChangesStyles">
3471
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3472
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3473
+ </xsl:call-template>
3474
+
3314
3475
  <fo:block>
3315
3476
  <xsl:apply-templates/>
3316
3477
  </fo:block>
@@ -3324,27 +3485,113 @@
3324
3485
  <fo:block id="{@id}">
3325
3486
  <xsl:apply-templates/>
3326
3487
  </fo:block>
3488
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3327
3489
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3328
3490
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3329
3491
  <xsl:apply-templates/>
3330
3492
  </fo:block>
3331
3493
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3332
- <fo:block xsl:use-attribute-sets="image-style">
3333
-
3334
-
3335
- <xsl:variable name="src">
3336
- <xsl:choose>
3337
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3338
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3339
- </xsl:when>
3340
- <xsl:otherwise>
3341
- <xsl:value-of select="@src"/>
3342
- </xsl:otherwise>
3343
- </xsl:choose>
3344
- </xsl:variable>
3345
-
3346
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3347
- </fo:block>
3494
+ <xsl:variable name="isAdded" select="../@added"/>
3495
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3496
+ <xsl:choose>
3497
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3498
+ <fo:inline padding-left="1mm" padding-right="1mm">
3499
+ <xsl:variable name="src">
3500
+ <xsl:call-template name="image_src"/>
3501
+ </xsl:variable>
3502
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3503
+ </fo:inline>
3504
+ </xsl:when>
3505
+ <xsl:otherwise>
3506
+ <fo:block xsl:use-attribute-sets="image-style">
3507
+
3508
+ <xsl:variable name="src">
3509
+ <xsl:call-template name="image_src"/>
3510
+ </xsl:variable>
3511
+
3512
+ <xsl:choose>
3513
+ <xsl:when test="$isDeleted = 'true'">
3514
+ <!-- enclose in svg -->
3515
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3516
+ <xsl:attribute name="width">100%</xsl:attribute>
3517
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3518
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3519
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3520
+
3521
+
3522
+ <xsl:apply-templates select="." mode="cross_image"/>
3523
+
3524
+ </fo:instream-foreign-object>
3525
+ </xsl:when>
3526
+ <xsl:otherwise>
3527
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3528
+ </xsl:otherwise>
3529
+ </xsl:choose>
3530
+
3531
+ </fo:block>
3532
+ </xsl:otherwise>
3533
+ </xsl:choose>
3534
+ </xsl:template><xsl:template name="image_src">
3535
+ <xsl:choose>
3536
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3537
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3538
+ </xsl:when>
3539
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3540
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3541
+ </xsl:when>
3542
+ <xsl:otherwise>
3543
+ <xsl:value-of select="@src"/>
3544
+ </xsl:otherwise>
3545
+ </xsl:choose>
3546
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3547
+ <xsl:choose>
3548
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3549
+ <xsl:variable name="src">
3550
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3551
+ </xsl:variable>
3552
+ <xsl:variable name="width" select="document($src)/@width"/>
3553
+ <xsl:variable name="height" select="document($src)/@height"/>
3554
+ <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">
3555
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3556
+ </svg>
3557
+ </xsl:when>
3558
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3559
+ <xsl:variable name="src">
3560
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3561
+ </xsl:variable>
3562
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3563
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3564
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3565
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3566
+ <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">
3567
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3568
+ </svg>
3569
+ </xsl:when>
3570
+ <xsl:otherwise>
3571
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3572
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3573
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3574
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3575
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3576
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3577
+ <!-- width=<xsl:value-of select="$width"/> -->
3578
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3579
+ <!-- height=<xsl:value-of select="$height"/> -->
3580
+ <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">
3581
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3582
+ <xsl:call-template name="svg_cross">
3583
+ <xsl:with-param name="width" select="$width"/>
3584
+ <xsl:with-param name="height" select="$height"/>
3585
+ </xsl:call-template>
3586
+ </svg>
3587
+ </xsl:otherwise>
3588
+ </xsl:choose>
3589
+
3590
+ </xsl:template><xsl:template name="svg_cross">
3591
+ <xsl:param name="width"/>
3592
+ <xsl:param name="height"/>
3593
+ <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; "/>
3594
+ <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; "/>
3348
3595
  </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">
3349
3596
  <xsl:apply-templates mode="contents"/>
3350
3597
  <xsl:text> </xsl:text>
@@ -3887,6 +4134,7 @@
3887
4134
  <xsl:variable name="element">
3888
4135
 
3889
4136
  inline
4137
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3890
4138
  </xsl:variable>
3891
4139
  <xsl:choose>
3892
4140
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3894,7 +4142,7 @@
3894
4142
  <xsl:apply-templates/>
3895
4143
  </fo:inline>
3896
4144
  </xsl:when>
3897
- <xsl:when test="normalize-space($element) = 'block'">
4145
+ <xsl:when test="contains(normalize-space($element), 'block')">
3898
4146
  <fo:block xsl:use-attribute-sets="example-name-style">
3899
4147
  <xsl:apply-templates/>
3900
4148
  </fo:block>
@@ -3907,10 +4155,11 @@
3907
4155
  </xsl:choose>
3908
4156
 
3909
4157
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3910
-
4158
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3911
4159
  <xsl:variable name="element">
3912
4160
  block
3913
4161
 
4162
+
3914
4163
  </xsl:variable>
3915
4164
  <xsl:choose>
3916
4165
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4001,29 +4250,47 @@
4001
4250
  <xsl:text>— </xsl:text>
4002
4251
  <xsl:apply-templates/>
4003
4252
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4004
- <fo:inline xsl:use-attribute-sets="eref-style">
4005
- <xsl:if test="@type = 'footnote'">
4006
-
4007
-
4008
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4009
- <xsl:attribute name="font-size">50%</xsl:attribute>
4010
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4011
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4012
-
4013
- </xsl:if>
4014
-
4015
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4016
-
4017
- <xsl:if test="@type = 'inline'">
4018
-
4019
-
4020
-
4021
- </xsl:if>
4022
-
4023
-
4024
- <xsl:apply-templates/>
4025
- </fo:basic-link>
4026
- </fo:inline>
4253
+
4254
+ <xsl:variable name="bibitemid">
4255
+ <xsl:choose>
4256
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4257
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4258
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4259
+ </xsl:choose>
4260
+ </xsl:variable>
4261
+
4262
+ <xsl:choose>
4263
+ <xsl:when test="normalize-space($bibitemid) != ''">
4264
+ <fo:inline xsl:use-attribute-sets="eref-style">
4265
+ <xsl:if test="@type = 'footnote'">
4266
+
4267
+
4268
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4269
+ <xsl:attribute name="font-size">50%</xsl:attribute>
4270
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4271
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4272
+
4273
+ </xsl:if>
4274
+
4275
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4276
+ <xsl:if test="normalize-space(@citeas) = ''">
4277
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4278
+ </xsl:if>
4279
+ <xsl:if test="@type = 'inline'">
4280
+
4281
+
4282
+
4283
+ </xsl:if>
4284
+
4285
+ <xsl:apply-templates/>
4286
+ </fo:basic-link>
4287
+
4288
+ </fo:inline>
4289
+ </xsl:when>
4290
+ <xsl:otherwise>
4291
+ <fo:inline><xsl:apply-templates/></fo:inline>
4292
+ </xsl:otherwise>
4293
+ </xsl:choose>
4027
4294
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4028
4295
  <!-- zero-space char -->
4029
4296
  <xsl:variable name="depth">
@@ -4084,7 +4351,8 @@
4084
4351
  </fo:inline>
4085
4352
  </xsl:when>
4086
4353
  <xsl:otherwise>
4087
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4354
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4355
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4088
4356
  </xsl:otherwise>
4089
4357
  </xsl:choose>
4090
4358
 
@@ -4211,6 +4479,153 @@
4211
4479
  </fo:block>
4212
4480
  </xsl:otherwise>
4213
4481
  </xsl:choose>
4482
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4483
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4484
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4485
+ </xsl:for-each>
4486
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4487
+ <xsl:copy>
4488
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4489
+ </xsl:copy>
4490
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4491
+ <xsl:variable name="id">
4492
+ <xsl:call-template name="generateIndexXrefId"/>
4493
+ </xsl:variable>
4494
+ <xsl:copy> <!-- add id to xref -->
4495
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4496
+ <xsl:attribute name="id">
4497
+ <xsl:value-of select="$id"/>
4498
+ </xsl:attribute>
4499
+ <xsl:apply-templates mode="index_add_id"/>
4500
+ </xsl:copy>
4501
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4502
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4503
+ <xsl:if test="@to">
4504
+ <xsl:value-of select="$dash"/>
4505
+ <xsl:copy>
4506
+ <xsl:copy-of select="@*"/>
4507
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4508
+ <xsl:attribute name="id">
4509
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4510
+ </xsl:attribute>
4511
+ <xsl:apply-templates mode="index_add_id"/>
4512
+ </xsl:copy>
4513
+ </xsl:if>
4514
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4515
+ <xsl:copy>
4516
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4517
+ </xsl:copy>
4518
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4519
+ <xsl:copy>
4520
+ <xsl:apply-templates select="@*" mode="index_update"/>
4521
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4522
+ </xsl:copy>
4523
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4524
+ <xsl:param name="element"/>
4525
+ <xsl:param name="remove" select="'false'"/>
4526
+ <xsl:param name="target"/>
4527
+ <!-- <node></node> -->
4528
+ <xsl:choose>
4529
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4530
+ <!-- skip text (i.e. remove it) and process next element -->
4531
+ <!-- [removed_<xsl:value-of select="."/>] -->
4532
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4533
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4534
+ </xsl:apply-templates>
4535
+ </xsl:when>
4536
+ <xsl:when test="self::text()">
4537
+ <xsl:value-of select="."/>
4538
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4539
+ </xsl:when>
4540
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4541
+ <xsl:variable name="id" select="@id"/>
4542
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4543
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4544
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4545
+
4546
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4547
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4548
+
4549
+ <xsl:choose>
4550
+ <!-- 2nd pass -->
4551
+ <!-- if page is equal to page for next and page is not the end of range -->
4552
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4553
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4554
+ <!-- [removed_xref] -->
4555
+
4556
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4557
+ <xsl:with-param name="remove">true</xsl:with-param>
4558
+ <xsl:with-param name="target">
4559
+ <xsl:choose>
4560
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4561
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4562
+ </xsl:choose>
4563
+ </xsl:with-param>
4564
+ </xsl:apply-templates>
4565
+ </xsl:when>
4566
+
4567
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4568
+ <!-- remove xref -->
4569
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4570
+ <xsl:with-param name="remove">true</xsl:with-param>
4571
+ </xsl:apply-templates>
4572
+ </xsl:when>
4573
+
4574
+ <xsl:otherwise>
4575
+ <xsl:apply-templates select="." mode="xref_copy">
4576
+ <xsl:with-param name="target" select="$target"/>
4577
+ </xsl:apply-templates>
4578
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4579
+ </xsl:otherwise>
4580
+ </xsl:choose>
4581
+ </xsl:when>
4582
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4583
+ <!-- ul -->
4584
+ <xsl:apply-templates select="." mode="index_update"/>
4585
+ </xsl:when>
4586
+ <xsl:otherwise>
4587
+ <xsl:apply-templates select="." mode="xref_copy">
4588
+ <xsl:with-param name="target" select="$target"/>
4589
+ </xsl:apply-templates>
4590
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4591
+ </xsl:otherwise>
4592
+ </xsl:choose>
4593
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4594
+ <xsl:param name="target"/>
4595
+ <xsl:copy>
4596
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4597
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4598
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4599
+ </xsl:if>
4600
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4601
+ </xsl:copy>
4602
+ </xsl:template><xsl:template name="generateIndexXrefId">
4603
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4604
+
4605
+ <xsl:variable name="docid">
4606
+ <xsl:call-template name="getDocumentId"/>
4607
+ </xsl:variable>
4608
+ <xsl:variable name="item_number">
4609
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4610
+ </xsl:variable>
4611
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4612
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4613
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4614
+ <xsl:apply-templates/>
4615
+ <fo:block>
4616
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4617
+ <fo:block> </fo:block>
4618
+ </xsl:if>
4619
+ </fo:block>
4620
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4621
+ <xsl:apply-templates/>
4622
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4623
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4624
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4625
+ <xsl:apply-templates/>
4626
+ </fo:block>
4627
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4628
+ <fo:inline id="{@id}" font-size="1pt"/>
4214
4629
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4215
4630
  <!-- <row>
4216
4631
  <date>05-07-2013</date>
@@ -4427,70 +4842,68 @@
4427
4842
  <xsl:variable name="lang">
4428
4843
  <xsl:call-template name="getLang"/>
4429
4844
  </xsl:variable>
4430
- <fo:declarations>
4431
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4432
- <pdf:dictionary type="normal" key="ViewerPreferences">
4433
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4434
- </pdf:dictionary>
4435
- </pdf:catalog>
4436
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4437
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4438
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4439
- <!-- Dublin Core properties go here -->
4440
- <dc:title>
4441
- <xsl:variable name="title">
4442
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4443
-
4444
-
4445
-
4446
-
4447
-
4448
- <xsl:value-of select="*[local-name() = 'title']"/>
4449
-
4450
-
4451
- </xsl:for-each>
4452
- </xsl:variable>
4453
- <xsl:choose>
4454
- <xsl:when test="normalize-space($title) != ''">
4455
- <xsl:value-of select="$title"/>
4456
- </xsl:when>
4457
- <xsl:otherwise>
4458
- <xsl:text> </xsl:text>
4459
- </xsl:otherwise>
4460
- </xsl:choose>
4461
- </dc:title>
4462
- <dc:creator>
4845
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4846
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4847
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4848
+ </pdf:dictionary>
4849
+ </pdf:catalog>
4850
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4851
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4852
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4853
+ <!-- Dublin Core properties go here -->
4854
+ <dc:title>
4855
+ <xsl:variable name="title">
4463
4856
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4464
4857
 
4465
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4466
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4467
- <xsl:if test="position() != last()">; </xsl:if>
4468
- </xsl:for-each>
4469
-
4470
4858
 
4471
4859
 
4472
- </xsl:for-each>
4473
- </dc:creator>
4474
- <dc:description>
4475
- <xsl:variable name="abstract">
4476
4860
 
4477
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4478
4861
 
4862
+ <xsl:value-of select="*[local-name() = 'title']"/>
4479
4863
 
4480
- </xsl:variable>
4481
- <xsl:value-of select="normalize-space($abstract)"/>
4482
- </dc:description>
4483
- <pdf:Keywords>
4484
- <xsl:call-template name="insertKeywords"/>
4485
- </pdf:Keywords>
4486
- </rdf:Description>
4487
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4488
- <!-- XMP properties go here -->
4489
- <xmp:CreatorTool/>
4490
- </rdf:Description>
4491
- </rdf:RDF>
4492
- </x:xmpmeta>
4493
- </fo:declarations>
4864
+
4865
+ </xsl:for-each>
4866
+ </xsl:variable>
4867
+ <xsl:choose>
4868
+ <xsl:when test="normalize-space($title) != ''">
4869
+ <xsl:value-of select="$title"/>
4870
+ </xsl:when>
4871
+ <xsl:otherwise>
4872
+ <xsl:text> </xsl:text>
4873
+ </xsl:otherwise>
4874
+ </xsl:choose>
4875
+ </dc:title>
4876
+ <dc:creator>
4877
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4878
+
4879
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4880
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4881
+ <xsl:if test="position() != last()">; </xsl:if>
4882
+ </xsl:for-each>
4883
+
4884
+
4885
+
4886
+ </xsl:for-each>
4887
+ </dc:creator>
4888
+ <dc:description>
4889
+ <xsl:variable name="abstract">
4890
+
4891
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4892
+
4893
+
4894
+ </xsl:variable>
4895
+ <xsl:value-of select="normalize-space($abstract)"/>
4896
+ </dc:description>
4897
+ <pdf:Keywords>
4898
+ <xsl:call-template name="insertKeywords"/>
4899
+ </pdf:Keywords>
4900
+ </rdf:Description>
4901
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4902
+ <!-- XMP properties go here -->
4903
+ <xmp:CreatorTool/>
4904
+ </rdf:Description>
4905
+ </rdf:RDF>
4906
+ </x:xmpmeta>
4494
4907
  </xsl:template><xsl:template name="getId">
4495
4908
  <xsl:choose>
4496
4909
  <xsl:when test="../@id">
@@ -4654,4 +5067,44 @@
4654
5067
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4655
5068
  </xsl:choose>
4656
5069
 
5070
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5071
+ <xsl:param name="isAdded"/>
5072
+ <xsl:param name="isDeleted"/>
5073
+ <xsl:choose>
5074
+ <xsl:when test="local-name() = 'math'">
5075
+ <xsl:if test="$isAdded = 'true'">
5076
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5077
+ </xsl:if>
5078
+ <xsl:if test="$isDeleted = 'true'">
5079
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5080
+ </xsl:if>
5081
+ </xsl:when>
5082
+ <xsl:otherwise>
5083
+ <xsl:if test="$isAdded = 'true'">
5084
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5085
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5086
+ </xsl:if>
5087
+ <xsl:if test="$isDeleted = 'true'">
5088
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5089
+ <xsl:if test="local-name() = 'table'">
5090
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5091
+ </xsl:if>
5092
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5093
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5094
+ </xsl:if>
5095
+ </xsl:otherwise>
5096
+ </xsl:choose>
5097
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5098
+ <xsl:if test="$lang = 'ar'">
5099
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5100
+ </xsl:if>
5101
+ </xsl:template><xsl:template name="setAlignment">
5102
+ <xsl:param name="align" select="normalize-space(@align)"/>
5103
+ <xsl:choose>
5104
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5105
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5106
+ <xsl:when test="$align != ''">
5107
+ <xsl:value-of select="$align"/>
5108
+ </xsl:when>
5109
+ </xsl:choose>
4657
5110
  </xsl:template></xsl:stylesheet>