metanorma-csa 1.7.1 → 1.7.6

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: e6fe06c1107b70d768044a3ebc469e00b060b466c0a4582b84344d25460daff8
4
- data.tar.gz: 3bdd15ce9f800edd24868b63ffe09f46d110b71906a67446a7000e8291ffa33d
3
+ metadata.gz: '038ff66044310e3d885d162467ea00ac88862984d42ed54090d450d91979dbfa'
4
+ data.tar.gz: 2878930f76d4fd76765ba564dae4b05f404873d4146fec60eadb2d86975a8e74
5
5
  SHA512:
6
- metadata.gz: 2ccc69f6f1dd8e66f96787f93ded9d5e867a73c0c38358908b7616fd9f25ddf5e3a3009089c0144ef50523e25fb6de4c50305e874d2fba315d42049d28e326eb
7
- data.tar.gz: e2127ad0bf2f0dec437c30a677b0bae3f3283946bb83d5eda4597daebfb97aa5304fb0e6e333f895f274677d86d3f369163dc8ef5a4625dbe169c02d435cf475
6
+ metadata.gz: a85d42849a4b81037444a83b4eb75c888705b83d9777dc84a45bbefaef6e56f3cb0a8b2ac813e7e7bd572c89da49fca6b3d557b293143b1be39b5f8a7e2811e2
7
+ data.tar.gz: 691de758131ffe0c1c4ef87dd11339aea79b41be5880a2b5a895f297efef431739999eb8b7331d87db6555144f371f4b23d17624fc00f8baade1c62d886c2f2f
@@ -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,47 +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
- - uses: actions/cache@v2
40
- with:
41
- path: vendor/bundle
42
- key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
43
- restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
44
-
45
- - run: bundle config set path 'vendor/bundle'
46
-
47
- - run: bundle install --jobs 4 --retry 3
40
+ bundler-cache: true
48
41
 
49
42
  - run: bundle exec rake
50
-
51
- tests-passed:
52
- needs: rake
53
- runs-on: ubuntu-latest
54
- steps:
55
- - name: Trigger tests passed event
56
- uses: Sibz/github-status-action@v1
57
- with:
58
- authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
59
- context: 'tests-passed-successfully'
60
- description: 'Tests passed successfully'
61
- state: 'success'
62
- sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -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"/>
@@ -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>
@@ -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"/>
@@ -253,6 +253,9 @@
253
253
  <data type="boolean"/>
254
254
  </attribute>
255
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
256
259
  <optional>
257
260
  <ref name="colgroup"/>
258
261
  </optional>
@@ -786,6 +789,9 @@
786
789
  <attribute name="width"/>
787
790
  </element>
788
791
  </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
789
795
  <define name="TextElement" combine="choice">
790
796
  <ref name="concept"/>
791
797
  </define>
@@ -806,6 +812,8 @@
806
812
  <ref name="requirement"/>
807
813
  <ref name="recommendation"/>
808
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
809
817
  </choice>
810
818
  </define>
811
819
  <define name="bibliography">
@@ -836,6 +844,9 @@
836
844
  <data type="boolean"/>
837
845
  </attribute>
838
846
  </optional>
847
+ <optional>
848
+ <attribute name="number"/>
849
+ </optional>
839
850
  <optional>
840
851
  <attribute name="obligation">
841
852
  <choice>
@@ -891,9 +902,11 @@
891
902
  <element name="code">
892
903
  <text/>
893
904
  </element>
894
- <element name="text">
895
- <text/>
896
- </element>
905
+ <optional>
906
+ <element name="text">
907
+ <text/>
908
+ </element>
909
+ </optional>
897
910
  </element>
898
911
  </define>
899
912
  <define name="standard-document">
@@ -906,6 +919,9 @@
906
919
  </choice>
907
920
  </attribute>
908
921
  <ref name="bibdata"/>
922
+ <optional>
923
+ <ref name="misccontainer"/>
924
+ </optional>
909
925
  <optional>
910
926
  <ref name="boilerplate"/>
911
927
  </optional>
@@ -916,11 +932,21 @@
916
932
  <zeroOrMore>
917
933
  <ref name="annex"/>
918
934
  </zeroOrMore>
935
+ <optional>
936
+ <ref name="bibliography"/>
937
+ </optional>
919
938
  <zeroOrMore>
920
- <ref name="references"/>
939
+ <ref name="indexsect"/>
921
940
  </zeroOrMore>
922
941
  </element>
923
942
  </define>
943
+ <define name="misccontainer">
944
+ <element name="misc-container">
945
+ <oneOrMore>
946
+ <ref name="AnyElement"/>
947
+ </oneOrMore>
948
+ </element>
949
+ </define>
924
950
  <define name="preface">
925
951
  <element name="preface">
926
952
  <oneOrMore>
@@ -944,6 +970,11 @@
944
970
  <ref name="Content-Section"/>
945
971
  </element>
946
972
  </define>
973
+ <define name="indexsect">
974
+ <element name="indexsect">
975
+ <ref name="Content-Section"/>
976
+ </element>
977
+ </define>
947
978
  <define name="boilerplate">
948
979
  <element name="boilerplate">
949
980
  <optional>
@@ -1063,6 +1094,9 @@
1063
1094
  </choice>
1064
1095
  </attribute>
1065
1096
  </optional>
