metanorma-csa 1.7.2 → 1.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 662b71103ad56cc32d0fcbd4926a6b483b82cebc0658f7b7d792d81a36343686
4
- data.tar.gz: 38b71724171ea25595f588335abfd45a9b88e8fc5ff30a962d6341089adb667f
3
+ metadata.gz: fb5ef6e84ef8c68dc962f3bd81883e18d934b9733735c6a7c9ba4e8a85ab0444
4
+ data.tar.gz: 72e5712dd7d2fcd224651126609a9f61716ca5b0acdef1fdc9c57fe29de48d1d
5
5
  SHA512:
6
- metadata.gz: e223eec78966bdf647936260b2da185837a859ae95198bc1eaa459697d1f3d9743fea0a35ada5d6f9e050dce93550aae053d8a05ac9a1e663d63ff3703766b4b
7
- data.tar.gz: c3711271668f6f89107bffa7804fac1b97222ae9a8a553b2e592f4e409b70f899f105acf132cf80eae78697ad0707d541045c8d7be414a68f149324cc9a488a8
6
+ metadata.gz: e92ca5dbb4aa9e4f61d8e00e7e43fa141d658d8696d904d5d2880b744fc53b4edc78287dd1cd08a4c5bcfca36e62d3bf57ab67c2c625445c212fac9dd2938285
7
+ data.tar.gz: 780a7ee7af46bd4a78e61ee3a2c8ff525a6e0ebdf4c8604bd0118b82646acb38452dadbd7548701ea07d1e62735b3f59f439f3f6b2af780b228b57ef8ab7cd0b
@@ -4,7 +4,7 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master, main ]
7
+ branches: [ master, main ]
8
8
  tags: [ v* ]
9
9
  pull_request:
10
10
 
@@ -16,50 +16,27 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.6', '2.5', '2.4' ]
19
+ ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  include:
23
- - ruby: '2.7'
23
+ - ruby: '3.0'
24
24
  os: 'ubuntu-latest'
25
25
  experimental: true
26
- - ruby: '2.7'
26
+ - ruby: '3.0'
27
27
  os: 'windows-latest'
28
28
  experimental: true
29
- - ruby: '2.7'
29
+ - ruby: '3.0'
30
30
  os: 'macos-latest'
31
31
  experimental: true
32
32
  steps:
33
- - uses: actions/checkout@master
33
+ - uses: actions/checkout@v2
34
+ with:
35
+ submodules: true
34
36
 
35
37
  - uses: ruby/setup-ruby@v1
36
38
  with:
37
39
  ruby-version: ${{ matrix.ruby }}
38
-
39
- - if: matrix.os == 'macos-latest'
40
- run: brew install autoconf automake libtool
41
-
42
- - uses: actions/cache@v2
43
- with:
44
- path: vendor/bundle
45
- key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
46
- restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
47
-
48
- - run: bundle config set path 'vendor/bundle'
49
-
50
- - run: bundle install --jobs 4 --retry 3
40
+ bundler-cache: true
51
41
 
52
42
  - run: bundle exec rake
53
-
54
- tests-passed:
55
- needs: rake
56
- runs-on: ubuntu-latest
57
- steps:
58
- - name: Trigger tests passed event
59
- uses: Sibz/github-status-action@v1
60
- with:
61
- authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
62
- context: 'tests-passed-successfully'
63
- description: 'Tests passed successfully'
64
- state: 'success'
65
- sha: ${{ github.event.pull_request.head.sha || github.sha }}
data/.gitignore CHANGED
@@ -6,3 +6,5 @@
6
6
 
7
7
  # test data
8
8
  /test.*
9
+
10
+ .rubocop-https--*
data/.rubocop.yml CHANGED
@@ -1,10 +1,14 @@
1
1
  # This project follows the Ribose OSS style guide.
2
2
  # https://github.com/riboseinc/oss-guides
3
3
  # All project-specific additions and overrides should be specified in this file.
4
-
5
4
  inherit_from:
6
5
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
6
+
7
+ # local repo-specific modifications
8
+
7
9
  AllCops:
8
- TargetRubyVersion: 2.3
10
+ DisplayCopNames: false
11
+ StyleGuideCopsOnly: false
12
+ TargetRubyVersion: 2.4
9
13
  Rails:
10
14
  Enabled: true
@@ -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>
@@ -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"/>
@@ -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>
@@ -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,193 +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 -->
1486
1429
 
1430
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1487
1431
 
1432
+
1488
1433
 
1434
+
1489
1435
 
1436
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1490
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"/> -->
1491
1454
 
1492
1455
 
