metanorma-iho 0.2.8 → 0.2.13

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: 513e82e7a645309759e5d909c752a93a0e2fd50c6cbec13720f40e1bc0917300
4
- data.tar.gz: e92beaf75f5e06b5b891d7b65b73a61d1c002661e4f6eea25735d8043a97da57
3
+ metadata.gz: 137305f698b157bf4eb0ecd5d85ab38f43212ef39876f626e4da891612e808e2
4
+ data.tar.gz: 70f52fd776708df63ca148f87061b06da3cbf3c74a76b87901478485a9dfb814
5
5
  SHA512:
6
- metadata.gz: 9ddf83a4a809b163cfd8b4d2468bb9a08a237fb76a65dfa69103d23122454eb0348edf0397ada178bcafeee54e950a8676f370ff932bd696946c5de864fda314
7
- data.tar.gz: 32987352ccaf4104e96ebba3b7b8960bf3e8e8c44f46a2f270cb33c861c336298525e7b7950edc95ceb1454e4f1146d734afacabb6c1f1922317f1977ecc371d
6
+ metadata.gz: 2a28f19570f0d541cab9e0669c7ba2d7bd69f8aef0284a10a55ef16d6d393cf39fe0be6883e40a70436ae979b071985d8e9befb30ebe12b67fb05c823230f20a
7
+ data.tar.gz: fe1775493f9005919a5a450d234a1947c1a492ef7759ca5b4af278452fc7c42f9e8cd9b565c991559567fabcf2fbd83e09fe9421285c981c93ec7590b520dcf4
@@ -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,17 +16,17 @@ 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:
@@ -35,16 +35,7 @@ jobs:
35
35
  - uses: ruby/setup-ruby@v1
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
-
39
- - uses: actions/cache@v2
40
- with:
41
- path: vendor/bundle
42
- key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
43
- restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
44
-
45
- - run: bundle config set path 'vendor/bundle'
46
-
47
- - run: bundle install --jobs 4 --retry 3
38
+ bundler-cache: true
48
39
 
49
40
  - name: install plantuml ubuntu
50
41
  if: matrix.os == 'ubuntu-latest'
@@ -64,3 +55,17 @@ jobs:
64
55
  run: cinst -y plantuml
65
56
 
66
57
  - run: bundle exec rake
58
+
59
+ tests-passed:
60
+ needs: rake
61
+ runs-on: ubuntu-latest
62
+ continue-on-error: true
63
+ steps:
64
+ - name: Trigger tests passed event
65
+ uses: Sibz/github-status-action@v1
66
+ with:
67
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
68
+ context: 'tests-passed-successfully'
69
+ description: 'Tests passed successfully'
70
+ state: 'success'
71
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ inherit_from:
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -728,13 +729,61 @@
728
729
  </define>
729
730
  <define name="index">
730
731
  <element name="index">
731
- <attribute name="primary"/>
732
732
  <optional>
733
- <attribute name="secondary"/>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
737
+ <element name="primary">
738
+ <oneOrMore>
739
+ <ref name="PureTextElement"/>
740
+ </oneOrMore>
741
+ </element>
742
+ <optional>
743
+ <element name="secondary">
744
+ <oneOrMore>
745
+ <ref name="PureTextElement"/>
746
+ </oneOrMore>
747
+ </element>
748
+ </optional>
749
+ <optional>
750
+ <element name="tertiary">
751
+ <oneOrMore>
752
+ <ref name="PureTextElement"/>
753
+ </oneOrMore>
754
+ </element>
755
+ </optional>
756
+ </element>
757
+ </define>
758
+ <define name="index-xref">
759
+ <element name="index-xref">
760
+ <attribute name="also">
761
+ <data type="boolean"/>
762
+ </attribute>
763
+ <element name="primary">
764
+ <oneOrMore>
765
+ <ref name="PureTextElement"/>
766
+ </oneOrMore>
767
+ </element>
768
+ <optional>
769
+ <element name="secondary">
770
+ <oneOrMore>
771
+ <ref name="PureTextElement"/>
772
+ </oneOrMore>
773
+ </element>
734
774
  </optional>
735
775
  <optional>
736
- <attribute name="tertiary"/>
776
+ <element name="tertiary">
777
+ <oneOrMore>
778
+ <ref name="PureTextElement"/>
779
+ </oneOrMore>
780
+ </element>
737
781
  </optional>
782
+ <element name="target">
783
+ <oneOrMore>
784
+ <ref name="PureTextElement"/>
785
+ </oneOrMore>
786
+ </element>
738
787
  </element>
739
788
  </define>
740
789
  <!-- bare ID element, used for referencing arbitrary spans of text -->
@@ -55,6 +55,13 @@
55
55
  <param name="pattern">\i\c*|\c+#\c+</param>
56
56
  </data>
57
57
  </attribute>
58
+ <optional>
59
+ <attribute name="to">
60
+ <data type="string">
61
+ <param name="pattern">\i\c*|\c+#\c+</param>
62
+ </data>
63
+ </attribute>
64
+ </optional>
58
65
  <optional>
59
66
  <attribute name="type">
60
67
  <ref name="ReferenceFormat"/>
@@ -246,6 +253,12 @@
246
253
  <data type="boolean"/>
247
254
  </attribute>
248
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
259
+ <optional>
260
+ <ref name="colgroup"/>
261
+ </optional>
249
262
  <optional>
250
263
  <ref name="tname"/>
251
264
  </optional>
@@ -764,6 +777,21 @@
764
777
  </define>
765
778
  </include>
766
779
  <!-- end overrides -->
780
+ <define name="colgroup">
781
+ <element name="colgroup">
782
+ <oneOrMore>
783
+ <ref name="col"/>
784
+ </oneOrMore>
785
+ </element>
786
+ </define>
787
+ <define name="col">
788
+ <element name="col">
789
+ <attribute name="width"/>
790
+ </element>
791
+ </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
767
795
  <define name="TextElement" combine="choice">
768
796
  <ref name="concept"/>
769
797
  </define>
@@ -784,6 +812,8 @@
784
812
  <ref name="requirement"/>
785
813
  <ref name="recommendation"/>
786
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
787
817
  </choice>
788
818
  </define>
789
819
  <define name="bibliography">
@@ -814,6 +844,9 @@
814
844
  <data type="boolean"/>
815
845
  </attribute>
816
846
  </optional>
847
+ <optional>
848
+ <attribute name="number"/>
849
+ </optional>
817
850
  <optional>
818
851
  <attribute name="obligation">
819
852
  <choice>
@@ -869,9 +902,11 @@
869
902
  <element name="code">
870
903
  <text/>
871
904
  </element>
