metanorma-m3aawg 1.6.4 → 1.6.9

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: 609a9a25743facaca6a46d3b95562d3c88f495b0861b716c8ab27c8e76395462
4
- data.tar.gz: b6527b4b1c98c8db6bfbc78f7671f03f66386e737d72d652ab25976860411705
3
+ metadata.gz: 5c3ccfbc9324c4503bcc379ef0e9b7de9f4b947c292eeda04cf69f8e0b9b3d28
4
+ data.tar.gz: 9b5bb67a578bc4e8e2832ab422028ffede8b0588ef3cdc40e34186590a8e7fea
5
5
  SHA512:
6
- metadata.gz: 0740a2fd599ffaa85273cb1f2fe653f7392321012fc878c350a784555763535a7c30f1b5ff07231446b3929751db5a1c165d481e7bf88277cac0e5b97c329c2e
7
- data.tar.gz: b85fd00c45fcb6651acf9e59e34e9dd0bb843275957d8c2d4941fb9877f41b554a57634d0444e413dbcbf5accb2bbac9f254bc060c9625a0544801b59151fc15
6
+ metadata.gz: '018a04109bf285e6eaab13f8a8e945a2ec34db99734ef401816bc467086e368bbbed2c6d947e33e73cb184150b92430b941fd3a62e55c6d481a6047a0ebacb27'
7
+ data.tar.gz: 55f84c4b92fa2e5faeddaba6a429cf164400985af30272f9920b1333485e5867c101bdf0095c72bcd596f7dd3267d2c0c9a2e1a70c9c181c44dbcec4e31cdb59
@@ -4,7 +4,7 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master, main ]
7
+ branches: [ master, main ]
8
8
  tags: [ v* ]
9
9
  pull_request:
10
10
 
@@ -16,50 +16,27 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.6', '2.5', '2.4' ]
19
+ ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  include:
23
- - ruby: '2.7'
23
+ - ruby: '3.0'
24
24
  os: 'ubuntu-latest'
25
25
  experimental: true
26
- - ruby: '2.7'
26
+ - ruby: '3.0'
27
27
  os: 'windows-latest'
28
28
  experimental: true
29
- - ruby: '2.7'
29
+ - ruby: '3.0'
30
30
  os: 'macos-latest'
31
31
  experimental: true
32
32
  steps:
33
- - uses: actions/checkout@master
33
+ - uses: actions/checkout@v2
34
+ with:
35
+ submodules: true
34
36
 
35
37
  - uses: ruby/setup-ruby@v1
36
38
  with:
37
39
  ruby-version: ${{ matrix.ruby }}
38
-
39
- - if: matrix.os == 'macos-latest'
40
- run: brew install autoconf automake libtool
41
-
42
- - uses: actions/cache@v2
43
- with:
44
- path: vendor/bundle
45
- key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
46
- restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
47
-
48
- - run: bundle config set path 'vendor/bundle'
49
-
50
- - run: bundle install --jobs 4 --retry 3
40
+ bundler-cache: true
51
41
 
52
42
  - run: bundle exec rake
53
-
54
- tests-passed:
55
- needs: rake
56
- runs-on: ubuntu-latest
57
- steps:
58
- - name: Trigger tests passed event
59
- uses: Sibz/github-status-action@v1
60
- with:
61
- authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
62
- context: 'tests-passed-successfully'
63
- description: 'Tests passed successfully'
64
- state: 'success'
65
- sha: ${{ github.event.pull_request.head.sha || github.sha }}
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
1
  .DS_Store
2
+
3
+ .rubocop-https--*
data/.rubocop.yml CHANGED
@@ -1,10 +1,14 @@
1
1
  # This project follows the Ribose OSS style guide.
2
2
  # https://github.com/riboseinc/oss-guides
3
3
  # All project-specific additions and overrides should be specified in this file.
4
-
5
4
  inherit_from:
6
5
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
6
+
7
+ # local repo-specific modifications
8
+
7
9
  AllCops:
8
- TargetRubyVersion: 2.3
10
+ DisplayCopNames: false
11
+ StyleGuideCopsOnly: false
12
+ TargetRubyVersion: 2.4
9
13
  Rails:
10
14
  Enabled: true
@@ -729,9 +729,11 @@
729
729
  </define>
730
730
  <define name="index">
731
731
  <element name="index">
732
- <attribute name="to">
733
- <data type="IDREF"/>
734
- </attribute>
732
+ <optional>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
735
737
  <element name="primary">
736
738
  <oneOrMore>
737
739
  <ref name="PureTextElement"/>
@@ -124,7 +124,7 @@
124
124
  <value>application/tei+xml</value>
125
125
  <value>text/x-asciidoc</value>
126
126
  <value>text/markdown</value>
127
- <value>application/x-isodoc+xml</value>
127
+ <value>application/x-metanorma+xml</value>
128
128
  <text/>
129
129
  </choice>
130
130
  </attribute>
@@ -452,6 +452,7 @@
452
452
  <attribute name="type">
453
453
  <choice>
454
454
  <value>isni</value>
455
+ <value>orcid</value>
455
456
  <value>uri</value>
456
457
  </choice>
457
458
  </attribute>
@@ -461,10 +462,7 @@
461
462
  <define name="org-identifier">
462
463
  <element name="identifier">
463
464
  <attribute name="type">
464
- <choice>
465
- <value>orcid</value>
466
- <value>uri</value>
467
- </choice>
465
+ <data type="string" datatypeLibrary=""/>
468
466
  </attribute>
469
467
  <text/>
470
468
  </element>
@@ -1106,7 +1104,7 @@
1106
1104
  <value>complementOf</value>
1107
1105
  <value>obsoletes</value>
1108
1106
  <value>obsoletedBy</value>
1109
- <value>cited</value>
1107
+ <value>cites</value>
1110
1108
  <value>isCitedIn</value>
1111
1109
  </choice>