1493
- <xsl:variable name="table_attributes">
1494
- <attribute name="table-layout">fixed</attribute>
1495
- <attribute name="width">
1496
- <xsl:choose>
1497
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1498
- <xsl:otherwise>100%</xsl:otherwise>
1499
- </xsl:choose>
1500
- </attribute>
1501
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1502
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
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"/> -->
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> -->
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 -->
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>
1483
+
1484
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1503
1485
 
1504
1486
 
1487
+
1488
+
1489
+
1505
1490
 
1506
1491
 
1507
-
1508
-
1509
-
1492
+
1510
1493
 
1511
-
1512
1494
 
1513
- </xsl:variable>
1514
-
1515
-
1516
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1517
1495
 
1518
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1519
- <xsl:attribute name="{@name}">
1520
- <xsl:value-of select="."/>
1521
- </xsl:attribute>
1522
- </xsl:for-each>
1523
1496
 
1524
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1525
- <xsl:if test="$isNoteOrFnExist = 'true'">
1526
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1527
- </xsl:if>
1528
1497
 
1529
- <xsl:choose>
1530
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1531
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1532
- <fo:table-column column-width="{@width}"/>
1533
- </xsl:for-each>
1534
- </xsl:when>
1535
- <xsl:otherwise>
1536
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1537
- <xsl:choose>
1538
- <xsl:when test=". = 1 or . = 0">
1539
- <fo:table-column column-width="proportional-column-width(2)"/>
1540
- </xsl:when>
1541
- <xsl:otherwise>
1542
- <fo:table-column column-width="proportional-column-width({.})"/>
1543
- </xsl:otherwise>
1544
- </xsl:choose>
1545
- </xsl:for-each>
1546
- </xsl:otherwise>
1547
- </xsl:choose>
1548
1498
 
1549
- <xsl:choose>
1550
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1551
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1552
- </xsl:when>
1553
- <xsl:otherwise>
1554
- <xsl:apply-templates/>
1555
- </xsl:otherwise>
1556
- </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>
1557
1505
 
1558
- </fo:table>
1559
-
1560
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1561
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1562
- <xsl:call-template name="insertTableFooterInSeparateTable">
1563
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1564
- <xsl:with-param name="colwidths" select="$colwidths"/>
1565
- <xsl:with-param name="colgroup" select="$colgroup"/>
1566
- </xsl:call-template>
1567
- </xsl:for-each>
1568
-
1569
- <!-- insert footer as table -->
1570
- <!-- <fo:table>
1571
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1572
- <xsl:attribute name="{@name}">
1573
- <xsl:value-of select="."/>
1574
- </xsl:attribute>
1575
- </xsl:for-each>
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>
1576
1522
 
1577
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1523
+
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
+
1578
1537
  <xsl:choose>
1579
- <xsl:when test=". = 1 or . = 0">
1580
- <fo:table-column column-width="proportional-column-width(2)"/>
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>
1581
1542
  </xsl:when>
1582
1543
  <xsl:otherwise>
1583
- <fo:table-column column-width="proportional-column-width({.})"/>
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>
1584
1554
  </xsl:otherwise>
1585
1555
  </xsl:choose>
1556
+
1557
+ <xsl:choose>
1558
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1559
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1560
+ </xsl:when>
1561
+ <xsl:otherwise>
1562
+ <xsl:apply-templates/>
1563
+ </xsl:otherwise>
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>
1586
1575
  </xsl:for-each>
1587
- </fo:table>-->
1588
-
1589
-
1590
-
1591
-
1592
-
1593
- </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
+
1594
1633
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1595
1634
  <xsl:if test="normalize-space() != ''">
1596
1635
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1718,7 +1757,15 @@
1718
1757
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1719
1758
  <xsl:value-of select="@target"/>
1720
1759
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1721
- <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))"/>
1722
1769
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1723
1770
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1724
1771
  <xsl:param name="cols-count"/>
@@ -2401,7 +2448,7 @@
2401
2448
  <xsl:with-param name="table" select="$html-table"/>
2402
2449
  </xsl:call-template>
2403
2450
  </xsl:variable>
2404
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2451
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2405
2452
  <xsl:variable name="maxlength_dt">
2406
2453
  <xsl:call-template name="getMaxLength_dt"/>
2407
2454
  </xsl:variable>
@@ -2430,13 +2477,22 @@
2430
2477
  </xsl:when>
2431
2478
  <xsl:otherwise>
2432
2479
  <xsl:choose>
2480
+ <!-- to set width check most wide chars like `W` -->
2433
2481
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2434
- <fo:table-column column-width="5%"/>
2435
- <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%"/>
2488
+ </xsl:when>
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%"/>
2436
2492
  </xsl:when>
2437
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2438
- <fo:table-column column-width="10%"/>
2439
- <fo:table-column column-width="90%"/>
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%"/>
2440
2496
  </xsl:when>
2441
2497
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2442
2498
  <fo:table-column column-width="60%"/>