872
- <element name="text">
873
- <text/>
874
- </element>
905
+ <optional>
906
+ <element name="text">
907
+ <text/>
908
+ </element>
909
+ </optional>
875
910
  </element>
876
911
  </define>
877
912
  <define name="standard-document">
@@ -1041,6 +1076,9 @@
1041
1076
  </choice>
1042
1077
  </attribute>
1043
1078
  </optional>
1079
+ <optional>
1080
+ <attribute name="number"/>
1081
+ </optional>
1044
1082
  <optional>
1045
1083
  <attribute name="type"/>
1046
1084
  </optional>
@@ -1094,6 +1132,9 @@
1094
1132
  <optional>
1095
1133
  <attribute name="type"/>
1096
1134
  </optional>
1135
+ <optional>
1136
+ <attribute name="number"/>
1137
+ </optional>
1097
1138
  <optional>
1098
1139
  <ref name="section-title"/>
1099
1140
  </optional>
@@ -1196,6 +1237,9 @@
1196
1237
  <optional>
1197
1238
  <attribute name="type"/>
1198
1239
  </optional>
1240
+ <optional>
1241
+ <attribute name="number"/>
1242
+ </optional>
1199
1243
  <optional>
1200
1244
  <attribute name="obligation">
1201
1245
  <choice>
@@ -1524,6 +1568,7 @@
1524
1568
  <value>add</value>
1525
1569
  <value>modify</value>
1526
1570
  <value>delete</value>
1571
+ <value>replace</value>
1527
1572
  </choice>
1528
1573
  </attribute>
1529
1574
  <optional>
@@ -1554,6 +1599,11 @@
1554
1599
  </optional>
1555
1600
  <optional>
1556
1601
  <element name="newcontent">
1602
+ <optional>
1603
+ <attribute name="id">
1604
+ <data type="ID"/>
1605
+ </attribute>
1606
+ </optional>
1557
1607
  <zeroOrMore>
1558
1608
  <ref name="BasicBlock"/>
1559
1609
  </zeroOrMore>
@@ -1587,4 +1637,65 @@
1587
1637
  <text/>
1588
1638
  </element>
1589
1639
  </define>
1640
+ <define name="imagemap">
1641
+ <element name="imagemap">
1642
+ <ref name="figure"/>
1643
+ <zeroOrMore>
1644
+ <element name="area">
1645
+ <attribute name="type">
1646
+ <choice>
1647
+ <value>rect</value>
1648
+ <value>circle</value>
1649
+ <value>ellipse</value>
1650
+ <value>poly</value>
1651
+ </choice>
1652
+ </attribute>
1653
+ <choice>
1654
+ <ref name="xref"/>
1655
+ <ref name="hyperlink"/>
1656
+ <ref name="eref"/>
1657
+ </choice>
1658
+ <oneOrMore>
1659
+ <element name="coords">
1660
+ <attribute name="x">
1661
+ <data type="float"/>
1662
+ </attribute>
1663
+ <attribute name="y">
1664
+ <data type="float"/>
1665
+ </attribute>
1666
+ </element>
1667
+ </oneOrMore>
1668
+ <optional>
1669
+ <element name="radius">
1670
+ <attribute name="x">
1671
+ <data type="float"/>
1672
+ </attribute>
1673
+ <optional>
1674
+ <attribute name="y">
1675
+ <data type="float"/>
1676
+ </attribute>
1677
+ </optional>
1678
+ </element>
1679
+ </optional>
1680
+ </element>
1681
+ </zeroOrMore>
1682
+ </element>
1683
+ </define>
1684
+ <define name="svgmap">
1685
+ <element name="svgmap">
1686
+ <ref name="figure"/>
1687
+ <zeroOrMore>
1688
+ <element name="target">
1689
+ <attribute name="href">
1690
+ <data type="anyURI"/>
1691
+ </attribute>
1692
+ <choice>
1693
+ <ref name="xref"/>
1694
+ <ref name="hyperlink"/>
1695
+ <ref name="eref"/>
1696
+ </choice>
1697
+ </element>
1698
+ </zeroOrMore>
1699
+ </element>
1700
+ </define>
1590
1701
  </grammar>
@@ -38,7 +38,7 @@
38
38
  <xsl:template match="/">
39
39
 
40
40
  <xsl:variable name="xslfo">
41
- <fo:root font-family="Helvetica Neue, Cambria Math" font-size="12pt" xml:lang="{$lang}">
41
+ <fo:root font-family="Arial, Cambria Math" font-size="12pt" xml:lang="{$lang}">
42
42
  <fo:layout-master-set>
43
43
  <!-- cover page -->
44
44
  <fo:simple-page-master master-name="cover" page-width="{$pageWidth}" page-height="{$pageHeight}">
@@ -862,10 +862,10 @@
862
862
  <xsl:otherwise> <!-- for ordered lists -->
863
863
  <xsl:choose>
864
864
  <xsl:when test="../@type = 'arabic'">
865
- <xsl:number format="a)"/>
865
+ <xsl:number format="a)" lang="en"/>
866
866
  </xsl:when>
867
867
  <xsl:when test="../@type = 'alphabet'">
868
- <xsl:number format="a)"/>
868
+ <xsl:number format="a)" lang="en"/>
869
869
  </xsl:when>
870
870
  <xsl:otherwise>
871
871
  <xsl:number format="1."/>
@@ -1125,7 +1125,7 @@
1125
1125
 
1126
1126
 
1127
1127
 
1128
- <xsl:attribute name="font-family">SF Mono</xsl:attribute>
1128
+ <xsl:attribute name="font-family">Fira Code</xsl:attribute>
1129
1129
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1130
1130
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1131
1131
  <xsl:attribute name="line-height">113%</xsl:attribute>
@@ -1336,10 +1336,12 @@
1336
1336
 
1337
1337
  </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1338
1338
 
1339
+
1339
1340
  </xsl:attribute-set><xsl:attribute-set name="quote-style">
1340
1341
 
1341
1342
 
1342
1343
 
1344
+
1343
1345
 
1344
1346
  <xsl:attribute name="margin-left">12.5mm</xsl:attribute>
1345
1347
  <xsl:attribute name="margin-right">14mm</xsl:attribute>
@@ -1486,184 +1488,236 @@
1486
1488
  </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
1487
1489
  <!-- <xsl:call-template name="add-zero-spaces"/> -->
1488
1490
  <xsl:call-template name="add-zero-spaces-java"/>
1489
- </xsl:template><xsl:template match="*[local-name()='table']">
1491
+ </xsl:template><xsl:template match="*[local-name()='table']" name="table">
1490
1492
 
1491
- <xsl:variable name="simple-table">
1492
- <xsl:call-template name="getSimpleTable"/>
1493
- </xsl:variable>
1493
+ <xsl:variable name="table">
1494
1494
 
