metanorma-csa 1.7.4 → 1.8.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: daf0ed999ef5457bed8a02eda5b125fbcb10ef32540f7cc09dc67154a264a0da
4
- data.tar.gz: a8e14de5abd1903bf8c8ad4bce7295e04fb0a1b494f37a4222284d209a0a11b2
3
+ metadata.gz: fd8619b12f45c11c2cab65e6aa78b6ad6749ba04c4be28c897a5c6120a54d4d7
4
+ data.tar.gz: 07d2d6395e4b820a5c14120e147a5091c1cf475f5aa5e6c9069ae974dbe87da7
5
5
  SHA512:
6
- metadata.gz: 442e12b1bfb2219134beb451b62210ea373f12685cc9050c2a52544ccd1e705205baed5cecb5b61fb202c846b758feba7f79c6124cda454defcb5982a6f616d6
7
- data.tar.gz: d1aef30954ef55f4515b461025d4edd030d5814deda495bd0f0656e552e53f5f317abdcfdd1ce13cf66bdbfd9099de3187020c1e9ad7b4e43fa51a34874aba61
6
+ metadata.gz: 720715e6a5614244a39936457a79dd311de41c6b6c904b4ba86d7cc9f56c07c81aa7705568fa07d2e8b6b7484ef7cf4b58708e7e1e1bd064997c7ef1eab0e6a7
7
+ data.tar.gz: 2b68d37f0dd18900cf3e5f012aa9579359e18ca4956aa7aaab80ae64aadc53bf9e250a80214ab7a55a1eb45e88fe228840d497f1699837fd97e1e81218fdecd7
@@ -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
@@ -6,3 +6,5 @@
6
6
 
7
7
  # test data
8
8
  /test.*
9
+
10
+ .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>
@@ -106,6 +106,9 @@
106
106
  <zeroOrMore>
107
107
  <ref name="termdocsource"/>
108
108
  </zeroOrMore>
109
+ <optional>
110
+ <ref name="misccontainer"/>
111
+ </optional>
109
112
  <optional>
110
113
  <ref name="boilerplate"/>
111
114
  </optional>
@@ -117,6 +120,9 @@
117
120
  <ref name="annex"/>
118
121
  </zeroOrMore>
119
122
  <ref name="bibliography"/>
123
+ <zeroOrMore>
124
+ <ref name="indexsect"/>
125
+ </zeroOrMore>
120
126
  </element>
121
127
  </define>
122
128
  </grammar>
@@ -86,6 +86,35 @@
86
86
  <text/>
87
87
  </element>
88
88
  </define>
89
+ <define name="erefType">
90
+ <optional>
91
+ <attribute name="normative">
92
+ <data type="boolean"/>
93
+ </attribute>
94
+ </optional>
95
+ <attribute name="citeas"/>
96
+ <attribute name="type">
97
+ <ref name="ReferenceFormat"/>
98
+ </attribute>
99
+ <optional>
100
+ <attribute name="alt"/>
101
+ </optional>
102
+ <optional>
103
+ <attribute name="case">
104
+ <choice>
105
+ <value>capital</value>
106
+ <value>lowercase</value>
107
+ </choice>
108
+ </attribute>
109
+ </optional>
110
+ <optional>
111
+ <attribute name="droploc">
112
+ <data type="boolean"/>
113
+ </attribute>
114
+ </optional>
115
+ <ref name="CitationType"/>
116
+ <text/>
117
+ </define>
89
118
  <define name="ul">
90
119
  <element name="ul">
91
120
  <attribute name="id">
@@ -102,7 +131,7 @@
102
131
  </attribute>
103
132
  </optional>
104
133
  <oneOrMore>
105
- <ref name="li"/>
134
+ <ref name="ul_li"/>
106
135
  </oneOrMore>
107
136
  <zeroOrMore>
108
137
  <ref name="note"/>
@@ -775,6 +804,78 @@
775
804
  <ref name="paragraph"/>
776
805
  </element>
777
806
  </define>
807
+ <define name="em">
808
+ <element name="em">
809
+ <zeroOrMore>
810
+ <choice>
811
+ <ref name="PureTextElement"/>
812
+ <ref name="stem"/>
813
+ <ref name="index"/>
814
+ </choice>
815
+ </zeroOrMore>
816
+ </element>
817
+ </define>
818
+ <define name="strong">
819
+ <element name="strong">
820
+ <zeroOrMore>
821
+ <choice>
822
+ <ref name="PureTextElement"/>
823
+ <ref name="stem"/>
824
+ <ref name="index"/>
825
+ </choice>
826
+ </zeroOrMore>
827
+ </element>
828
+ </define>
829
+ <define name="tt">
830
+ <element name="tt">
831
+ <zeroOrMore>
832
+ <choice>
833
+ <ref name="PureTextElement"/>
834
+ <ref name="index"/>
835
+ </choice>
836
+ </zeroOrMore>
837
+ </element>
838
+ </define>
839
+ <define name="keyword">
840
+ <element name="keyword">
841
+ <zeroOrMore>
842
+ <choice>
843
+ <ref name="PureTextElement"/>
844
+ <ref name="index"/>
845
+ </choice>
846
+ </zeroOrMore>
847
+ </element>
848
+ </define>
849
+ <define name="strike">
850
+ <element name="strike">
851
+ <zeroOrMore>
852
+ <choice>
853
+ <ref name="PureTextElement"/>
854
+ <ref name="index"/>
855
+ </choice>
856
+ </zeroOrMore>
857
+ </element>
858
+ </define>
859
+ <define name="underline">
860
+ <element name="underline">
861
+ <zeroOrMore>
862
+ <choice>
863
+ <ref name="PureTextElement"/>
864
+ <ref name="index"/>
865
+ </choice>
866
+ </zeroOrMore>
867
+ </element>
868
+ </define>
869
+ <define name="smallcap">
870
+ <element name="smallcap">
871
+ <zeroOrMore>
872
+ <choice>
873
+ <ref name="PureTextElement"/>
874
+ <ref name="index"/>
875
+ </choice>
876
+ </zeroOrMore>
877
+ </element>
878
+ </define>
778
879
  </include>
