metanorma-un 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: 4ac4dfb800b093d690e6794598aa8156d689d00ee3d60056c2a8f75de4c603e2
4
- data.tar.gz: 4005cbaf627818c531ec208e0d2f53f90067f0d2e812582973264fa680639a1c
3
+ metadata.gz: 9c90de3003be5bb327042c4c18599a7370ce7a301dfab79344ccdf3a8d9d870c
4
+ data.tar.gz: 380402b9b954aeac4986fe2599d44b5334367db790b68e8bc01a524d6fab6833
5
5
  SHA512:
6
- metadata.gz: 7fbc779c9ab63e8689a1224fcc4b725faf59fd6b6f40e1e71a81ff5227a286590ca02e23a92cf69593d29fb98f95526af24fa156d639f0dc4b52fb693bfc046a
7
- data.tar.gz: 996c353ed8ee929fd8d3d95df7d6b59049cb38f054b14e993abea7d820110f7a32dfbd129f067e9961ffe26e06392588391cdf56be1ccef3e010377e8cfead00
6
+ metadata.gz: 0bc101d08b76185ec9a6f9ebd8f5edb9829a60dde96c0bd98f7871734cc09a541cb539b7cc64762d0de2b9ed598ab81aa2e8f3ace9c82c20b79ff2a94d497412
7
+ data.tar.gz: 104ccc6eb3d64ba0d96b20ed9b14b682d90e0c3407291a7580779a5da1f276d5c044ddf6c37113b5374c8fd2950001b70d95e2de7bb8864718645cb55e08136a
@@ -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>
@@ -348,6 +348,9 @@
348
348
  </choice>
349
349
  </attribute>
350
350
  <ref name="bibdata"/>
351
+ <optional>
352
+ <ref name="misccontainer"/>
353
+ </optional>
351
354
  <optional>
352
355
  <ref name="boilerplate"/>
353
356
  </optional>
@@ -358,6 +361,9 @@
358
361
  <zeroOrMore>
359
362
  <ref name="annex"/>
360
363
  </zeroOrMore>
364
+ <zeroOrMore>
365
+ <ref name="indexsect"/>
366
+ </zeroOrMore>
361
367
  </element>
362
368
  </define>
363
369
  </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
 
@@ -37,7 +37,6 @@ module IsoDoc
37
37
  htmlstylesheet: html_doc_path("htmlstyle.scss"),
38
38
  htmlcoverpage: html_doc_path("html_unece_titlepage.html"),
39
39
  htmlintropage: html_doc_path("html_unece_intro.html"),
40
- scripts: html_doc_path("scripts.html"),
41
40
  }
42
41
  end
43
42
 
@@ -3,7 +3,9 @@
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
+ <xsl:param name="basepath"/>
7
9
 
8
10
 
9
11
 
@@ -72,7 +74,9 @@
72
74
  </fo:page-sequence-master>
73
75
  </fo:layout-master-set>
74
76
 
75
- <xsl:call-template name="addPDFUAmeta"/>
77
+ <fo:declarations>
78
+ <xsl:call-template name="addPDFUAmeta"/>
79
+ </fo:declarations>
76
80
 
77
81
  <xsl:call-template name="addBookmarks">
78
82
  <xsl:with-param name="contents" select="$contents"/>
@@ -1347,6 +1351,7 @@
1347
1351
  </xsl:choose>
1348
1352
  </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">
1349
1353
 
1354
+
1350
1355
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1351
1356
 
1352
1357
 
@@ -1448,6 +1453,7 @@
1448
1453
 
1449
1454
 
1450
1455
 
1456
+
1451
1457
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1452
1458
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1453
1459
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1649,13 +1655,31 @@
1649
1655
 
1650
1656
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1651
1657
 
1652
-
1658
+
1653
1659
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1654
1660
 
1655
1661
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
1656
1662
 
1657
1663
 
1658
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1664
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1665
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1666
+ </xsl:variable><xsl:attribute-set name="add-style">
1667
+ <xsl:attribute name="color">red</xsl:attribute>
1668
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1669
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1670
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1671
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1672
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1673
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1674
+ <xsl:text>red</xsl:text>
1675
+ </xsl:variable><xsl:attribute-set name="del-style">
1676
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1677
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1678
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1679
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1680
+
1681
+
1682
+ </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">
1659
1683
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1660
1684
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1661
1685
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1700,16 +1724,17 @@
1700
1724
  <xsl:call-template name="add-zero-spaces-java"/>
1701
1725
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1702
1726
 
1727
+ <xsl:variable name="table-preamble">
1728
+
1729
+
1730
+ </xsl:variable>
1731
+
1703
1732
  <xsl:variable name="table">