1495
-
1496
-
1497
-
1498
-
1499
- <!-- <xsl:if test="$namespace = 'bipm'">
1500
- <fo:block>&#xA0;</fo:block>
1501
- </xsl:if> -->
1502
-
1503
- <!-- $namespace = 'iso' or -->
1504
-
1505
- <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1506
-
1507
-
1508
-
1509
- <xsl:call-template name="fn_name_display"/>
1495
+ <xsl:variable name="simple-table">
1496
+ <xsl:call-template name="getSimpleTable"/>
1497
+ </xsl:variable>
1510
1498
 
1511
1499
 
1512
-
1513
- <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1514
-
1515
- <!-- <xsl:variable name="cols-count">
1516
- <xsl:choose>
1517
- <xsl:when test="*[local-name()='thead']">
1518
- <xsl:call-template name="calculate-columns-numbers">
1519
- <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1520
- </xsl:call-template>
1521
- </xsl:when>
1522
- <xsl:otherwise>
1523
- <xsl:call-template name="calculate-columns-numbers">
1524
- <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1525
- </xsl:call-template>
1526
- </xsl:otherwise>
1527
- </xsl:choose>
1528
- </xsl:variable> -->
1529
- <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1530
- <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1531
-
1532
-
1533
-
1534
- <xsl:variable name="colwidths">
1535
- <xsl:call-template name="calculate-column-widths">
1536
- <xsl:with-param name="cols-count" select="$cols-count"/>
1537
- <xsl:with-param name="table" select="$simple-table"/>
1538
- </xsl:call-template>
1539
- </xsl:variable>
1540
- <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1541
-
1542
- <!-- <xsl:variable name="colwidths2">
1543
- <xsl:call-template name="calculate-column-widths">
1544
- <xsl:with-param name="cols-count" select="$cols-count"/>
1545
- </xsl:call-template>
1546
- </xsl:variable> -->
1547
-
1548
- <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1549
- colwidthsNew=<xsl:copy-of select="$colwidths"/>
1550
- colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1551
-
1552
- <xsl:variable name="margin-left">
1553
- <xsl:choose>
1554
- <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1555
- <xsl:otherwise>0</xsl:otherwise>
1556
- </xsl:choose>
1557
- </xsl:variable>
1558
-
1559
- <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1560
1500
 
1561
1501
 
1562
-
1563
-
1564
-
1565
1502
 
1503
+ <!-- <xsl:if test="$namespace = 'bipm'">
1504
+ <fo:block>&#xA0;</fo:block>
1505
+ </xsl:if> -->
1566
1506
 
1567
-
1507
+ <!-- $namespace = 'iso' or -->
1508
+
1509
+ <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1510
+
1511
+
1512
+
1513
+ <xsl:call-template name="fn_name_display"/>
1568
1514
 
1515
+
1516
+
1517
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)//tr[1]/td)"/>
1518
+
1519
+ <!-- <xsl:variable name="cols-count">
1520
+ <xsl:choose>
1521
+ <xsl:when test="*[local-name()='thead']">
1522
+ <xsl:call-template name="calculate-columns-numbers">
1523
+ <xsl:with-param name="table-row" select="*[local-name()='thead']/*[local-name()='tr'][1]"/>
1524
+ </xsl:call-template>
1525
+ </xsl:when>
1526
+ <xsl:otherwise>
1527
+ <xsl:call-template name="calculate-columns-numbers">
1528
+ <xsl:with-param name="table-row" select="*[local-name()='tbody']/*[local-name()='tr'][1]"/>
1529
+ </xsl:call-template>
1530
+ </xsl:otherwise>
1531
+ </xsl:choose>
1532
+ </xsl:variable> -->
1533
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/> -->
1534
+ <!-- cols-count2=<xsl:copy-of select="$cols-count2"/> -->
1569
1535
 
1570
1536
 
1571
- <xsl:attribute name="space-after">18pt</xsl:attribute>
1572
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
1573
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
1574
1537
 
1538
+ <xsl:variable name="colwidths">
1539
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
1540
+ <xsl:call-template name="calculate-column-widths">
1541
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1542
+ <xsl:with-param name="table" select="$simple-table"/>
1543
+ </xsl:call-template>
1544
+ </xsl:if>
1545
+ </xsl:variable>
1546
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
1575
1547
 
1548
+ <!-- <xsl:variable name="colwidths2">
1549
+ <xsl:call-template name="calculate-column-widths">
1550
+ <xsl:with-param name="cols-count" select="$cols-count"/>
1551
+ </xsl:call-template>
1552
+ </xsl:variable> -->
1576
1553
 
1554
+ <!-- cols-count=<xsl:copy-of select="$cols-count"/>
1555
+ colwidthsNew=<xsl:copy-of select="$colwidths"/>
1556
+ colwidthsOld=<xsl:copy-of select="$colwidths2"/>z -->
1577
1557
 
1558
+ <xsl:variable name="margin-left">
1559
+ <xsl:choose>
1560
+ <xsl:when test="sum(xalan:nodeset($colwidths)//column) &gt; 75">15</xsl:when>
1561
+ <xsl:otherwise>0</xsl:otherwise>
1562
+ </xsl:choose>
1563
+ </xsl:variable>
1578
1564
 
1579
- <xsl:variable name="table_attributes">
1580
- <attribute name="table-layout">fixed</attribute>
1581
- <attribute name="width">100%</attribute>
1582
- <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1583
- <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1565
+ <fo:block-container margin-left="-{$margin-left}mm" margin-right="-{$margin-left}mm">
1584
1566
 
1585
1567
 
1568
+
1569
+
1570
+
1586
1571
 
1587
1572
 
1588
-
1589
-
1590
-
1591
-
1592
- <attribute name="margin-left">0mm</attribute>
1593
- <attribute name="margin-right">0mm</attribute>
1573
+
1594
1574
 
1595
-
1596
1575
 
1597
- </xsl:variable>
1598
-
1599
-
1600
- <fo:table id="{@id}" table-omit-footer-at-break="true">
1601
1576
 
1602
- <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1603
- <xsl:attribute name="{@name}">
1604
- <xsl:value-of select="."/>
1605
- </xsl:attribute>
1606
- </xsl:for-each>
1577
+ <xsl:attribute name="space-after">18pt</xsl:attribute>
1578
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
1579
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
1607
1580
 
1608
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1609
- <xsl:if test="$isNoteOrFnExist = 'true'">
1610
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1611
- </xsl:if>
1612
1581
 