1097
+ <optional>
1098
+ <attribute name="number"/>
1099
+ </optional>
1066
1100
  <optional>
1067
1101
  <attribute name="type"/>
1068
1102
  </optional>
@@ -1116,6 +1150,9 @@
1116
1150
  <optional>
1117
1151
  <attribute name="type"/>
1118
1152
  </optional>
1153
+ <optional>
1154
+ <attribute name="number"/>
1155
+ </optional>
1119
1156
  <optional>
1120
1157
  <ref name="section-title"/>
1121
1158
  </optional>
@@ -1218,6 +1255,9 @@
1218
1255
  <optional>
1219
1256
  <attribute name="type"/>
1220
1257
  </optional>
1258
+ <optional>
1259
+ <attribute name="number"/>
1260
+ </optional>
1221
1261
  <optional>
1222
1262
  <attribute name="obligation">
1223
1263
  <choice>
@@ -1546,6 +1586,7 @@
1546
1586
  <value>add</value>
1547
1587
  <value>modify</value>
1548
1588
  <value>delete</value>
1589
+ <value>replace</value>
1549
1590
  </choice>
1550
1591
  </attribute>
1551
1592
  <optional>
@@ -1576,6 +1617,11 @@
1576
1617
  </optional>
1577
1618
  <optional>
1578
1619
  <element name="newcontent">
1620
+ <optional>
1621
+ <attribute name="id">
1622
+ <data type="ID"/>
1623
+ </attribute>
1624
+ </optional>
1579
1625
  <zeroOrMore>
1580
1626
  <ref name="BasicBlock"/>
1581
1627
  </zeroOrMore>
@@ -1609,4 +1655,87 @@
1609
1655
  <text/>
1610
1656
  </element>
1611
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>
1612
1741
  </grammar>
@@ -3,6 +3,7 @@
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)"/>
7
8
 
8
9
  <xsl:variable name="pageWidth" select="'215.9mm'"/>
@@ -52,7 +53,9 @@
52
53
 
53
54
  </fo:layout-master-set>
54
55
 
55
- <xsl:call-template name="addPDFUAmeta"/>
56
+ <fo:declarations>
57
+ <xsl:call-template name="addPDFUAmeta"/>
58
+ </fo:declarations>
56
59
 
57
60
  <xsl:call-template name="addBookmarks">
58
61
  <xsl:with-param name="contents" select="$contents"/>
@@ -1146,6 +1149,7 @@
1146
1149
 
1147
1150
 
1148
1151
 
1152
+
1149
1153
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
1150
1154
 
1151
1155
  <xsl:attribute name="padding-right">10mm</xsl:attribute>
@@ -1264,6 +1268,7 @@
1264
1268
 
1265
1269
 
1266
1270
 
1271
+
1267
1272
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1268
1273
 
1269
1274
  <xsl:attribute name="text-align">right</xsl:attribute>
@@ -1404,188 +1409,227 @@
1404
1409
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1405
1410
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1406
1411
  <xsl:call-template name="add-zero-spaces-java"/>
1407
- </xsl:template><xsl:template match="*[local-name()='table']">
1412
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1408
1413
 
1409
- <xsl:variable name="simple-table">
1410
- <xsl:call-template name="getSimpleTable"/>
1411
- </xsl:variable>
1414
+ <xsl:variable name="table">
1412
1415
 
1413
-
1414
-
1415
-
1416
-
1417
- <!-- <xsl:if test="$namespace = 'bipm'">
1418
- <fo:block>&#xA0;</fo:block>
1419
- </xsl:if> -->
1420
-
1421
- <!-- $namespace = 'iso' or -->
1422
-
1423
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1424
-
1425
-
1416
+ <xsl:variable name="simple-table">
1417
+ <xsl:call-template name="getSimpleTable"/>
1418
+ </xsl:variable>
1426
1419
 
1427
1420
 
1428
-
1429
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1430
-
1431
- <!-- <xsl:variable name="cols-count">
1432
- <xsl:choose>
1433
- <xsl:when test="*[local-name()='thead']">
1434
- <xsl:call-template name="calculate-columns-numbers">
1435
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1436
- </xsl:call-template>
1437
- </xsl:when>
1438
- <xsl:otherwise>
1439
- <xsl:call-template name="calculate-columns-numbers">
1440
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1441
- </xsl:call-template>
1442
- </xsl:otherwise>
1443
- </xsl:choose>
1444
- </xsl:variable> -->
1445
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1446
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1447
-
1448
-
1449
-
1450
- <xsl:variable name="colwidths">
1451
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1452
- <xsl:call-template name="calculate-column-widths">
1453
- <xsl:with-param name="cols-count" select="$cols-count"/>
1454
- <xsl:with-param name="table" select="$simple-table"/>
1455
- </xsl:call-template>
1456
- </xsl:if>
1457
- </xsl:variable>
1458
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1459
-
1460
- <!-- <xsl:variable name="colwidths2">
1461
- <xsl:call-template name="calculate-column-widths">
1462
- <xsl:with-param name="cols-count" select="$cols-count"/>
1463
- </xsl:call-template>
1464
- </xsl:variable> -->
1465
-
1466
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1467
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1468
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1469
-
1470
- <xsl:variable name="margin-left">
1471
- <xsl:choose>
1472
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1473
- <xsl:otherwise>0</xsl:otherwise>
1474
- </xsl:choose>
1475
- </xsl:variable>
1476
-
1477
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1478
1421
 