779
880
  <!-- end overrides -->
780
881
  <define name="colgroup">
@@ -793,7 +894,35 @@
793
894
  <value>internal</value>
794
895
  </define>
795
896
  <define name="TextElement" combine="choice">
796
- <ref name="concept"/>
897
+ <choice>
898
+ <ref name="concept"/>
899
+ <ref name="add"/>
900
+ <ref name="del"/>
901
+ </choice>
902
+ </define>
903
+ <define name="add">
904
+ <element name="add">
905
+ <choice>
906
+ <ref name="PureTextElement"/>
907
+ <ref name="eref"/>
908
+ <ref name="stem"/>
909
+ <ref name="keyword"/>
910
+ <ref name="xref"/>
911
+ <ref name="hyperlink"/>
912
+ </choice>
913
+ </element>
914
+ </define>
915
+ <define name="del">
916
+ <element name="del">
917
+ <choice>
918
+ <ref name="PureTextElement"/>
919
+ <ref name="eref"/>
920
+ <ref name="stem"/>
921
+ <ref name="keyword"/>
922
+ <ref name="xref"/>
923
+ <ref name="hyperlink"/>
924
+ </choice>
925
+ </element>
797
926
  </define>
798
927
  <define name="concept">
799
928
  <element name="concept">
@@ -919,6 +1048,9 @@
919
1048
  </choice>
920
1049
  </attribute>
921
1050
  <ref name="bibdata"/>
1051
+ <optional>
1052
+ <ref name="misccontainer"/>
1053
+ </optional>
922
1054
  <optional>
923
1055
  <ref name="boilerplate"/>
924
1056
  </optional>
@@ -929,11 +1061,21 @@
929
1061
  <zeroOrMore>
930
1062
  <ref name="annex"/>
931
1063
  </zeroOrMore>
1064
+ <optional>
1065
+ <ref name="bibliography"/>
1066
+ </optional>
932
1067
  <zeroOrMore>
933
- <ref name="references"/>
1068
+ <ref name="indexsect"/>
934
1069
  </zeroOrMore>
935
1070
  </element>
936
1071
  </define>
1072
+ <define name="misccontainer">
1073
+ <element name="misc-container">
1074
+ <oneOrMore>
1075
+ <ref name="AnyElement"/>
1076
+ </oneOrMore>
1077
+ </element>
1078
+ </define>
937
1079
  <define name="preface">
938
1080
  <element name="preface">
939
1081
  <oneOrMore>
@@ -957,6 +1099,11 @@
957
1099
  <ref name="Content-Section"/>
958
1100
  </element>
959
1101
  </define>
1102
+ <define name="indexsect">
1103
+ <element name="indexsect">
1104
+ <ref name="Content-Section"/>
1105
+ </element>
1106
+ </define>
960
1107
  <define name="boilerplate">
961
1108
  <element name="boilerplate">
962
1109
  <optional>
@@ -1698,4 +1845,26 @@
1698
1845
  </zeroOrMore>
1699
1846
  </element>
1700
1847
  </define>
1848
+ <define name="ul_li">
1849
+ <element name="li">
1850
+ <optional>
1851
+ <attribute name="id">
1852
+ <data type="ID"/>
1853
+ </attribute>
1854
+ </optional>
1855
+ <optional>
1856
+ <attribute name="uncheckedcheckbox">
1857
+ <data type="boolean"/>
1858
+ </attribute>
1859
+ </optional>
1860
+ <optional>
1861
+ <attribute name="checkedcheckbox">
1862
+ <data type="boolean"/>
1863
+ </attribute>
1864
+ </optional>
1865
+ <oneOrMore>
1866
+ <ref name="BasicBlock"/>
1867
+ </oneOrMore>
1868
+ </element>
1869
+ </define>
1701
1870
  </grammar>
@@ -3,7 +3,9 @@
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="yes"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
8
+ <xsl:param name="basepath"/>
7
9
 
8
10
  <xsl:variable name="pageWidth" select="'215.9mm'"/>
9
11
  <xsl:variable name="pageHeight" select="'279.4mm'"/>
@@ -52,7 +54,9 @@
52
54
 
53
55
  </fo:layout-master-set>
54
56
 
55
- <xsl:call-template name="addPDFUAmeta"/>
57
+ <fo:declarations>
58
+ <xsl:call-template name="addPDFUAmeta"/>
59
+ </fo:declarations>
56
60
 
57
61
  <xsl:call-template name="addBookmarks">
58
62
  <xsl:with-param name="contents" select="$contents"/>
@@ -1028,6 +1032,7 @@
1028
1032
  </xsl:choose>
1029
1033
  </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">
1030
1034
 
1035
+
1031
1036
  </xsl:attribute-set><xsl:attribute-set name="link-style">
1032
1037
 
1033
1038
 
@@ -1146,6 +1151,7 @@
1146
1151
 
1147
1152
 
1148
1153
 
1154
+
1149
1155
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1150
1156
 
1151
1157
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -1354,7 +1360,7 @@
1354
1360
 
1355
1361
  </xsl:attribute-set><xsl:attribute-set name="admitted-style">
1356
1362
 
1357
-
1363
+
1358
1364
  </xsl:attribute-set><xsl:attribute-set name="deprecates-style">
1359
1365
 
1360
1366
  </xsl:attribute-set><xsl:attribute-set name="definition-style">
@@ -1362,7 +1368,25 @@
1362
1368
  <xsl:attribute name="space-after">6pt</xsl:attribute>
1363
1369
 
1364
1370
 