1613
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1582
+
1583
+
1584
+ <xsl:variable name="table_width">
1585
+ <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1586
+ 100%
1587
+
1588
+
1589
+ </xsl:variable>
1590
+
1591
+ <xsl:variable name="table_attributes">
1592
+ <attribute name="table-layout">fixed</attribute>
1593
+ <attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></attribute>
1594
+ <attribute name="margin-left"><xsl:value-of select="$margin-left"/>mm</attribute>
1595
+ <attribute name="margin-right"><xsl:value-of select="$margin-left"/>mm</attribute>
1596
+
1597
+
1598
+
1599
+
1600
+
1601
+
1602
+
1603
+
1604
+ <attribute name="margin-left">0mm</attribute>
1605
+ <attribute name="margin-right">0mm</attribute>
1606
+
1607
+
1608
+
1609
+ </xsl:variable>
1610
+
1611
+
1612
+ <fo:table id="{@id}" table-omit-footer-at-break="true">
1613
+
1614
+ <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
1615
+ <xsl:attribute name="{@name}">
1616
+ <xsl:value-of select="."/>
1617
+ </xsl:attribute>
1618
+ </xsl:for-each>
1619
+
1620
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or .//*[local-name()='fn'][local-name(..) != 'name']"/>
1621
+ <xsl:if test="$isNoteOrFnExist = 'true'">
1622
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1623
+ </xsl:if>
1624
+
1614
1625
  <xsl:choose>
1615
- <xsl:when test=". = 1 or . = 0">
1616
- <fo:table-column column-width="proportional-column-width(2)"/>
1626
+ <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1627
+ <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
1628
+ <fo:table-column column-width="{@width}"/>
1629
+ </xsl:for-each>
1617
1630
  </xsl:when>
1618
1631
  <xsl:otherwise>
1619
- <fo:table-column column-width="proportional-column-width({.})"/>
1632
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1633
+ <xsl:choose>
1634
+ <xsl:when test=". = 1 or . = 0">
1635
+ <fo:table-column column-width="proportional-column-width(2)"/>
1636
+ </xsl:when>
1637
+ <xsl:otherwise>
1638
+ <fo:table-column column-width="proportional-column-width({.})"/>
1639
+ </xsl:otherwise>
1640
+ </xsl:choose>
1641
+ </xsl:for-each>
1620
1642
  </xsl:otherwise>
1621
1643
  </xsl:choose>
1622
- </xsl:for-each>
1623
-
1624
- <xsl:choose>
1625
- <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1626
- <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1627
- </xsl:when>
1628
- <xsl:otherwise>
1629
- <xsl:apply-templates/>
1630
- </xsl:otherwise>
1631
- </xsl:choose>
1632
-
1633
- </fo:table>
1634
-
1635
- <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1636
- <xsl:call-template name="insertTableFooterInSeparateTable">
1637
- <xsl:with-param name="table_attributes" select="$table_attributes"/>
1638
- <xsl:with-param name="colwidths" select="$colwidths"/>
1639
- </xsl:call-template>
1640
- </xsl:for-each>
1641
-
1642
- <!-- insert footer as table -->
1643
- <!-- <fo:table>
1644
- <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1645
- <xsl:attribute name="{@name}">
1646
- <xsl:value-of select="."/>
1647
- </xsl:attribute>
1648
- </xsl:for-each>
1649
-
1650
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1644
+
1651
1645
  <xsl:choose>
1652
- <xsl:when test=". = 1 or . = 0">
1653
- <fo:table-column column-width="proportional-column-width(2)"/>
1646
+ <xsl:when test="not(*[local-name()='tbody']) and *[local-name()='thead']">
1647
+ <xsl:apply-templates select="*[local-name()='thead']" mode="process_tbody"/>
1654
1648
  </xsl:when>
1655
1649
  <xsl:otherwise>
1656
- <fo:table-column column-width="proportional-column-width({.})"/>
1650
+ <xsl:apply-templates/>
1657
1651
  </xsl:otherwise>
1658
1652
  </xsl:choose>
1653
+
1654
+ </fo:table>
1655
+
1656
+ <xsl:variable name="colgroup" select="*[local-name()='colgroup']"/>
1657
+ <xsl:for-each select="*[local-name()='tbody']"><!-- select context to tbody -->
1658
+ <xsl:call-template name="insertTableFooterInSeparateTable">
1659
+ <xsl:with-param name="table_attributes" select="$table_attributes"/>
1660
+ <xsl:with-param name="colwidths" select="$colwidths"/>
1661
+ <xsl:with-param name="colgroup" select="$colgroup"/>
1662
+ </xsl:call-template>
1659
1663
  </xsl:for-each>
1660
- </fo:table>-->
1661
-
1662
-
1663
-
1664
-
1665
-
1666
- </fo:block-container>
1664
+
1665
+ <!-- insert footer as table -->
1666
+ <!-- <fo:table>
1667
+ <xsl:for-each select="xalan::nodeset($table_attributes)/attribute">
1668
+ <xsl:attribute name="{@name}">
1669
+ <xsl:value-of select="."/>
1670
+ </xsl:attribute>
1671
+ </xsl:for-each>
1672
+
1673
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1674
+ <xsl:choose>
1675
+ <xsl:when test=". = 1 or . = 0">
1676
+ <fo:table-column column-width="proportional-column-width(2)"/>
1677
+ </xsl:when>
1678
+ <xsl:otherwise>
1679
+ <fo:table-column column-width="proportional-column-width({.})"/>
1680
+ </xsl:otherwise>
1681
+ </xsl:choose>
1682
+ </xsl:for-each>
1683
+ </fo:table>-->
1684
+
1685
+
1686
+
1687
+
1688
+
1689
+ </fo:block-container>
1690
+ </xsl:variable>
1691
+
1692
+
1693
+
1694
+ <xsl:choose>
1695
+ <xsl:when test="@width">
1696
+
1697
+ <!-- centered table when table name is centered (see table-name-style) -->
1698
+
1699
+ <fo:table table-layout="fixed" width="100%">
1700
+ <fo:table-column column-width="proportional-column-width(1)"/>
1701
+ <fo:table-column column-width="{@width}"/>
1702
+ <fo:table-column column-width="proportional-column-width(1)"/>
1703
+ <fo:table-body>
1704
+ <fo:table-row>
1705
+ <fo:table-cell column-number="2">
1706
+ <fo:block><xsl:copy-of select="$table"/></fo:block>
1707
+ </fo:table-cell>
1708
+ </fo:table-row>
1709
+ </fo:table-body>
1710
+ </fo:table>
1711
+
1712
+
1713
+
1714
+
1715
+ </xsl:when>
1716
+ <xsl:otherwise>
1717
+ <xsl:copy-of select="$table"/>
1718
+ </xsl:otherwise>
1719
+ </xsl:choose>
1720
+
1667
1721
  </xsl:template><xsl:template match="*[local-name()='table']/*[local-name() = 'name']"/><xsl:template match="*[local-name()='table']/*[local-name() = 'name']" mode="presentation">