1479
1422
 
1480
-
1481
-
1482
-
1483
1423
 
1424
+ <!-- <xsl:if test="$namespace = 'bipm'">
1425
+ <fo:block>&#xA0;</fo:block>
1426
+ </xsl:if> -->
1484
1427
 
1485
-
1428
+ <!-- $namespace = 'iso' or -->
1429
+
1430
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1431
+
1432
+
1433
+
1434
+
1435
+
1436
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1437
+
1438
+ <!-- <xsl:variable name="cols-count">
1439
+ <xsl:choose>
1440
+ <xsl:when test="*[local-name()='thead']">
1441
+ <xsl:call-template name="calculate-columns-numbers">
1442
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1443
+ </xsl:call-template>
1444
+ </xsl:when>
1445
+ <xsl:otherwise>
1446
+ <xsl:call-template name="calculate-columns-numbers">
1447
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1448
+ </xsl:call-template>
1449
+ </xsl:otherwise>
1450
+ </xsl:choose>
1451
+ </xsl:variable> -->
1452
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1453
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1486
1454
 
1487
1455
 
1488
1456
 
1457
+ <xsl:variable name="colwidths">
1458
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1459
+ <xsl:call-template name="calculate-column-widths">
1460
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1461
+ <xsl:with-param name="table" select="$simple-table"/>
1462
+ </xsl:call-template>
1463
+ </xsl:if>
1464
+ </xsl:variable>
1465
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1489
1466
 
1467
+ <!-- <xsl:variable name="colwidths2">
1468
+ <xsl:call-template name="calculate-column-widths">
1469
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1470
+ </xsl:call-template>
1471
+ </xsl:variable> -->
1490
1472
 
1473
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1474
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1475
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1491
1476
 
1477
+ <xsl:variable name="margin-left">
1478
+ <xsl:choose>
1479
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1480
+ <xsl:otherwise>0</xsl:otherwise>
1481
+ </xsl:choose>
1482
+ </xsl:variable>
1492
1483
 
1493
- <xsl:variable name="table_attributes">
1494
- <attribute name="table-layout">fixed</attribute>
1495
- <attribute name="width">100%</attribute>
1496
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1497
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1484
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1498
1485
 
1499
1486
 
1487
+
1488
+
1489
+
1500
1490
 
1501
1491
 
1502
-
1503
-
1504
-
1492
+
1505
1493
 
1506
-
1507
1494
 
1508
- </xsl:variable>
1509
-
1510
-
1511
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1512
1495
 
1513
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1514
- <xsl:attribute name="{@name}">
1515
- <xsl:value-of select="."/>
1516
- </xsl:attribute>
1517
- </xsl:for-each>
1518
1496
 
1519
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1520
- <xsl:if test="$isNoteOrFnExist = 'true'">
1521
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1522
- </xsl:if>
1523
1497
 
1524
- <xsl:choose>
1525
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1526
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1527
- <fo:table-column column-width="{@width}"/>
1528
- </xsl:for-each>
1529
- </xsl:when>
1530
- <xsl:otherwise>
1531
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1532
- <xsl:choose>
1533
- <xsl:when test=". = 1 or . = 0">
1534
- <fo:table-column column-width="proportional-column-width(2)"/>
1535
- </xsl:when>
1536
- <xsl:otherwise>
1537
- <fo:table-column column-width="proportional-column-width({.})"/>
1538
- </xsl:otherwise>
1539
- </xsl:choose>
1540
- </xsl:for-each>
1541
- </xsl:otherwise>
1542
- </xsl:choose>
1543
1498
 
1544
- <xsl:choose>
1545
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1546
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1547
- </xsl:when>
1548
- <xsl:otherwise>
1549
- <xsl:apply-templates/>
1550
- </xsl:otherwise>
1551
- </xsl:choose>
1499
+ <xsl:variable name="table_width">
1500
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1501
+ 100%
1502
+
1503
+
1504
+ </xsl:variable>
1505
+
1506
+ <xsl:variable name="table_attributes">
1507
+ <attribute name="table-layout">fixed</attribute>
1508
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1509
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1510
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1511
+
1512
+
1513
+
1514
+
1515
+
1516
+
1517
+
1518
+
1519
+
1520
+
1521
+ </xsl:variable>
1552
1522
 
1553
- </fo:table>
1554
-
1555
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1556
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1557
- <xsl:call-template name="insertTableFooterInSeparateTable">
1558
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1559
- <xsl:with-param name="colwidths" select="$colwidths"/>
1560
- <xsl:with-param name="colgroup" select="$colgroup"/>
1561
- </xsl:call-template>
1562
- </xsl:for-each>
1563
-
1564
- <!-- insert footer as table -->
1565
- <!-- <fo:table>
1566
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1567
- <xsl:attribute name="{@name}">
1568
- <xsl:value-of select="."/>
1569
- </xsl:attribute>
1570
- </xsl:for-each>
1571
1523
 