1365
- </xsl:attribute-set><xsl:template name="processPrefaceSectionsDefault_Contents">
1371
+ </xsl:attribute-set><xsl:variable name="color-added-text">
1372
+ <xsl:text>rgb(0, 255, 0)</xsl:text>
1373
+ </xsl:variable><xsl:attribute-set name="add-style">
1374
+ <xsl:attribute name="color">red</xsl:attribute>
1375
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1376
+ <!-- <xsl:attribute name="color">black</xsl:attribute>
1377
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
1378
+ <xsl:attribute name="padding-top">1mm</xsl:attribute>
1379
+ <xsl:attribute name="padding-bottom">0.5mm</xsl:attribute> -->
1380
+ </xsl:attribute-set><xsl:variable name="color-deleted-text">
1381
+ <xsl:text>red</xsl:text>
1382
+ </xsl:variable><xsl:attribute-set name="del-style">
1383
+ <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
1384
+ <xsl:attribute name="text-decoration">line-through</xsl:attribute>
1385
+ </xsl:attribute-set><xsl:attribute-set name="mathml-style">
1386
+ <xsl:attribute name="font-family">STIX Two Math</xsl:attribute>
1387
+
1388
+
1389
+ </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">
1366
1390
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1367
1391
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1368
1392
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
@@ -1407,16 +1431,17 @@
1407
1431
  <xsl:call-template name="add-zero-spaces-java"/>
1408
1432
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1409
1433
 
1434
+ <xsl:variable name="table-preamble">
1435
+
1436
+
1437
+ </xsl:variable>
1438
+
1410
1439
  <xsl:variable name="table">
1411
1440
 
1412
1441
  <xsl:variable name="simple-table">
1413
1442
  <xsl:call-template name="getSimpleTable"/>
1414
1443
  </xsl:variable>
1415
1444
 
1416
-
1417
-
1418
-
1419
-
1420
1445
  <!-- <xsl:if test="$namespace = 'bipm'">
1421
1446
  <fo:block>&#xA0;</fo:block>
1422
1447
  </xsl:if> -->
@@ -1429,7 +1454,7 @@
1429
1454
 
1430
1455
 
1431
1456
 
1432
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1457
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
1433
1458
 
1434
1459
  <!-- <xsl:variable name="cols-count">
1435
1460
  <xsl:choose>
@@ -1448,8 +1473,6 @@
1448
1473
  <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1449
1474
  <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1450
1475
 
1451
-
1452
-
1453
1476
  <xsl:variable name="colwidths">
1454
1477
  <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1455
1478
  <xsl:call-template name="calculate-column-widths">
@@ -1477,6 +1500,7 @@
1477
1500
  </xsl:choose>
1478
1501
  </xsl:variable>
1479
1502
 
1503
+
1480
1504
  <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1481
1505
 
1482
1506
 
@@ -1508,6 +1532,7 @@
1508
1532
 
1509
1533
 
1510
1534
 
1535
+
1511
1536
 
1512
1537
 
1513
1538
 
@@ -1597,7 +1622,8 @@
1597
1622
  </fo:block-container>
1598
1623
  </xsl:variable>
1599
1624
 
1600
-
1625
+ <xsl:variable name="isAdded" select="@added"/>
1626
+ <xsl:variable name="isDeleted" select="@deleted"/>
1601
1627
 
1602
1628
  <xsl:choose>
1603
1629
  <xsl:when test="@width">
@@ -1611,7 +1637,14 @@
1611
1637
  <fo:table-body>
1612
1638
  <fo:table-row>
1613
1639
  <fo:table-cell column-number="2">
1614
- <fo:block><xsl:copy-of select="$table"/></fo:block>
1640
+ <xsl:copy-of select="$table-preamble"/>
1641
+ <fo:block>
1642
+ <xsl:call-template name="setTrackChangesStyles">
1643
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1644
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1645
+ </xsl:call-template>
1646
+ <xsl:copy-of select="$table"/>
1647
+ </fo:block>
1615
1648
  </fo:table-cell>
1616
1649
  </fo:table-row>
1617
1650
  </fo:table-body>
@@ -1622,7 +1655,22 @@
1622
1655
 
1623
1656
  </xsl:when>
1624
1657
  <xsl:otherwise>
1625
- <xsl:copy-of select="$table"/>
1658
+ <xsl:choose>
1659
+ <xsl:when test="$isAdded = 'true' or $isDeleted = 'true'">
1660
+ <xsl:copy-of select="$table-preamble"/>
1661
+ <fo:block>
1662
+ <xsl:call-template name="setTrackChangesStyles">
1663
+ <xsl:with-param name="isAdded" select="$isAdded"/>
1664
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
1665
+ </xsl:call-template>
1666
+ <xsl:copy-of select="$table"/>
1667
+ </fo:block>
1668
+ </xsl:when>
1669
+ <xsl:otherwise>
1670
+ <xsl:copy-of select="$table-preamble"/>
1671
+ <xsl:copy-of select="$table"/>
1672
+ </xsl:otherwise>
1673
+ </xsl:choose>
1626
1674
  </xsl:otherwise>
1627
1675
  </xsl:choose>
1628
1676
 
@@ -1683,7 +1731,7 @@
1683
1731
  </xsl:for-each>
1684
1732
  </xsl:when>
1685
1733
  <xsl:otherwise>
1686
- <xsl:for-each select="xalan:nodeset($table)//tr">
1734
+ <xsl:for-each select="xalan:nodeset($table)/*/tr">
1687
1735
  <xsl:variable name="td_text">
1688
1736
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
1689
1737
 
@@ -1753,7 +1801,15 @@
1753
1801
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1754
1802
  <xsl:value-of select="@target"/>
1755
1803
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1756
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1804
+ <xsl:variable name="mathml">
1805
+ <xsl:for-each select="*">
1806
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1807
+ <xsl:copy-of select="."/>
1808
+ </xsl:if>
1809
+ </xsl:for-each>
1810
+ </xsl:variable>
1811
+
1812
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1757
1813
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1758
1814
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1759
1815
  <xsl:param name="cols-count"/>
@@ -2015,7 +2071,8 @@
2015
2071
  <xsl:attribute name="text-align">
2016
2072
  <xsl:choose>
2017
2073
  <xsl:when test="@align">
2018
- <xsl:value-of select="@align"/>
2074
+ <xsl:call-template name="setAlignment"/>
2075
+ <!-- <xsl:value-of select="@align"/> -->
2019
2076
  </xsl:when>
2020
2077
  <xsl:otherwise>center</xsl:otherwise>
2021
2078
  </xsl:choose>
@@ -2031,6 +2088,9 @@
2031
2088
 
2032
2089
 
2033
2090
 
