metanorma-un 0.5.11 → 0.5.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3669c8651ebe2fd2d2ee518d75f80e152bdf76b1f6e6580ca2795e365a440fda
4
- data.tar.gz: 75d299cd1e26be0ab1e8b407f60ac0c8eb6e790923d1beb4f4154383923da117
3
+ metadata.gz: ec139c7a4c8d73d3d274edfbd05f5169f0d10da3ac8d3439ea7c35445d9561a4
4
+ data.tar.gz: 1cd3a00831238f7bfccfccb7a7a29bafbf3767341a7ebf4fa6a3811ab600b69f
5
5
  SHA512:
6
- metadata.gz: 0b4fbbad777aed0a62be4f95fe3668fc7fcc1ed1a42478b9e6b69cbbe5c8adddcd833731cc64062e6484b735a9d35e2a378a6ea260f27bfe4bfc7eeff82aaa9c
7
- data.tar.gz: 3e82ec5eb0e089f3259644789b6c53297f313d0d6f31dba720c656029cf40ce8396fcde56f82954aefa4988ffdf1551147b23a92090c6564fcc87bb5966a1f46
6
+ metadata.gz: f88a58ddc30aa6028a0ddba08360e280a98ac491d657e1b8b332b3109d496cecd80d6c0421c2d8f86a5bac3e55fdc5b14359023a278f8aaab802d44fabec1856
7
+ data.tar.gz: 8394a664e6d7185d2f4713acca25568d77a52ef5bc1259908cfa8789775b5c70a4ae52eddf801e223407e5bfd005bd324b0caf5125cc34e90029039365be3cb2
@@ -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>
@@ -30,7 +30,7 @@ module Asciidoctor
30
30
  end
31
31
 
32
32
  def asciidoc_sub(text)
33
- Asciidoctor::Standoc::Utils::asciidoc_sub(text)
33
+ Metanorma::Utils::asciidoc_sub(text)
34
34
  end
35
35
 
36
36
  def title(node, xml)
@@ -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>
@@ -348,6 +348,9 @@
348
348
  </choice>
349
349
  </attribute>
350
350
  <ref name="bibdata"/>
351
+ <optional>
352
+ <ref name="misccontainer"/>
353
+ </optional>
351
354
  <optional>
352
355
  <ref name="boilerplate"/>
353
356
  </optional>
@@ -358,6 +361,9 @@
358
361
  <zeroOrMore>
359
362
  <ref name="annex"/>
360
363
  </zeroOrMore>
364
+ <zeroOrMore>
365
+ <ref name="indexsect"/>
366
+ </zeroOrMore>
361
367
  </element>
362
368
  </define>
363
369
  </grammar>
@@ -6,7 +6,7 @@
6
6
  {% endif %}
7
7
 
8
8
  <nav>
9
- <h1 id="content">Contents</h1>
9
+ <h1 id="content">{{ labels["table_of_contents"] }}</h1>
10
10
  <div id="toc"></div>
11
11
 
12
12
  </nav>
@@ -9,7 +9,7 @@
9
9
  {% endif %}
10
10
 
11
11
  {% if toc %}
12
- <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>
12
+ <p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">{{ labels["table_of_contents"] }}</span></p>
13
13
 
14
14
  WORDTOC
15
15
  {% endif %}