1668
1722
  <xsl:if test="normalize-space() != ''">
1669
1723
  <fo:block xsl:use-attribute-sets="table-name-style">
@@ -1889,12 +1943,22 @@
1889
1943
  </xsl:template><xsl:template name="insertTableFooterInSeparateTable">
1890
1944
  <xsl:param name="table_attributes"/>
1891
1945
  <xsl:param name="colwidths"/>
1946
+ <xsl:param name="colgroup"/>
1892
1947
 
1893
1948
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
1894
1949
 
1895
1950
  <xsl:if test="$isNoteOrFnExist = 'true'">
1896
1951
 
1897
- <xsl:variable name="cols-count" select="count(xalan:nodeset($colwidths)//column)"/>
1952
+ <xsl:variable name="cols-count">
1953
+ <xsl:choose>
1954
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1955
+ <xsl:value-of select="count(xalan:nodeset($colgroup)//*[local-name()='col'])"/>
1956
+ </xsl:when>
1957
+ <xsl:otherwise>
1958
+ <xsl:value-of select="count(xalan:nodeset($colwidths)//column)"/>
1959
+ </xsl:otherwise>
1960
+ </xsl:choose>
1961
+ </xsl:variable>
1898
1962
 
1899
1963
  <fo:table keep-with-previous="always">
1900
1964
  <xsl:for-each select="xalan:nodeset($table_attributes)/attribute">
@@ -1912,16 +1976,25 @@
1912
1976
  </xsl:choose>
1913
1977
  </xsl:for-each>
1914
1978
 
1915
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
1916
- <xsl:choose>
1917
- <xsl:when test=". = 1 or . = 0">
1918
- <fo:table-column column-width="proportional-column-width(2)"/>
1919
- </xsl:when>
1920
- <xsl:otherwise>
1921
- <fo:table-column column-width="proportional-column-width({.})"/>
1922
- </xsl:otherwise>
1923
- </xsl:choose>
1924
- </xsl:for-each>
1979
+ <xsl:choose>
1980
+ <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
1981
+ <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
1982
+ <fo:table-column column-width="{@width}"/>
1983
+ </xsl:for-each>
1984
+ </xsl:when>
1985
+ <xsl:otherwise>
1986
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
1987
+ <xsl:choose>
1988
+ <xsl:when test=". = 1 or . = 0">
1989
+ <fo:table-column column-width="proportional-column-width(2)"/>
1990
+ </xsl:when>
1991
+ <xsl:otherwise>
1992
+ <fo:table-column column-width="proportional-column-width({.})"/>
1993
+ </xsl:otherwise>
1994
+ </xsl:choose>
1995
+ </xsl:for-each>
1996
+ </xsl:otherwise>
1997
+ </xsl:choose>
1925
1998
 
1926
1999
  <fo:table-body>
1927
2000
  <fo:table-row>
@@ -2330,7 +2403,9 @@
2330
2403
  </xsl:template><xsl:template match="*[local-name()='dl']">
2331
2404
  <fo:block-container>
2332
2405
 
2333
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2406
+ <xsl:if test="not(ancestor::*[local-name() = 'quote'])">
2407
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
2408
+ </xsl:if>
2334
2409
 
2335
2410
 
2336
2411
  <xsl:if test="parent::*[local-name() = 'note']">
@@ -2345,6 +2420,7 @@
2345
2420
  <fo:block-container>
2346
2421
 
2347
2422
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2423
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
2348
2424
 
2349
2425
 
2350
2426
  <xsl:variable name="parent" select="local-name(..)"/>
@@ -2465,7 +2541,7 @@
2465
2541
  <xsl:with-param name="table" select="$html-table"/>
2466
2542
  </xsl:call-template>
2467
2543
  </xsl:variable>
2468
- <!-- colwidths=<xsl:value-of select="$colwidths"/> -->
2544
+ <!-- colwidths=<xsl:copy-of select="$colwidths"/> -->
2469
2545
  <xsl:variable name="maxlength_dt">
2470
2546
  <xsl:call-template name="getMaxLength_dt"/>
2471
2547
  </xsl:variable>
@@ -2494,13 +2570,22 @@
2494
2570
  </xsl:when>
2495
2571
  <xsl:otherwise>
2496
2572
  <xsl:choose>
2573
+ <!-- to set width check most wide chars like `W` -->
2497
2574
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
2498
- <fo:table-column column-width="5%"/>
2499
- <fo:table-column column-width="95%"/>
2575
+ <fo:table-column column-width="7%"/>
2576
+ <fo:table-column column-width="93%"/>
2577
+ </xsl:when>
2578
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like ABC, etc -->
2579
+ <fo:table-column column-width="15%"/>
2580
+ <fo:table-column column-width="85%"/>
2581
+ </xsl:when>
2582
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 7"> <!-- if dt contains short text like ABCDEF, etc -->
2583
+ <fo:table-column column-width="20%"/>
2584
+ <fo:table-column column-width="80%"/>
2500
2585
  </xsl:when>
2501
- <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 5"> <!-- if dt contains short text like t90, a, etc -->
2502
- <fo:table-column column-width="10%"/>
2503
- <fo:table-column column-width="90%"/>
2586
+ <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 10"> <!-- if dt contains short text like ABCDEFEF, etc -->
2587
+ <fo:table-column column-width="25%"/>
2588
+ <fo:table-column column-width="75%"/>
2504
2589
  </xsl:when>
2505
2590
  <!-- <xsl:when test="xalan:nodeset($colwidths)/column[1] div xalan:nodeset($colwidths)/column[2] &gt; 1.7">
2506
2591
  <fo:table-column column-width="60%"/>
@@ -2532,12 +2617,32 @@
2532
2617
  </xsl:otherwise>
2533
2618
  </xsl:choose>
2534
2619
  </xsl:template><xsl:template name="getMaxLength_dt">