2091
+ <xsl:if test="$lang = 'ar'">
2092
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2093
+ </xsl:if>
2034
2094
  <xsl:if test="@colspan">
2035
2095
  <xsl:attribute name="number-columns-spanned">
2036
2096
  <xsl:value-of select="@colspan"/>
@@ -2062,11 +2122,15 @@
2062
2122
  <xsl:attribute name="text-align">
2063
2123
  <xsl:choose>
2064
2124
  <xsl:when test="@align">
2065
- <xsl:value-of select="@align"/>
2125
+ <xsl:call-template name="setAlignment"/>
2126
+ <!-- <xsl:value-of select="@align"/> -->
2066
2127
  </xsl:when>
2067
2128
  <xsl:otherwise>left</xsl:otherwise>
2068
2129
  </xsl:choose>
2069
2130
  </xsl:attribute>
2131
+ <xsl:if test="$lang = 'ar'">
2132
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2133
+ </xsl:if>
2070
2134
 
2071
2135
 
2072
2136
 
@@ -2078,6 +2142,9 @@
2078
2142
 
2079
2143
 
2080
2144
 
2145
+ <xsl:if test=".//*[local-name() = 'table']">
2146
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
2147
+ </xsl:if>
2081
2148
  <xsl:if test="@colspan">
2082
2149
  <xsl:attribute name="number-columns-spanned">
2083
2150
  <xsl:value-of select="@colspan"/>
@@ -2203,13 +2270,13 @@
2203
2270
  </xsl:choose>
2204
2271
  </xsl:variable>
2205
2272
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2206
- <xsl:element name="{$ns}:table">
2273
+ <!-- <xsl:element name="{$ns}:table"> -->
2207
2274
  <xsl:for-each select="*[local-name() = 'dl'][1]">
2208
2275
  <tbody>
2209
2276
  <xsl:apply-templates mode="dl"/>
2210
2277
  </tbody>
2211
2278
  </xsl:for-each>
2212
- </xsl:element>
2279
+ <!-- </xsl:element> -->
2213
2280
  </xsl:variable>
2214
2281
 
2215
2282
  <xsl:call-template name="calculate-column-widths">
@@ -2300,6 +2367,8 @@
2300
2367
  <xsl:apply-templates/>
2301
2368
  </fo:inline>
2302
2369
  </xsl:template><xsl:template match="*[local-name()='dl']">
2370
+ <xsl:variable name="isAdded" select="@added"/>
2371
+ <xsl:variable name="isDeleted" select="@deleted"/>
2303
2372
  <fo:block-container>
2304
2373
 
2305
2374
  <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
@@ -2316,6 +2385,12 @@
2316
2385
  </xsl:attribute>
2317
2386
 
2318
2387
  </xsl:if>
2388
+
2389
+ <xsl:call-template name="setTrackChangesStyles">
2390
+ <xsl:with-param name="isAdded" select="$isAdded"/>
2391
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
2392
+ </xsl:call-template>
2393
+
2319
2394
  <fo:block-container>
2320
2395
 
2321
2396
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
@@ -2423,11 +2498,11 @@
2423
2498
  </xsl:choose>
2424
2499
  </xsl:variable>
2425
2500
  <!-- <xsl:variable name="ns" select="substring-before(name(/*), '-')"/> -->
2426
- <xsl:element name="{$ns}:table">
2501
+ <!-- <xsl:element name="{$ns}:table"> -->
2427
2502
  <tbody>
2428
2503
  <xsl:apply-templates mode="dl"/>
2429
2504
  </tbody>
2430
- </xsl:element>
2505
+ <!-- </xsl:element> -->
2431
2506
  </xsl:variable>
2432
2507
  <!-- html-table<xsl:copy-of select="$html-table"/> -->
2433
2508
  <xsl:variable name="colwidths">
@@ -2694,8 +2769,78 @@
2694
2769
  <fo:inline text-decoration="underline">
2695
2770
  <xsl:apply-templates/>
2696
2771
  </fo:inline>
2772
+ </xsl:template><xsl:template match="*[local-name()='add']">
2773
+ <xsl:choose>
2774
+ <xsl:when test="@amendment">
2775
+ <fo:inline>
2776
+ <xsl:call-template name="insertTag">
2777
+ <xsl:with-param name="kind">A</xsl:with-param>
2778
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2779
+ </xsl:call-template>
2780
+ <xsl:apply-templates/>
2781
+ <xsl:call-template name="insertTag">
2782
+ <xsl:with-param name="type">closing</xsl:with-param>
2783
+ <xsl:with-param name="kind">A</xsl:with-param>
2784
+ <xsl:with-param name="value"><xsl:value-of select="@amendment"/></xsl:with-param>
2785
+ </xsl:call-template>
2786
+ </fo:inline>
2787
+ </xsl:when>
2788
+ <xsl:when test="@corrigenda">
2789
+ <fo:inline>
2790
+ <xsl:call-template name="insertTag">
2791
+ <xsl:with-param name="kind">C</xsl:with-param>
2792
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2793
+ </xsl:call-template>
2794
+ <xsl:apply-templates/>
2795
+ <xsl:call-template name="insertTag">
2796
+ <xsl:with-param name="type">closing</xsl:with-param>
2797
+ <xsl:with-param name="kind">C</xsl:with-param>
2798
+ <xsl:with-param name="value"><xsl:value-of select="@corrigenda"/></xsl:with-param>
2799
+ </xsl:call-template>
2800
+ </fo:inline>
2801
+ </xsl:when>
2802
+ <xsl:otherwise>
2803
+ <fo:inline xsl:use-attribute-sets="add-style">
2804
+ <xsl:apply-templates/>
2805
+ </fo:inline>
2806
+ </xsl:otherwise>
2807
+ </xsl:choose>
2808
+
2809
+ </xsl:template><xsl:template name="insertTag">
2810
+ <xsl:param name="type"/>
2811
+ <xsl:param name="kind"/>
2812
+ <xsl:param name="value"/>
2813
+ <xsl:variable name="add_width" select="string-length($value) * 20"/>
2814
+ <xsl:variable name="maxwidth" select="60 + $add_width"/>
2815
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
2816
+ <!-- <xsl:attribute name="width">7mm</xsl:attribute>
2817
+ <xsl:attribute name="content-height">100%</xsl:attribute> -->
2818
+ <xsl:attribute name="height">5mm</xsl:attribute>
2819
+ <xsl:attribute name="content-width">100%</xsl:attribute>
2820
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
2821
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
2822
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
2823
+ <g>
2824
+ <xsl:if test="$type = 'closing'">
2825
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
2826
+ </xsl:if>
2827
+ <polyline points="0,0 {$maxwidth},0 {$maxwidth + 30},40 {$maxwidth},80 0,80 " stroke="black" stroke-width="5" fill="white"/>
2828
+ <line x1="0" y1="0" x2="0" y2="80" stroke="black" stroke-width="20"/>
2829
+ </g>
2830
+ <text font-family="Arial" x="15" y="57" font-size="40pt">
2831
+ <xsl:if test="$type = 'closing'">
2832
+ <xsl:attribute name="x">25</xsl:attribute>
2833
+ </xsl:if>
2834
+ <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
2835
+ </text>
2836
+ </svg>
2837
+ </fo:instream-foreign-object>
2697
2838
  </xsl:template><xsl:template match="*[local-name()='del']">