1704
1733
 
1705
1734
  <xsl:variable name="simple-table">
1706
1735
  <xsl:call-template name="getSimpleTable"/>
1707
1736
  </xsl:variable>
1708
1737
 
1709
-
1710
-
1711
-
1712
-
1713
1738
  <!-- <xsl:if test="$namespace = 'bipm'">
1714
1739
  <fo:block>&#xA0;</fo:block>
1715
1740
  </xsl:if> -->
@@ -1724,7 +1749,7 @@
1724
1749
 
1725
1750
 
1726
1751
 
1727
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1752
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1728
1753
 
1729
1754
  <!-- <xsl:variable name="cols-count">
1730
1755
  <xsl:choose>
@@ -1743,8 +1768,6 @@
1743
1768
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1744
1769
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1745
1770
 
1746
-
1747
-
1748
1771
  <xsl:variable name="colwidths">
1749
1772
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1750
1773
  <xsl:call-template name="calculate-column-widths">
@@ -1772,6 +1795,7 @@
1772
1795
  </xsl:choose>
1773
1796
  </xsl:variable>
1774
1797
 
1798
+
1775
1799
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1776
1800
 
1777
1801
 
@@ -1811,6 +1835,7 @@
1811
1835
 
1812
1836
 
1813
1837
 
1838
+
1814
1839
 
1815
1840
 
1816
1841
 
@@ -1902,7 +1927,8 @@
1902
1927
  </fo:block-container>
1903
1928
  </xsl:variable>
1904
1929
 
1905
-
1930
+ <xsl:variable name="isAdded" select="@added"/>
1931
+ <xsl:variable name="isDeleted" select="@deleted"/>
1906
1932
 
1907
1933
  <xsl:choose>
1908
1934
  <xsl:when test="@width">
@@ -1911,12 +1937,42 @@
1911
1937
 
1912
1938
 
1913
1939
 
1914
- <xsl:copy-of select="$table"/>
1940
+ <xsl:choose>
1941
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1942
+ <xsl:copy-of select="$table-preamble"/>
1943
+ <fo:block>
1944
+ <xsl:call-template name="setTrackChangesStyles">
1945
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1946
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1947
+ </xsl:call-template>
1948
+ <xsl:copy-of select="$table"/>
1949
+ </fo:block>
1950
+ </xsl:when>
1951
+ <xsl:otherwise>
1952
+ <xsl:copy-of select="$table-preamble"/>
1953
+ <xsl:copy-of select="$table"/>
1954
+ </xsl:otherwise>
1955
+ </xsl:choose>
1915
1956
 
1916
1957
 
1917
1958
  </xsl:when>
1918
1959
  <xsl:otherwise>
1919
- <xsl:copy-of select="$table"/>
1960
+ <xsl:choose>
1961
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1962
+ <xsl:copy-of select="$table-preamble"/>
1963
+ <fo:block>
1964
+ <xsl:call-template name="setTrackChangesStyles">
1965
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1966
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1967
+ </xsl:call-template>
1968
+ <xsl:copy-of select="$table"/>
1969
+ </fo:block>
1970
+ </xsl:when>
1971
+ <xsl:otherwise>
1972
+ <xsl:copy-of select="$table-preamble"/>
1973
+ <xsl:copy-of select="$table"/>
1974
+ </xsl:otherwise>
1975
+ </xsl:choose>
1920
1976
  </xsl:otherwise>
1921
1977
  </xsl:choose>
1922
1978
 
@@ -1977,7 +2033,7 @@
1977
2033
  </xsl:for-each>
1978
2034
  </xsl:when>
1979
2035
  <xsl:otherwise>
1980
- <xsl:for-each select="xalan:nodeset($table)//tr">
2036
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1981
2037
  <xsl:variable name="td_text">
1982
2038
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1983
2039
 
@@ -2047,7 +2103,15 @@
2047
2103
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2048
2104
  <xsl:value-of select="@target"/>
2049
2105
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2050
- <xsl:variable name="math_text" select="normalize-space(.)"/>
2106
+ <xsl:variable name="mathml">
2107
+ <xsl:for-each select="*">
2108
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2109
+ <xsl:copy-of select="."/>
2110
+ </xsl:if>
2111
+ </xsl:for-each>
2112
+ </xsl:variable>
2113
+
2114
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2051
2115
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2052
2116
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2053
2117
  <xsl:param name="cols-count"/>
@@ -2313,7 +2377,8 @@
2313
2377
  <xsl:attribute name="text-align">
2314
2378
  <xsl:choose>