2535
- <xsl:for-each select="*[local-name()='dt']">
2536
- <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2537
- <xsl:if test="position() = 1">
2538
- <xsl:value-of select="string-length(normalize-space(.))"/>
2539
- </xsl:if>
2540
- </xsl:for-each>
2620
+ <xsl:variable name="lengths">
2621
+ <xsl:for-each select="*[local-name()='dt']">
2622
+ <xsl:variable name="maintext_length" select="string-length(normalize-space(.))"/>
2623
+ <xsl:variable name="attributes">
2624
+ <xsl:for-each select=".//@open"><xsl:value-of select="."/></xsl:for-each>
2625
+ <xsl:for-each select=".//@close"><xsl:value-of select="."/></xsl:for-each>
2626
+ </xsl:variable>
2627
+ <length><xsl:value-of select="string-length(normalize-space(.)) + string-length($attributes)"/></length>
2628
+ </xsl:for-each>
2629
+ </xsl:variable>
2630
+ <xsl:variable name="maxLength">
2631
+ <!-- <xsl:for-each select="*[local-name()='dt']">
2632
+ <xsl:sort select="string-length(normalize-space(.))" data-type="number" order="descending"/>
2633
+ <xsl:if test="position() = 1">
2634
+ <xsl:value-of select="string-length(normalize-space(.))"/>
2635
+ </xsl:if>
2636
+ </xsl:for-each> -->
2637
+ <xsl:for-each select="xalan:nodeset($lengths)/length">
2638
+ <xsl:sort select="." data-type="number" order="descending"/>
2639
+ <xsl:if test="position() = 1">
2640
+ <xsl:value-of select="."/>
2641
+ </xsl:if>
2642
+ </xsl:for-each>
2643
+ </xsl:variable>
2644
+ <!-- <xsl:message>DEBUG:<xsl:value-of select="$maxLength"/></xsl:message> -->
2645
+ <xsl:value-of select="$maxLength"/>
2541
2646
  </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']" priority="2">
2542
2647
  <xsl:param name="key_iso"/>
2543
2648
 
@@ -2679,6 +2784,7 @@
2679
2784
 
2680
2785
 
2681
2786
 
2787
+
2682
2788
 
2683
2789
  </xsl:variable>
2684
2790
  <xsl:variable name="font-size" select="normalize-space($_font-size)"/>
@@ -2692,6 +2798,10 @@
2692
2798
  </xsl:if>
2693
2799
  <xsl:apply-templates/>
2694
2800
  </fo:inline>
2801
+ </xsl:template><xsl:template match="*[local-name()='underline']">
2802
+ <fo:inline text-decoration="underline">
2803
+ <xsl:apply-templates/>
2804
+ </fo:inline>
2695
2805
  </xsl:template><xsl:template match="*[local-name()='del']">
2696
2806
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
2697
2807
  <xsl:apply-templates/>
@@ -2785,6 +2895,10 @@
2785
2895
  <xsl:param name="text" select="."/>
2786
2896
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2787
2897
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
2898
+ </xsl:template><xsl:template name="add-zero-spaces-link-java">
2899
+ <xsl:param name="text" select="."/>
2900
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
2901
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
2788
2902
  </xsl:template><xsl:template name="add-zero-spaces">
2789
2903
  <xsl:param name="text" select="."/>
2790
2904
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
@@ -3045,6 +3159,11 @@
3045
3159
  <!-- replace start and end spaces to non-break space -->
3046
3160
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3047
3161
  </xsl:copy>
3162
+ </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3163
+ <xsl:copy>
3164
+ <xsl:apply-templates select="@*|node()" mode="mathml"/>
3165
+ </xsl:copy>
3166
+ <mathml:mspace width="0.5ex"/>
3048
3167
  </xsl:template><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3049
3168
  <xsl:variable name="target">
3050
3169
  <xsl:choose>
@@ -3066,7 +3185,10 @@
3066
3185
  <fo:basic-link external-destination="{@target}" fox:alt-text="{@target}">
3067
3186
  <xsl:choose>
3068
3187
  <xsl:when test="normalize-space(.) = ''">
3069
- <xsl:value-of select="$target"/>
3188
+ <!-- <xsl:value-of select="$target"/> -->
3189
+ <xsl:call-template name="add-zero-spaces-link-java">
3190
+ <xsl:with-param name="text" select="$target"/>
3191
+ </xsl:call-template>
3070
3192
  </xsl:when>
3071
3193
  <xsl:otherwise>
3072
3194
  <xsl:apply-templates/>
@@ -3272,7 +3394,7 @@
3272
3394
  </xsl:if> -->
3273
3395
  </fo:inline>
3274
3396
  </xsl:if>
3275
- </xsl:template><xsl:template match="*[local-name() = 'figure']">
3397
+ </xsl:template><xsl:template match="*[local-name() = 'figure']" name="figure">
3276
3398
  <fo:block-container id="{@id}">
3277
3399
 
3278
3400
  <fo:block>
@@ -3341,6 +3463,8 @@
3341
3463
  <xsl:variable name="bookmark-title_">
3342
3464
  <xsl:call-template name="getLangVersion">
3343
3465
  <xsl:with-param name="lang" select="@lang"/>
3466
+ <xsl:with-param name="doctype" select="@doctype"/>
3467
+ <xsl:with-param name="title" select="@title-part"/>
3344
3468
  </xsl:call-template>
3345
3469
  </xsl:variable>
3346
3470
  <xsl:choose>
@@ -3358,13 +3482,34 @@
3358
3482
  </xsl:choose>
3359
3483
  </fo:bookmark-title>
3360
3484
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3485
+
3486
+ <xsl:call-template name="insertFigureBookmarks">
3487
+ <xsl:with-param name="contents" select="contents"/>
3488
+ </xsl:call-template>
3489
+
3490
+ <xsl:call-template name="insertTableBookmarks">
3491
+ <xsl:with-param name="contents" select="contents"/>
3492
+ <xsl:with-param name="lang" select="@lang"/>
3493
+ </xsl:call-template>
3494
+
3361
3495
  </fo:bookmark>
3362
3496
 
3363
3497
  </xsl:for-each>
3364
3498
  </xsl:when>
3365
3499
  <xsl:otherwise>
3366
3500
  <xsl:for-each select="xalan:nodeset($contents)/doc">
3501
+
3367
3502
  <xsl:apply-templates select="contents/item" mode="bookmark"/>
3503
+
3504
+ <xsl:call-template name="insertFigureBookmarks">
3505
+ <xsl:with-param name="contents" select="contents"/>
3506
+ </xsl:call-template>
3507
+
3508
+ <xsl:call-template name="insertTableBookmarks">
3509
+ <xsl:with-param name="contents" select="contents"/>
3510
+ <xsl:with-param name="lang" select="@lang"/>
3511
+ </xsl:call-template>
3512
+
3368
3513
  </xsl:for-each>
3369
3514
  </xsl:otherwise>
3370
3515
  </xsl:choose>
@@ -3383,8 +3528,44 @@
3383
3528
 
3384
3529
  </fo:bookmark-tree>
3385
3530
  </xsl:if>