2698
- <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2839
+ <fo:inline xsl:use-attribute-sets="del-style">
2840
+ <xsl:apply-templates/>
2841
+ </fo:inline>
2842
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2843
+ <fo:inline background-color="yellow">
2699
2844
  <xsl:apply-templates/>
2700
2845
  </fo:inline>
2701
2846
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
@@ -3032,12 +3177,23 @@
3032
3177
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring($str, 1, 1)))"/>
3033
3178
  <xsl:value-of select="substring($str, 2)"/>
3034
3179
  </xsl:template><xsl:template match="mathml:math">
3035
- <fo:inline font-family="STIX Two Math"> <!-- -->
3180
+ <xsl:variable name="isAdded" select="@added"/>
3181
+ <xsl:variable name="isDeleted" select="@deleted"/>
3182
+
3183
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3184
+
3185
+
3186
+ <xsl:call-template name="setTrackChangesStyles">
3187
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3188
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3189
+ </xsl:call-template>
3036
3190
 
3037
3191
  <xsl:variable name="mathml">
3038
3192
  <xsl:apply-templates select="." mode="mathml"/>
3039
3193
  </xsl:variable>
3040
3194
  <fo:instream-foreign-object fox:alt-text="Math">
3195
+
3196
+
3041
3197
  <!-- <xsl:copy-of select="."/> -->
3042
3198
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3043
3199
  </fo:instream-foreign-object>
@@ -3056,7 +3212,7 @@
3056
3212
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
3057
3213
  </xsl:copy>
3058
3214
  <mathml:mspace width="0.5ex"/>
3059
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3215
+ </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">
3060
3216
  <xsl:variable name="target">
3061
3217
  <xsl:choose>
3062
3218
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3090,8 +3246,6 @@
3090
3246
  </xsl:otherwise>
3091
3247
  </xsl:choose>
3092
3248
  </fo:inline>
3093
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3094
- <fo:inline id="{@id}"/>
3095
3249
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3096
3250
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3097
3251
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3287,8 +3441,15 @@
3287
3441
  </fo:inline>
3288
3442
  </xsl:if>
3289
3443
  </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3444
+ <xsl:variable name="isAdded" select="@added"/>
3445
+ <xsl:variable name="isDeleted" select="@deleted"/>
3290
3446
  <fo:block-container id="{@id}">
3291
3447
 
3448
+ <xsl:call-template name="setTrackChangesStyles">
3449
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3450
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3451
+ </xsl:call-template>
3452
+
3292
3453
  <fo:block>
3293
3454
  <xsl:apply-templates/>
3294
3455
  </fo:block>
@@ -3302,27 +3463,113 @@
3302
3463
  <fo:block id="{@id}">
3303
3464
  <xsl:apply-templates/>
3304
3465
  </fo:block>
3466
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3305
3467
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3306
3468
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3307
3469
  <xsl:apply-templates/>
3308
3470
  </fo:block>
3309
3471
  </xsl:template><xsl:template match="*[local-name() = 'image']">