2315
2379
  <xsl:when test="@align">
2316
- <xsl:value-of select="@align"/>
2380
+ <xsl:call-template name="setAlignment"/>
2381
+ <!-- <xsl:value-of select="@align"/> -->
2317
2382
  </xsl:when>
2318
2383
  <xsl:otherwise>center</xsl:otherwise>
2319
2384
  </xsl:choose>
@@ -2339,6 +2404,9 @@
2339
2404
 
2340
2405
 
2341
2406
 
2407
+ <xsl:if test="$lang = 'ar'">
2408
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2409
+ </xsl:if>
2342
2410
  <xsl:if test="@colspan">
2343
2411
  <xsl:attribute name="number-columns-spanned">
2344
2412
  <xsl:value-of select="@colspan"/>
@@ -2370,11 +2438,15 @@
2370
2438
  <xsl:attribute name="text-align">
2371
2439
  <xsl:choose>
2372
2440
  <xsl:when test="@align">
2373
- <xsl:value-of select="@align"/>
2441
+ <xsl:call-template name="setAlignment"/>
2442
+ <!-- <xsl:value-of select="@align"/> -->
2374
2443
  </xsl:when>
2375
2444
  <xsl:otherwise>left</xsl:otherwise>
2376
2445
  </xsl:choose>
2377
2446
  </xsl:attribute>
2447
+ <xsl:if test="$lang = 'ar'">
2448
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2449
+ </xsl:if>
2378
2450
 
2379
2451
 
2380
2452
 
@@ -2394,6 +2466,9 @@
2394
2466
 
2395
2467
 
2396
2468
 
2469
+ <xsl:if test=".//*[local-name() = 'table']">
2470
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2471
+ </xsl:if>
2397
2472
  <xsl:if test="@colspan">
2398
2473
  <xsl:attribute name="number-columns-spanned">
2399
2474
  <xsl:value-of select="@colspan"/>
@@ -2531,13 +2606,13 @@
2531
2606
  </xsl:choose>
2532
2607
  </xsl:variable>
2533
2608
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2534
- <xsl:element name="{$ns}:table">
2609
+ <!-- <xsl:element name="{$ns}:table"> -->
2535
2610
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2536
2611
  <tbody>
2537
2612
  <xsl:apply-templates mode="dl"/>
2538
2613
  </tbody>
2539
2614
  </xsl:for-each>
2540
- </xsl:element>
2615
+ <!-- </xsl:element> -->
2541
2616
  </xsl:variable>
2542
2617
 
2543
2618
  <xsl:call-template name="calculate-column-widths">
@@ -2628,6 +2703,8 @@
2628
2703
  <xsl:apply-templates/>
2629
2704
  </fo:inline>
2630
2705
  </xsl:template><xsl:template match="*[local-name()='dl']">
2706
+ <xsl:variable name="isAdded" select="@added"/>
2707
+ <xsl:variable name="isDeleted" select="@deleted"/>
2631
2708
  <fo:block-container>
2632
2709
 
2633
2710
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2644,6 +2721,12 @@
2644
2721
  </xsl:attribute>
2645
2722
 
2646
2723
  </xsl:if>
2724
+
2725
+ <xsl:call-template name="setTrackChangesStyles">
2726
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2727
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2728
+ </xsl:call-template>
2729
+
2647
2730
  <fo:block-container>
2648
2731
 
2649
2732
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2751,11 +2834,11 @@
2751
2834
  </xsl:choose>
2752
2835
  </xsl:variable>
2753
2836
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2754
- <xsl:element name="{$ns}:table">
2837
+ <!-- <xsl:element name="{$ns}:table"> -->
2755
2838
  <tbody>
2756
2839
  <xsl:apply-templates mode="dl"/>
2757
2840
  </tbody>
2758
- </xsl:element>
2841
+ <!-- </xsl:element> -->
2759
2842
  </xsl:variable>
2760
2843
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2761
2844
  <xsl:variable name="colwidths">
@@ -3022,8 +3105,78 @@
3022
3105
  <fo:inline text-decoration="underline">
3023
3106
  <xsl:apply-templates/>
3024
3107
  </fo:inline>