@@ -18,12 +18,12 @@ module IsoDoc
18
18
  {
19
19
  bodyfont: (
20
20
  options[:script] == "Hans" ?
21
- '"SimSun",serif' :
21
+ '"Source Han Sans",serif' :
22
22
  '"Times New Roman", serif'
23
23
  ),
24
24
  headerfont: (
25
25
  options[:script] == "Hans" ?
26
- '"SimHei",sans-serif' :
26
+ '"Source Han Sans",sans-serif' :
27
27
  '"Times New Roman", serif'
28
28
  ),
29
29
  monospacefont: '"Courier New",monospace',
@@ -3,6 +3,7 @@
3
3
  <xsl:output version="1.0" 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
 
@@ -72,7 +73,9 @@
72
73
  </fo:page-sequence-master>
73
74
  </fo:layout-master-set>
74
75
 
75
- <xsl:call-template name="addPDFUAmeta"/>
76
+ <fo:declarations>
77
+ <xsl:call-template name="addPDFUAmeta"/>
78
+ </fo:declarations>
76
79
 
77
80
  <xsl:call-template name="addBookmarks">
78
81
  <xsl:with-param name="contents" select="$contents"/>
@@ -1448,6 +1451,7 @@
1448
1451
 
1449
1452
 
1450
1453
 
1454
+
1451
1455
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1452
1456
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1453
1457
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1568,6 +1572,7 @@
1568
1572
 
1569
1573
 
1570
1574
 
1575
+
1571
1576
  </xsl:attribute-set><xsl:attribute-set name="quote-source-style">
1572
1577
 
1573
1578
 
@@ -1697,200 +1702,228 @@
1697
1702
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1698
1703
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1699
1704
  <xsl:call-template name="add-zero-spaces-java"/>
1700
- </xsl:template><xsl:template match="*[local-name()='table']">
1705
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1701
1706
 
1702
- <xsl:variable name="simple-table">
1703
- <xsl:call-template name="getSimpleTable"/>
1704
- </xsl:variable>
1707
+ <xsl:variable name="table">
1705
1708
 
1706
-
1707
-
1708
-
1709
-
1710
- <!-- <xsl:if test="$namespace = 'bipm'">
1711
- <fo:block>&#xA0;</fo:block>
1712
- </xsl:if> -->
1713
-
1714
- <!-- $namespace = 'iso' or -->
1715
-
1716
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1717
-
1718
-
1719
-
1720
- <xsl:call-template name="fn_name_display"/>
1709
+ <xsl:variable name="simple-table">
1710
+ <xsl:call-template name="getSimpleTable"/>
1711
+ </xsl:variable>
1721
1712
 
1722
1713
 
1723
-
1724
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1725
-
1726
- <!-- <xsl:variable name="cols-count">
1727
- <xsl:choose>
1728
- <xsl:when test="*[local-name()='thead']">
1729
- <xsl:call-template name="calculate-columns-numbers">
1730
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1731
- </xsl:call-template>
1732
- </xsl:when>
1733
- <xsl:otherwise>
1734
- <xsl:call-template name="calculate-columns-numbers">
1735
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1736
- </xsl:call-template>
1737
- </xsl:otherwise>
1738
- </xsl:choose>
1739
- </xsl:variable> -->
1740
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1741
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1742
-
1743
-
1744
-
1745
- <xsl:variable name="colwidths">
1746
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1747
- <xsl:call-template name="calculate-column-widths">
1748
- <xsl:with-param name="cols-count" select="$cols-count"/>
1749
- <xsl:with-param name="table" select="$simple-table"/>
1750
- </xsl:call-template>
1751
- </xsl:if>
1752
- </xsl:variable>
1753
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1754
-
1755
- <!-- <xsl:variable name="colwidths2">
1756
- <xsl:call-template name="calculate-column-widths">
1757
- <xsl:with-param name="cols-count" select="$cols-count"/>
1758
- </xsl:call-template>
1759
- </xsl:variable> -->
1760
-
1761
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1762
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1763
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1764
-
1765
- <xsl:variable name="margin-left">
1766
- <xsl:choose>
1767
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1768
- <xsl:otherwise>0</xsl:otherwise>
1769
- </xsl:choose>
1770
- </xsl:variable>
1771
-
1772
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1773
1714
 
1774
1715
 
1775
-
1776
-
1777
1716
 
1778
- <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1779
- <xsl:attribute name="font-size">8pt</xsl:attribute>
1780
-
1717
+ <!-- <xsl:if test="$namespace = 'bipm'">
1718
+ <fo:block>&#xA0;</fo:block>
1719
+ </xsl:if> -->
1781
1720
 
1721
+ <!-- $namespace = 'iso' or -->
1782
1722
 
1783
-
1723
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1784
1724
 
1725
+
1785
1726
 
1727
+ <xsl:call-template name="fn_name_display"/>
1786
1728
 
1729
+
1787
1730
 
1731
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1788
1732
 
1733
+ <!-- <xsl:variable name="cols-count">
1734
+ <xsl:choose>
1735
+ <xsl:when test="*[local-name()='thead']">
1736
+ <xsl:call-template name="calculate-columns-numbers">
1737
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1738
+ </xsl:call-template>
1739
+ </xsl:when>
1740
+ <xsl:otherwise>
1741
+ <xsl:call-template name="calculate-columns-numbers">
1742
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1743
+ </xsl:call-template>
1744
+ </xsl:otherwise>
1745
+ </xsl:choose>
1746
+ </xsl:variable> -->
1747
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1748
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1789
1749
 
1790
1750
 
1791
- <xsl:variable name="table_attributes">
1792
- <attribute name="table-layout">fixed</attribute>
1793
- <attribute name="width">
1794
- <xsl:choose>
1795
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1796
- <xsl:otherwise>100%</xsl:otherwise>
1797
- </xsl:choose>
1798
- </attribute>
1799
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1800
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1751
+
1752
+ <xsl:variable name="colwidths">
1753
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1754
+ <xsl:call-template name="calculate-column-widths">
1755
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1756
+ <xsl:with-param name="table" select="$simple-table"/>
1757
+ </xsl:call-template>
1758
+ </xsl:if>
1759
+ </xsl:variable>
1760
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1761
+
1762
+ <!-- <xsl:variable name="colwidths2">
1763
+ <xsl:call-template name="calculate-column-widths">
1764
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1765
+ </xsl:call-template>
1766
+ </xsl:variable> -->
1767
+
1768
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1769
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1770
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1771
+
1772
+ <xsl:variable name="margin-left">
1773
+ <xsl:choose>
1774
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1775
+ <xsl:otherwise>0</xsl:otherwise>
1776
+ </xsl:choose>
1777
+ </xsl:variable>
1778
+
1779
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1801
1780
 
1802
1781
 
1782
+
1783
+
1803
1784
 
1785
+ <xsl:attribute name="margin-bottom">18pt</xsl:attribute>
1786
+ <xsl:attribute name="font-size">8pt</xsl:attribute>
1787
+
1804
1788
 
1805
-
1806
-
1807
1789
 
1808
- <attribute name="border-top">0.5pt solid black</attribute>
1809
-
1790
+
1810
1791
 
1811
-
1812
1792
 
1813
- </xsl:variable>
1814
-
1815
-
1816
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1817
1793
 
1818
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1819
- <xsl:attribute name="{@name}">
1820
- <xsl:value-of select="."/>
1821
- </xsl:attribute>
1822
- </xsl:for-each>
1823
1794
 
1824
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1825
- <xsl:if test="$isNoteOrFnExist = 'true'">
1826
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1827
- </xsl:if>
1828
1795
 
1829
- <xsl:choose>
1830
- <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1831
- <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1832
- <fo:table-column column-width="{@width}"/>
1833
- </xsl:for-each>
1834
- </xsl:when>
1835
- <xsl:otherwise>
1836
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1837
- <xsl:choose>
1838
- <xsl:when test=". = 1 or . = 0">
1839
- <fo:table-column column-width="proportional-column-width(2)"/>
1840
- </xsl:when>
1841
- <xsl:otherwise>
1842
- <fo:table-column column-width="proportional-column-width({.})"/>
1843
- </xsl:otherwise>
1844
- </xsl:choose>
1845
- </xsl:for-each>
1846
- </xsl:otherwise>
1847
- </xsl:choose>
1848
1796
 
1849
- <xsl:choose>
1850
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1851
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1852
- </xsl:when>
1853
- <xsl:otherwise>
1854
- <xsl:apply-templates/>
1855
- </xsl:otherwise>
1856
- </xsl:choose>
1797
+ <xsl:variable name="table_width">
1798
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1799
+
1800
+
1801
+
1802
+ <xsl:choose>
1803
+ <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
1804
+ <xsl:otherwise>100%</xsl:otherwise>
1805
+ </xsl:choose>
1806
+
1807
+ </xsl:variable>
1808
+
1809
+ <xsl:variable name="table_attributes">
1810
+ <attribute name="table-layout">fixed</attribute>
1811
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1812
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1813
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1814
+
1815
+
1816
+
1817
+
1818
+
1819
+
1820
+
1821
+ <attribute name="border-top">0.5pt solid black</attribute>
1822
+
1823
+
1824
+
1825
+
1826
+ </xsl:variable>
1857
1827
 
1858
- </fo:table>
1859
-
1860
- <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1861
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1862
- <xsl:call-template name="insertTableFooterInSeparateTable">
1863
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1864
- <xsl:with-param name="colwidths" select="$colwidths"/>
1865
- <xsl:with-param name="colgroup" select="$colgroup"/>
1866
- </xsl:call-template>
1867
- </xsl:for-each>
1868
-
1869
- <!-- insert footer as table -->
1870
- <!-- <fo:table>
1871
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1872
- <xsl:attribute name="{@name}">
1873
- <xsl:value-of select="."/>
1874
- </xsl:attribute>
1875
- </xsl:for-each>
1876
1828
 
1877
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1829
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1830
+
1831
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1832
+ <xsl:attribute name="{@name}">
1833
+ <xsl:value-of select="."/>
1834
+ </xsl:attribute>
1835
+ </xsl:for-each>
1836
+
1837
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1838
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1839
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1840
+ </xsl:if>
1841
+
1842
+ <xsl:choose>
1843
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1844
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1845
+ <fo:table-column column-width="{@width}"/>
1846
+ </xsl:for-each>
1847
+ </xsl:when>
1848
+ <xsl:otherwise>
1849
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1850
+ <xsl:choose>
1851
+ <xsl:when test=". = 1 or . = 0">
1852
+ <fo:table-column column-width="proportional-column-width(2)"/>
1853
+ </xsl:when>
1854
+ <xsl:otherwise>
1855
+ <fo:table-column column-width="proportional-column-width({.})"/>
1856
+ </xsl:otherwise>
1857
+ </xsl:choose>
1858
+ </xsl:for-each>
1859
+ </xsl:otherwise>
1860
+ </xsl:choose>
1861
+
1878
1862
  <xsl:choose>
1879
- <xsl:when test=". = 1 or . = 0">
1880
- <fo:table-column column-width="proportional-column-width(2)"/>
1863
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1864
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1881
1865
  </xsl:when>
1882
1866
  <xsl:otherwise>
1883
- <fo:table-column column-width="proportional-column-width({.})"/>
1867
+ <xsl:apply-templates/>
1884
1868
  </xsl:otherwise>
1885
1869
  </xsl:choose>
1870
+
1871
+ </fo:table>
1872
+
1873
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1874
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1875
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1876
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1877
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1878
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1879
+ </xsl:call-template>
1886
1880
  </xsl:for-each>
1887
- </fo:table>-->
1888
-
1889
-
1890
-
1891
-
1892
-
1893
- </fo:block-container>
1881
+
1882
+ <!-- insert footer as table -->
1883
+ <!-- <fo:table>
1884
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1885
+ <xsl:attribute name="{@name}">
1886
+ <xsl:value-of select="."/>
1887
+ </xsl:attribute>
1888
+ </xsl:for-each>
1889
+
1890
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1891
+ <xsl:choose>
1892
+ <xsl:when test=". = 1 or . = 0">
1893
+ <fo:table-column column-width="proportional-column-width(2)"/>
1894
+ </xsl:when>
1895
+ <xsl:otherwise>
1896
+ <fo:table-column column-width="proportional-column-width({.})"/>
1897
+ </xsl:otherwise>
1898
+ </xsl:choose>
1899
+ </xsl:for-each>
1900
+ </fo:table>-->
1901
+
1902
+
1903
+
1904
+
1905
+
1906
+ </fo:block-container>
1907
+ </xsl:variable>
1908
+
1909
+
1910
+
1911
+ <xsl:choose>
1912
+ <xsl:when test="@width">
1913
+
1914
+ <!-- centered table when table name is centered (see table-name-style) -->
1915
+
1916
+
1917
+
1918
+ <xsl:copy-of select="$table"/>
1919
+
1920
+
1921
+ </xsl:when>
1922
+ <xsl:otherwise>
1923
+ <xsl:copy-of select="$table"/>
1924
+ </xsl:otherwise>
1925
+ </xsl:choose>
1926
+
1894
1927
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1895
1928
  <xsl:if test="normalize-space() != ''">
1896
1929
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -2018,7 +2051,15 @@
2018
2051
  </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2019
2052
  <xsl:value-of select="@target"/>
2020
2053
  </xsl:template><xsl:template match="*[local-name()='math']" mode="td_text">
2021
- <xsl:variable name="math_text" select="normalize-space(.)"/>
2054
+ <xsl:variable name="mathml">
2055
+ <xsl:for-each select="*">
2056
+ <xsl:if test="local-name() != 'unit' and local-name() != 'prefix' and local-name() != 'dimension' and local-name() != 'quantity'">
2057
+ <xsl:copy-of select="."/>
2058
+ </xsl:if>
2059
+ </xsl:for-each>
2060
+ </xsl:variable>
2061
+
2062
+ <xsl:variable name="math_text" select="normalize-space(xalan:nodeset($mathml))"/>
2022
2063
  <xsl:value-of select="translate($math_text, ' ', '#')"/><!-- mathml images as one 'word' without spaces -->
2023
2064
  </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2024
2065
  <xsl:param name="cols-count"/>
@@ -2735,7 +2776,7 @@
2735
2776
  <xsl:with-param name="table" select="$html-table"/>
2736
2777
  </xsl:call-template>
2737
2778
  </xsl:variable>
2738
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2779
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2739
2780
  <xsl:variable name="maxlength_dt">
2740
2781
  <xsl:call-template name="getMaxLength_dt"/>
2741
2782
  </xsl:variable>
@@ -2764,13 +2805,22 @@
2764
2805
  </xsl:when>
2765
2806
  <xsl:otherwise>
2766
2807
  <xsl:choose>
2808
+ <!-- to set width check most wide chars like `W` -->
2767
2809
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2768
- <fo:table-column column-width="5%"/>
2769
- <fo:table-column column-width="95%"/>
2810
+ <fo:table-column column-width="7%"/>
2811
+ <fo:table-column column-width="93%"/>
2770
2812
  </xsl:when>
2771
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2772
- <fo:table-column column-width="10%"/>
2773
- <fo:table-column column-width="90%"/>
2813
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2814
+ <fo:table-column column-width="15%"/>
2815
+ <fo:table-column column-width="85%"/>
2816
+ </xsl:when>
2817
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2818
+ <fo:table-column column-width="20%"/>
2819
+ <fo:table-column column-width="80%"/>
2820
+ </xsl:when>
2821
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2822
+ <fo:table-column column-width="25%"/>
2823
+ <fo:table-column column-width="75%"/>
2774
2824
  </xsl:when>
2775
2825
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2776
2826
  <fo:table-column column-width="60%"/>
@@ -2966,6 +3016,7 @@
2966
3016
 
2967
3017
 
2968
3018
 
3019
+
2969
3020
 
2970
3021
  </xsl:variable>
2971
3022
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2987,6 +3038,10 @@
2987
3038
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2988
3039
  <xsl:apply-templates/>
2989
3040
  </fo:inline>
3041
+ </xsl:template><xsl:template match="*[local-name()='hi']">
3042
+ <fo:inline background-color="yellow">
3043
+ <xsl:apply-templates/>
3044
+ </fo:inline>
2990
3045
  </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
2991
3046
  <xsl:variable name="text" select="normalize-space(.)"/>
2992
3047
  <fo:inline font-size="75%">
@@ -3076,6 +3131,10 @@
3076
3131
  <xsl:param name="text" select="."/>
3077
3132
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3078
3133
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3134
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
3135
+ <xsl:param name="text" select="."/>
3136
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3137
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
3079
3138
  </xsl:template><xsl:template name="add-zero-spaces">
3080
3139
  <xsl:param name="text" select="."/>
3081
3140
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3323,6 +3382,7 @@
3323
3382
  <xsl:apply-templates select="." mode="mathml"/>
3324
3383
  </xsl:variable>
3325
3384
  <fo:instream-foreign-object fox:alt-text="Math">
3385
+
3326
3386
  <!-- <xsl:copy-of select="."/> -->
3327
3387
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3328
3388
  </fo:instream-foreign-object>
@@ -3336,7 +3396,12 @@
3336
3396
  <!-- replace start and end spaces to non-break space -->
3337
3397
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3338
3398
  </xsl:copy>
3339
- </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3399
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3400
+ <xsl:copy>
3401
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3402
+ </xsl:copy>
3403
+ <mathml:mspace width="0.5ex"/>
3404
+ </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">
3340
3405
  <xsl:variable name="target">
3341
3406
  <xsl:choose>
3342
3407
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3357,7 +3422,10 @@
3357
3422
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3358
3423
  <xsl:choose>
3359
3424
  <xsl:when test="normalize-space(.) = ''">
3360
- <xsl:value-of select="$target"/>
3425
+ <!-- <xsl:value-of select="$target"/> -->
3426
+ <xsl:call-template name="add-zero-spaces-link-java">
3427
+ <xsl:with-param name="text" select="$target"/>
3428
+ </xsl:call-template>
3361
3429
  </xsl:when>
3362
3430
  <xsl:otherwise>
3363
3431
  <xsl:apply-templates/>
@@ -3367,8 +3435,6 @@
3367
3435
  </xsl:otherwise>
3368
3436
  </xsl:choose>
3369
3437
  </fo:inline>
3370
- </xsl:template><xsl:template match="*[local-name()='bookmark']">
3371
- <fo:inline id="{@id}"/>
3372
3438
  </xsl:template><xsl:template match="*[local-name()='appendix']">
3373
3439
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3374
3440
  <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
@@ -3572,7 +3638,7 @@
3572
3638
  </xsl:if> -->
3573
3639
  </fo:inline>
3574
3640
  </xsl:if>
3575
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3641
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3576
3642
  <fo:block-container id="{@id}">
3577
3643
 
3578
3644
  <fo:block>
@@ -3588,6 +3654,7 @@
3588
3654
  <fo:block id="{@id}">
3589
3655
  <xsl:apply-templates/>
3590
3656
  </fo:block>
3657
+ <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
3591
3658
  </xsl:template><xsl:template match="*[local-name() = 'figure'][@class = 'pseudocode']//*[local-name() = 'p']">
3592
3659
  <fo:block xsl:use-attribute-sets="figure-pseudocode-p-style">
3593
3660
  <xsl:apply-templates/>
@@ -3779,6 +3846,12 @@
3779
3846
  <!-- <xsl:text> </xsl:text> -->
3780
3847
  </xsl:template><xsl:template name="getSection">
3781
3848
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3849
+ <!--
3850
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3851
+ <xsl:value-of select="."/>
3852
+ </xsl:for-each>
3853
+ -->
3854
+
3782
3855
  </xsl:template><xsl:template name="getName">
3783
3856
  <xsl:choose>
3784
3857
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3831,6 +3904,12 @@
3831
3904
  <xsl:copy>
3832
3905
  <xsl:apply-templates mode="contents_item"/>
3833
3906
  </xsl:copy>
3907
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3908
+ <xsl:copy>
3909
+ <xsl:apply-templates mode="contents_item"/>
3910
+ </xsl:copy>
3911
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3912
+ <xsl:copy-of select="."/>
3834
3913
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3835
3914
  <xsl:text> </xsl:text>
3836
3915
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3856,6 +3935,7 @@
3856
3935
 
3857
3936
 
3858
3937
 
3938
+
3859
3939
 
3860
3940
 
3861
3941
 
@@ -4158,10 +4238,11 @@
4158
4238
  </xsl:choose>
4159
4239
 
4160
4240
  </xsl:template><xsl:template match="*[local-name() = 'example']/*[local-name() = 'p']">
4161
-
4241
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
4162
4242
  <xsl:variable name="element">
4163
4243
  block
4164
4244
 
4245
+
4165
4246
  </xsl:variable>
4166
4247
  <xsl:choose>
4167
4248
  <xsl:when test="normalize-space($element) = 'block'">
@@ -4228,11 +4309,13 @@
4228
4309
  </xsl:if>
4229
4310
  </xsl:if>
4230
4311
 
4312
+
4231
4313
  <fo:block-container margin-left="0mm">
4232
4314
 
4233
4315
  <fo:block xsl:use-attribute-sets="quote-style">
4234
4316
  <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4235
- <xsl:apply-templates select="./*[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4317
+
4318
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
4236
4319
  </fo:block>
4237
4320
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
4238
4321
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4255,31 +4338,49 @@
4255
4338
  <xsl:text>— </xsl:text>
4256
4339
  <xsl:apply-templates/>
4257
4340
  </xsl:template><xsl:template match="*[local-name() = 'eref']">
4258
- <fo:inline xsl:use-attribute-sets="eref-style">
4259
- <xsl:if test="@type = 'footnote'">
4260
-
4261
- <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4262
- <xsl:attribute name="font-size">80%</xsl:attribute>
4263
- <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4264
- <xsl:attribute name="vertical-align">super</xsl:attribute>
4265
-
4266
-
4267
- </xsl:if>
4268
-
4269
- <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4270
-
4271
- <xsl:if test="@type = 'inline'">
4272
-
4273
-
4274
-
4275
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
4276
-
4277
- </xsl:if>
4278
-
4279
-
4280
- <xsl:apply-templates/>
4281
- </fo:basic-link>
4282
- </fo:inline>
4341
+
4342
+ <xsl:variable name="bibitemid">
4343
+ <xsl:choose>
4344
+ <xsl:when test="//*[local-name() = 'bibitem'][@hidden='true' and @id = current()/@bibitemid]"/>
4345
+ <xsl:when test="//*[local-name() = 'references'][@hidden='true']/*[local-name() = 'bibitem'][@id = current()/@bibitemid]"/>
4346
+ <xsl:otherwise><xsl:value-of select="@bibitemid"/></xsl:otherwise>
4347
+ </xsl:choose>
4348
+ </xsl:variable>
4349
+
4350
+ <xsl:choose>
4351
+ <xsl:when test="normalize-space($bibitemid) != ''">
4352
+ <fo:inline xsl:use-attribute-sets="eref-style">
4353
+ <xsl:if test="@type = 'footnote'">
4354
+
4355
+ <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
4356
+ <xsl:attribute name="font-size">80%</xsl:attribute>
4357
+ <xsl:attribute name="keep-with-previous.within-line">always</xsl:attribute>
4358
+ <xsl:attribute name="vertical-align">super</xsl:attribute>
4359
+
4360
+
4361
+ </xsl:if>
4362
+
4363
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4364
+ <xsl:if test="normalize-space(@citeas) = ''">
4365
+ <xsl:attribute name="fox:alt-text"><xsl:value-of select="."/></xsl:attribute>
4366
+ </xsl:if>
4367
+ <xsl:if test="@type = 'inline'">
4368
+
4369
+
4370
+
4371
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
4372
+
4373
+ </xsl:if>
4374
+
4375
+ <xsl:apply-templates/>
4376
+ </fo:basic-link>
4377
+
4378
+ </fo:inline>
4379
+ </xsl:when>
4380
+ <xsl:otherwise>
4381
+ <fo:inline><xsl:apply-templates/></fo:inline>
4382
+ </xsl:otherwise>
4383
+ </xsl:choose>
4283
4384
  </xsl:template><xsl:template match="*[local-name() = 'tab']">
4284
4385
  <!-- zero-space char -->
4285
4386
  <xsl:variable name="depth">
@@ -4385,6 +4486,7 @@
4385
4486
 
4386
4487
 
4387
4488
 
4489
+
4388
4490
 
4389
4491
 
4390
4492
 
@@ -4401,7 +4503,7 @@
4401
4503
 
4402
4504
 
4403
4505
 
4404
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4506
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4405
4507
  <fo:block break-after="page"/>
4406
4508
  <fo:block>
4407
4509
  <xsl:call-template name="setId"/>
@@ -4409,7 +4511,8 @@
4409
4511
  </fo:block>
4410
4512
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4411
4513
  <fo:block>
4412
- <xsl:call-template name="setId"/>
4514
+ <xsl:call-template name="setId"/>
4515
+
4413
4516
 
4414
4517
  <xsl:apply-templates/>
4415
4518
  </fo:block>
@@ -4465,6 +4568,153 @@
4465
4568
  </fo:block>
4466
4569
  </xsl:otherwise>
4467
4570
  </xsl:choose>
4571
+ </xsl:template><xsl:variable name="index" select="document($external_index)"/><xsl:variable name="dash" select="'–'"/><xsl:variable name="bookmark_in_fn">
4572
+ <xsl:for-each select="//*[local-name() = 'bookmark'][ancestor::*[local-name() = 'fn']]">
4573
+ <bookmark><xsl:value-of select="@id"/></bookmark>
4574
+ </xsl:for-each>
4575
+ </xsl:variable><xsl:template match="@*|node()" mode="index_add_id">
4576
+ <xsl:copy>
4577
+ <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
4578
+ </xsl:copy>
4579
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
4580
+ <xsl:variable name="id">
4581
+ <xsl:call-template name="generateIndexXrefId"/>
4582
+ </xsl:variable>
4583
+ <xsl:copy> <!-- add id to xref -->
4584
+ <xsl:apply-templates select="@*" mode="index_add_id"/>
4585
+ <xsl:attribute name="id">
4586
+ <xsl:value-of select="$id"/>
4587
+ </xsl:attribute>
4588
+ <xsl:apply-templates mode="index_add_id"/>
4589
+ </xsl:copy>
4590
+ <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
4591
+ <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
4592
+ <xsl:if test="@to">
4593
+ <xsl:value-of select="$dash"/>
4594
+ <xsl:copy>
4595
+ <xsl:copy-of select="@*"/>
4596
+ <xsl:attribute name="target"><xsl:value-of select="@to"/></xsl:attribute>
4597
+ <xsl:attribute name="id">
4598
+ <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
4599
+ </xsl:attribute>
4600
+ <xsl:apply-templates mode="index_add_id"/>
4601
+ </xsl:copy>
4602
+ </xsl:if>
4603
+ </xsl:template><xsl:template match="@*|node()" mode="index_update">
4604
+ <xsl:copy>
4605
+ <xsl:apply-templates select="@*|node()" mode="index_update"/>
4606
+ </xsl:copy>
4607
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" mode="index_update">
4608
+ <xsl:copy>
4609
+ <xsl:apply-templates select="@*" mode="index_update"/>
4610
+ <xsl:apply-templates select="node()[1]" mode="process_li_element"/>
4611
+ </xsl:copy>
4612
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']/node()" mode="process_li_element" priority="2">
4613
+ <xsl:param name="element"/>
4614
+ <xsl:param name="remove" select="'false'"/>
4615
+ <xsl:param name="target"/>
4616
+ <!-- <node></node> -->
4617
+ <xsl:choose>
4618
+ <xsl:when test="self::text() and (normalize-space(.) = ',' or normalize-space(.) = $dash) and $remove = 'true'">
4619
+ <!-- skip text (i.e. remove it) and process next element -->
4620
+ <!-- [removed_<xsl:value-of select="."/>] -->
4621
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4622
+ <xsl:with-param name="target"><xsl:value-of select="$target"/></xsl:with-param>
4623
+ </xsl:apply-templates>
4624
+ </xsl:when>
4625
+ <xsl:when test="self::text()">
4626
+ <xsl:value-of select="."/>
4627
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4628
+ </xsl:when>
4629
+ <xsl:when test="self::* and local-name(.) = 'xref'">
4630
+ <xsl:variable name="id" select="@id"/>
4631
+ <xsl:variable name="page" select="$index//item[@id = $id]"/>
4632
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
4633
+ <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
4634
+
4635
+ <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
4636
+ <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
4637
+
4638
+ <xsl:choose>
4639
+ <!-- 2nd pass -->
4640
+ <!-- if page is equal to page for next and page is not the end of range -->
4641
+ <xsl:when test="$page != '' and $page_next != '' and $page = $page_next and not(contains($page, '_to'))"> <!-- case: 12, 12-14 -->
4642
+ <!-- skip element (i.e. remove it) and remove next text ',' -->
4643
+ <!-- [removed_xref] -->
4644
+
4645
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4646
+ <xsl:with-param name="remove">true</xsl:with-param>
4647
+ <xsl:with-param name="target">
4648
+ <xsl:choose>
4649
+ <xsl:when test="$target != ''"><xsl:value-of select="$target"/></xsl:when>
4650
+ <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise>
4651
+ </xsl:choose>
4652
+ </xsl:with-param>
4653
+ </xsl:apply-templates>
4654
+ </xsl:when>
4655
+
4656
+ <xsl:when test="$page != '' and $page_prev != '' and $page = $page_prev and contains($page_prev, '_to')"> <!-- case: 12-14, 14, ... -->
4657
+ <!-- remove xref -->
4658
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element">
4659
+ <xsl:with-param name="remove">true</xsl:with-param>
4660
+ </xsl:apply-templates>
4661
+ </xsl:when>
4662
+
4663
+ <xsl:otherwise>
4664
+ <xsl:apply-templates select="." mode="xref_copy">
4665
+ <xsl:with-param name="target" select="$target"/>
4666
+ </xsl:apply-templates>
4667
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4668
+ </xsl:otherwise>
4669
+ </xsl:choose>
4670
+ </xsl:when>
4671
+ <xsl:when test="self::* and local-name(.) = 'ul'">
4672
+ <!-- ul -->
4673
+ <xsl:apply-templates select="." mode="index_update"/>
4674
+ </xsl:when>
4675
+ <xsl:otherwise>
4676
+ <xsl:apply-templates select="." mode="xref_copy">
4677
+ <xsl:with-param name="target" select="$target"/>
4678
+ </xsl:apply-templates>
4679
+ <xsl:apply-templates select="following-sibling::node()[1]" mode="process_li_element"/>
4680
+ </xsl:otherwise>
4681
+ </xsl:choose>
4682
+ </xsl:template><xsl:template match="@*|node()" mode="xref_copy">
4683
+ <xsl:param name="target"/>
4684
+ <xsl:copy>
4685
+ <xsl:apply-templates select="@*" mode="xref_copy"/>
4686
+ <xsl:if test="$target != '' and not(xalan:nodeset($bookmark_in_fn)//bookmark[. = $target])">
4687
+ <xsl:attribute name="target"><xsl:value-of select="$target"/></xsl:attribute>
4688
+ </xsl:if>
4689
+ <xsl:apply-templates select="node()" mode="xref_copy"/>
4690
+ </xsl:copy>
4691
+ </xsl:template><xsl:template name="generateIndexXrefId">
4692
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4693
+
4694
+ <xsl:variable name="docid">
4695
+ <xsl:call-template name="getDocumentId"/>
4696
+ </xsl:variable>
4697
+ <xsl:variable name="item_number">
4698
+ <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
4699
+ </xsl:variable>
4700
+ <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
4701
+ <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
4702
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'clause']" priority="4">
4703
+ <xsl:apply-templates/>
4704
+ <fo:block>
4705
+ <xsl:if test="following-sibling::*[local-name() = 'clause']">
4706
+ <fo:block> </fo:block>
4707
+ </xsl:if>
4708
+ </fo:block>
4709
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'ul']" priority="4">
4710
+ <xsl:apply-templates/>
4711
+ </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
4712
+ <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
4713
+ <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
4714
+ <xsl:apply-templates/>
4715
+ </fo:block>
4716
+ </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
4717
+ <fo:inline id="{@id}" font-size="1pt"/>
4468
4718
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
4469
4719
  <!-- <row>