1112
1110
  </define>
@@ -102,7 +102,7 @@
102
102
  </attribute>
103
103
  </optional>
104
104
  <oneOrMore>
105
- <ref name="li"/>
105
+ <ref name="ul_li"/>
106
106
  </oneOrMore>
107
107
  <zeroOrMore>
108
108
  <ref name="note"/>
@@ -789,6 +789,9 @@
789
789
  <attribute name="width"/>
790
790
  </element>
791
791
  </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
792
795
  <define name="TextElement" combine="choice">
793
796
  <ref name="concept"/>
794
797
  </define>
@@ -809,6 +812,8 @@
809
812
  <ref name="requirement"/>
810
813
  <ref name="recommendation"/>
811
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
812
817
  </choice>
813
818
  </define>
814
819
  <define name="bibliography">
@@ -914,6 +919,9 @@
914
919
  </choice>
915
920
  </attribute>
916
921
  <ref name="bibdata"/>
922
+ <optional>
923
+ <ref name="misccontainer"/>
924
+ </optional>
917
925
  <optional>
918
926
  <ref name="boilerplate"/>
919
927
  </optional>
@@ -924,11 +932,21 @@
924
932
  <zeroOrMore>
925
933
  <ref name="annex"/>
926
934
  </zeroOrMore>
935
+ <optional>
936
+ <ref name="bibliography"/>
937
+ </optional>
927
938
  <zeroOrMore>
928
- <ref name="references"/>
939
+ <ref name="indexsect"/>
929
940
  </zeroOrMore>
930
941
  </element>
931
942
  </define>
943
+ <define name="misccontainer">
944
+ <element name="misc-container">
945
+ <oneOrMore>
946
+ <ref name="AnyElement"/>
947
+ </oneOrMore>
948
+ </element>
949
+ </define>
932
950
  <define name="preface">
933
951
  <element name="preface">
934
952
  <oneOrMore>
@@ -952,6 +970,11 @@
952
970
  <ref name="Content-Section"/>
953
971
  </element>
954
972
  </define>
973
+ <define name="indexsect">
974
+ <element name="indexsect">
975
+ <ref name="Content-Section"/>
976
+ </element>
977
+ </define>
955
978
  <define name="boilerplate">
956
979
  <element name="boilerplate">
957
980
  <optional>
@@ -1632,4 +1655,87 @@
1632
1655
  <text/>
1633
1656
  </element>
1634
1657
  </define>
1658
+ <define name="imagemap">
1659
+ <element name="imagemap">
1660
+ <ref name="figure"/>
1661
+ <zeroOrMore>
1662
+ <element name="area">
1663
+ <attribute name="type">
1664
+ <choice>
1665
+ <value>rect</value>
1666
+ <value>circle</value>
1667
+ <value>ellipse</value>
1668
+ <value>poly</value>
1669
+ </choice>
1670
+ </attribute>
1671
+ <choice>
1672
+ <ref name="xref"/>
1673
+ <ref name="hyperlink"/>
1674
+ <ref name="eref"/>
1675
+ </choice>
1676
+ <oneOrMore>
1677
+ <element name="coords">
1678
+ <attribute name="x">
1679
+ <data type="float"/>
1680
+ </attribute>
1681
+ <attribute name="y">
1682
+ <data type="float"/>
1683
+ </attribute>
1684
+ </element>
1685
+ </oneOrMore>
1686
+ <optional>
1687
+ <element name="radius">
1688
+ <attribute name="x">
1689
+ <data type="float"/>
1690
+ </attribute>
1691
+ <optional>
1692
+ <attribute name="y">
1693
+ <data type="float"/>
1694
+ </attribute>
1695
+ </optional>
1696
+ </element>
1697
+ </optional>
1698
+ </element>
1699
+ </zeroOrMore>
1700
+ </element>
1701
+ </define>
1702
+ <define name="svgmap">
1703
+ <element name="svgmap">
1704
+ <ref name="figure"/>
1705
+ <zeroOrMore>
1706
+ <element name="target">
1707
+ <attribute name="href">
1708
+ <data type="anyURI"/>
1709
+ </attribute>
1710
+ <choice>
1711
+ <ref name="xref"/>
1712
+ <ref name="hyperlink"/>
1713
+ <ref name="eref"/>
1714
+ </choice>
1715
+ </element>
1716
+ </zeroOrMore>
1717
+ </element>
1718
+ </define>
1719
+ <define name="ul_li">
1720
+ <element name="li">
1721
+ <optional>
1722
+ <attribute name="id">
1723
+ <data type="ID"/>
1724
+ </attribute>
1725
+ </optional>
1726
+ <optional>
1727
+ <attribute name="uncheckedcheckbox">
1728
+ <data type="boolean"/>
1729
+ </attribute>
1730
+ </optional>
1731
+ <optional>
1732
+ <attribute name="checkedcheckbox">
1733
+ <data type="boolean"/>
1734
+ </attribute>
1735
+ </optional>
1736
+ <oneOrMore>
1737
+ <ref name="BasicBlock"/>
1738
+ </oneOrMore>
1739
+ </element>
1740
+ </define>
1635
1741
  </grammar>
@@ -100,6 +100,9 @@
100
100
  <zeroOrMore>
101
101
  <ref name="termdocsource"/>
102
102
  </zeroOrMore>
103
+ <optional>
104
+ <ref name="misccontainer"/>
105
+ </optional>
103
106
  <optional>
104
107
  <ref name="boilerplate"/>
105
108
  </optional>
@@ -111,6 +114,9 @@
111
114
  <ref name="annex"/>
112
115
  </zeroOrMore>
113
116
  <ref name="bibliography"/>
117
+ <zeroOrMore>
118
+ <ref name="indexsect"/>
119
+ </zeroOrMore>
114
120
  </element>
115
121
  </define>
116
122
  </grammar>