3108
+ </xsl:template><xsl:template match="*[local-name()='add']">
3109
+ <xsl:choose>
3110
+ <xsl:when test="@amendment">
3111
+ <fo:inline>
3112
+ <xsl:call-template name="insertTag">
3113
+ <xsl:with-param name="kind">A</xsl:with-param>
3114
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3115
+ </xsl:call-template>
3116
+ <xsl:apply-templates/>
3117
+ <xsl:call-template name="insertTag">
3118
+ <xsl:with-param name="type">closing</xsl:with-param>
3119
+ <xsl:with-param name="kind">A</xsl:with-param>
3120
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
3121
+ </xsl:call-template>
3122
+ </fo:inline>
3123
+ </xsl:when>
3124
+ <xsl:when test="@corrigenda">
3125
+ <fo:inline>
3126
+ <xsl:call-template name="insertTag">
3127
+ <xsl:with-param name="kind">C</xsl:with-param>
3128
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3129
+ </xsl:call-template>
3130
+ <xsl:apply-templates/>
3131
+ <xsl:call-template name="insertTag">
3132
+ <xsl:with-param name="type">closing</xsl:with-param>
3133
+ <xsl:with-param name="kind">C</xsl:with-param>
3134
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
3135
+ </xsl:call-template>
3136
+ </fo:inline>
3137
+ </xsl:when>
3138
+ <xsl:otherwise>
3139
+ <fo:inline xsl:use-attribute-sets="add-style">
3140
+ <xsl:apply-templates/>
3141
+ </fo:inline>
3142
+ </xsl:otherwise>
3143
+ </xsl:choose>
3144
+
3145
+ </xsl:template><xsl:template name="insertTag">
3146
+ <xsl:param name="type"/>
3147
+ <xsl:param name="kind"/>
3148
+ <xsl:param name="value"/>
3149
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
3150
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
3151
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
3152
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
3153
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
3154
+ <xsl:attribute name="height">5mm</xsl:attribute>
3155
+ <xsl:attribute name="content-width">100%</xsl:attribute>
3156
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3157
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3158
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
3159
+ <g>
3160
+ <xsl:if test="$type = 'closing'">
3161
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
3162
+ </xsl:if>
3163
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
3164
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
3165
+ </g>
3166
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
3167
+ <xsl:if test="$type = 'closing'">
3168
+ <xsl:attribute name="x">25</xsl:attribute>
3169
+ </xsl:if>
3170
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
3171
+ </text>
3172
+ </svg>
3173
+ </fo:instream-foreign-object>
3025
3174
  </xsl:template><xsl:template match="*[local-name()='del']">
3026
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3175
+ <fo:inline xsl:use-attribute-sets="del-style">
3176
+ <xsl:apply-templates/>
3177
+ </fo:inline>
3178
+ </xsl:template><xsl:template match="*[local-name()='hi']">
3179
+ <fo:inline background-color="yellow">
3027
3180
  <xsl:apply-templates/>
3028
3181
  </fo:inline>
3029
3182
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -3360,12 +3513,23 @@
3360
3513
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3361
3514
  <xsl:value-of select="substring($str, 2)"/>
3362
3515
  </xsl:template><xsl:template match="mathml:math">
3363
- <fo:inline font-family="STIX Two Math"> <!-- -->
3516
+ <xsl:variable name="isAdded" select="@added"/>
3517
+ <xsl:variable name="isDeleted" select="@deleted"/>
3518
+
3519
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3520
+
3521
+
3522
+ <xsl:call-template name="setTrackChangesStyles">
3523
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3524
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3525
+ </xsl:call-template>
3364
3526
 
3365
3527
  <xsl:variable name="mathml">
3366
3528
  <xsl:apply-templates select="." mode="mathml"/>
3367
3529
  </xsl:variable>
3368
3530
  <fo:instream-foreign-object fox:alt-text="Math">
3531
+
3532
+
3369
3533
  <!-- <xsl:copy-of select="."/> -->
3370
3534
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3371
3535
  </fo:instream-foreign-object>
@@ -3384,7 +3548,7 @@
3384
3548
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3385
3549
  </xsl:copy>
3386
3550
  <mathml:mspace width="0.5ex"/>
3387
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3551
+ </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">
3388
3552
  <xsl:variable name="target">
3389
3553
  <xsl:choose>
3390
3554
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3418,8 +3582,6 @@
3418
3582
  </xsl:otherwise>
3419
3583
  </xsl:choose>
3420
3584
  </fo:inline>
3421
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3422
- <fo:inline id="{@id}"/>
3423
3585
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3424
3586
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3425
3587
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3624,8 +3786,15 @@
3624
3786
  </fo:inline>
3625
3787
  </xsl:if>
3626
3788
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3789
+ <xsl:variable name="isAdded" select="@added"/>
3790
+ <xsl:variable name="isDeleted" select="@deleted"/>
3627
3791
  <fo:block-container id="{@id}">
3628
3792
 