1572
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1524
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1525
+
1526
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1527
+ <xsl:attribute name="{@name}">
1528
+ <xsl:value-of select="."/>
1529
+ </xsl:attribute>
1530
+ </xsl:for-each>
1531
+
1532
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1533
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1534
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1535
+ </xsl:if>
1536
+
1537
+ <xsl:choose>
1538
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1539
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1540
+ <fo:table-column column-width="{@width}"/>
1541
+ </xsl:for-each>
1542
+ </xsl:when>
1543
+ <xsl:otherwise>
1544
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1545
+ <xsl:choose>
1546
+ <xsl:when test=". = 1 or . = 0">
1547
+ <fo:table-column column-width="proportional-column-width(2)"/>
1548
+ </xsl:when>
1549
+ <xsl:otherwise>
1550
+ <fo:table-column column-width="proportional-column-width({.})"/>
1551
+ </xsl:otherwise>
1552
+ </xsl:choose>
1553
+ </xsl:for-each>
1554
+ </xsl:otherwise>
1555
+ </xsl:choose>
1556
+
1573
1557
  <xsl:choose>
1574
- <xsl:when test=". = 1 or . = 0">
1575
- <fo:table-column column-width="proportional-column-width(2)"/>
1558
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1559
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1576
1560
  </xsl:when>
1577
1561
  <xsl:otherwise>
1578
- <fo:table-column column-width="proportional-column-width({.})"/>
1562
+ <xsl:apply-templates/>
1579
1563
  </xsl:otherwise>
1580
1564
  </xsl:choose>
1565
+
1566
+ </fo:table>
1567
+
1568
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1569
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1570
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1571
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1572
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1573
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1574
+ </xsl:call-template>
1581
1575
  </xsl:for-each>
1582
- </fo:table>-->
1583
-
1584
-
1585
-
1586
-
1587
-
1588
- </fo:block-container>
1576
+
1577
+ <!-- insert footer as table -->
1578
+ <!-- <fo:table>
1579
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1580
+ <xsl:attribute name="{@name}">
1581
+ <xsl:value-of select="."/>
1582
+ </xsl:attribute>
1583
+ </xsl:for-each>
1584
+
1585
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1586
+ <xsl:choose>
1587
+ <xsl:when test=". = 1 or . = 0">
1588
+ <fo:table-column column-width="proportional-column-width(2)"/>
1589
+ </xsl:when>
1590
+ <xsl:otherwise>
1591
+ <fo:table-column column-width="proportional-column-width({.})"/>
1592
+ </xsl:otherwise>
1593
+ </xsl:choose>
1594
+ </xsl:for-each>
1595
+ </fo:table>-->
1596
+
1597
+
1598
+
1599
+
1600
+
1601
+ </fo:block-container>
1602
+ </xsl:variable>
1603
+
1604
+
1605
+
1606
+ <xsl:choose>
1607
+ <xsl:when test="@width">
1608
+
1609
+ <!-- centered table when table name is centered (see table-name-style) -->
1610
+
1611
+ <fo:table table-layout="fixed" width="100%">
1612
+ <fo:table-column column-width="proportional-column-width(1)"/>
1613
+ <fo:table-column column-width="{@width}"/>
1614
+ <fo:table-column column-width="proportional-column-width(1)"/>
1615
+ <fo:table-body>
1616
+ <fo:table-row>
1617
+ <fo:table-cell column-number="2">
1618
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
1619
+ </fo:table-cell>
1620
+ </fo:table-row>
1621
+ </fo:table-body>
1622
+ </fo:table>
1623
+
1624
+
1625
+
1626
+
1627
+ </xsl:when>
1628
+ <xsl:otherwise>
1629
+ <xsl:copy-of select="$table"/>
1630
+ </xsl:otherwise>
1631
+ </xsl:choose>
1632
+
1589
1633
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1590
1634
  <xsl:if test="normalize-space() != ''">
1591
1635
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1713,7 +1757,15 @@
1713
1757
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1714
1758
  <xsl:value-of select="@target"/>
1715
1759
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1716
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1760
+ <xsl:variable name="mathml">
1761
+ <xsl:for-each select="*">
1762
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1763
+ <xsl:copy-of select="."/>
1764
+ </xsl:if>
1765
+ </xsl:for-each>
1766
+ </xsl:variable>
1767
+
1768
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1717
1769
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1718
1770
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1719
1771
  <xsl:param name="cols-count"/>
@@ -2396,7 +2448,7 @@
2396
2448
  <xsl:with-param name="table" select="$html-table"/>
2397
2449
  </xsl:call-template>
2398
2450
  </xsl:variable>
2399
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2451
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2400
2452
  <xsl:variable name="maxlength_dt">
2401
2453
  <xsl:call-template name="getMaxLength_dt"/>
2402
2454
  </xsl:variable>
@@ -2425,13 +2477,22 @@
2425
2477
  </xsl:when>
2426
2478
  <xsl:otherwise>
2427
2479
  <xsl:choose>
2480
+ <!-- to set width check most wide chars like `W` -->
2428
2481
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2429
- <fo:table-column column-width="5%"/>
2430
- <fo:table-column column-width="95%"/>
2482
+ <fo:table-column column-width="7%"/>
2483
+ <fo:table-column column-width="93%"/>
2484
+ </xsl:when>
2485
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2486
+ <fo:table-column column-width="15%"/>
2487
+ <fo:table-column column-width="85%"/>
2431
2488
  </xsl:when>