4470
4720
  <date>05-07-2013</date>
@@ -4586,6 +4836,57 @@
4586
4836
  </xsl:variable>
4587
4837
  <xsl:variable name="result">
4588
4838
  <xsl:choose>
4839
+ <xsl:when test="$format = 'ddMMyyyy'">
4840
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4841
+ <xsl:text> </xsl:text>
4842
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4843
+ </xsl:when>
4844
+ <xsl:when test="$format = 'ddMM'">
4845
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4846
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4847
+ </xsl:when>
4848
+ <xsl:when test="$format = 'short' or $day = ''">
4849
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4850
+ </xsl:when>
4851
+ <xsl:otherwise>
4852
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4853
+ </xsl:otherwise>
4854
+ </xsl:choose>
4855
+ </xsl:variable>
4856
+ <xsl:value-of select="$result"/>
4857
+ </xsl:template><xsl:template name="convertDateLocalized">
4858
+ <xsl:param name="date"/>
4859
+ <xsl:param name="format" select="'short'"/>
4860
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4861
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4862
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4863
+ <xsl:variable name="monthStr">
4864
+ <xsl:choose>
4865
+ <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>
4866
+ <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>
4867
+ <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>
4868
+ <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>
4869
+ <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>
4870
+ <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>
4871
+ <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>
4872
+ <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>
4873
+ <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>
4874
+ <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>
4875
+ <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>
4876
+ <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>
4877
+ </xsl:choose>
4878
+ </xsl:variable>
4879
+ <xsl:variable name="result">
4880
+ <xsl:choose>
4881
+ <xsl:when test="$format = 'ddMMyyyy'">
4882
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4883
+ <xsl:text> </xsl:text>
4884
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4885
+ </xsl:when>
4886
+ <xsl:when test="$format = 'ddMM'">
4887
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4888
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4889
+ </xsl:when>
4589
4890
  <xsl:when test="$format = 'short' or $day = ''">