3531
+ </xsl:template><xsl:template name="insertFigureBookmarks">
3532
+ <xsl:param name="contents"/>
3533
+ <xsl:if test="xalan:nodeset($contents)/figure">
3534
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/figure[1]/@id}" starting-state="hide">
3535
+ <fo:bookmark-title>Figures</fo:bookmark-title>
3536
+ <xsl:for-each select="xalan:nodeset($contents)/figure">
3537
+ <fo:bookmark internal-destination="{@id}">
3538
+ <fo:bookmark-title>
3539
+ <xsl:value-of select="normalize-space(title)"/>
3540
+ </fo:bookmark-title>
3541
+ </fo:bookmark>
3542
+ </xsl:for-each>
3543
+ </fo:bookmark>
3544
+ </xsl:if>
3545
+ </xsl:template><xsl:template name="insertTableBookmarks">
3546
+ <xsl:param name="contents"/>
3547
+ <xsl:param name="lang"/>
3548
+ <xsl:if test="xalan:nodeset($contents)/table">
3549
+ <fo:bookmark internal-destination="{xalan:nodeset($contents)/table[1]/@id}" starting-state="hide">
3550
+ <fo:bookmark-title>
3551
+ <xsl:choose>
3552
+ <xsl:when test="$lang = 'fr'">Tableaux</xsl:when>
3553
+ <xsl:otherwise>Tables</xsl:otherwise>
3554
+ </xsl:choose>
3555
+ </fo:bookmark-title>
3556
+ <xsl:for-each select="xalan:nodeset($contents)/table">
3557
+ <fo:bookmark internal-destination="{@id}">
3558
+ <fo:bookmark-title>
3559
+ <xsl:value-of select="normalize-space(title)"/>
3560
+ </fo:bookmark-title>
3561
+ </fo:bookmark>
3562
+ </xsl:for-each>
3563
+ </fo:bookmark>
3564
+ </xsl:if>
3386
3565
  </xsl:template><xsl:template name="getLangVersion">
3387
3566
  <xsl:param name="lang"/>
3567
+ <xsl:param name="doctype" select="''"/>
3568
+ <xsl:param name="title" select="''"/>
3388
3569
  <xsl:choose>
3389
3570
  <xsl:when test="$lang = 'en'">
3390
3571
 
@@ -3420,6 +3601,12 @@
3420
3601
  <!-- <xsl:text> </xsl:text> -->
3421
3602
  </xsl:template><xsl:template name="getSection">
3422
3603
  <xsl:value-of select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
3604
+ <!--
3605
+ <xsl:for-each select="*[local-name() = 'title']/*[local-name() = 'tab'][1]/preceding-sibling::node()">
3606
+ <xsl:value-of select="."/>
3607
+ </xsl:for-each>
3608
+ -->
3609
+
3423
3610
  </xsl:template><xsl:template name="getName">
3424
3611
  <xsl:choose>
3425
3612
  <xsl:when test="*[local-name() = 'title']/*[local-name() = 'tab']">
@@ -3472,6 +3659,12 @@
3472
3659
  <xsl:copy>
3473
3660
  <xsl:apply-templates mode="contents_item"/>
3474
3661
  </xsl:copy>
3662
+ </xsl:template><xsl:template match="*[local-name() = 'em']" mode="contents_item">
3663
+ <xsl:copy>
3664
+ <xsl:apply-templates mode="contents_item"/>
3665
+ </xsl:copy>
3666
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents_item">
3667
+ <xsl:copy-of select="."/>
3475
3668
  </xsl:template><xsl:template match="*[local-name() = 'br']" mode="contents_item">
3476
3669
  <xsl:text> </xsl:text>
3477
3670
  </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
@@ -3497,6 +3690,7 @@
3497
3690
  10
3498
3691
 
3499
3692
 
3693
+
3500
3694
 
3501
3695
 
3502
3696
 
@@ -3877,10 +4071,13 @@
3877
4071
  </xsl:if>
3878
4072
  </xsl:if>
3879
4073
 
4074
+
3880
4075
  <fo:block-container margin-left="0mm">
3881
4076
 
3882
4077
  <fo:block xsl:use-attribute-sets="quote-style">
3883
- <xsl:apply-templates select=".//*[local-name() = 'p']"/>
4078
+ <!-- <xsl:apply-templates select=".//*[local-name() = 'p']"/> -->
4079
+
4080
+ <xsl:apply-templates select="./node()[not(local-name() = 'author') and not(local-name() = 'source')]"/> <!-- process all nested nodes, except author and source -->
3884
4081
  </fo:block>
3885
4082
  <xsl:if test="*[local-name() = 'author'] or *[local-name() = 'source']">
3886
4083
  <fo:block xsl:use-attribute-sets="quote-source-style">
@@ -4035,6 +4232,7 @@
4035
4232
 
4036
4233
 
4037
4234
 
4235
+
4038
4236
 
4039
4237
 
4040
4238
 
@@ -4046,7 +4244,7 @@
4046
4244
 
4047
4245
 
4048
4246
 
4049
- </xsl:template><xsl:template match="/*/*[local-name() = 'preface']/*" priority="2">
4247
+ </xsl:template><xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
4050
4248
  <fo:block break-after="page"/>
4051
4249
  <fo:block>
4052
4250
  <xsl:call-template name="setId"/>
@@ -4054,7 +4252,8 @@
4054
4252
  </fo:block>
4055
4253
  </xsl:template><xsl:template match="*[local-name() = 'clause']">
4056
4254
  <fo:block>
4057
- <xsl:call-template name="setId"/>
4255
+ <xsl:call-template name="setId"/>
4256
+
4058
4257
 
4059
4258
  <xsl:apply-templates/>
4060
4259
  </fo:block>
@@ -4119,7 +4318,8 @@
4119
4318
  <fo:table-column column-width="107mm"/>
4120
4319
  <fo:table-column column-width="15mm"/>
4121
4320
  <fo:table-body>
4122
- <fo:table-row font-family="Arial" text-align="center" font-weight="bold" background-color="black" color="white">
4321
+ <fo:table-row text-align="center" font-weight="bold" background-color="black" color="white">
4322
+
4123
4323
  <fo:table-cell border="1pt solid black"><fo:block>Date</fo:block></fo:table-cell>
4124
4324
  <fo:table-cell border="1pt solid black"><fo:block>Type</fo:block></fo:table-cell>
4125
4325
  <fo:table-cell border="1pt solid black"><fo:block>Change</fo:block></fo:table-cell>
@@ -4137,6 +4337,10 @@
4137
4337
  <fo:block><xsl:apply-templates/></fo:block>
4138
4338
  </fo:table-cell>
4139
4339
  </xsl:template><xsl:template name="processBibitem">
4340
+
4341
+
4342
+ <!-- end BIPM bibitem processing-->
4343
+
4140
4344
 
4141
4345
 
4142
4346
 
@@ -4294,6 +4498,8 @@
4294
4498
  <xsl:value-of select="translate(.,'. ','')"/>
4295
4499
  </xsl:template><xsl:template match="*[local-name() = 'name']/*[local-name() = 'forename']/text()" mode="strip">