@@ -3,6 +3,7 @@
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
5
5
  <xsl:param name="svg_images"/>
6
+ <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
6
7
  <xsl:variable name="images" select="document($svg_images)"/>
7
8
 
8
9
 
@@ -73,7 +74,9 @@
73
74
 
74
75
  </fo:layout-master-set>
75
76
 
76
- <xsl:call-template name="addPDFUAmeta"/>
77
+ <fo:declarations>
78
+ <xsl:call-template name="addPDFUAmeta"/>
79
+ </fo:declarations>
77
80
 
78
81
  <xsl:call-template name="addBookmarks">
79
82
  <xsl:with-param name="contents" select="$contents"/>
@@ -1146,6 +1149,7 @@
1146
1149
 
1147
1150
 
1148
1151
 
1152
+
1149
1153
  <xsl:attribute name="margin-top">8pt</xsl:attribute>
1150
1154
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1151
1155
 
@@ -1281,6 +1285,7 @@
1281
1285
 
1282
1286
 
1283
1287
 
1288
+
1284
1289
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1285
1290
 
1286
1291
 
@@ -1415,195 +1420,229 @@
1415
1420
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1416
1421
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1417
1422
  <xsl:call-template name="add-zero-spaces-java"/>
1418
- </xsl:template><xsl:template match="*[local-name()='table']">
1423
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1419
1424
 
1420
- <xsl:variable name="simple-table">
1421
- <xsl:call-template name="getSimpleTable"/>
1422
- </xsl:variable>
1425
+ <xsl:variable name="table">
1423
1426
 
1424
-
1425
-
1426
-
1427
-
1428
- <!-- <xsl:if test="$namespace = 'bipm'">
1429
- <fo:block>&#xA0;</fo:block>
1430
- </xsl:if> -->
1431
-
1432
- <!-- $namespace = 'iso' or -->
1433
-
1434
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1435
-
1436
-
1437
-
1438
- <xsl:call-template name="fn_name_display"/>
1427
+ <xsl:variable name="simple-table">
1428
+ <xsl:call-template name="getSimpleTable"/>
1429
+ </xsl:variable>
1439
1430
 
1440
1431
 
1441
-
1442
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1443
-
1444
- <!-- <xsl:variable name="cols-count">
1445
- <xsl:choose>
1446
- <xsl:when test="*[local-name()='thead']">
1447
- <xsl:call-template name="calculate-columns-numbers">
1448
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1449
- </xsl:call-template>
1450
- </xsl:when>
1451
- <xsl:otherwise>
1452
- <xsl:call-template name="calculate-columns-numbers">
1453
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1454
- </xsl:call-template>
1455
- </xsl:otherwise>
1456
- </xsl:choose>
1457
- </xsl:variable> -->
1458
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1459
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1460
-
1461
-
1462
-
1463
- <xsl:variable name="colwidths">
1464
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1465
- <xsl:call-template name="calculate-column-widths">
1466
- <xsl:with-param name="cols-count" select="$cols-count"/>
1467
- <xsl:with-param name="table" select="$simple-table"/>
1468
- </xsl:call-template>
1469
- </xsl:if>
1470
- </xsl:variable>
1471
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1472
-
1473
- <!-- <xsl:variable name="colwidths2">
1474
- <xsl:call-template name="calculate-column-widths">
1475
- <xsl:with-param name="cols-count" select="$cols-count"/>
1476
- </xsl:call-template>
1477
- </xsl:variable> -->
1478
-
1479
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1480
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1481
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1482
-
1483
- <xsl:variable name="margin-left">
1484
- <xsl:choose>
1485
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1486
- <xsl:otherwise>0</xsl:otherwise>
1487
- </xsl:choose>
1488
- </xsl:variable>
1489
-
1490
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1491
1432
 
1492
1433
 
1493
-
1494
-
1495
-
1496
1434
 
1435
+ <!-- <xsl:if test="$namespace = 'bipm'">
1436
+ <fo:block>&#xA0;</fo:block>
1437
+ </xsl:if> -->
1497
1438
 
1498
-
1439
+ <!-- $namespace = 'iso' or -->
1499
1440
 
1441
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1500
1442
 
1443
+
1501
1444
 
1445
+ <xsl:call-template name="fn_name_display"/>
1502
1446
 
1447
+
1503
1448
 
1449
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1504
1450
 
1451
+ <!-- <xsl:variable name="cols-count">
1452
+ <xsl:choose>
1453
+ <xsl:when test="*[local-name()='thead']">
1454
+ <xsl:call-template name="calculate-columns-numbers">
1455
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1456
+ </xsl:call-template>
1457
+ </xsl:when>
1458
+ <xsl:otherwise>
1459
+ <xsl:call-template name="calculate-columns-numbers">
1460
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1461
+ </xsl:call-template>
1462
+ </xsl:otherwise>
1463
+ </xsl:choose>
1464
+ </xsl:variable> -->
1465
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1466
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1505
1467
 
1506
- <xsl:variable name="table_attributes">
1507
- <attribute name="table-layout">fixed</attribute>
1508
- <attribute name="width">
1509
- <xsl:choose>
1510
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1511
- <xsl:otherwise>100%</xsl:otherwise>
1512
- </xsl:choose>
1513
- </attribute>
1514
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1515
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1468
+
1469
+
1470
+ <xsl:variable name="colwidths">
1471
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1472
+ <xsl:call-template name="calculate-column-widths">
1473
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1474
+ <xsl:with-param name="table" select="$simple-table"/>
1475
+ </xsl:call-template>
1476
+ </xsl:if>
1477
+ </xsl:variable>
1478
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1479
+
1480
+ <!-- <xsl:variable name="colwidths2">
1481
+ <xsl:call-template name="calculate-column-widths">
1482
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1483
+ </xsl:call-template>
1484
+ </xsl:variable> -->
1485
+
1486
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1487
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1488
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1489
+
1490
+ <xsl:variable name="margin-left">
1491
+ <xsl:choose>
1492
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1493
+ <xsl:otherwise>0</xsl:otherwise>
1494
+ </xsl:choose>
1495
+ </xsl:variable>
1496
+
1497
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1516
1498
 