4590
4891
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4591
4892
  </xsl:when>
@@ -4601,7 +4902,7 @@
4601
4902
  <xsl:param name="charDelim" select="', '"/>
4602
4903
  <xsl:choose>
4603
4904
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4604
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4905
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4605
4906
  <xsl:sort data-type="text" order="ascending"/>
4606
4907
  <xsl:call-template name="insertKeyword">
4607
4908
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4610,7 +4911,7 @@
4610
4911
  </xsl:for-each>
4611
4912
  </xsl:when>
4612
4913
  <xsl:otherwise>
4613
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4914
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4614
4915
  <xsl:call-template name="insertKeyword">
4615
4916
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4616
4917
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4627,63 +4928,71 @@
4627
4928
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4628
4929
  </xsl:choose>
4629
4930
  </xsl:template><xsl:template name="addPDFUAmeta">
4630
- <fo:declarations>
4631
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4632
- <pdf:dictionary type="normal" key="ViewerPreferences">
4633
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4634
- </pdf:dictionary>
4635
- </pdf:catalog>
4636
- <x:xmpmeta xmlns:x="adobe:ns:meta/">
4637
- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4638
- <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4639
- <!-- Dublin Core properties go here -->
4640
- <dc:title>
4641
- <xsl:variable name="title">
4931
+ <xsl:variable name="lang">
4932
+ <xsl:call-template name="getLang"/>
4933
+ </xsl:variable>
4934
+ <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4935
+ <pdf:dictionary type="normal" key="ViewerPreferences">
4936
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
4937
+ </pdf:dictionary>
4938
+ </pdf:catalog>
4939
+ <x:xmpmeta xmlns:x="adobe:ns:meta/">
4940
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
4941
+ <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
4942
+ <!-- Dublin Core properties go here -->
4943
+ <dc:title>
4944
+ <xsl:variable name="title">
4945
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4946
+
4947
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang and @type = 'main']"/>
4642
4948
 