3793
+ <xsl:call-template name="setTrackChangesStyles">
3794
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3795
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3796
+ </xsl:call-template>
3797
+
3629
3798
  <fo:block>
3630
3799
  <xsl:apply-templates/>
3631
3800
  </fo:block>
@@ -3639,27 +3808,113 @@
3639
3808
  <fo:block id="{@id}">
3640
3809
  <xsl:apply-templates/>
3641
3810
  </fo:block>
3811
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3642
3812
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3643
3813
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3644
3814
  <xsl:apply-templates/>
3645
3815
  </fo:block>
3646
3816
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3647
- <fo:block xsl:use-attribute-sets="image-style">
3648
-
3649
-
3650
- <xsl:variable name="src">
3651
- <xsl:choose>
3652
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3653
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3654
- </xsl:when>
3655
- <xsl:otherwise>
3656
- <xsl:value-of select="@src"/>
3657
- </xsl:otherwise>
3658
- </xsl:choose>
3659
- </xsl:variable>
3660
-
3661
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3662
- </fo:block>
3817
+ <xsl:variable name="isAdded" select="../@added"/>
3818
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3819
+ <xsl:choose>
3820
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3821
+ <fo:inline padding-left="1mm" padding-right="1mm">
3822
+ <xsl:variable name="src">
3823
+ <xsl:call-template name="image_src"/>
3824
+ </xsl:variable>
3825
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3826
+ </fo:inline>
3827
+ </xsl:when>
3828
+ <xsl:otherwise>
3829
+ <fo:block xsl:use-attribute-sets="image-style">
3830
+
3831
+ <xsl:variable name="src">
3832
+ <xsl:call-template name="image_src"/>
3833
+ </xsl:variable>
3834
+
3835
+ <xsl:choose>
3836
+ <xsl:when test="$isDeleted = 'true'">
3837
+ <!-- enclose in svg -->
3838
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3839
+ <xsl:attribute name="width">100%</xsl:attribute>
3840
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3841
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3842
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3843
+
3844
+
3845
+ <xsl:apply-templates select="." mode="cross_image"/>
3846
+
3847
+ </fo:instream-foreign-object>
3848
+ </xsl:when>
3849
+ <xsl:otherwise>
3850
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3851
+ </xsl:otherwise>
3852
+ </xsl:choose>
3853
+
3854
+ </fo:block>
3855
+ </xsl:otherwise>
3856
+ </xsl:choose>
3857
+ </xsl:template><xsl:template name="image_src">
3858
+ <xsl:choose>
3859
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3860
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3861
+ </xsl:when>
3862
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3863
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3864
+ </xsl:when>
3865
+ <xsl:otherwise>
3866
+ <xsl:value-of select="@src"/>
3867
+ </xsl:otherwise>
3868
+ </xsl:choose>
3869
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3870
+ <xsl:choose>
3871
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3872
+ <xsl:variable name="src">
3873
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3874
+ </xsl:variable>
3875
+ <xsl:variable name="width" select="document($src)/@width"/>
3876
+ <xsl:variable name="height" select="document($src)/@height"/>
3877
+ <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">
3878
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3879
+ </svg>
3880
+ </xsl:when>
3881
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3882
+ <xsl:variable name="src">
3883
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3884
+ </xsl:variable>
3885
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3886
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3887
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3888
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3889
+ <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">
3890
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3891
+ </svg>
3892
+ </xsl:when>
3893
+ <xsl:otherwise>
3894
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3895
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3896
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3897
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3898
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3899
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3900
+ <!-- width=<xsl:value-of select="$width"/> -->
3901
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3902
+ <!-- height=<xsl:value-of select="$height"/> -->
3903
+ <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">
3904
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3905
+ <xsl:call-template name="svg_cross">
3906
+ <xsl:with-param name="width" select="$width"/>
3907
+ <xsl:with-param name="height" select="$height"/>
3908
+ </xsl:call-template>
3909
+ </svg>
3910
+ </xsl:otherwise>
3911
+ </xsl:choose>
3912
+
3913
+ </xsl:template><xsl:template name="svg_cross">
3914
+ <xsl:param name="width"/>
3915
+ <xsl:param name="height"/>
3916
+ <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; "/>
3917
+ <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; "/>
3663
3918
  </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">
3664
3919
  <xsl:apply-templates mode="contents"/>
3665
3920
  <xsl:text> </xsl:text>
@@ -4202,6 +4457,7 @@
4202
4457
  <xsl:variable name="element">
4203
4458
  block
4204
4459
 
4460
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
4205
4461
  </xsl:variable>
4206
4462
  <xsl:choose>
4207
4463
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -4209,7 +4465,7 @@
4209
4465
  <xsl:apply-templates/>