3310
- <fo:block xsl:use-attribute-sets="image-style">
3311
-
3312
-
3313
- <xsl:variable name="src">
3314
- <xsl:choose>
3315
- <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3316
- <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3317
- </xsl:when>
3318
- <xsl:otherwise>
3319
- <xsl:value-of select="@src"/>
3320
- </xsl:otherwise>
3321
- </xsl:choose>
3322
- </xsl:variable>
3323
-
3324
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3325
- </fo:block>
3472
+ <xsl:variable name="isAdded" select="../@added"/>
3473
+ <xsl:variable name="isDeleted" select="../@deleted"/>
3474
+ <xsl:choose>
3475
+ <xsl:when test="ancestor::*[local-name() = 'title']">
3476
+ <fo:inline padding-left="1mm" padding-right="1mm">
3477
+ <xsl:variable name="src">
3478
+ <xsl:call-template name="image_src"/>
3479
+ </xsl:variable>
3480
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
3481
+ </fo:inline>
3482
+ </xsl:when>
3483
+ <xsl:otherwise>
3484
+ <fo:block xsl:use-attribute-sets="image-style">
3485
+
3486
+ <xsl:variable name="src">
3487
+ <xsl:call-template name="image_src"/>
3488
+ </xsl:variable>
3489
+
3490
+ <xsl:choose>
3491
+ <xsl:when test="$isDeleted = 'true'">
3492
+ <!-- enclose in svg -->
3493
+ <fo:instream-foreign-object fox:alt-text="Image {@alt}">
3494
+ <xsl:attribute name="width">100%</xsl:attribute>
3495
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3496
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3497
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3498
+
3499
+
3500
+ <xsl:apply-templates select="." mode="cross_image"/>
3501
+
3502
+ </fo:instream-foreign-object>
3503
+ </xsl:when>
3504
+ <xsl:otherwise>
3505
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3506
+ </xsl:otherwise>
3507
+ </xsl:choose>
3508
+
3509
+ </fo:block>
3510
+ </xsl:otherwise>
3511
+ </xsl:choose>
3512
+ </xsl:template><xsl:template name="image_src">
3513
+ <xsl:choose>
3514
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3515
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3516
+ </xsl:when>
3517
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3518
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3519
+ </xsl:when>
3520
+ <xsl:otherwise>
3521
+ <xsl:value-of select="@src"/>
3522
+ </xsl:otherwise>
3523
+ </xsl:choose>
3524
+ </xsl:template><xsl:template match="*[local-name() = 'image']" mode="cross_image">
3525
+ <xsl:choose>
3526
+ <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
3527
+ <xsl:variable name="src">
3528
+ <xsl:value-of select="$images/images/image[@id = current()/@id]/@src"/>
3529
+ </xsl:variable>
3530
+ <xsl:variable name="width" select="document($src)/@width"/>
3531
+ <xsl:variable name="height" select="document($src)/@height"/>
3532
+ <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">
3533
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3534
+ </svg>
3535
+ </xsl:when>
3536
+ <xsl:when test="not(starts-with(@src, 'data:'))">
3537
+ <xsl:variable name="src">
3538
+ <xsl:value-of select="concat('url(file:',$basepath, @src, ')')"/>
3539
+ </xsl:variable>
3540
+ <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
3541
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
3542
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3543
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3544
+ <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">
3545
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{$src}" style="overflow:visible;"/>
3546
+ </svg>
3547
+ </xsl:when>
3548
+ <xsl:otherwise>
3549
+ <xsl:variable name="base64String" select="substring-after(@src, 'base64,')"/>
3550
+ <xsl:variable name="decoder" select="java:java.util.Base64.getDecoder()"/>
3551
+ <xsl:variable name="fileContent" select="java:decode($decoder, $base64String)"/>
3552
+ <xsl:variable name="bis" select="java:java.io.ByteArrayInputStream.new($fileContent)"/>
3553
+ <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($bis)"/>
3554
+ <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
3555
+ <!-- width=<xsl:value-of select="$width"/> -->
3556
+ <xsl:variable name="height" select="java:getHeight($bufferedImage)"/>
3557
+ <!-- height=<xsl:value-of select="$height"/> -->
3558
+ <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">
3559
+ <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="{@src}" height="{$height}" width="{$width}" style="overflow:visible;"/>
3560
+ <xsl:call-template name="svg_cross">
3561
+ <xsl:with-param name="width" select="$width"/>
3562
+ <xsl:with-param name="height" select="$height"/>
3563
+ </xsl:call-template>
3564
+ </svg>
3565
+ </xsl:otherwise>
3566
+ </xsl:choose>
3567
+
3568
+ </xsl:template><xsl:template name="svg_cross">
3569
+ <xsl:param name="width"/>
3570
+ <xsl:param name="height"/>
3571
+ <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; "/>
3572
+ <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; "/>
3326
3573
  </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">
3327
3574
  <xsl:apply-templates mode="contents"/>
3328
3575
  <xsl:text> </xsl:text>
@@ -3865,6 +4112,7 @@
3865
4112
  <xsl:variable name="element">
3866
4113
  block
3867
4114
 
4115
+ <xsl:if test="following-sibling::*[1][local-name() = 'table']">block</xsl:if>
3868
4116
  </xsl:variable>
3869
4117
  <xsl:choose>
3870
4118
  <xsl:when test="ancestor::*[local-name() = 'appendix']">
@@ -3872,7 +4120,7 @@
3872
4120
  <xsl:apply-templates/>
3873
4121
  </fo:inline>
3874
4122
  </xsl:when>
3875
- <xsl:when test="normalize-space($element) = 'block'">
4123
+ <xsl:when test="contains(normalize-space($element), 'block')">
3876
4124
  <fo:block xsl:use-attribute-sets="example-name-style">
3877
4125
  <xsl:apply-templates/>
3878
4126
  </fo:block>
@@ -3885,10 +4133,11 @@
3885
4133
  </xsl:choose>
3886
4134
 
3887
4135
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3888
-
4136
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3889
4137
  <xsl:variable name="element">
3890
4138
  block
3891
4139
 
4140
+
3892
4141
  </xsl:variable>
3893
4142
  <xsl:choose>
3894
4143
  <xsl:when test="normalize-space($element) = 'block'">
@@ -3992,29 +4241,47 @@
3992
4241
  <xsl:text>— </xsl:text>
3993
4242
  <xsl:apply-templates/>
3994
4243
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
3995
- <fo:inline xsl:use-attribute-sets="eref-style">
3996
- <xsl:if test="@type = 'footnote'">
3997
-
3998
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3999
- <xsl:attribute name="font-size">80%</xsl:attribute>
4000
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4001
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4002
-
4003
-
4004
- </xsl:if>
4005
-
4006
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4007
-
4008
- <xsl:if test="@type = 'inline'">
4009
-
4010
-
4011
-
4012
- </xsl:if>
4013
-
4014
-
4015
- <xsl:apply-templates/>
4016
- </fo:basic-link>
4017
- </fo:inline>
4244
+
4245
+ <xsl:variable name="bibitemid">
4246
+ <xsl:choose>
4247
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4248
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4249
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4250
+ </xsl:choose>
4251
+ </xsl:variable>
4252
+
4253
+ <xsl:choose>
4254
+ <xsl:when test="normalize-space($bibitemid) != ''">
4255
+ <fo:inline xsl:use-attribute-sets="eref-style">
4256
+ <xsl:if test="@type = 'footnote'">
4257
+
4258
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4259
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4260
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4261
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4262
+
4263
+
4264
+ </xsl:if>
4265
+
4266
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4267
+ <xsl:if test="normalize-space(@citeas) = ''">
4268
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4269
+ </xsl:if>
4270
+ <xsl:if test="@type = 'inline'">
4271
+
4272
+
4273
+
4274
+ </xsl:if>
4275
+
4276
+ <xsl:apply-templates/>
4277
+ </fo:basic-link>
4278
+
4279
+ </fo:inline>
4280
+ </xsl:when>
4281
+ <xsl:otherwise>
4282
+ <fo:inline><xsl:apply-templates/></fo:inline>
4283
+ </xsl:otherwise>
4284
+ </xsl:choose>
4018
4285
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4019
4286
  <!-- zero-space char -->