2432
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2433
- <fo:table-column column-width="10%"/>
2434
- <fo:table-column column-width="90%"/>
2489
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2490
+ <fo:table-column column-width="20%"/>
2491
+ <fo:table-column column-width="80%"/>
2492
+ </xsl:when>
2493
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2494
+ <fo:table-column column-width="25%"/>
2495
+ <fo:table-column column-width="75%"/>
2435
2496
  </xsl:when>
2436
2497
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2437
2498
  <fo:table-column column-width="60%"/>
@@ -2627,6 +2688,7 @@
2627
2688
 
2628
2689
 
2629
2690
 
2691
+
2630
2692
 
2631
2693
  </xsl:variable>
2632
2694
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2640,10 +2702,18 @@
2640
2702
  </xsl:if>
2641
2703
  <xsl:apply-templates/>
2642
2704
  </fo:inline>
2705
+ </xsl:template><xsl:template match="*[local-name()='underline']">
2706
+ <fo:inline text-decoration="underline">
2707
+ <xsl:apply-templates/>
2708
+ </fo:inline>
2643
2709
  </xsl:template><xsl:template match="*[local-name()='del']">
2644
2710
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2645
2711
  <xsl:apply-templates/>
2646
2712
  </fo:inline>
2713
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2714
+ <fo:inline background-color="yellow">
2715
+ <xsl:apply-templates/>
2716
+ </fo:inline>
2647
2717
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2648
2718
  <xsl:variable name="text" select="normalize-space(.)"/>
2649
2719
  <fo:inline font-size="75%">
@@ -2733,6 +2803,10 @@
2733
2803
  <xsl:param name="text" select="."/>
2734
2804
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2735
2805
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2806
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
2807
+ <xsl:param name="text" select="."/>
2808
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2809
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2736
2810
  </xsl:template><xsl:template name="add-zero-spaces">
2737
2811
  <xsl:param name="text" select="."/>
2738
2812
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -2980,6 +3054,7 @@
2980
3054
  <xsl:apply-templates select="." mode="mathml"/>
2981
3055
  </xsl:variable>
2982
3056
  <fo:instream-foreign-object fox:alt-text="Math">
3057
+
2983
3058
  <!-- <xsl:copy-of select="."/> -->
2984
3059
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
2985
3060
  </fo:instream-foreign-object>
@@ -2993,7 +3068,12 @@
2993
3068
  <!-- replace start and end spaces to non-break space -->
2994
3069
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
2995
3070
  </xsl:copy>
2996
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3071
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3072
+ <xsl:copy>
3073
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3074
+ </xsl:copy>
3075
+ <mathml:mspace width="0.5ex"/>
3076
+ </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">
2997
3077
  <xsl:variable name="target">
2998
3078
  <xsl:choose>
2999
3079
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3014,7 +3094,10 @@
3014
3094
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3015
3095
  <xsl:choose>
3016
3096
  <xsl:when test="normalize-space(.) = ''">
3017
- <xsl:value-of select="$target"/>
3097
+ <!-- <xsl:value-of select="$target"/> -->
3098
+ <xsl:call-template name="add-zero-spaces-link-java">
3099
+ <xsl:with-param name="text" select="$target"/>
3100
+ </xsl:call-template>
3018
3101
  </xsl:when>
3019
3102
  <xsl:otherwise>
3020
3103
  <xsl:apply-templates/>
@@ -3024,8 +3107,6 @@
3024
3107
  </xsl:otherwise>
3025
3108
  </xsl:choose>
3026
3109
  </fo:inline>
3027
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3028
- <fo:inline id="{@id}"/>
3029
3110
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3030
3111
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3031
3112
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3220,7 +3301,7 @@
3220
3301
  </xsl:if> -->
3221
3302
  </fo:inline>
3222
3303
  </xsl:if>
3223
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3304
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3224
3305
  <fo:block-container id="{@id}">
3225
3306
 
3226
3307
  <fo:block>
@@ -3236,6 +3317,7 @@
3236
3317
  <fo:block id="{@id}">
3237
3318
  <xsl:apply-templates/>
3238
3319
  </fo:block>
3320
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3239
3321
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3240
3322
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3241
3323
  <xsl:apply-templates/>
@@ -3427,6 +3509,12 @@
3427
3509
  <!-- <xsl:text> </xsl:text> -->
3428
3510
  </xsl:template><xsl:template name="getSection">
3429
3511
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3512
+ <!--
3513
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3514
+ <xsl:value-of select="."/>
3515
+ </xsl:for-each>
3516
+ -->
3517
+
3430
3518
  </xsl:template><xsl:template name="getName">
3431
3519
  <xsl:choose>
3432
3520
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3479,6 +3567,12 @@
3479
3567
  <xsl:copy>
3480
3568
  <xsl:apply-templates mode="contents_item"/>
3481
3569
  </xsl:copy>
3570
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3571
+ <xsl:copy>
3572
+ <xsl:apply-templates mode="contents_item"/>
3573
+ </xsl:copy>
3574
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3575
+ <xsl:copy-of select="."/>
3482
3576
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3483
3577
  <xsl:text> </xsl:text>
3484
3578
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3504,6 +3598,7 @@
3504
3598
 
3505
3599
 
3506
3600
 
3601
+
3507
3602
 
3508
3603
 
3509
3604
 
@@ -3806,10 +3901,11 @@
3806
3901
  </xsl:choose>
3807
3902
 
3808
3903
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3809
-
3904
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3810
3905
  <xsl:variable name="element">
3811
3906
  block