4210
4466
  </fo:inline>
4211
4467
  </xsl:when>
4212
- <xsl:when test="normalize-space($element) = 'block'">
4468
+ <xsl:when test="contains(normalize-space($element), 'block')">
4213
4469
  <fo:block xsl:use-attribute-sets="example-name-style">
4214
4470
  <xsl:apply-templates/>
4215
4471
  </fo:block>
@@ -4222,10 +4478,11 @@
4222
4478
  </xsl:choose>
4223
4479
 
4224
4480
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4225
-
4481
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4226
4482
  <xsl:variable name="element">
4227
4483
  block
4228
4484
 
4485
+
4229
4486
  </xsl:variable>
4230
4487
  <xsl:choose>
4231
4488
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4321,31 +4578,49 @@
4321
4578
  <xsl:text>— </xsl:text>
4322
4579
  <xsl:apply-templates/>
4323
4580
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4324
- <fo:inline xsl:use-attribute-sets="eref-style">
4325
- <xsl:if test="@type = 'footnote'">
4326
-
4327
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4328
- <xsl:attribute name="font-size">80%</xsl:attribute>
4329
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4330
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4331
-
4332
-
4333
- </xsl:if>
4334
-
4335
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4336
-
4337
- <xsl:if test="@type = 'inline'">
4338
-
4339
-
4340
-
4341
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
4342
-
4343
- </xsl:if>
4344
-
4345
-
4346
- <xsl:apply-templates/>
4347
- </fo:basic-link>
4348
- </fo:inline>
4581
+
4582
+ <xsl:variable name="bibitemid">
4583
+ <xsl:choose>
4584
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4585
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4586
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4587
+ </xsl:choose>
4588
+ </xsl:variable>
4589
+
4590
+ <xsl:choose>
4591
+ <xsl:when test="normalize-space($bibitemid) != ''">
4592
+ <fo:inline xsl:use-attribute-sets="eref-style">
4593
+ <xsl:if test="@type = 'footnote'">
4594
+
4595
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4596
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4597
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4598
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4599
+
4600
+
4601
+ </xsl:if>
4602
+
4603
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4604
+ <xsl:if test="normalize-space(@citeas) = ''">
4605
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4606
+ </xsl:if>
4607
+ <xsl:if test="@type = 'inline'">
4608
+
4609
+
4610
+
4611
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4612
+
4613
+ </xsl:if>
4614
+
4615
+ <xsl:apply-templates/>
4616
+ </fo:basic-link>
4617
+
4618
+ </fo:inline>
4619
+ </xsl:when>
4620
+ <xsl:otherwise>
4621
+ <fo:inline><xsl:apply-templates/></fo:inline>
4622
+ </xsl:otherwise>
4623
+ </xsl:choose>
4349
4624
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4350
4625
  <!-- zero-space char -->
4351
4626
  <xsl:variable name="depth">
@@ -4403,7 +4678,8 @@
4403
4678
  </fo:inline>
4404
4679
  </xsl:when>
4405
4680
  <xsl:otherwise>
4406
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4681
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4682
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4407
4683
  </xsl:otherwise>
4408
4684
  </xsl:choose>
4409
4685
 
@@ -4533,6 +4809,153 @@
4533
4809
  </fo:block>
4534
4810
  </xsl:otherwise>
4535
4811
  </xsl:choose>
