metanorma-mpfa 0.5.11 → 0.5.16

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: b6b4fb45cca9108e736075604129bbd75df3639b0da7e4acf98e260f8b1423a2
4
- data.tar.gz: 197f73f8a3f35bf7a1a33d80c8d392f882ec40dace0f4005c8f4c023e24bc62c
3
+ metadata.gz: 1c287b4767d612802722ba02af6e73135932eba81eead3d0353048d760cc3237
4
+ data.tar.gz: bac24e96c20795d4f2061aa517b995f264aa8ddcbd573b92af26a6c730f486c0
5
5
  SHA512:
6
- metadata.gz: 235ee64575a96e7973502abe404564966040aa711ea48a3096364ccda817cb65f0aa1d8da9d57729088a7761b0a8574b8a31a845db9945b1d97ac46d58c0d858
7
- data.tar.gz: b49a34338f58c0faff58d362f4a9ec17de4482512e116470c40c7a7ef3ee7bd7267e70fc98b8c275d22045de552ff02da21bf868a343e1afd11b7a2703177994
6
+ metadata.gz: 0a806826278e84b8fc1d318bb28dfc496cdc7cfcf4943084123a4c2f39b556c55e57d11b1bcb996d15785d64737ceace0301f324975c6cf1c9596906c9c1ca5d
7
+ data.tar.gz: 37173fac1ecee0ed3c9bb0693a179744c5449958d7f880d44c9230c285a230924a8524236c608123c4c67588cb924e934e37699c51d9743892142066e7f26928
@@ -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
@@ -729,9 +729,11 @@
729
729
  </define>
730
730
  <define name="index">
731
731
  <element name="index">
732
- <attribute name="to">
733
- <data type="IDREF"/>
734
- </attribute>
732
+ <optional>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
735
737
  <element name="primary">
736
738
  <oneOrMore>
737
739
  <ref name="PureTextElement"/>
@@ -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>
@@ -102,7 +102,7 @@
102
102
  </attribute>
103
103
  </optional>
104
104
  <oneOrMore>
105
- <ref name="li"/>
105
+ <ref name="ul_li"/>
106
106
  </oneOrMore>
107
107
  <zeroOrMore>
108
108
  <ref name="note"/>
@@ -789,6 +789,9 @@
789
789
  <attribute name="width"/>
790
790
  </element>
791
791
  </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
792
795
  <define name="TextElement" combine="choice">
793
796
  <ref name="concept"/>
794
797
  </define>
@@ -809,6 +812,8 @@
809
812
  <ref name="requirement"/>
810
813
  <ref name="recommendation"/>
811
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
812
817
  </choice>
813
818
  </define>
814
819
  <define name="bibliography">
@@ -914,6 +919,9 @@
914
919
  </choice>
915
920
  </attribute>
916
921
  <ref name="bibdata"/>
922
+ <optional>
923
+ <ref name="misccontainer"/>
924
+ </optional>
917
925
  <optional>
918
926
  <ref name="boilerplate"/>
919
927
  </optional>
@@ -924,11 +932,21 @@
924
932
  <zeroOrMore>
925
933
  <ref name="annex"/>
926
934
  </zeroOrMore>
935
+ <optional>
936
+ <ref name="bibliography"/>
937
+ </optional>
927
938
  <zeroOrMore>
928
- <ref name="references"/>
939
+ <ref name="indexsect"/>
929
940
  </zeroOrMore>
930
941
  </element>
931
942
  </define>
943
+ <define name="misccontainer">
944
+ <element name="misc-container">
945
+ <oneOrMore>
946
+ <ref name="AnyElement"/>
947
+ </oneOrMore>
948
+ </element>
949
+ </define>
932
950
  <define name="preface">
933
951
  <element name="preface">
934
952
  <oneOrMore>
@@ -952,6 +970,11 @@
952
970
  <ref name="Content-Section"/>
953
971
  </element>
954
972
  </define>
973
+ <define name="indexsect">
974
+ <element name="indexsect">
975
+ <ref name="Content-Section"/>
976
+ </element>
977
+ </define>
955
978
  <define name="boilerplate">
956
979
  <element name="boilerplate">
957
980
  <optional>
@@ -1632,4 +1655,87 @@
1632
1655
  <text/>
1633
1656
  </element>
1634
1657
  </define>