4296
4500
  <xsl:value-of select="substring(.,1,1)"/>
4501
+ </xsl:template><xsl:template match="*[local-name() = 'title']" mode="title">
4502
+ <fo:inline><xsl:apply-templates/></fo:inline>
4297
4503
  </xsl:template><xsl:template name="convertDate">
4298
4504
  <xsl:param name="date"/>
4299
4505
  <xsl:param name="format" select="'short'"/>
@@ -4318,6 +4524,57 @@
4318
4524
  </xsl:variable>
4319
4525
  <xsl:variable name="result">
4320
4526
  <xsl:choose>
4527
+ <xsl:when test="$format = 'ddMMyyyy'">
4528
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4529
+ <xsl:text> </xsl:text>
4530
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4531
+ </xsl:when>
4532
+ <xsl:when test="$format = 'ddMM'">
4533
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4534
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4535
+ </xsl:when>
4536
+ <xsl:when test="$format = 'short' or $day = ''">
4537
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4538
+ </xsl:when>
4539
+ <xsl:otherwise>
4540
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
4541
+ </xsl:otherwise>
4542
+ </xsl:choose>
4543
+ </xsl:variable>
4544
+ <xsl:value-of select="$result"/>
4545
+ </xsl:template><xsl:template name="convertDateLocalized">
4546
+ <xsl:param name="date"/>
4547
+ <xsl:param name="format" select="'short'"/>
4548
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
4549
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
4550
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
4551
+ <xsl:variable name="monthStr">
4552
+ <xsl:choose>
4553
+ <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>
4554
+ <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>
4555
+ <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>
4556
+ <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>
4557
+ <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>
4558
+ <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>
4559
+ <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>
4560
+ <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>
4561
+ <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>
4562
+ <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>
4563
+ <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>
4564
+ <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>
4565
+ </xsl:choose>
4566
+ </xsl:variable>
4567
+ <xsl:variable name="result">
4568
+ <xsl:choose>
4569
+ <xsl:when test="$format = 'ddMMyyyy'">
4570
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4571
+ <xsl:text> </xsl:text>
4572
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ' , $year))"/>
4573
+ </xsl:when>
4574
+ <xsl:when test="$format = 'ddMM'">
4575
+ <xsl:if test="$day != ''"><xsl:value-of select="number($day)"/></xsl:if>
4576
+ <xsl:text> </xsl:text><xsl:value-of select="$monthStr"/>
4577
+ </xsl:when>
4321
4578
  <xsl:when test="$format = 'short' or $day = ''">
4322
4579
  <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
4323
4580
  </xsl:when>
@@ -4333,7 +4590,7 @@
4333
4590
  <xsl:param name="charDelim" select="', '"/>
4334
4591
  <xsl:choose>
4335
4592
  <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
4336
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4593
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4337
4594
  <xsl:sort data-type="text" order="ascending"/>
4338
4595
  <xsl:call-template name="insertKeyword">
4339
4596
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
@@ -4342,7 +4599,7 @@
4342
4599
  </xsl:for-each>
4343
4600
  </xsl:when>
4344
4601
  <xsl:otherwise>
4345
- <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4602
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
4346
4603
  <xsl:call-template name="insertKeyword">
4347
4604
  <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
4348
4605
  <xsl:with-param name="charDelim" select="$charDelim"/>
@@ -4359,6 +4616,9 @@
4359
4616
  <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
4360
4617
  </xsl:choose>
4361
4618
  </xsl:template><xsl:template name="addPDFUAmeta">
4619
+ <xsl:variable name="lang">
4620
+ <xsl:call-template name="getLang"/>
4621
+ </xsl:variable>
4362
4622
  <fo:declarations>
4363
4623
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
4364
4624
  <pdf:dictionary type="normal" key="ViewerPreferences">
@@ -4371,13 +4631,16 @@
4371
4631
  <!-- Dublin Core properties go here -->
4372
4632
  <dc:title>
4373
4633
  <xsl:variable name="title">
4374
-
4375
-
4376
-
4377
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'title'][@language = 'en']"/>
4378
-
4379
-
4380
-
4634
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4635
+
4636
+
4637
+
4638
+
4639
+ <xsl:value-of select="*[local-name() = 'title'][@language = $lang]"/>
4640
+
4641
+
4642
+
4643
+ </xsl:for-each>
4381
4644
  </xsl:variable>
4382
4645
  <xsl:choose>
4383
4646
  <xsl:when test="normalize-space($title) != ''">
@@ -4389,19 +4652,21 @@
4389
4652
  </xsl:choose>
4390
4653
  </dc:title>
4391
4654
  <dc:creator>
4392
-
4393
- <xsl:value-of select="/*/*[local-name() = 'bibdata']/*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']/*[local-name() = 'organization']/*[local-name() = 'name']"/>
4394
-
4395
-
4396
-
4397
- </dc:creator>
4398
- <dc:description>
4399
- <xsl:variable name="abstract">
4655
+ <xsl:for-each select="(//*[contains(local-name(), '-standard')])[1]/*[local-name() = 'bibdata']">
4656
+
4657
+ <xsl:for-each select="*[local-name() = 'contributor'][*[local-name() = 'role']/@type='author']">
4658
+ <xsl:value-of select="*[local-name() = 'organization']/*[local-name() = 'name']"/>
4659
+ <xsl:if test="position() != last()">; </xsl:if>
4660
+ </xsl:for-each>
4400
4661
 
4401
- <xsl:copy-of select="/*/*[local-name() = 'bibliography']/*[local-name() = 'references']/*[local-name() = 'bibitem']/*[local-name() = 'abstract']//text()"/>
4402
4662
 
4403
4663
 
4664
+ </xsl:for-each>
4665
+ </dc:creator>
4666
+ <dc:description>
4667
+ <xsl:variable name="abstract">
4404
4668
 
4669
+ <xsl:copy-of select="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*[local-name() = 'abstract']//text()"/>
4405
4670
 
4406
4671
 
4407
4672
  </xsl:variable>
@@ -4514,6 +4779,7 @@
4514
4779
 
4515
4780
 
4516
4781
 
4782
+
4517
4783
  </xsl:variable>
4518
4784
  <xsl:if test="$documentNS != $XSLNS">
4519
4785
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4573,6 +4839,11 @@
4573
4839
  <xsl:call-template name="getLang"/>
4574
4840
  </xsl:variable>
4575
4841
 
4576
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4842
+ <xsl:choose>
4843
+ <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
4844
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
4845
+ </xsl:when>
4846
+ <xsl:otherwise><xsl:value-of select="$key"/></xsl:otherwise>
4847
+ </xsl:choose>
4577
4848
 
4578
4849
  </xsl:template></xsl:stylesheet>