4812
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4813
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4814
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4815
+ </xsl:for-each>
4816
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4817
+ <xsl:copy>
4818
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4819
+ </xsl:copy>
4820
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4821
+ <xsl:variable name="id">
4822
+ <xsl:call-template name="generateIndexXrefId"/>
4823
+ </xsl:variable>
4824
+ <xsl:copy> <!-- add id to xref -->
4825
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4826
+ <xsl:attribute name="id">
4827
+ <xsl:value-of select="$id"/>
4828
+ </xsl:attribute>
4829
+ <xsl:apply-templates mode="index_add_id"/>
4830
+ </xsl:copy>
4831
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4832
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4833
+ <xsl:if test="@to">
4834
+ <xsl:value-of select="$dash"/>
4835
+ <xsl:copy>
4836
+ <xsl:copy-of select="@*"/>
4837
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4838
+ <xsl:attribute name="id">
4839
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4840
+ </xsl:attribute>
4841
+ <xsl:apply-templates mode="index_add_id"/>
4842
+ </xsl:copy>
4843
+ </xsl:if>
4844
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4845
+ <xsl:copy>
4846
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4847
+ </xsl:copy>
4848
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4849
+ <xsl:copy>
4850
+ <xsl:apply-templates select="@*" mode="index_update"/>
4851
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4852
+ </xsl:copy>
4853
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4854
+ <xsl:param name="element"/>
4855
+ <xsl:param name="remove" select="'false'"/>
4856
+ <xsl:param name="target"/>
4857
+ <!-- <node></node> -->
4858
+ <xsl:choose>
4859
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4860
+ <!-- skip text (i.e. remove it) and process next element -->
4861
+ <!-- [removed_<xsl:value-of select="."/>] -->
4862
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4863
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4864
+ </xsl:apply-templates>
4865
+ </xsl:when>
4866
+ <xsl:when test="self::text()">
4867
+ <xsl:value-of select="."/>
4868
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4869
+ </xsl:when>
4870
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4871
+ <xsl:variable name="id" select="@id"/>
4872
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4873
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4874
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4875
+
4876
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4877
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4878
+
4879
+ <xsl:choose>
4880
+ <!-- 2nd pass -->
4881
+ <!-- if page is equal to page for next and page is not the end of range -->
4882
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4883
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4884
+ <!-- [removed_xref] -->
4885
+
4886
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4887
+ <xsl:with-param name="remove">true</xsl:with-param>
4888
+ <xsl:with-param name="target">
4889
+ <xsl:choose>
4890
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4891
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4892
+ </xsl:choose>
4893
+ </xsl:with-param>
4894
+ </xsl:apply-templates>
4895
+ </xsl:when>
4896
+
4897
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4898
+ <!-- remove xref -->
4899
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4900
+ <xsl:with-param name="remove">true</xsl:with-param>
4901
+ </xsl:apply-templates>
4902
+ </xsl:when>
4903
+
4904
+ <xsl:otherwise>
4905
+ <xsl:apply-templates select="." mode="xref_copy">
4906
+ <xsl:with-param name="target" select="$target"/>
4907
+ </xsl:apply-templates>
4908
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4909
+ </xsl:otherwise>
4910
+ </xsl:choose>
4911
+ </xsl:when>
4912
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4913
+ <!-- ul -->
4914
+ <xsl:apply-templates select="." mode="index_update"/>
4915
+ </xsl:when>
4916
+ <xsl:otherwise>
4917
+ <xsl:apply-templates select="." mode="xref_copy">
4918
+ <xsl:with-param name="target" select="$target"/>
4919
+ </xsl:apply-templates>
4920
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4921
+ </xsl:otherwise>
4922
+ </xsl:choose>
4923
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4924
+ <xsl:param name="target"/>
4925
+ <xsl:copy>
4926
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4927
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4928
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4929
+ </xsl:if>
4930
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4931
+ </xsl:copy>
4932
+ </xsl:template><xsl:template name="generateIndexXrefId">
4933
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4934
+
4935
+ <xsl:variable name="docid">
4936
+ <xsl:call-template name="getDocumentId"/>
4937
+ </xsl:variable>
4938
+ <xsl:variable name="item_number">
4939
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4940
+ </xsl:variable>
4941
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4942
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4943
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4944
+ <xsl:apply-templates/>
4945
+ <fo:block>
4946
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4947
+ <fo:block> </fo:block>
4948
+ </xsl:if>
4949
+ </fo:block>
4950
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4951
+ <xsl:apply-templates/>
4952
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4953
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4954
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4955
+ <xsl:apply-templates/>
4956
+ </fo:block>
4957
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4958
+ <fo:inline id="{@id}" font-size="1pt"/>
4536
4959
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4537
4960
  <!-- <row>
4538
4961
  <date>05-07-2013</date>
@@ -4749,70 +5172,68 @@
4749
5172
  <xsl:variable name="lang">
4750
5173
  <xsl:call-template name="getLang"/>
4751
5174
  </xsl:variable>
4752
- <fo:declarations>
4753
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4754
- <pdf:dictionary type="normal" key="ViewerPreferences">
4755
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4756
- </pdf:dictionary>
4757
- </pdf:catalog>
4758
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4759
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4760
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4761
- <!-- Dublin Core properties go here -->
4762
- <dc:title>
4763
- <xsl:variable name="title">
4764
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4765
-
4766
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4767
-
4768
-
4769
-
4770
-
4771
-
4772
-
4773
- </xsl:for-each>
4774
- </xsl:variable>
4775
- <xsl:choose>
4776
- <xsl:when test="normalize-space($title) != ''">
4777
- <xsl:value-of select="$title"/>
4778
- </xsl:when>
4779
- <xsl:otherwise>
4780
- <xsl:text> </xsl:text>
4781
- </xsl:otherwise>
4782
- </xsl:choose>
4783
- </dc:title>
4784
- <dc:creator>
5175
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
5176
+ <pdf:dictionary type="normal" key="ViewerPreferences">
5177
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
5178
+ </pdf:dictionary>
5179
+ </pdf:catalog>
5180
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
5181
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
5182
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
5183
+ <!-- Dublin Core properties go here -->
5184
+ <dc:title>
5185
+ <xsl:variable name="title">
4785
5186
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4786
5187
 