3812
3907
 
3908
+
3813
3909
  </xsl:variable>
3814
3910
  <xsl:choose>
3815
3911
  <xsl:when test="normalize-space($element) = 'block'">
@@ -3884,11 +3980,13 @@
3884
3980
  </xsl:if>
3885
3981
  </xsl:if>
3886
3982
 
3983
+
3887
3984
  <fo:block-container margin-left="0mm">
3888
3985
 
3889
3986
  <fo:block xsl:use-attribute-sets="quote-style">
3890
3987
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
3891
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3988
+
3989
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3892
3990
  </fo:block>
3893
3991
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3894
3992
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -3911,29 +4009,47 @@
3911
4009
  <xsl:text>— </xsl:text>
3912
4010
  <xsl:apply-templates/>
3913
4011
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
3914
- <fo:inline xsl:use-attribute-sets="eref-style">
3915
- <xsl:if test="@type = 'footnote'">
3916
-
3917
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3918
- <xsl:attribute name="font-size">80%</xsl:attribute>
3919
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3920
- <xsl:attribute name="vertical-align">super</xsl:attribute>
3921
-
3922
-
3923
- </xsl:if>
3924
-
3925
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3926
-
3927
- <xsl:if test="@type = 'inline'">
3928
-
3929
-
3930
-
3931
- </xsl:if>
3932
-
3933
-
3934
- <xsl:apply-templates/>
3935
- </fo:basic-link>
3936
- </fo:inline>
4012
+
4013
+ <xsl:variable name="bibitemid">
4014
+ <xsl:choose>
4015
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4016
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4017
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4018
+ </xsl:choose>
4019
+ </xsl:variable>
4020
+
4021
+ <xsl:choose>
4022
+ <xsl:when test="normalize-space($bibitemid) != ''">
4023
+ <fo:inline xsl:use-attribute-sets="eref-style">
4024
+ <xsl:if test="@type = 'footnote'">
4025
+
4026
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4027
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4028
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4029
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4030
+
4031
+
4032
+ </xsl:if>
4033
+
4034
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4035
+ <xsl:if test="normalize-space(@citeas) = ''">
4036
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4037
+ </xsl:if>
4038
+ <xsl:if test="@type = 'inline'">
4039
+
4040
+
4041
+
4042
+ </xsl:if>
4043
+
4044
+ <xsl:apply-templates/>
4045
+ </fo:basic-link>
4046
+
4047
+ </fo:inline>
4048
+ </xsl:when>
4049
+ <xsl:otherwise>
4050
+ <fo:inline><xsl:apply-templates/></fo:inline>
4051
+ </xsl:otherwise>
4052
+ </xsl:choose>
3937
4053
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
3938
4054
  <!-- zero-space char -->
3939
4055
  <xsl:variable name="depth">
@@ -4039,6 +4155,7 @@
4039
4155
 
4040
4156
 
4041
4157
 
4158
+
4042
4159
 
4043
4160
 
4044
4161
 
@@ -4050,7 +4167,7 @@
4050
4167
 
4051
4168
 
4052
4169
 
4053
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4170
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4054
4171
  <fo:block break-after="page"/>
4055
4172
  <fo:block>
4056
4173
  <xsl:call-template name="setId"/>
@@ -4058,7 +4175,8 @@
4058
4175
  </fo:block>
4059
4176
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4060
4177
  <fo:block>
4061
- <xsl:call-template name="setId"/>
4178
+ <xsl:call-template name="setId"/>
4179
+
4062
4180
 
4063
4181
  <xsl:apply-templates/>
4064
4182
  </fo:block>
@@ -4109,6 +4227,153 @@
4109
4227
  </fo:block>
4110
4228
  </xsl:otherwise>
4111
4229
  </xsl:choose>