1658
+ <define name="imagemap">
1659
+ <element name="imagemap">
1660
+ <ref name="figure"/>
1661
+ <zeroOrMore>
1662
+ <element name="area">
1663
+ <attribute name="type">
1664
+ <choice>
1665
+ <value>rect</value>
1666
+ <value>circle</value>
1667
+ <value>ellipse</value>
1668
+ <value>poly</value>
1669
+ </choice>
1670
+ </attribute>
1671
+ <choice>
1672
+ <ref name="xref"/>
1673
+ <ref name="hyperlink"/>
1674
+ <ref name="eref"/>
1675
+ </choice>
1676
+ <oneOrMore>
1677
+ <element name="coords">
1678
+ <attribute name="x">
1679
+ <data type="float"/>
1680
+ </attribute>
1681
+ <attribute name="y">
1682
+ <data type="float"/>
1683
+ </attribute>
1684
+ </element>
1685
+ </oneOrMore>
1686
+ <optional>
1687
+ <element name="radius">
1688
+ <attribute name="x">
1689
+ <data type="float"/>
1690
+ </attribute>
1691
+ <optional>
1692
+ <attribute name="y">
1693
+ <data type="float"/>
1694
+ </attribute>
1695
+ </optional>
1696
+ </element>
1697
+ </optional>
1698
+ </element>
1699
+ </zeroOrMore>
1700
+ </element>
1701
+ </define>
1702
+ <define name="svgmap">
1703
+ <element name="svgmap">
1704
+ <ref name="figure"/>
1705
+ <zeroOrMore>
1706
+ <element name="target">
1707
+ <attribute name="href">
1708
+ <data type="anyURI"/>
1709
+ </attribute>
1710
+ <choice>
1711
+ <ref name="xref"/>
1712
+ <ref name="hyperlink"/>
1713
+ <ref name="eref"/>
1714
+ </choice>
1715
+ </element>
1716
+ </zeroOrMore>
1717
+ </element>
1718
+ </define>
1719
+ <define name="ul_li">
1720
+ <element name="li">
1721
+ <optional>
1722
+ <attribute name="id">
1723
+ <data type="ID"/>
1724
+ </attribute>
1725
+ </optional>
1726
+ <optional>
1727
+ <attribute name="uncheckedcheckbox">
1728
+ <data type="boolean"/>
1729
+ </attribute>
1730
+ </optional>
1731
+ <optional>
1732
+ <attribute name="checkedcheckbox">
1733
+ <data type="boolean"/>
1734
+ </attribute>
1735
+ </optional>
1736
+ <oneOrMore>
1737
+ <ref name="BasicBlock"/>
1738
+ </oneOrMore>
1739
+ </element>
1740
+ </define>
1635
1741
  </grammar>
@@ -70,6 +70,9 @@
70
70
  <zeroOrMore>
71
71
  <ref name="termdocsource"/>
72
72
  </zeroOrMore>
73
+ <optional>
74
+ <ref name="misccontainer"/>
75
+ </optional>
73
76
  <optional>
74
77
  <ref name="boilerplate"/>
75
78
  </optional>
@@ -81,6 +84,9 @@
81
84
  <ref name="annex"/>
82
85
  </zeroOrMore>
83
86
  <ref name="bibliography"/>
87
+ <zeroOrMore>
88
+ <ref name="indexsect"/>
89
+ </zeroOrMore>
84
90
  </element>
85
91
  </define>
86
92
  </grammar>
@@ -18,8 +18,8 @@ module IsoDoc
18
18
 
19
19
  def default_fonts(options)