4787
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4788
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4789
- <xsl:if test="position() != last()">; </xsl:if>
4790
- </xsl:for-each>
5188
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4791
5189
 
4792
5190
 
4793
5191
 
4794
- </xsl:for-each>
4795
- </dc:creator>
4796
- <dc:description>
4797
- <xsl:variable name="abstract">
4798
5192
 
4799
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4800
5193
 
4801
-
4802
- </xsl:variable>
4803
- <xsl:value-of select="normalize-space($abstract)"/>
4804
- </dc:description>
4805
- <pdf:Keywords>
4806
- <xsl:call-template name="insertKeywords"/>
4807
- </pdf:Keywords>
4808
- </rdf:Description>
4809
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4810
- <!-- XMP properties go here -->
4811
- <xmp:CreatorTool/>
4812
- </rdf:Description>
4813
- </rdf:RDF>
4814
- </x:xmpmeta>
4815
- </fo:declarations>
5194
+
5195
+ </xsl:for-each>
5196
+ </xsl:variable>
5197
+ <xsl:choose>
5198
+ <xsl:when test="normalize-space($title) != ''">
5199
+ <xsl:value-of select="$title"/>
5200
+ </xsl:when>
5201
+ <xsl:otherwise>
5202
+ <xsl:text> </xsl:text>
5203
+ </xsl:otherwise>
5204
+ </xsl:choose>
5205
+ </dc:title>
5206
+ <dc:creator>
5207
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
5208
+
5209
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
5210
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
5211
+ <xsl:if test="position() != last()">; </xsl:if>
5212
+ </xsl:for-each>
5213
+
5214
+
5215
+
5216
+ </xsl:for-each>
5217
+ </dc:creator>
5218
+ <dc:description>
5219
+ <xsl:variable name="abstract">
5220
+
5221
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
5222
+
5223
+
5224
+ </xsl:variable>
5225
+ <xsl:value-of select="normalize-space($abstract)"/>
5226
+ </dc:description>
5227
+ <pdf:Keywords>
5228
+ <xsl:call-template name="insertKeywords"/>
5229
+ </pdf:Keywords>
5230
+ </rdf:Description>
5231
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
5232
+ <!-- XMP properties go here -->
5233
+ <xmp:CreatorTool/>
5234
+ </rdf:Description>
5235
+ </rdf:RDF>
5236
+ </x:xmpmeta>
4816
5237
  </xsl:template><xsl:template name="getId">
4817
5238
  <xsl:choose>
4818
5239
  <xsl:when test="../@id">
@@ -4976,4 +5397,44 @@
4976
5397
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4977
5398
  </xsl:choose>
4978
5399
 
5400
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5401
+ <xsl:param name="isAdded"/>
5402
+ <xsl:param name="isDeleted"/>
5403
+ <xsl:choose>
5404
+ <xsl:when test="local-name() = 'math'">
5405
+ <xsl:if test="$isAdded = 'true'">
5406
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5407
+ </xsl:if>
5408
+ <xsl:if test="$isDeleted = 'true'">
5409
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5410
+ </xsl:if>
5411
+ </xsl:when>
5412
+ <xsl:otherwise>
5413
+ <xsl:if test="$isAdded = 'true'">
5414
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5415
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5416
+ </xsl:if>
5417
+ <xsl:if test="$isDeleted = 'true'">
5418
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5419
+ <xsl:if test="local-name() = 'table'">
5420
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5421
+ </xsl:if>
5422
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5423
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5424
+ </xsl:if>
5425
+ </xsl:otherwise>
5426
+ </xsl:choose>
5427
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5428
+ <xsl:if test="$lang = 'ar'">
5429
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5430
+ </xsl:if>
5431
+ </xsl:template><xsl:template name="setAlignment">
5432
+ <xsl:param name="align" select="normalize-space(@align)"/>
5433
+ <xsl:choose>
5434
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5435
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5436
+ <xsl:when test="$align != ''">
5437
+ <xsl:value-of select="$align"/>
5438
+ </xsl:when>
5439
+ </xsl:choose>
4979
5440
  </xsl:template></xsl:stylesheet>