4230
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4231
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4232
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4233
+ </xsl:for-each>
4234
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4235
+ <xsl:copy>
4236
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4237
+ </xsl:copy>
4238
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4239
+ <xsl:variable name="id">
4240
+ <xsl:call-template name="generateIndexXrefId"/>
4241
+ </xsl:variable>
4242
+ <xsl:copy> <!-- add id to xref -->
4243
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4244
+ <xsl:attribute name="id">
4245
+ <xsl:value-of select="$id"/>
4246
+ </xsl:attribute>
4247
+ <xsl:apply-templates mode="index_add_id"/>
4248
+ </xsl:copy>
4249
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4250
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4251
+ <xsl:if test="@to">
4252
+ <xsl:value-of select="$dash"/>
4253
+ <xsl:copy>
4254
+ <xsl:copy-of select="@*"/>
4255
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4256
+ <xsl:attribute name="id">
4257
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4258
+ </xsl:attribute>
4259
+ <xsl:apply-templates mode="index_add_id"/>
4260
+ </xsl:copy>
4261
+ </xsl:if>
4262
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4263
+ <xsl:copy>
4264
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4265
+ </xsl:copy>
4266
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4267
+ <xsl:copy>
4268
+ <xsl:apply-templates select="@*" mode="index_update"/>
4269
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4270
+ </xsl:copy>
4271
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4272
+ <xsl:param name="element"/>
4273
+ <xsl:param name="remove" select="'false'"/>
4274
+ <xsl:param name="target"/>
4275
+ <!-- <node></node> -->
4276
+ <xsl:choose>
4277
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4278
+ <!-- skip text (i.e. remove it) and process next element -->
4279
+ <!-- [removed_<xsl:value-of select="."/>] -->
4280
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4281
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4282
+ </xsl:apply-templates>
4283
+ </xsl:when>
4284
+ <xsl:when test="self::text()">
4285
+ <xsl:value-of select="."/>
4286
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4287
+ </xsl:when>
4288
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4289
+ <xsl:variable name="id" select="@id"/>
4290
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4291
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4292
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4293
+
4294
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4295
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4296
+
4297
+ <xsl:choose>
4298
+ <!-- 2nd pass -->
4299
+ <!-- if page is equal to page for next and page is not the end of range -->
4300
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4301
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4302
+ <!-- [removed_xref] -->
4303
+
4304
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4305
+ <xsl:with-param name="remove">true</xsl:with-param>
4306
+ <xsl:with-param name="target">
4307
+ <xsl:choose>
4308
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4309
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4310
+ </xsl:choose>
4311
+ </xsl:with-param>
4312
+ </xsl:apply-templates>
4313
+ </xsl:when>
4314
+
4315
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4316
+ <!-- remove xref -->
4317
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4318
+ <xsl:with-param name="remove">true</xsl:with-param>
4319
+ </xsl:apply-templates>
4320
+ </xsl:when>
4321
+
4322
+ <xsl:otherwise>
4323
+ <xsl:apply-templates select="." mode="xref_copy">
4324
+ <xsl:with-param name="target" select="$target"/>
4325
+ </xsl:apply-templates>
4326
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4327
+ </xsl:otherwise>
4328
+ </xsl:choose>
4329
+ </xsl:when>
4330
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4331
+ <!-- ul -->
4332
+ <xsl:apply-templates select="." mode="index_update"/>
4333
+ </xsl:when>
4334
+ <xsl:otherwise>
4335
+ <xsl:apply-templates select="." mode="xref_copy">
4336
+ <xsl:with-param name="target" select="$target"/>
4337
+ </xsl:apply-templates>
4338
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4339
+ </xsl:otherwise>
4340
+ </xsl:choose>
4341
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4342
+ <xsl:param name="target"/>
4343
+ <xsl:copy>
4344
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4345
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4346
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4347
+ </xsl:if>
4348
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4349
+ </xsl:copy>
4350
+ </xsl:template><xsl:template name="generateIndexXrefId">
4351
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4352
+
4353
+ <xsl:variable name="docid">
4354
+ <xsl:call-template name="getDocumentId"/>
4355
+ </xsl:variable>
4356
+ <xsl:variable name="item_number">
4357
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4358
+ </xsl:variable>
4359
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4360
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4361
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4362
+ <xsl:apply-templates/>
4363
+ <fo:block>
4364
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4365
+ <fo:block> </fo:block>
4366
+ </xsl:if>
4367
+ </fo:block>
4368
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4369
+ <xsl:apply-templates/>
4370
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4371
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4372
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4373
+ <xsl:apply-templates/>
4374
+ </fo:block>
4375
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']">
4376
+ <fo:inline id="{@id}"/>
4112
4377
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4113
4378
  <!-- <row>
4114
4379
  <date>05-07-2013</date>
@@ -4204,6 +4469,8 @@
4204
4469
  <xsl:value-of select="translate(.,'. ','')"/>
4205
4470
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4206
4471
  <xsl:value-of select="substring(.,1,1)"/>
4472
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4473
+ <fo:inline><xsl:apply-templates/></fo:inline>
4207
4474
  </xsl:template><xsl:template name="convertDate">
4208
4475
  <xsl:param name="date"/>
4209
4476
  <xsl:param name="format" select="'short'"/>
@@ -4228,6 +4495,57 @@
4228
4495
  </xsl:variable>
4229
4496
  <xsl:variable name="result">
4230
4497
  <xsl:choose>
4498
+ <xsl:when test="$format = 'ddMMyyyy'">
4499
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4500
+ <xsl:text> </xsl:text>
4501
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4502
+ </xsl:when>
4503
+ <xsl:when test="$format = 'ddMM'">
4504
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4505
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4506
+ </xsl:when>
4507
+ <xsl:when test="$format = 'short' or $day = ''">
4508
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4509
+ </xsl:when>
4510
+ <xsl:otherwise>
4511
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4512
+ </xsl:otherwise>
4513
+ </xsl:choose>
4514
+ </xsl:variable>
4515
+ <xsl:value-of select="$result"/>
4516
+ </xsl:template><xsl:template name="convertDateLocalized">
4517
+ <xsl:param name="date"/>
4518
+ <xsl:param name="format" select="'short'"/>
4519
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4520
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4521
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4522
+ <xsl:variable name="monthStr">
4523
+ <xsl:choose>
4524
+ <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>
4525
+ <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>
4526
+ <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>
4527
+ <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>
4528
+ <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>
4529
+ <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>
4530
+ <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>
4531
+ <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>
4532
+ <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>
4533
+ <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>
4534
+ <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>
4535
+ <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>
4536
+ </xsl:choose>
4537
+ </xsl:variable>
4538
+ <xsl:variable name="result">
4539
+ <xsl:choose>
4540
+ <xsl:when test="$format = 'ddMMyyyy'">
4541
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4542
+ <xsl:text> </xsl:text>
4543
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4544
+ </xsl:when>
4545
+ <xsl:when test="$format = 'ddMM'">
4546
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4547
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4548
+ </xsl:when>
4231
4549
  <xsl:when test="$format = 'short' or $day = ''">