4020
4287
  <xsl:variable name="depth">
@@ -4067,7 +4334,8 @@
4067
4334
  </fo:inline>
4068
4335
  </xsl:when>
4069
4336
  <xsl:otherwise>
4070
- <fo:inline padding-right="{$padding-right}mm">​</fo:inline>
4337
+ <xsl:variable name="direction"><xsl:if test="$lang = 'ar'"><xsl:value-of select="$RLM"/></xsl:if></xsl:variable>
4338
+ <fo:inline padding-right="{$padding-right}mm"><xsl:value-of select="$direction"/>​</fo:inline>
4071
4339
  </xsl:otherwise>
4072
4340
  </xsl:choose>
4073
4341
 
@@ -4192,6 +4460,153 @@
4192
4460
  </fo:block>
4193
4461
  </xsl:otherwise>
4194
4462
  </xsl:choose>
4463
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4464
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4465
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4466
+ </xsl:for-each>
4467
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4468
+ <xsl:copy>
4469
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4470
+ </xsl:copy>
4471
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4472
+ <xsl:variable name="id">
4473
+ <xsl:call-template name="generateIndexXrefId"/>
4474
+ </xsl:variable>
4475
+ <xsl:copy> <!-- add id to xref -->
4476
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4477
+ <xsl:attribute name="id">
4478
+ <xsl:value-of select="$id"/>
4479
+ </xsl:attribute>
4480
+ <xsl:apply-templates mode="index_add_id"/>
4481
+ </xsl:copy>
4482
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4483
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4484
+ <xsl:if test="@to">
4485
+ <xsl:value-of select="$dash"/>
4486
+ <xsl:copy>
4487
+ <xsl:copy-of select="@*"/>
4488
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4489
+ <xsl:attribute name="id">
4490
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4491
+ </xsl:attribute>
4492
+ <xsl:apply-templates mode="index_add_id"/>
4493
+ </xsl:copy>
4494
+ </xsl:if>
4495
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4496
+ <xsl:copy>
4497
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4498
+ </xsl:copy>
4499
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4500
+ <xsl:copy>
4501
+ <xsl:apply-templates select="@*" mode="index_update"/>
4502
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4503
+ </xsl:copy>
4504
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4505
+ <xsl:param name="element"/>
4506
+ <xsl:param name="remove" select="'false'"/>
4507
+ <xsl:param name="target"/>
4508
+ <!-- <node></node> -->
4509
+ <xsl:choose>
4510
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4511
+ <!-- skip text (i.e. remove it) and process next element -->
4512
+ <!-- [removed_<xsl:value-of select="."/>] -->
4513
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4514
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4515
+ </xsl:apply-templates>
4516
+ </xsl:when>
4517
+ <xsl:when test="self::text()">
4518
+ <xsl:value-of select="."/>
4519
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4520
+ </xsl:when>
4521
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4522
+ <xsl:variable name="id" select="@id"/>
4523
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4524
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4525
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4526
+
4527
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4528
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4529
+
4530
+ <xsl:choose>
4531
+ <!-- 2nd pass -->
4532
+ <!-- if page is equal to page for next and page is not the end of range -->
4533
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4534
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4535
+ <!-- [removed_xref] -->
4536
+
4537
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4538
+ <xsl:with-param name="remove">true</xsl:with-param>
4539
+ <xsl:with-param name="target">
4540
+ <xsl:choose>
4541
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4542
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4543
+ </xsl:choose>
4544
+ </xsl:with-param>
4545
+ </xsl:apply-templates>
4546
+ </xsl:when>
4547
+
4548
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4549
+ <!-- remove xref -->
4550
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4551
+ <xsl:with-param name="remove">true</xsl:with-param>
4552
+ </xsl:apply-templates>
4553
+ </xsl:when>
4554
+
4555
+ <xsl:otherwise>
4556
+ <xsl:apply-templates select="." mode="xref_copy">
4557
+ <xsl:with-param name="target" select="$target"/>
4558
+ </xsl:apply-templates>
4559
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4560
+ </xsl:otherwise>
4561
+ </xsl:choose>
4562
+ </xsl:when>
4563
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4564
+ <!-- ul -->
4565
+ <xsl:apply-templates select="." mode="index_update"/>
4566
+ </xsl:when>
4567
+ <xsl:otherwise>
4568
+ <xsl:apply-templates select="." mode="xref_copy">
4569
+ <xsl:with-param name="target" select="$target"/>
4570
+ </xsl:apply-templates>
4571
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4572
+ </xsl:otherwise>
4573
+ </xsl:choose>
4574
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4575
+ <xsl:param name="target"/>
4576
+ <xsl:copy>
4577
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4578
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4579
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4580
+ </xsl:if>
4581
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4582
+ </xsl:copy>
4583
+ </xsl:template><xsl:template name="generateIndexXrefId">
4584
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4585
+
4586
+ <xsl:variable name="docid">
4587
+ <xsl:call-template name="getDocumentId"/>
4588
+ </xsl:variable>
4589
+ <xsl:variable name="item_number">
4590
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4591
+ </xsl:variable>
4592
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4593
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4594
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4595
+ <xsl:apply-templates/>
4596
+ <fo:block>
4597
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4598
+ <fo:block> </fo:block>
4599
+ </xsl:if>
4600
+ </fo:block>
4601
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4602
+ <xsl:apply-templates/>
4603
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4604
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4605
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4606
+ <xsl:apply-templates/>
4607
+ </fo:block>
4608
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4609
+ <fo:inline id="{@id}" font-size="1pt"/>
4195
4610
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4196
4611
  <!-- <row>
4197
4612
  <date>05-07-2013</date>
@@ -4408,70 +4823,68 @@
4408
4823
  <xsl:variable name="lang">
4409
4824
  <xsl:call-template name="getLang"/>
4410
4825
  </xsl:variable>