1517
1499
 
1500
+
1501
+
1502
+
1518
1503
 
1519
1504
 
1520
-
1521
-
1522
-
1505
+
1523
1506
 
1524
-
1525
1507
 
1526
- </xsl:variable>
1527
-
1528
-
1529
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1530
1508
 
1531
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1532
- <xsl:attribute name="{@name}">
1533
- <xsl:value-of select="."/>
1534
- </xsl:attribute>
1535
- </xsl:for-each>
1536
1509
 
1537
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1538
- <xsl:if test="$isNoteOrFnExist = 'true'">
1539
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1540
- </xsl:if>
1541
1510
 
1542
- <xsl:choose>
1543
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1544
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1545
- <fo:table-column column-width="{@width}"/>
1546
- </xsl:for-each>
1547
- </xsl:when>
1548
- <xsl:otherwise>
1549
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1550
- <xsl:choose>
1551
- <xsl:when test=". = 1 or . = 0">
1552
- <fo:table-column column-width="proportional-column-width(2)"/>
1553
- </xsl:when>
1554
- <xsl:otherwise>
1555
- <fo:table-column column-width="proportional-column-width({.})"/>
1556
- </xsl:otherwise>
1557
- </xsl:choose>
1558
- </xsl:for-each>
1559
- </xsl:otherwise>
1560
- </xsl:choose>
1561
1511
 
1562
- <xsl:choose>
1563
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1564
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1565
- </xsl:when>
1566
- <xsl:otherwise>
1567
- <xsl:apply-templates/>
1568
- </xsl:otherwise>
1569
- </xsl:choose>
1512
+ <xsl:variable name="table_width">
1513
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1514
+ 100%
1515
+
1516
+
1517
+ </xsl:variable>
1570
1518
 
1571
- </fo:table>
1572
-
1573
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1574
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1575
- <xsl:call-template name="insertTableFooterInSeparateTable">
1576
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1577
- <xsl:with-param name="colwidths" select="$colwidths"/>
1578
- <xsl:with-param name="colgroup" select="$colgroup"/>
1579
- </xsl:call-template>
1580
- </xsl:for-each>
1581
-
1582
- <!-- insert footer as table -->
1583
- <!-- <fo:table>
1584
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1585
- <xsl:attribute name="{@name}">
1586
- <xsl:value-of select="."/>
1587
- </xsl:attribute>
1588
- </xsl:for-each>
1519
+ <xsl:variable name="table_attributes">
1520
+ <attribute name="table-layout">fixed</attribute>
1521
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1522
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1523
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1524
+
1525
+
1526
+
1527
+
1528
+
1529
+
1530
+
1531
+
1532
+
1533
+
1534
+ </xsl:variable>
1589
1535
 
1590
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1536
+
1537
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1538
+
1539
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1540
+ <xsl:attribute name="{@name}">
1541
+ <xsl:value-of select="."/>
1542
+ </xsl:attribute>
1543
+ </xsl:for-each>
1544
+
1545
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1546
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1547
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1548
+ </xsl:if>
1549
+
1591
1550
  <xsl:choose>
1592
- <xsl:when test=". = 1 or . = 0">
1593
- <fo:table-column column-width="proportional-column-width(2)"/>
1551
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1552
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1553
+ <fo:table-column column-width="{@width}"/>
1554
+ </xsl:for-each>
1594
1555
  </xsl:when>
1595
1556
  <xsl:otherwise>
1596
- <fo:table-column column-width="proportional-column-width({.})"/>
1557
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1558
+ <xsl:choose>
1559
+ <xsl:when test=". = 1 or . = 0">
1560
+ <fo:table-column column-width="proportional-column-width(2)"/>
1561
+ </xsl:when>
1562
+ <xsl:otherwise>
1563
+ <fo:table-column column-width="proportional-column-width({.})"/>
1564
+ </xsl:otherwise>
1565
+ </xsl:choose>
1566
+ </xsl:for-each>
1597
1567
  </xsl:otherwise>
1598
1568
  </xsl:choose>
1569
+
1570
+ <xsl:choose>
1571
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1572
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1573
+ </xsl:when>
1574
+ <xsl:otherwise>
1575
+ <xsl:apply-templates/>
1576
+ </xsl:otherwise>
1577
+ </xsl:choose>
1578
+
1579
+ </fo:table>
1580
+
1581
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1582
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1583
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1584
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1585
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1586
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1587
+ </xsl:call-template>
1599
1588
  </xsl:for-each>
1600
- </fo:table>-->
1601
-
1602
-
1603
-
1604
-
1605
-
1606
- </fo:block-container>
1589
+
1590
+ <!-- insert footer as table -->
1591
+ <!-- <fo:table>
1592
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1593
+ <xsl:attribute name="{@name}">
1594
+ <xsl:value-of select="."/>
1595
+ </xsl:attribute>
1596
+ </xsl:for-each>
1597
+
1598
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1599
+ <xsl:choose>
1600
+ <xsl:when test=". = 1 or . = 0">
1601
+ <fo:table-column column-width="proportional-column-width(2)"/>
1602
+ </xsl:when>
1603
+ <xsl:otherwise>
1604
+ <fo:table-column column-width="proportional-column-width({.})"/>
1605
+ </xsl:otherwise>
1606
+ </xsl:choose>
1607
+ </xsl:for-each>
1608
+ </fo:table>-->
1609
+
1610
+
1611
+
1612
+
1613
+
1614
+ </fo:block-container>
1615
+ </xsl:variable>
1616
+
1617
+
1618
+
1619
+ <xsl:choose>
1620
+ <xsl:when test="@width">
1621
+
1622
+ <!-- centered table when table name is centered (see table-name-style) -->
1623
+
1624
+ <fo:table table-layout="fixed" width="100%">
1625
+ <fo:table-column column-width="proportional-column-width(1)"/>
1626
+ <fo:table-column column-width="{@width}"/>
1627
+ <fo:table-column column-width="proportional-column-width(1)"/>
1628
+ <fo:table-body>
1629
+ <fo:table-row>
1630
+ <fo:table-cell column-number="2">
1631
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
1632
+ </fo:table-cell>
1633
+ </fo:table-row>
1634
+ </fo:table-body>
1635
+ </fo:table>
1636
+
1637
+
1638
+
1639
+
1640
+ </xsl:when>
1641
+ <xsl:otherwise>
1642
+ <xsl:copy-of select="$table"/>
1643
+ </xsl:otherwise>
1644
+ </xsl:choose>
1645
+
1607
1646
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1608
1647
  <xsl:if test="normalize-space() != ''">