@@ -2632,6 +2688,7 @@
2632
2688
 
2633
2689
 
2634
2690
 
2691
+
2635
2692
 
2636
2693
  </xsl:variable>
2637
2694
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2653,6 +2710,10 @@
2653
2710
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2654
2711
  <xsl:apply-templates/>
2655
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>
2656
2717
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2657
2718
  <xsl:variable name="text" select="normalize-space(.)"/>
2658
2719
  <fo:inline font-size="75%">
@@ -2742,6 +2803,10 @@
2742
2803
  <xsl:param name="text" select="."/>
2743
2804
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2744
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​')"/>
2745
2810
  </xsl:template><xsl:template name="add-zero-spaces">
2746
2811
  <xsl:param name="text" select="."/>
2747
2812
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -2989,6 +3054,7 @@
2989
3054
  <xsl:apply-templates select="." mode="mathml"/>
2990
3055
  </xsl:variable>
2991
3056
  <fo:instream-foreign-object fox:alt-text="Math">
3057
+
2992
3058
  <!-- <xsl:copy-of select="."/> -->
2993
3059
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
2994
3060
  </fo:instream-foreign-object>
@@ -3002,7 +3068,12 @@
3002
3068
  <!-- replace start and end spaces to non-break space -->
3003
3069
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3004
3070
  </xsl:copy>
3005
- </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">
3006
3077
  <xsl:variable name="target">
3007
3078
  <xsl:choose>
3008
3079
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3023,7 +3094,10 @@
3023
3094
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3024
3095
  <xsl:choose>
3025
3096
  <xsl:when test="normalize-space(.) = ''">
3026
- <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>
3027
3101
  </xsl:when>
3028
3102
  <xsl:otherwise>
3029
3103
  <xsl:apply-templates/>
@@ -3033,8 +3107,6 @@
3033
3107
  </xsl:otherwise>
3034
3108
  </xsl:choose>
3035
3109
  </fo:inline>
3036
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3037
- <fo:inline id="{@id}"/>
3038
3110
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3039
3111
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3040
3112
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3229,7 +3301,7 @@
3229
3301
  </xsl:if> -->
3230
3302
  </fo:inline>
3231
3303
  </xsl:if>
3232
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3304
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3233
3305
  <fo:block-container id="{@id}">
3234
3306
 
3235
3307
  <fo:block>
@@ -3245,6 +3317,7 @@
3245
3317
  <fo:block id="{@id}">
3246
3318
  <xsl:apply-templates/>
3247
3319
  </fo:block>
3320
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3248
3321
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3249
3322
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3250
3323
  <xsl:apply-templates/>
@@ -3436,6 +3509,12 @@
3436
3509
  <!-- <xsl:text> </xsl:text> -->
3437
3510
  </xsl:template><xsl:template name="getSection">
3438
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
+
3439
3518
  </xsl:template><xsl:template name="getName">
3440
3519
  <xsl:choose>
3441
3520
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3488,6 +3567,12 @@
3488
3567
  <xsl:copy>
3489
3568
  <xsl:apply-templates mode="contents_item"/>
3490
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="."/>
3491
3576
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3492
3577
  <xsl:text> </xsl:text>
3493
3578
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3513,6 +3598,7 @@
3513
3598
 
3514
3599
 
3515
3600
 
3601
+
3516
3602
 
3517
3603
 
3518
3604
 
@@ -3815,10 +3901,11 @@
3815
3901
  </xsl:choose>
3816
3902
 
3817
3903
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3818
-
3904
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3819
3905
  <xsl:variable name="element">
3820
3906
  block
3821
3907
 
3908
+
3822
3909
  </xsl:variable>
3823
3910
  <xsl:choose>
3824
3911
  <xsl:when test="normalize-space($element) = 'block'">
@@ -3893,11 +3980,13 @@
3893
3980
  </xsl:if>
3894
3981
  </xsl:if>
3895
3982
 
3983
+
3896
3984
  <fo:block-container margin-left="0mm">
3897
3985
 
3898
3986
  <fo:block xsl:use-attribute-sets="quote-style">
3899
3987
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
3900
- <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 -->
3901
3990
  </fo:block>
3902
3991
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3903
3992
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -3920,29 +4009,47 @@
3920
4009
  <xsl:text>— </xsl:text>
3921
4010
  <xsl:apply-templates/>
3922
4011
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
3923
- <fo:inline xsl:use-attribute-sets="eref-style">
3924
- <xsl:if test="@type = 'footnote'">
3925
-
3926
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3927
- <xsl:attribute name="font-size">80%</xsl:attribute>
3928
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3929
- <xsl:attribute name="vertical-align">super</xsl:attribute>
3930
-
3931
-
3932
- </xsl:if>
3933
-
3934
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3935
-
3936
- <xsl:if test="@type = 'inline'">
3937
-
3938
-
3939
-
3940
- </xsl:if>
3941
-
3942
-
3943
- <xsl:apply-templates/>
3944
- </fo:basic-link>
3945
- </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>
3946
4053
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
3947
4054
  <!-- zero-space char -->