4232
4550
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4233
4551
  </xsl:when>
@@ -4243,7 +4561,7 @@
4243
4561
  <xsl:param name="charDelim" select="', '"/>
4244
4562
  <xsl:choose>
4245
4563
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4246
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4564
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4247
4565
  <xsl:sort data-type="text" order="ascending"/>
4248
4566
  <xsl:call-template name="insertKeyword">
4249
4567
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4252,7 +4570,7 @@
4252
4570
  </xsl:for-each>
4253
4571
  </xsl:when>
4254
4572
  <xsl:otherwise>
4255
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4573
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4256
4574
  <xsl:call-template name="insertKeyword">
4257
4575
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4258
4576
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4269,63 +4587,71 @@
4269
4587
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4270
4588
  </xsl:choose>
4271
4589
  </xsl:template><xsl:template name="addPDFUAmeta">
4272
- <fo:declarations>
4273
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4274
- <pdf:dictionary type="normal" key="ViewerPreferences">
4275
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4276
- </pdf:dictionary>
4277
- </pdf:catalog>
4278
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4279
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4280
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4281
- <!-- Dublin Core properties go here -->
4282
- <dc:title>
4283
- <xsl:variable name="title">
4590
+ <xsl:variable name="lang">
4591
+ <xsl:call-template name="getLang"/>
4592
+ </xsl:variable>
4593
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4594
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4595
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4596
+ </pdf:dictionary>
4597
+ </pdf:catalog>
4598
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4599
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4600
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4601
+ <!-- Dublin Core properties go here -->
4602
+ <dc:title>
4603
+ <xsl:variable name="title">
4604
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4605
+
4284
4606
 
4285
4607
 
4286
4608
 
4287
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
4609
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4288
4610
 
4289
4611
 
4290
4612
 
4291
- </xsl:variable>
4292
- <xsl:choose>
4293
- <xsl:when test="normalize-space($title) != ''">
4294
- <xsl:value-of select="$title"/>
4295
- </xsl:when>
4296
- <xsl:otherwise>
4297
- <xsl:text> </xsl:text>
4298
- </xsl:otherwise>
4299
- </xsl:choose>
4300
- </dc:title>
4301
- <dc:creator>
4613
+ </xsl:for-each>
4614
+ </xsl:variable>
4615
+ <xsl:choose>
4616
+ <xsl:when test="normalize-space($title) != ''">
4617
+ <xsl:value-of select="$title"/>
4618
+ </xsl:when>
4619
+ <xsl:otherwise>
4620
+ <xsl:text> </xsl:text>
4621
+ </xsl:otherwise>
4622
+ </xsl:choose>
4623
+ </dc:title>
4624
+ <dc:creator>
4625
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4302
4626
 
4627
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4628
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4629
+ <xsl:if test="position() != last()">; </xsl:if>
4630
+ </xsl:for-each>
4303
4631
 
4304
4632
 
4305
- </dc:creator>
4306
- <dc:description>
4307
- <xsl:variable name="abstract">
4308
-
4309
-
4310
-
4311
-
4312
- <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
4313
-
4314
-
4315
- </xsl:variable>
4316
- <xsl:value-of select="normalize-space($abstract)"/>
4317
- </dc:description>
4318
- <pdf:Keywords>
4319
- <xsl:call-template name="insertKeywords"/>
4320
- </pdf:Keywords>
4321
- </rdf:Description>
4322
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4323
- <!-- XMP properties go here -->
4324
- <xmp:CreatorTool/>
4325
- </rdf:Description>
4326
- </rdf:RDF>
4327
- </x:xmpmeta>
4328
- </fo:declarations>
4633
+
4634
+ </xsl:for-each>
4635
+ </dc:creator>
4636
+ <dc:description>
4637
+ <xsl:variable name="abstract">
4638
+
4639
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4640
+
4641
+
4642
+ </xsl:variable>
4643
+ <xsl:value-of select="normalize-space($abstract)"/>
4644
+ </dc:description>
4645
+ <pdf:Keywords>
4646
+ <xsl:call-template name="insertKeywords"/>
4647
+ </pdf:Keywords>
4648
+ </rdf:Description>
4649
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4650
+ <!-- XMP properties go here -->
4651
+ <xmp:CreatorTool/>
4652
+ </rdf:Description>
4653
+ </rdf:RDF>
4654
+ </x:xmpmeta>
4329
4655
  </xsl:template><xsl:template name="getId">
4330
4656
  <xsl:choose>
4331
4657
  <xsl:when test="../@id">
@@ -4422,6 +4748,7 @@
4422
4748
 
4423
4749
 
4424
4750
 
4751
+
4425
4752
  </xsl:variable>
4426
4753
  <xsl:if test="$documentNS != $XSLNS">
4427
4754
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4481,6 +4808,11 @@
4481
4808
  <xsl:call-template name="getLang"/>
4482
4809
  </xsl:variable>
4483
4810
 
4484
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4811
+ <xsl:choose>
4812
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4813
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4814
+ </xsl:when>
4815
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4816
+ </xsl:choose>
4485
4817
 
4486
4818
  </xsl:template></xsl:stylesheet>