1609
1648
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1731,7 +1770,15 @@
1731
1770
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
1732
1771
  <xsl:value-of select="@target"/>
1733
1772
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
1734
- <xsl:variable name="math_text" select="normalize-space(.)"/>
1773
+ <xsl:variable name="mathml">
1774
+ <xsl:for-each select="*">
1775
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
1776
+ <xsl:copy-of select="."/>
1777
+ </xsl:if>
1778
+ </xsl:for-each>
1779
+ </xsl:variable>
1780
+
1781
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
1735
1782
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
1736
1783
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
1737
1784
  <xsl:param name="cols-count"/>
@@ -2416,7 +2463,7 @@
2416
2463
  <xsl:with-param name="table" select="$html-table"/>
2417
2464
  </xsl:call-template>
2418
2465
  </xsl:variable>
2419
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2466
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2420
2467
  <xsl:variable name="maxlength_dt">
2421
2468
  <xsl:call-template name="getMaxLength_dt"/>
2422
2469
  </xsl:variable>
@@ -2445,13 +2492,22 @@
2445
2492
  </xsl:when>
2446
2493
  <xsl:otherwise>
2447
2494
  <xsl:choose>
2495
+ <!-- to set width check most wide chars like `W` -->
2448
2496
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2449
- <fo:table-column column-width="5%"/>
2450
- <fo:table-column column-width="95%"/>
2497
+ <fo:table-column column-width="7%"/>
2498
+ <fo:table-column column-width="93%"/>
2451
2499
  </xsl:when>
2452
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2453
- <fo:table-column column-width="10%"/>
2454
- <fo:table-column column-width="90%"/>
2500
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2501
+ <fo:table-column column-width="15%"/>
2502
+ <fo:table-column column-width="85%"/>
2503
+ </xsl:when>
2504
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2505
+ <fo:table-column column-width="20%"/>
2506
+ <fo:table-column column-width="80%"/>
2507
+ </xsl:when>
2508
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2509
+ <fo:table-column column-width="25%"/>
2510
+ <fo:table-column column-width="75%"/>
2455
2511
  </xsl:when>
2456
2512
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2457
2513
  <fo:table-column column-width="60%"/>
@@ -2642,6 +2698,7 @@
2642
2698
 
2643
2699
 
2644
2700
 
2701
+
2645
2702
  <xsl:choose>
2646
2703
  <xsl:when test="not(ancestor::*[local-name()='note'])">10</xsl:when>
2647
2704
  <xsl:otherwise>11</xsl:otherwise>
@@ -2673,6 +2730,10 @@
2673
2730
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2674
2731
  <xsl:apply-templates/>
2675
2732
  </fo:inline>
2733
+ </xsl:template><xsl:template match="*[local-name()='hi']">
2734
+ <fo:inline background-color="yellow">
2735
+ <xsl:apply-templates/>
2736
+ </fo:inline>
2676
2737
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2677
2738
  <xsl:variable name="text" select="normalize-space(.)"/>
2678
2739
  <fo:inline font-size="75%">
@@ -2762,6 +2823,10 @@
2762
2823
  <xsl:param name="text" select="."/>
2763
2824
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2764
2825
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2826
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
2827
+ <xsl:param name="text" select="."/>
2828
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2829
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2765
2830
  </xsl:template><xsl:template name="add-zero-spaces">
2766
2831
  <xsl:param name="text" select="."/>
2767
2832
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3009,6 +3074,7 @@
3009
3074
  <xsl:apply-templates select="." mode="mathml"/>
3010
3075
  </xsl:variable>
3011
3076
  <fo:instream-foreign-object fox:alt-text="Math">
3077
+
3012
3078
  <!-- <xsl:copy-of select="."/> -->
3013
3079
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3014
3080
  </fo:instream-foreign-object>
@@ -3022,7 +3088,12 @@
3022
3088
  <!-- replace start and end spaces to non-break space -->
3023
3089
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3024
3090
  </xsl:copy>
3025
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3091
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3092
+ <xsl:copy>
3093
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3094
+ </xsl:copy>
3095
+ <mathml:mspace width="0.5ex"/>
3096
+ </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">
3026
3097
  <xsl:variable name="target">
3027
3098
  <xsl:choose>
3028
3099
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3043,7 +3114,10 @@
3043
3114
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3044
3115
  <xsl:choose>
3045
3116
  <xsl:when test="normalize-space(.) = ''">
3046
- <xsl:value-of select="$target"/>
3117
+ <!-- <xsl:value-of select="$target"/> -->
3118
+ <xsl:call-template name="add-zero-spaces-link-java">
3119
+ <xsl:with-param name="text" select="$target"/>
3120
+ </xsl:call-template>
3047
3121
  </xsl:when>
3048
3122
  <xsl:otherwise>
3049
3123
  <xsl:apply-templates/>
@@ -3053,8 +3127,6 @@
3053
3127
  </xsl:otherwise>