4411
- <fo:declarations>
4412
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4413
- <pdf:dictionary type="normal" key="ViewerPreferences">
4414
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4415
- </pdf:dictionary>
4416
- </pdf:catalog>
4417
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4418
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4419
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4420
- <!-- Dublin Core properties go here -->
4421
- <dc:title>
4422
- <xsl:variable name="title">
4423
- <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4424
-
4425
-
4426
-
4427
-
4428
- <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4429
-
4430
-
4431
-
4432
- </xsl:for-each>
4433
- </xsl:variable>
4434
- <xsl:choose>
4435
- <xsl:when test="normalize-space($title) != ''">
4436
- <xsl:value-of select="$title"/>
4437
- </xsl:when>
4438
- <xsl:otherwise>
4439
- <xsl:text> </xsl:text>
4440
- </xsl:otherwise>
4441
- </xsl:choose>
4442
- </dc:title>
4443
- <dc:creator>
4826
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4827
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4828
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4829
+ </pdf:dictionary>
4830
+ </pdf:catalog>
4831
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4832
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4833
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4834
+ <!-- Dublin Core properties go here -->
4835
+ <dc:title>
4836
+ <xsl:variable name="title">
4444
4837
  <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4445
4838
 
4446
- <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4447
- <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4448
- <xsl:if test="position() != last()">; </xsl:if>
4449
- </xsl:for-each>
4450
-
4451
-
4452
4839
 
4453
- </xsl:for-each>
4454
- </dc:creator>
4455
- <dc:description>
4456
- <xsl:variable name="abstract">
4457
4840
 
4458
- <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4841
+
4842
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4459
4843
 
4460
4844
 
4461
- </xsl:variable>
4462
- <xsl:value-of select="normalize-space($abstract)"/>
4463
- </dc:description>
4464
- <pdf:Keywords>
4465
- <xsl:call-template name="insertKeywords"/>
4466
- </pdf:Keywords>
4467
- </rdf:Description>
4468
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4469
- <!-- XMP properties go here -->
4470
- <xmp:CreatorTool/>
4471
- </rdf:Description>
4472
- </rdf:RDF>
4473
- </x:xmpmeta>
4474
- </fo:declarations>
4845
+
4846
+ </xsl:for-each>
4847
+ </xsl:variable>
4848
+ <xsl:choose>
4849
+ <xsl:when test="normalize-space($title) != ''">
4850
+ <xsl:value-of select="$title"/>
4851
+ </xsl:when>
4852
+ <xsl:otherwise>
4853
+ <xsl:text> </xsl:text>
4854
+ </xsl:otherwise>
4855
+ </xsl:choose>
4856
+ </dc:title>
4857
+ <dc:creator>
4858
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4859
+
4860
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4861
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4862
+ <xsl:if test="position() != last()">; </xsl:if>
4863
+ </xsl:for-each>
4864
+
4865
+
4866
+
4867
+ </xsl:for-each>
4868
+ </dc:creator>
4869
+ <dc:description>
4870
+ <xsl:variable name="abstract">
4871
+
4872
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4873
+
4874
+
4875
+ </xsl:variable>
4876
+ <xsl:value-of select="normalize-space($abstract)"/>
4877
+ </dc:description>
4878
+ <pdf:Keywords>
4879
+ <xsl:call-template name="insertKeywords"/>
4880
+ </pdf:Keywords>
4881
+ </rdf:Description>
4882
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4883
+ <!-- XMP properties go here -->
4884
+ <xmp:CreatorTool/>
4885
+ </rdf:Description>
4886
+ </rdf:RDF>
4887
+ </x:xmpmeta>
4475
4888
  </xsl:template><xsl:template name="getId">
4476
4889
  <xsl:choose>
4477
4890
  <xsl:when test="../@id">
@@ -4635,4 +5048,44 @@
4635
5048
  <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4636
5049
  </xsl:choose>
4637
5050
 
5051
+ </xsl:template><xsl:template name="setTrackChangesStyles">
5052
+ <xsl:param name="isAdded"/>
5053
+ <xsl:param name="isDeleted"/>
5054
+ <xsl:choose>
5055
+ <xsl:when test="local-name() = 'math'">
5056
+ <xsl:if test="$isAdded = 'true'">
5057
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-added-text"/></xsl:attribute>
5058
+ </xsl:if>
5059
+ <xsl:if test="$isDeleted = 'true'">
5060
+ <xsl:attribute name="background-color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute>
5061
+ </xsl:if>
5062
+ </xsl:when>
5063
+ <xsl:otherwise>
5064
+ <xsl:if test="$isAdded = 'true'">
5065
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-added"/></xsl:attribute>
5066
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5067
+ </xsl:if>
5068
+ <xsl:if test="$isDeleted = 'true'">
5069
+ <xsl:attribute name="border"><xsl:value-of select="$border-block-deleted"/></xsl:attribute>
5070
+ <xsl:if test="local-name() = 'table'">
5071
+ <xsl:attribute name="background-color">rgb(255, 185, 185)</xsl:attribute>
5072
+ </xsl:if>
5073
+ <!-- <xsl:attribute name="color"><xsl:value-of select="$color-deleted-text"/></xsl:attribute> -->
5074
+ <xsl:attribute name="padding">2mm</xsl:attribute>
5075
+ </xsl:if>
5076
+ </xsl:otherwise>
5077
+ </xsl:choose>
5078
+ </xsl:template><xsl:variable name="LRM" select="'‎'"/><xsl:variable name="RLM" select="'‏'"/><xsl:template name="setWritingMode">
5079
+ <xsl:if test="$lang = 'ar'">
5080
+ <xsl:attribute name="writing-mode">rl-tb</xsl:attribute>
5081
+ </xsl:if>
5082
+ </xsl:template><xsl:template name="setAlignment">
5083
+ <xsl:param name="align" select="normalize-space(@align)"/>
5084
+ <xsl:choose>
5085
+ <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
5086
+ <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
5087
+ <xsl:when test="$align != ''">
5088
+ <xsl:value-of select="$align"/>
5089
+ </xsl:when>
5090
+ </xsl:choose>
4638
5091
  </xsl:template></xsl:stylesheet>