3948
4055
  <xsl:variable name="depth">
@@ -4048,6 +4155,7 @@
4048
4155
 
4049
4156
 
4050
4157
 
4158
+
4051
4159
 
4052
4160
 
4053
4161
 
@@ -4059,7 +4167,7 @@
4059
4167
 
4060
4168
 
4061
4169
 
4062
- </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']/* -->
4063
4171
  <fo:block break-after="page"/>
4064
4172
  <fo:block>
4065
4173
  <xsl:call-template name="setId"/>
@@ -4067,7 +4175,8 @@
4067
4175
  </fo:block>
4068
4176
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4069
4177
  <fo:block>
4070
- <xsl:call-template name="setId"/>
4178
+ <xsl:call-template name="setId"/>
4179
+
4071
4180
 
4072
4181
  <xsl:apply-templates/>
4073
4182
  </fo:block>
@@ -4118,6 +4227,153 @@
4118
4227
  </fo:block>
4119
4228
  </xsl:otherwise>
4120
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']" name="bookmark">
4376
+ <fo:inline id="{@id}" font-size="1pt"/>
4121
4377
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4122
4378
  <!-- <row>
4123
4379
  <date>05-07-2013</date>
@@ -4239,6 +4495,57 @@
4239
4495
  </xsl:variable>
4240
4496
  <xsl:variable name="result">
4241
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>
4242
4549
  <xsl:when test="$format = 'short' or $day = ''">
4243
4550
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4244
4551
  </xsl:when>
@@ -4254,7 +4561,7 @@
4254
4561
  <xsl:param name="charDelim" select="', '"/>
4255
4562
  <xsl:choose>
4256
4563
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4257
- <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']">
4258
4565
  <xsl:sort data-type="text" order="ascending"/>
4259
4566
  <xsl:call-template name="insertKeyword">
4260
4567
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4263,7 +4570,7 @@
4263
4570
  </xsl:for-each>
4264
4571
  </xsl:when>
4265
4572
  <xsl:otherwise>
4266
- <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']">
4267
4574
  <xsl:call-template name="insertKeyword">
4268
4575
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4269
4576
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4280,63 +4587,71 @@
4280
4587
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4281
4588
  </xsl:choose>
4282
4589
  </xsl:template><xsl:template name="addPDFUAmeta">
4283
- <fo:declarations>
4284
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4285
- <pdf:dictionary type="normal" key="ViewerPreferences">
4286
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4287
- </pdf:dictionary>
4288
- </pdf:catalog>
4289
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4290
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4291
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4292
- <!-- Dublin Core properties go here -->
4293
- <dc:title>
4294
- <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
+
4295
4606
 
4296
4607
 
4297
4608
 
4298
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
4609
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4299
4610
 
4300
4611
 
4301
4612
 
4302
- </xsl:variable>
4303
- <xsl:choose>
4304
- <xsl:when test="normalize-space($title) != ''">
4305
- <xsl:value-of select="$title"/>
4306
- </xsl:when>
4307
- <xsl:otherwise>
4308
- <xsl:text> </xsl:text>
4309
- </xsl:otherwise>
4310
- </xsl:choose>
4311
- </dc:title>
4312
- <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']">
4313
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>
4314
4631
 
4315
4632
 
4316
- </dc:creator>
4317
- <dc:description>
4318
- <xsl:variable name="abstract">
4319
-
4320
-
4321
-
4322
-
4323
- <xsl:copy-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'abstract']//text()"/>
4324
-
4325
-
4326
- </xsl:variable>
4327
- <xsl:value-of select="normalize-space($abstract)"/>
4328
- </dc:description>
4329
- <pdf:Keywords>
4330
- <xsl:call-template name="insertKeywords"/>
4331
- </pdf:Keywords>
4332
- </rdf:Description>
4333
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4334
- <!-- XMP properties go here -->
4335
- <xmp:CreatorTool/>
4336
- </rdf:Description>
4337
- </rdf:RDF>
4338
- </x:xmpmeta>
4339
- </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>
4340
4655
  </xsl:template><xsl:template name="getId">
4341
4656
  <xsl:choose>
4342
4657
  <xsl:when test="../@id">
@@ -4433,6 +4748,7 @@
4433
4748
 
4434
4749
 
4435
4750
 
4751
+
4436
4752
  </xsl:variable>
4437
4753
  <xsl:if test="$documentNS != $XSLNS">
4438
4754
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>