3054
3128
  </xsl:choose>
3055
3129
  </fo:inline>
3056
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3057
- <fo:inline id="{@id}"/>
3058
3130
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3059
3131
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3060
3132
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3251,7 +3323,7 @@
3251
3323
  </xsl:if> -->
3252
3324
  </fo:inline>
3253
3325
  </xsl:if>
3254
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3326
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3255
3327
  <fo:block-container id="{@id}">
3256
3328
 
3257
3329
  <fo:block>
@@ -3267,6 +3339,7 @@
3267
3339
  <fo:block id="{@id}">
3268
3340
  <xsl:apply-templates/>
3269
3341
  </fo:block>
3342
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3270
3343
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3271
3344
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3272
3345
  <xsl:apply-templates/>
@@ -3458,6 +3531,12 @@
3458
3531
  <!-- <xsl:text> </xsl:text> -->
3459
3532
  </xsl:template><xsl:template name="getSection">
3460
3533
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3534
+ <!--
3535
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3536
+ <xsl:value-of select="."/>
3537
+ </xsl:for-each>
3538
+ -->
3539
+
3461
3540
  </xsl:template><xsl:template name="getName">
3462
3541
  <xsl:choose>
3463
3542
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3510,6 +3589,12 @@
3510
3589
  <xsl:copy>
3511
3590
  <xsl:apply-templates mode="contents_item"/>
3512
3591
  </xsl:copy>
3592
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3593
+ <xsl:copy>
3594
+ <xsl:apply-templates mode="contents_item"/>
3595
+ </xsl:copy>
3596
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3597
+ <xsl:copy-of select="."/>
3513
3598
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3514
3599
  <xsl:text> </xsl:text>
3515
3600
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3535,6 +3620,7 @@
3535
3620
 
3536
3621
 
3537
3622
 
3623
+
3538
3624
 
3539
3625
 
3540
3626
 
@@ -3837,10 +3923,11 @@
3837
3923
  </xsl:choose>
3838
3924
 
3839
3925
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
3840
-
3926
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
3841
3927
  <xsl:variable name="element">
3842
3928
  block
3843
3929
 
3930
+
3844
3931
  </xsl:variable>
3845
3932
  <xsl:choose>
3846
3933
  <xsl:when test="normalize-space($element) = 'block'">
@@ -3902,11 +3989,13 @@
3902
3989
  </xsl:if>
3903
3990
  </xsl:if>
3904
3991
 
3992
+
3905
3993
  <fo:block-container margin-left="0mm">
3906
3994
 
3907
3995
  <fo:block xsl:use-attribute-sets="quote-style">
3908
3996
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
3909
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3997
+
3998
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3910
3999
  </fo:block>
3911
4000
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3912
4001
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -3929,29 +4018,47 @@
3929
4018
  <xsl:text>— </xsl:text>
3930
4019
  <xsl:apply-templates/>
3931
4020
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
3932
- <fo:inline xsl:use-attribute-sets="eref-style">
3933
- <xsl:if test="@type = 'footnote'">
3934
-
3935
-
3936
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
3937
- <xsl:attribute name="font-size">50%</xsl:attribute>
3938
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
3939
- <xsl:attribute name="vertical-align">super</xsl:attribute>
3940
-
3941
- </xsl:if>
3942
-
3943
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
3944
-
3945
- <xsl:if test="@type = 'inline'">
3946
-
3947
-
3948
-
3949
- </xsl:if>
3950
-
3951
-
3952
- <xsl:apply-templates/>
3953
- </fo:basic-link>
3954
- </fo:inline>
4021
+
4022
+ <xsl:variable name="bibitemid">
4023
+ <xsl:choose>
4024
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4025
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4026
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4027
+ </xsl:choose>
4028
+ </xsl:variable>
4029
+
4030
+ <xsl:choose>
4031
+ <xsl:when test="normalize-space($bibitemid) != ''">
4032
+ <fo:inline xsl:use-attribute-sets="eref-style">
4033
+ <xsl:if test="@type = 'footnote'">
4034
+
4035
+
4036
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4037
+ <xsl:attribute name="font-size">50%</xsl:attribute>
4038
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4039
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4040
+
4041
+ </xsl:if>
4042
+
4043
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4044
+ <xsl:if test="normalize-space(@citeas) = ''">
4045
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4046
+ </xsl:if>
4047
+ <xsl:if test="@type = 'inline'">
4048
+
4049
+
4050
+
4051
+ </xsl:if>
4052
+
4053
+ <xsl:apply-templates/>
4054
+ </fo:basic-link>
4055
+
4056
+ </fo:inline>
4057
+ </xsl:when>
4058
+ <xsl:otherwise>
4059
+ <fo:inline><xsl:apply-templates/></fo:inline>
4060
+ </xsl:otherwise>
4061
+ </xsl:choose>
3955
4062
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
3956
4063
  <!-- zero-space char -->
3957
4064
  <xsl:variable name="depth">
@@ -4063,6 +4170,7 @@
4063
4170
 
4064
4171
 
4065
4172
 
4173
+
4066
4174
  <xsl:variable name="pos"><xsl:number count="m3d:sections/m3d:clause | m3d:sections/m3d:terms"/></xsl:variable>
4067
4175
  <xsl:if test="$pos &gt;= 2">
4068
4176
  <xsl:attribute name="space-before">18pt</xsl:attribute>
@@ -4078,7 +4186,7 @@
4078
4186
 
4079
4187
 
4080
4188
 
4081
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4189
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4082
4190
  <fo:block break-after="page"/>
4083
4191
  <fo:block>
4084
4192
  <xsl:call-template name="setId"/>
@@ -4086,7 +4194,8 @@
4086
4194
  </fo:block>
4087
4195
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4088
4196
  <fo:block>
4089
- <xsl:call-template name="setId"/>
4197
+ <xsl:call-template name="setId"/>
4198
+
4090
4199
 