4643
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en' and @type = 'main']"/>
4644
4949
 
4645
4950
 
4646
4951
 
4647
4952
 
4648
4953
 
4649
- </xsl:variable>
4650
- <xsl:choose>
4651
- <xsl:when test="normalize-space($title) != ''">
4652
- <xsl:value-of select="$title"/>
4653
- </xsl:when>
4654
- <xsl:otherwise>
4655
- <xsl:text> </xsl:text>
4656
- </xsl:otherwise>
4657
- </xsl:choose>
4658
- </dc:title>
4659
- <dc:creator>
4954
+ </xsl:for-each>
4955
+ </xsl:variable>
4956
+ <xsl:choose>
4957
+ <xsl:when test="normalize-space($title) != ''">
4958
+ <xsl:value-of select="$title"/>
4959
+ </xsl:when>
4960
+ <xsl:otherwise>
4961
+ <xsl:text> </xsl:text>
4962
+ </xsl:otherwise>
4963
+ </xsl:choose>
4964
+ </dc:title>
4965
+ <dc:creator>
4966
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4660
4967
 
4968
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4969
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4970
+ <xsl:if test="position() != last()">; </xsl:if>
4971
+ </xsl:for-each>
4661
4972
 
4662
4973
 
4663
- </dc:creator>
4664
- <dc:description>
4665
- <xsl:variable name="abstract">
4666
-
4667
-
4668
-
4669
- <xsl:copy-of select="/*/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4670
-
4671
-
4672
-
4673
- </xsl:variable>
4674
- <xsl:value-of select="normalize-space($abstract)"/>
4675
- </dc:description>
4676
- <pdf:Keywords>
4677
- <xsl:call-template name="insertKeywords"/>
4678
- </pdf:Keywords>
4679
- </rdf:Description>
4680
- <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4681
- <!-- XMP properties go here -->
4682
- <xmp:CreatorTool/>
4683
- </rdf:Description>
4684
- </rdf:RDF>
4685
- </x:xmpmeta>
4686
- </fo:declarations>
4974
+
4975
+ </xsl:for-each>
4976
+ </dc:creator>
4977
+ <dc:description>
4978
+ <xsl:variable name="abstract">
4979
+
4980
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4981
+
4982
+
4983
+ </xsl:variable>
4984
+ <xsl:value-of select="normalize-space($abstract)"/>
4985
+ </dc:description>
4986
+ <pdf:Keywords>
4987
+ <xsl:call-template name="insertKeywords"/>
4988
+ </pdf:Keywords>
4989
+ </rdf:Description>
4990
+ <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
4991
+ <!-- XMP properties go here -->
4992
+ <xmp:CreatorTool/>
4993
+ </rdf:Description>
4994
+ </rdf:RDF>
4995
+ </x:xmpmeta>
4687
4996
  </xsl:template><xsl:template name="getId">
4688
4997
  <xsl:choose>
4689
4998
  <xsl:when test="../@id">
@@ -4780,6 +5089,7 @@
4780
5089
 
4781
5090
 
4782
5091
 
5092
+
4783
5093
  </xsl:variable>
4784
5094
  <xsl:if test="$documentNS != $XSLNS">
4785
5095
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>