20
20
  {
21
- bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Titillium Web",sans-serif'),
22
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Titillium Web",sans-serif'),
21
+ bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' : '"Titillium Web",sans-serif'),
22
+ headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' : '"Titillium Web",sans-serif'),
23
23
  monospacefont: '"Space Mono",monospace',
24
24
  normalfontsize: "15px",
25
25
  footnotefontsize: "0.9em",
@@ -3,6 +3,7 @@
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
7
8
 
8
9
  <xsl:key name="kfn" match="mpfd:p/mpfd:fn" use="@reference"/>
@@ -94,7 +95,9 @@
94
95
 
95
96
  </fo:layout-master-set>
96
97
 
97
- <xsl:call-template name="addPDFUAmeta"/>
98
+ <fo:declarations>
99
+ <xsl:call-template name="addPDFUAmeta"/>
100
+ </fo:declarations>
98
101
 
99
102
  <xsl:call-template name="addBookmarks">
100
103
  <xsl:with-param name="contents" select="$contents"/>
@@ -1039,6 +1042,7 @@
1039
1042
 
1040
1043
 
1041
1044
 
1045
+
1042
1046
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1043
1047
 
1044
1048
 
@@ -1146,6 +1150,7 @@
1146
1150
 
1147
1151
 
1148
1152
 
1153
+
1149
1154
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1150
1155
  <xsl:attribute name="margin-left">12mm</xsl:attribute>
1151
1156
  <xsl:attribute name="margin-right">12mm</xsl:attribute>
@@ -1278,202 +1283,236 @@
1278
1283
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1279
1284
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1280
1285
  <xsl:call-template name="add-zero-spaces-java"/>
1281
- </xsl:template><xsl:template match="*[local-name()='table']">
1286
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1282
1287
 
1283
- <xsl:variable name="simple-table">
1284
- <xsl:call-template name="getSimpleTable"/>
1285
- </xsl:variable>
1288
+ <xsl:variable name="table">
1286
1289
 
1287
-
1288
-
1289
-
1290
-
1291
- <!-- <xsl:if test="$namespace = 'bipm'">
1292
- <fo:block>&#xA0;</fo:block>
1293
- </xsl:if> -->
1294
-
1295
- <!-- $namespace = 'iso' or -->
1296
-
1297
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1298
-
1299
-
1300
-
1301
- <xsl:call-template name="fn_name_display"/>
1290
+ <xsl:variable name="simple-table">
1291
+ <xsl:call-template name="getSimpleTable"/>
1292
+ </xsl:variable>
1302
1293
 
1303
1294
 
1304
-
1305
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1306
-
1307
- <!-- <xsl:variable name="cols-count">
1308
- <xsl:choose>
1309
- <xsl:when test="*[local-name()='thead']">
1310
- <xsl:call-template name="calculate-columns-numbers">
1311
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1312
- </xsl:call-template>
1313
- </xsl:when>
1314
- <xsl:otherwise>
1315
- <xsl:call-template name="calculate-columns-numbers">
1316
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1317
- </xsl:call-template>
1318
- </xsl:otherwise>
1319
- </xsl:choose>
1320
- </xsl:variable> -->
1321
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1322
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1323
-
1324
-
1325
-
1326
- <xsl:variable name="colwidths">
1327
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1328
- <xsl:call-template name="calculate-column-widths">
1329
- <xsl:with-param name="cols-count" select="$cols-count"/>
1330
- <xsl:with-param name="table" select="$simple-table"/>
1331
- </xsl:call-template>
1332
- </xsl:if>
1333
- </xsl:variable>
1334
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1335
-
1336
- <!-- <xsl:variable name="colwidths2">
1337
- <xsl:call-template name="calculate-column-widths">
1338
- <xsl:with-param name="cols-count" select="$cols-count"/>
1339
- </xsl:call-template>
1340
- </xsl:variable> -->
1341
-
1342
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1343
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1344
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1345
-
1346
- <xsl:variable name="margin-left">
1347
- <xsl:choose>
1348
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1349
- <xsl:otherwise>0</xsl:otherwise>
1350
- </xsl:choose>
1351
- </xsl:variable>
1352
-
1353
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1354
1295
 
1355
1296
 
1356
-
1357
-
1358
-
1359
1297
 
1298
+ <!-- <xsl:if test="$namespace = 'bipm'">
1299
+ <fo:block>&#xA0;</fo:block>
1300
+ </xsl:if> -->
1360
1301
 
1361
-
1302
+ <!-- $namespace = 'iso' or -->
1303
+
1304
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1305
+
1306
+
1362
1307
 
1308
+ <xsl:call-template name="fn_name_display"/>
1363
1309
 
1310
+
1311
+
1312
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1313
+
1314
+ <!-- <xsl:variable name="cols-count">
1315
+ <xsl:choose>
1316
+ <xsl:when test="*[local-name()='thead']">
1317
+ <xsl:call-template name="calculate-columns-numbers">
1318
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1319
+ </xsl:call-template>
1320
+ </xsl:when>
1321
+ <xsl:otherwise>
1322
+ <xsl:call-template name="calculate-columns-numbers">
1323
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1324
+ </xsl:call-template>
1325
+ </xsl:otherwise>
1326
+ </xsl:choose>
1327
+ </xsl:variable> -->
1328
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1329
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1364
1330
 
1365
1331
 
1366
- <xsl:attribute name="space-after">12pt</xsl:attribute>
1367
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1368
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1369
1332
 
1333
+ <xsl:variable name="colwidths">
1334
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1335
+ <xsl:call-template name="calculate-column-widths">
1336
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1337
+ <xsl:with-param name="table" select="$simple-table"/>
1338
+ </xsl:call-template>
1339
+ </xsl:if>
1340
+ </xsl:variable>
1341
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1370
1342
 
1343
+ <!-- <xsl:variable name="colwidths2">
1344
+ <xsl:call-template name="calculate-column-widths">
1345
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1346
+ </xsl:call-template>
1347
+ </xsl:variable> -->
1371
1348
 
1349
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1350
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1351
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1372
1352
 
1373
- <xsl:variable name="table_attributes">
1374
- <attribute name="table-layout">fixed</attribute>
1375
- <attribute name="width">
1376
- <xsl:choose>
1377
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1378
- <xsl:otherwise>100%</xsl:otherwise>
1379
- </xsl:choose>
1380
- </attribute>
1381
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1382
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1353
+ <xsl:variable name="margin-left">
1354
+ <xsl:choose>
1355
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1356
+ <xsl:otherwise>0</xsl:otherwise>
1357
+ </xsl:choose>
1358
+ </xsl:variable>
1359
+
1360
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1383
1361
 
1384
1362
 
1363
+
1364
+
1365
+
1385
1366
 
1386
1367
 
1387
-
1388
-
1389
-
1368
+
1390
1369
 
1391
1370
 
1392
- <attribute name="border-top">2pt solid black</attribute>
1393
- <attribute name="border-bottom">2pt solid black</attribute>
1394
-
1395
1371
 
1396
- </xsl:variable>
1397
-
1398
-
1399
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1400
1372
 
1401
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1402
- <xsl:attribute name="{@name}">
1403
- <xsl:value-of select="."/>
1404
- </xsl:attribute>
1405
- </xsl:for-each>
1373
+ <xsl:attribute name="space-after">12pt</xsl:attribute>
1374
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
1375
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
1406
1376
 
1407
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1408
- <xsl:if test="$isNoteOrFnExist = 'true'">
1409
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1410
- </xsl:if>
1411
1377
 
1412
- <xsl:choose>
1413
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1414
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1415
- <fo:table-column column-width="{@width}"/>
1416
- </xsl:for-each>
1417
- </xsl:when>
1418
- <xsl:otherwise>
1419
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1420
- <xsl:choose>
1421
- <xsl:when test=". = 1 or . = 0">
1422
- <fo:table-column column-width="proportional-column-width(2)"/>
1423
- </xsl:when>
1424
- <xsl:otherwise>
1425
- <fo:table-column column-width="proportional-column-width({.})"/>
1426
- </xsl:otherwise>
1427
- </xsl:choose>
1428
- </xsl:for-each>
1429
- </xsl:otherwise>
1430
- </xsl:choose>
1431
1378
 
1432
- <xsl:choose>
1433
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1434
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1435
- </xsl:when>
1436
- <xsl:otherwise>
1437
- <xsl:apply-templates/>
1438
- </xsl:otherwise>
1439
- </xsl:choose>
1379
+ <xsl:variable name="table_width">
1380
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1381
+ 100%
1382
+
1383
+
1384
+ </xsl:variable>
1385
+
1386
+ <xsl:variable name="table_attributes">
1387
+ <attribute name="table-layout">fixed</attribute>
1388
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1389
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1390
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1391
+
1392
+
1393
+
1394
+
1395
+
1396
+
1397
+
1398
+
1399
+
1400
+ <attribute name="border-top">2pt solid black</attribute>
1401
+ <attribute name="border-bottom">2pt solid black</attribute>
1402
+
1403
+
1404
+ </xsl:variable>
1440
1405
 
1441
- </fo:table>
1442
-
1443
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1444
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1445
- <xsl:call-template name="insertTableFooterInSeparateTable">
1446
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1447
- <xsl:with-param name="colwidths" select="$colwidths"/>
1448
- <xsl:with-param name="colgroup" select="$colgroup"/>
1449
- </xsl:call-template>
1450
- </xsl:for-each>
1451
-
1452
- <!-- insert footer as table -->
1453
- <!-- <fo:table>
1454
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1455
- <xsl:attribute name="{@name}">
1456
- <xsl:value-of select="."/>
1457
- </xsl:attribute>
1458
- </xsl:for-each>
1459
1406
 
1460
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1407
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1408
+
1409
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1410
+ <xsl:attribute name="{@name}">
1411
+ <xsl:value-of select="."/>
1412
+ </xsl:attribute>
1413
+ </xsl:for-each>
1414
+
1415
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1416
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1417
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1418
+ </xsl:if>
1419
+
1420
+ <xsl:choose>
1421
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1422
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1423
+ <fo:table-column column-width="{@width}"/>
1424
+ </xsl:for-each>
1425
+ </xsl:when>
1426
+ <xsl:otherwise>
1427
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1428
+ <xsl:choose>
1429
+ <xsl:when test=". = 1 or . = 0">
1430
+ <fo:table-column column-width="proportional-column-width(2)"/>
1431
+ </xsl:when>
1432
+ <xsl:otherwise>
1433
+ <fo:table-column column-width="proportional-column-width({.})"/>
1434
+ </xsl:otherwise>
1435
+ </xsl:choose>
1436
+ </xsl:for-each>
1437
+ </xsl:otherwise>
1438
+ </xsl:choose>
1439
+
1461
1440
  <xsl:choose>
1462
- <xsl:when test=". = 1 or . = 0">
1463
- <fo:table-column column-width="proportional-column-width(2)"/>
1441
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1442
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1464
1443
  </xsl:when>
1465
1444
  <xsl:otherwise>
1466
- <fo:table-column column-width="proportional-column-width({.})"/>
1445
+ <xsl:apply-templates/>
1467
1446
  </xsl:otherwise>
1468
1447
  </xsl:choose>
1448
+
1449
+ </fo:table>
1450
+
1451
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1452
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1453
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1454
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1455
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1456
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1457
+ </xsl:call-template>
1469
1458
  </xsl:for-each>
1470
- </fo:table>-->
1471
-
1472
-
1473
-
1474
-
1475
-
1476
- </fo:block-container>
1459
+
1460
+ <!-- insert footer as table -->
1461
+ <!-- <fo:table>
1462
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1463
+ <xsl:attribute name="{@name}">
1464
+ <xsl:value-of select="."/>
1465
+ </xsl:attribute>
1466
+ </xsl:for-each>
1467
+
1468
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1469
+ <xsl:choose>
1470
+ <xsl:when test=". = 1 or . = 0">
1471
+ <fo:table-column column-width="proportional-column-width(2)"/>
1472
+ </xsl:when>
1473
+ <xsl:otherwise>
1474
+ <fo:table-column column-width="proportional-column-width({.})"/>
1475
+ </xsl:otherwise>
1476
+ </xsl:choose>
1477
+ </xsl:for-each>
1478
+ </fo:table>-->
1479
+
1480
+
1481
+
1482
+
1483
+
1484
+ </fo:block-container>
1485
+ </xsl:variable>
1486
+
1487
+
1488
+
1489
+ <xsl:choose>
1490
+ <xsl:when test="@width">
1491
+
1492
+ <!-- centered table when table name is centered (see table-name-style) -->
1493
+
1494
+ <fo:table table-layout="fixed" width="100%">
1495
+ <fo:table-column column-width="proportional-column-width(1)"/>
1496
+ <fo:table-column column-width="{@width}"/>
1497
+ <fo:table-column column-width="proportional-column-width(1)"/>
1498
+ <fo:table-body>
1499
+ <fo:table-row>
1500
+ <fo:table-cell column-number="2">
1501
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
1502
+ </fo:table-cell>
1503
+ </fo:table-row>
1504
+ </fo:table-body>
1505
+ </fo:table>
1506
+
1507
+
1508
+
1509
+
1510
+ </xsl:when>
1511
+ <xsl:otherwise>
1512
+ <xsl:copy-of select="$table"/>
1513
+ </xsl:otherwise>
1514
+ </xsl:choose>
1515
+
1477
1516
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1478
1517
  <xsl:if test="normalize-space() != ''">
1479
1518
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1601,7 +1640,15 @@
1601
1640
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1602
1641
  <xsl:value-of select="@target"/>
1603
1642
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1604
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1643
+ <xsl:variable name="mathml">
1644
+ <xsl:for-each select="*">
1645
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1646
+ <xsl:copy-of select="."/>
1647
+ </xsl:if>
1648
+ </xsl:for-each>
1649
+ </xsl:variable>
1650
+
1651
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1605
1652
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1606
1653
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1607
1654
  <xsl:param name="cols-count"/>
@@ -2287,7 +2334,7 @@
2287
2334
  <xsl:with-param name="table" select="$html-table"/>
2288
2335
  </xsl:call-template>
2289
2336
  </xsl:variable>
2290
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2337
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2291
2338
  <xsl:variable name="maxlength_dt">
2292
2339
  <xsl:call-template name="getMaxLength_dt"/>
2293
2340
  </xsl:variable>
@@ -2316,13 +2363,22 @@
2316
2363
  </xsl:when>
2317
2364
  <xsl:otherwise>
2318
2365
  <xsl:choose>
2366
+ <!-- to set width check most wide chars like `W` -->
2319
2367
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2320
- <fo:table-column column-width="5%"/>
2321
- <fo:table-column column-width="95%"/>
2368
+ <fo:table-column column-width="7%"/>
2369
+ <fo:table-column column-width="93%"/>
2322
2370
  </xsl:when>
2323
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2324
- <fo:table-column column-width="10%"/>
2325
- <fo:table-column column-width="90%"/>
2371
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2372
+ <fo:table-column column-width="15%"/>
2373
+ <fo:table-column column-width="85%"/>
2374
+ </xsl:when>
2375
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2376
+ <fo:table-column column-width="20%"/>
2377
+ <fo:table-column column-width="80%"/>
2378
+ </xsl:when>
2379
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2380
+ <fo:table-column column-width="25%"/>
2381
+ <fo:table-column column-width="75%"/>
2326
2382
  </xsl:when>
2327
2383
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2328
2384
  <fo:table-column column-width="60%"/>
@@ -2518,6 +2574,7 @@
2518
2574
 
2519
2575
 
2520
2576
 
2577
+
2521
2578
 
2522
2579
  </xsl:variable>
2523
2580
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2539,6 +2596,10 @@
2539
2596
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2540
2597
  <xsl:apply-templates/>
2541
2598
  </fo:inline>
2599
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2600
+ <fo:inline background-color="yellow">
2601
+ <xsl:apply-templates/>
2602
+ </fo:inline>
2542
2603
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2543
2604
  <xsl:variable name="text" select="normalize-space(.)"/>
2544
2605
  <fo:inline font-size="75%">
@@ -2628,6 +2689,10 @@
2628
2689
  <xsl:param name="text" select="."/>
2629
2690
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2630
2691
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2692
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
2693
+ <xsl:param name="text" select="."/>
2694
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2695
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2631
2696
  </xsl:template><xsl:template name="add-zero-spaces">
2632
2697
  <xsl:param name="text" select="."/>
2633
2698
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -2875,6 +2940,7 @@
2875
2940
  <xsl:apply-templates select="." mode="mathml"/>
2876
2941
  </xsl:variable>
2877
2942
  <fo:instream-foreign-object fox:alt-text="Math">
2943
+
2878
2944
  <!-- <xsl:copy-of select="."/> -->
2879
2945
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
2880
2946
  </fo:instream-foreign-object>
@@ -2888,7 +2954,12 @@
2888
2954
  <!-- replace start and end spaces to non-break space -->
2889
2955
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
2890
2956
  </xsl:copy>
2891
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
2957
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
2958
+ <xsl:copy>
2959
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
2960
+ </xsl:copy>
2961
+ <mathml:mspace width="0.5ex"/>
2962
+ </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">
2892
2963
  <xsl:variable name="target">
2893
2964
  <xsl:choose>
2894
2965
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -2909,7 +2980,10 @@
2909
2980
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
2910
2981
  <xsl:choose>
2911
2982
  <xsl:when test="normalize-space(.) = ''">
2912
- <xsl:value-of select="$target"/>
2983
+ <!-- <xsl:value-of select="$target"/> -->
2984
+ <xsl:call-template name="add-zero-spaces-link-java">
2985
+ <xsl:with-param name="text" select="$target"/>
2986
+ </xsl:call-template>
2913
2987
  </xsl:when>
2914
2988
  <xsl:otherwise>
2915
2989
  <xsl:apply-templates/>
@@ -2919,8 +2993,6 @@
2919
2993
  </xsl:otherwise>
2920
2994
  </xsl:choose>
2921
2995
  </fo:inline>
2922
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
2923
- <fo:inline id="{@id}"/>
2924
2996
  </xsl:template><xsl:template match="*[local-name()='appendix']">
2925
2997
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
2926
2998
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3111,7 +3183,7 @@
3111
3183
  </xsl:if> -->
3112
3184
  </fo:inline>
3113
3185
  </xsl:if>
3114
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3186
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3115
3187
  <fo:block-container id="{@id}">
3116
3188
 
3117
3189
  <fo:block>
@@ -3127,6 +3199,7 @@
3127
3199
  <fo:block id="{@id}">
3128
3200
  <xsl:apply-templates/>
3129
3201
  </fo:block>
3202
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3130
3203
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3131
3204
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3132
3205
  <xsl:apply-templates/>
@@ -3318,6 +3391,12 @@
3318
3391
  <!-- <xsl:text> </xsl:text> -->
3319
3392
  </xsl:template><xsl:template name="getSection">
3320
3393
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3394
+ <!--
3395
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3396
+ <xsl:value-of select="."/>
3397
+ </xsl:for-each>
3398
+ -->
3399
+
3321
3400
  </xsl:template><xsl:template name="getName">
3322
3401
  <xsl:choose>
3323
3402
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3370,6 +3449,12 @@
3370
3449
  <xsl:copy>
3371
3450
  <xsl:apply-templates mode="contents_item"/>
3372
3451
  </xsl:copy>
3452
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3453
+ <xsl:copy>
3454
+ <xsl:apply-templates mode="contents_item"/>
3455
+ </xsl:copy>
3456
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3457
+ <xsl:copy-of select="."/>
3373
3458
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3374
3459
  <xsl:text> </xsl:text>
3375
3460
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3395,6 +3480,7 @@
3395
3480
 
3396
3481
 
3397
3482
 
3483
+
3398
3484
 
3399
3485
 
3400
3486
 
@@ -3697,10 +3783,11 @@
3697
3783
  </xsl:choose>
3698
3784
 
3699
3785
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3700
-
3786
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3701
3787
  <xsl:variable name="element">
3702
3788
  block
3703
3789
 
3790
+
3704
3791
  </xsl:variable>
3705
3792
  <xsl:choose>
3706
3793
  <xsl:when test="normalize-space($element) = 'block'">
@@ -3771,11 +3858,13 @@
3771
3858
  </xsl:if>
3772
3859
  </xsl:if>
3773
3860
 
3861
+
3774
3862
  <fo:block-container margin-left="0mm">
3775
3863
 
3776
3864
  <fo:block xsl:use-attribute-sets="quote-style">
3777
3865
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
3778
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3866
+
3867
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3779
3868
  </fo:block>
3780
3869
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3781
3870
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -3798,32 +3887,50 @@
3798
3887
  <xsl:text>— </xsl:text>
3799
3888
  <xsl:apply-templates/>
3800
3889
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
3801
- <fo:inline xsl:use-attribute-sets="eref-style">
3802
- <xsl:if test="@type = 'footnote'">
3803
-
3804
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3805
- <xsl:attribute name="font-size">80%</xsl:attribute>
3806
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3807
- <xsl:attribute name="vertical-align">super</xsl:attribute>
3808
-
3809
-
3810
- </xsl:if>
3811
-
3812
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3813
-
3814
- <xsl:if test="@type = 'inline'">
3815
-
3816
- <xsl:attribute name="color">blue</xsl:attribute>
3817
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
3818
-
3819
-
3820
-
3821
- </xsl:if>
3822
-
3823
-
3824
- <xsl:apply-templates/>
3825
- </fo:basic-link>
3826
- </fo:inline>
3890
+
3891
+ <xsl:variable name="bibitemid">
3892
+ <xsl:choose>
3893
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
3894
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
3895
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
3896
+ </xsl:choose>
3897
+ </xsl:variable>
3898
+
3899
+ <xsl:choose>
3900
+ <xsl:when test="normalize-space($bibitemid) != ''">
3901
+ <fo:inline xsl:use-attribute-sets="eref-style">
3902
+ <xsl:if test="@type = 'footnote'">
3903
+
3904
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3905
+ <xsl:attribute name="font-size">80%</xsl:attribute>
3906
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3907
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
3908
+
3909
+
3910
+ </xsl:if>
3911
+
3912
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3913
+ <xsl:if test="normalize-space(@citeas) = ''">
3914
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
3915
+ </xsl:if>
3916
+ <xsl:if test="@type = 'inline'">
3917
+
3918
+ <xsl:attribute name="color">blue</xsl:attribute>
3919
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
3920
+
3921
+
3922
+
3923
+ </xsl:if>
3924
+
3925
+ <xsl:apply-templates/>
3926
+ </fo:basic-link>
3927
+
3928
+ </fo:inline>
3929
+ </xsl:when>
3930
+ <xsl:otherwise>
3931
+ <fo:inline><xsl:apply-templates/></fo:inline>
3932
+ </xsl:otherwise>
3933
+ </xsl:choose>
3827
3934
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
3828
3935
  <!-- zero-space char -->
3829
3936
  <xsl:variable name="depth">
@@ -3924,6 +4031,7 @@
3924
4031
 
3925
4032
 
3926
4033
 
4034
+
3927
4035
 
3928
4036
 
3929
4037
 
@@ -3935,7 +4043,7 @@
3935
4043
 
3936
4044
 
3937
4045
 
3938
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4046
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
3939
4047
  <fo:block break-after="page"/>
3940
4048
  <fo:block>
3941
4049
  <xsl:call-template name="setId"/>
@@ -3943,7 +4051,8 @@
3943
4051
  </fo:block>
3944
4052
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
3945
4053
  <fo:block>
3946
- <xsl:call-template name="setId"/>
4054
+ <xsl:call-template name="setId"/>
4055
+
3947
4056
 
3948
4057
  <xsl:apply-templates/>
3949
4058
  </fo:block>
@@ -3994,6 +4103,153 @@
3994
4103
  </fo:block>
3995
4104
  </xsl:otherwise>
3996
4105
  </xsl:choose>
4106
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4107
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4108
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4109
+ </xsl:for-each>
4110
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4111
+ <xsl:copy>
4112
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4113
+ </xsl:copy>
4114
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4115
+ <xsl:variable name="id">
4116
+ <xsl:call-template name="generateIndexXrefId"/>
4117
+ </xsl:variable>
4118
+ <xsl:copy> <!-- add id to xref -->
4119
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4120
+ <xsl:attribute name="id">
4121
+ <xsl:value-of select="$id"/>
4122
+ </xsl:attribute>
4123
+ <xsl:apply-templates mode="index_add_id"/>
4124
+ </xsl:copy>
4125
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4126
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4127
+ <xsl:if test="@to">
4128
+ <xsl:value-of select="$dash"/>
4129
+ <xsl:copy>
4130
+ <xsl:copy-of select="@*"/>
4131
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4132
+ <xsl:attribute name="id">
4133
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4134
+ </xsl:attribute>
4135
+ <xsl:apply-templates mode="index_add_id"/>
4136
+ </xsl:copy>
4137
+ </xsl:if>
4138
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4139
+ <xsl:copy>
4140
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4141
+ </xsl:copy>
4142
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4143
+ <xsl:copy>
4144
+ <xsl:apply-templates select="@*" mode="index_update"/>
4145
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4146
+ </xsl:copy>
4147
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4148
+ <xsl:param name="element"/>
4149
+ <xsl:param name="remove" select="'false'"/>
4150
+ <xsl:param name="target"/>
4151
+ <!-- <node></node> -->
4152
+ <xsl:choose>
4153
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4154
+ <!-- skip text (i.e. remove it) and process next element -->
4155
+ <!-- [removed_<xsl:value-of select="."/>] -->
4156
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4157
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4158
+ </xsl:apply-templates>
4159
+ </xsl:when>
4160
+ <xsl:when test="self::text()">
4161
+ <xsl:value-of select="."/>
4162
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4163
+ </xsl:when>
4164
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4165
+ <xsl:variable name="id" select="@id"/>
4166
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4167
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4168
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4169
+
4170
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4171
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4172
+
4173
+ <xsl:choose>
4174
+ <!-- 2nd pass -->
4175
+ <!-- if page is equal to page for next and page is not the end of range -->
4176
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4177
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4178
+ <!-- [removed_xref] -->
4179
+
4180
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4181
+ <xsl:with-param name="remove">true</xsl:with-param>
4182
+ <xsl:with-param name="target">
4183
+ <xsl:choose>
4184
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4185
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4186
+ </xsl:choose>
4187
+ </xsl:with-param>
4188
+ </xsl:apply-templates>
4189
+ </xsl:when>
4190
+
4191
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4192
+ <!-- remove xref -->
4193
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4194
+ <xsl:with-param name="remove">true</xsl:with-param>
4195
+ </xsl:apply-templates>
4196
+ </xsl:when>
4197
+
4198
+ <xsl:otherwise>
4199
+ <xsl:apply-templates select="." mode="xref_copy">
4200
+ <xsl:with-param name="target" select="$target"/>
4201
+ </xsl:apply-templates>
4202
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4203
+ </xsl:otherwise>
4204
+ </xsl:choose>
4205
+ </xsl:when>
4206
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4207
+ <!-- ul -->
4208
+ <xsl:apply-templates select="." mode="index_update"/>
4209
+ </xsl:when>
4210
+ <xsl:otherwise>
4211
+ <xsl:apply-templates select="." mode="xref_copy">
4212
+ <xsl:with-param name="target" select="$target"/>
4213
+ </xsl:apply-templates>
4214
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4215
+ </xsl:otherwise>
4216
+ </xsl:choose>
4217
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4218
+ <xsl:param name="target"/>
4219
+ <xsl:copy>
4220
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4221
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4222
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4223
+ </xsl:if>
4224
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4225
+ </xsl:copy>
4226
+ </xsl:template><xsl:template name="generateIndexXrefId">
4227
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4228
+
4229
+ <xsl:variable name="docid">
4230
+ <xsl:call-template name="getDocumentId"/>
4231
+ </xsl:variable>
4232
+ <xsl:variable name="item_number">
4233
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4234
+ </xsl:variable>
4235
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4236
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4237
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4238
+ <xsl:apply-templates/>
4239
+ <fo:block>
4240
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4241
+ <fo:block> </fo:block>
4242
+ </xsl:if>
4243
+ </fo:block>
4244
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4245
+ <xsl:apply-templates/>
4246
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4247
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4248
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4249
+ <xsl:apply-templates/>
4250
+ </fo:block>
4251
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4252
+ <fo:inline id="{@id}" font-size="1pt"/>
3997
4253
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
3998
4254
  <!-- <row>
3999
4255
  <date>05-07-2013</date>
@@ -4115,6 +4371,57 @@
4115
4371
  </xsl:variable>
4116
4372
  <xsl:variable name="result">
4117
4373
  <xsl:choose>
4374
+ <xsl:when test="$format = 'ddMMyyyy'">
4375
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4376
+ <xsl:text> </xsl:text>
4377
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4378
+ </xsl:when>
4379
+ <xsl:when test="$format = 'ddMM'">
4380
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4381
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4382
+ </xsl:when>
4383
+ <xsl:when test="$format = 'short' or $day = ''">
4384
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4385
+ </xsl:when>
4386
+ <xsl:otherwise>
4387
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4388
+ </xsl:otherwise>
4389
+ </xsl:choose>
4390
+ </xsl:variable>
4391
+ <xsl:value-of select="$result"/>
4392
+ </xsl:template><xsl:template name="convertDateLocalized">
4393
+ <xsl:param name="date"/>
4394
+ <xsl:param name="format" select="'short'"/>
4395
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4396
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4397
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4398
+ <xsl:variable name="monthStr">
4399
+ <xsl:choose>
4400
+ <xsl:when test="$month = '01'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_january</xsl:with-param></xsl:call-template></xsl:when>
4401
+ <xsl:when test="$month = '02'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_february</xsl:with-param></xsl:call-template></xsl:when>
4402
+ <xsl:when test="$month = '03'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_march</xsl:with-param></xsl:call-template></xsl:when>
4403
+ <xsl:when test="$month = '04'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_april</xsl:with-param></xsl:call-template></xsl:when>
4404
+ <xsl:when test="$month = '05'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_may</xsl:with-param></xsl:call-template></xsl:when>
4405
+ <xsl:when test="$month = '06'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_june</xsl:with-param></xsl:call-template></xsl:when>
4406
+ <xsl:when test="$month = '07'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_july</xsl:with-param></xsl:call-template></xsl:when>
4407
+ <xsl:when test="$month = '08'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_august</xsl:with-param></xsl:call-template></xsl:when>
4408
+ <xsl:when test="$month = '09'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_september</xsl:with-param></xsl:call-template></xsl:when>
4409
+ <xsl:when test="$month = '10'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_october</xsl:with-param></xsl:call-template></xsl:when>
4410
+ <xsl:when test="$month = '11'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_november</xsl:with-param></xsl:call-template></xsl:when>
4411
+ <xsl:when test="$month = '12'"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">month_december</xsl:with-param></xsl:call-template></xsl:when>
4412
+ </xsl:choose>
4413
+ </xsl:variable>
4414
+ <xsl:variable name="result">
4415
+ <xsl:choose>
4416
+ <xsl:when test="$format = 'ddMMyyyy'">
4417
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4418
+ <xsl:text> </xsl:text>
4419
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4420
+ </xsl:when>
4421
+ <xsl:when test="$format = 'ddMM'">
4422
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4423
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4424
+ </xsl:when>
4118
4425
  <xsl:when test="$format = 'short' or $day = ''">
4119
4426
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4120
4427
  </xsl:when>
@@ -4130,7 +4437,7 @@
4130
4437
  <xsl:param name="charDelim" select="', '"/>
4131
4438
  <xsl:choose>
4132
4439
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4133
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4440
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4134
4441
  <xsl:sort data-type="text" order="ascending"/>
4135
4442
  <xsl:call-template name="insertKeyword">
4136
4443
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4139,7 +4446,7 @@
4139
4446
  </xsl:for-each>
4140
4447
  </xsl:when>
4141
4448
  <xsl:otherwise>
4142
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4449
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4143
4450
  <xsl:call-template name="insertKeyword">
4144
4451
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4145
4452
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4156,61 +4463,64 @@
4156
4463
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4157
4464
  </xsl:choose>
4158
4465
  </xsl:template><xsl:template name="addPDFUAmeta">
4159
- <fo:declarations>
4160
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4161
- <pdf:dictionary type="normal" key="ViewerPreferences">
4162
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4163
- </pdf:dictionary>
4164
- </pdf:catalog>
4165
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4166
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4167
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4168
- <!-- Dublin Core properties go here -->
4169
- <dc:title>
4170
- <xsl:variable name="title">
4466
+ <xsl:variable name="lang">
4467
+ <xsl:call-template name="getLang"/>
4468
+ </xsl:variable>
4469
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4470
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4471
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4472
+ </pdf:dictionary>
4473
+ </pdf:catalog>
4474
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4475
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4476
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4477
+ <!-- Dublin Core properties go here -->
4478
+ <dc:title>
4479
+ <xsl:variable name="title">
4480
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4481
+
4171
4482
 
4172
4483
 
4173
4484
 
4174
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
4485
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4175
4486
 
4176
4487
 
4177
4488
 
4178
- </xsl:variable>
4179
- <xsl:choose>
4180
- <xsl:when test="normalize-space($title) != ''">
4181
- <xsl:value-of select="$title"/>
4182
- </xsl:when>
4183
- <xsl:otherwise>
4184
- <xsl:text> </xsl:text>
4185
- </xsl:otherwise>
4186
- </xsl:choose>
4187
- </dc:title>
4188
- <dc:creator>
4489
+ </xsl:for-each>
4490
+ </xsl:variable>
4491
+ <xsl:choose>
4492
+ <xsl:when test="normalize-space($title) != ''">
4493
+ <xsl:value-of select="$title"/>
4494
+ </xsl:when>
4495
+ <xsl:otherwise>
4496
+ <xsl:text> </xsl:text>
4497
+ </xsl:otherwise>
4498
+ </xsl:choose>
4499
+ </dc:title>
4500
+ <dc:creator>
4501
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4189
4502
 
4190
4503
 
4191
4504
 
4192
- </dc:creator>
4193
- <dc:description>
4194
- <xsl:variable name="abstract">
4195
-
4196
-
4197
-
4198
-
4199
-
4200
- </xsl:variable>
4201
- <xsl:value-of select="normalize-space($abstract)"/>
4202
- </dc:description>
4203
- <pdf:Keywords>
4204
- <xsl:call-template name="insertKeywords"/>
4205
- </pdf:Keywords>
4206
- </rdf:Description>
4207
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4208
- <!-- XMP properties go here -->
4209
- <xmp:CreatorTool/>
4210
- </rdf:Description>
4211
- </rdf:RDF>
4212
- </x:xmpmeta>
4213
- </fo:declarations>
4505
+ </xsl:for-each>
4506
+ </dc:creator>
4507
+ <dc:description>
4508
+ <xsl:variable name="abstract">
4509
+
4510
+
4511
+ </xsl:variable>
4512
+ <xsl:value-of select="normalize-space($abstract)"/>
4513
+ </dc:description>
4514
+ <pdf:Keywords>
4515
+ <xsl:call-template name="insertKeywords"/>
4516
+ </pdf:Keywords>
4517
+ </rdf:Description>
4518
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4519
+ <!-- XMP properties go here -->
4520
+ <xmp:CreatorTool/>
4521
+ </rdf:Description>
4522
+ </rdf:RDF>
4523
+ </x:xmpmeta>
4214
4524
  </xsl:template><xsl:template name="getId">
4215
4525
  <xsl:choose>
4216
4526
  <xsl:when test="../@id">
@@ -4307,6 +4617,7 @@
4307
4617
  <xsl:value-of select="document('')//*/namespace::mpfd"/>
4308
4618
 
4309
4619
 
4620
+
4310
4621
  </xsl:variable>
4311
4622
  <xsl:if test="$documentNS != $XSLNS">
4312
4623
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>