4091
4200
  <xsl:apply-templates/>
4092
4201
  </fo:block>
@@ -4137,6 +4246,153 @@
4137
4246
  </fo:block>
4138
4247
  </xsl:otherwise>
4139
4248
  </xsl:choose>
4249
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4250
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4251
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4252
+ </xsl:for-each>
4253
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4254
+ <xsl:copy>
4255
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4256
+ </xsl:copy>
4257
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4258
+ <xsl:variable name="id">
4259
+ <xsl:call-template name="generateIndexXrefId"/>
4260
+ </xsl:variable>
4261
+ <xsl:copy> <!-- add id to xref -->
4262
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4263
+ <xsl:attribute name="id">
4264
+ <xsl:value-of select="$id"/>
4265
+ </xsl:attribute>
4266
+ <xsl:apply-templates mode="index_add_id"/>
4267
+ </xsl:copy>
4268
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4269
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4270
+ <xsl:if test="@to">
4271
+ <xsl:value-of select="$dash"/>
4272
+ <xsl:copy>
4273
+ <xsl:copy-of select="@*"/>
4274
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4275
+ <xsl:attribute name="id">
4276
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4277
+ </xsl:attribute>
4278
+ <xsl:apply-templates mode="index_add_id"/>
4279
+ </xsl:copy>
4280
+ </xsl:if>
4281
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4282
+ <xsl:copy>
4283
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4284
+ </xsl:copy>
4285
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4286
+ <xsl:copy>
4287
+ <xsl:apply-templates select="@*" mode="index_update"/>
4288
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4289
+ </xsl:copy>
4290
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4291
+ <xsl:param name="element"/>
4292
+ <xsl:param name="remove" select="'false'"/>
4293
+ <xsl:param name="target"/>
4294
+ <!-- <node></node> -->
4295
+ <xsl:choose>
4296
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4297
+ <!-- skip text (i.e. remove it) and process next element -->
4298
+ <!-- [removed_<xsl:value-of select="."/>] -->
4299
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4300
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4301
+ </xsl:apply-templates>
4302
+ </xsl:when>
4303
+ <xsl:when test="self::text()">
4304
+ <xsl:value-of select="."/>
4305
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4306
+ </xsl:when>
4307
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4308
+ <xsl:variable name="id" select="@id"/>
4309
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4310
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4311
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4312
+
4313
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4314
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4315
+
4316
+ <xsl:choose>
4317
+ <!-- 2nd pass -->
4318
+ <!-- if page is equal to page for next and page is not the end of range -->
4319
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4320
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4321
+ <!-- [removed_xref] -->
4322
+
4323
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4324
+ <xsl:with-param name="remove">true</xsl:with-param>
4325
+ <xsl:with-param name="target">
4326
+ <xsl:choose>
4327
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4328
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4329
+ </xsl:choose>
4330
+ </xsl:with-param>
4331
+ </xsl:apply-templates>
4332
+ </xsl:when>
4333
+
4334
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4335
+ <!-- remove xref -->
4336
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4337
+ <xsl:with-param name="remove">true</xsl:with-param>
4338
+ </xsl:apply-templates>
4339
+ </xsl:when>
4340
+
4341
+ <xsl:otherwise>
4342
+ <xsl:apply-templates select="." mode="xref_copy">
4343
+ <xsl:with-param name="target" select="$target"/>
4344
+ </xsl:apply-templates>
4345
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4346
+ </xsl:otherwise>
4347
+ </xsl:choose>
4348
+ </xsl:when>
4349
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4350
+ <!-- ul -->
4351
+ <xsl:apply-templates select="." mode="index_update"/>
4352
+ </xsl:when>
4353
+ <xsl:otherwise>
4354
+ <xsl:apply-templates select="." mode="xref_copy">
4355
+ <xsl:with-param name="target" select="$target"/>
4356
+ </xsl:apply-templates>
4357
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4358
+ </xsl:otherwise>
4359
+ </xsl:choose>
4360
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4361
+ <xsl:param name="target"/>
4362
+ <xsl:copy>
4363
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4364
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4365
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4366
+ </xsl:if>
4367
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4368
+ </xsl:copy>
4369
+ </xsl:template><xsl:template name="generateIndexXrefId">
4370
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4371
+
4372
+ <xsl:variable name="docid">
4373
+ <xsl:call-template name="getDocumentId"/>
4374
+ </xsl:variable>
4375
+ <xsl:variable name="item_number">
4376
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4377
+ </xsl:variable>
4378
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4379
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4380
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4381
+ <xsl:apply-templates/>
4382
+ <fo:block>
4383
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4384
+ <fo:block> </fo:block>
4385
+ </xsl:if>
4386
+ </fo:block>
4387
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4388
+ <xsl:apply-templates/>
4389
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4390
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4391
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4392
+ <xsl:apply-templates/>
4393
+ </fo:block>
4394
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4395
+ <fo:inline id="{@id}" font-size="1pt"/>
4140
4396
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4141
4397
  <!-- <row>
4142
4398
  <date>05-07-2013</date>
@@ -4258,6 +4514,57 @@
4258
4514
  </xsl:variable>
4259
4515
  <xsl:variable name="result">
4260
4516
  <xsl:choose>
4517
+ <xsl:when test="$format = 'ddMMyyyy'">
4518
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4519
+ <xsl:text> </xsl:text>
4520
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4521
+ </xsl:when>
4522
+ <xsl:when test="$format = 'ddMM'">
4523
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4524
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4525
+ </xsl:when>
4526
+ <xsl:when test="$format = 'short' or $day = ''">
4527
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4528
+ </xsl:when>
4529
+ <xsl:otherwise>
4530
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4531
+ </xsl:otherwise>
4532
+ </xsl:choose>
4533
+ </xsl:variable>
4534
+ <xsl:value-of select="$result"/>
4535
+ </xsl:template><xsl:template name="convertDateLocalized">
4536
+ <xsl:param name="date"/>
4537
+ <xsl:param name="format" select="'short'"/>
4538
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4539
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4540
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4541
+ <xsl:variable name="monthStr">
4542
+ <xsl:choose>
4543
+ <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>
4544
+ <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>
4545
+ <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>
4546
+ <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>
4547
+ <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>
4548
+ <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>
4549
+ <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>
4550
+ <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>
4551
+ <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>
4552
+ <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>
4553
+ <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>
4554
+ <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>
4555
+ </xsl:choose>
4556
+ </xsl:variable>
4557
+ <xsl:variable name="result">
4558
+ <xsl:choose>
4559
+ <xsl:when test="$format = 'ddMMyyyy'">
4560
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4561
+ <xsl:text> </xsl:text>
4562
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4563
+ </xsl:when>
4564
+ <xsl:when test="$format = 'ddMM'">
4565
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4566
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4567
+ </xsl:when>
4261
4568
  <xsl:when test="$format = 'short' or $day = ''">
4262
4569
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4263
4570
  </xsl:when>
@@ -4273,7 +4580,7 @@
4273
4580
  <xsl:param name="charDelim" select="', '"/>
4274
4581
  <xsl:choose>
4275
4582
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4276
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4583
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4277
4584
  <xsl:sort data-type="text" order="ascending"/>
4278
4585
  <xsl:call-template name="insertKeyword">
4279
4586
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4282,7 +4589,7 @@
4282
4589
  </xsl:for-each>
4283
4590
  </xsl:when>
4284
4591
  <xsl:otherwise>
4285
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4592
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4286
4593
  <xsl:call-template name="insertKeyword">
4287
4594
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4288
4595
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4299,63 +4606,71 @@
4299
4606
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4300
4607
  </xsl:choose>
4301
4608
  </xsl:template><xsl:template name="addPDFUAmeta">
4302
- <fo:declarations>
4303
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4304
- <pdf:dictionary type="normal" key="ViewerPreferences">
4305
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4306
- </pdf:dictionary>
4307
- </pdf:catalog>
4308
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4309
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4310
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4311
- <!-- Dublin Core properties go here -->
4312
- <dc:title>
4313
- <xsl:variable name="title">
4609
+ <xsl:variable name="lang">
4610
+ <xsl:call-template name="getLang"/>
4611
+ </xsl:variable>
4612
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4613
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4614
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4615
+ </pdf:dictionary>
4616
+ </pdf:catalog>
4617
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4618
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4619
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4620
+ <!-- Dublin Core properties go here -->
4621
+ <dc:title>
4622
+ <xsl:variable name="title">
4623
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4314
4624
 
4315
4625
 
4316
4626
 
4317
4627
 
4318
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title']"/>
4628
+
4629
+ <xsl:value-of select="*[local-name() = 'title']"/>
4319
4630
 
4320
4631
 
4321
- </xsl:variable>
4322
- <xsl:choose>
4323
- <xsl:when test="normalize-space($title) != ''">
4324
- <xsl:value-of select="$title"/>
4325
- </xsl:when>
4326
- <xsl:otherwise>
4327
- <xsl:text> </xsl:text>
4328
- </xsl:otherwise>
4329
- </xsl:choose>
4330
- </dc:title>
4331
- <dc:creator>
4632
+ </xsl:for-each>
4633
+ </xsl:variable>
4634
+ <xsl:choose>
4635
+ <xsl:when test="normalize-space($title) != ''">
4636
+ <xsl:value-of select="$title"/>
4637
+ </xsl:when>
4638
+ <xsl:otherwise>
4639
+ <xsl:text> </xsl:text>
4640
+ </xsl:otherwise>
4641
+ </xsl:choose>
4642
+ </dc:title>
4643
+ <dc:creator>
4644
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4332
4645
 
4333
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
4646
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4647
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4648
+ <xsl:if test="position() != last()">; </xsl:if>
4649
+ </xsl:for-each>
4334
4650
 
4335
4651
 
4336
4652
 
4337
- </dc:creator>
4338
- <dc:description>
4339
- <xsl:variable name="abstract">
4340
-
4341
-
4342
-
4343
-
4344
-
4345
- </xsl:variable>
4346
- <xsl:value-of select="normalize-space($abstract)"/>
4347
- </dc:description>
4348
- <pdf:Keywords>
4349
- <xsl:call-template name="insertKeywords"/>
4350
- </pdf:Keywords>
4351
- </rdf:Description>
4352
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4353
- <!-- XMP properties go here -->
4354
- <xmp:CreatorTool/>
4355
- </rdf:Description>
4356
- </rdf:RDF>
4357
- </x:xmpmeta>
4358
- </fo:declarations>
4653
+ </xsl:for-each>
4654
+ </dc:creator>
4655
+ <dc:description>
4656
+ <xsl:variable name="abstract">
4657
+
4658
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4659
+
4660
+
4661
+ </xsl:variable>
4662
+ <xsl:value-of select="normalize-space($abstract)"/>
4663
+ </dc:description>
4664
+ <pdf:Keywords>
4665
+ <xsl:call-template name="insertKeywords"/>
4666
+ </pdf:Keywords>
4667
+ </rdf:Description>
4668
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4669
+ <!-- XMP properties go here -->
4670
+ <xmp:CreatorTool/>
4671
+ </rdf:Description>
4672
+ </rdf:RDF>
4673
+ </x:xmpmeta>
4359
4674
  </xsl:template><xsl:template name="getId">
4360
4675
  <xsl:choose>
4361
4676
  <xsl:when test="../@id">
@@ -4452,6 +4767,7 @@
4452
4767
 
4453
4768
 
4454
4769
 
4770
+
4455
4771
  </xsl:variable>
4456
4772
  <xsl:if test="$documentNS != $XSLNS">
4457
4773
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>