metanorma-un 0.6.9 → 0.6.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -160,7 +160,7 @@
160
160
  <fo:block>
161
161
  <xsl:value-of select="translate(/un:un-standard/un:sections/un:clause[1]/un:ol[1]/un:li[1]/un:p[1], '.', '')"/>
162
162
  </fo:block>
163
- <fo:block><xsl:value-of select="$title"/></fo:block>
163
+ <fo:block role="H1"><xsl:value-of select="$title"/></fo:block>
164
164
  </fo:block>
165
165
  </fo:block-container>
166
166
 
@@ -485,7 +485,10 @@
485
485
  </xsl:template>
486
486
 
487
487
  <xsl:template match="un:title" mode="inline-header">
488
- <fo:inline>
488
+ <xsl:variable name="level">
489
+ <xsl:call-template name="getLevel"/>
490
+ </xsl:variable>
491
+ <fo:inline role="H{$level}">
489
492
  <xsl:apply-templates/>
490
493
  </fo:inline>
491
494
  </xsl:template>
@@ -715,8 +718,9 @@
715
718
  <xsl:otherwise>11pt</xsl:otherwise>
716
719
  </xsl:choose>
717
720
  </xsl:variable>
718
- <fo:block font-size="{$font-size}" font-weight="bold" margin-top="3pt" margin-bottom="16pt" keep-with-next="always">
721
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-top="3pt" margin-bottom="16pt" keep-with-next="always" role="H{$level}">
719
722
  <xsl:apply-templates/>
723
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
720
724
  </fo:block>
721
725
  </xsl:template>
722
726
 
@@ -734,15 +738,17 @@
734
738
  </xsl:variable>
735
739
  <xsl:choose>
736
740
  <xsl:when test="$level = 1">
737
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" keep-with-next="always">
741
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" keep-with-next="always" role="H{$level}">
738
742
  <fo:block margin-bottom="12pt">
739
743
  <xsl:apply-templates/>
744
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
740
745
  </fo:block>
741
746
  </fo:block>
742
747
  </xsl:when>
743
748
  <xsl:otherwise>
744
- <fo:block font-size="{$font-size}" font-weight="bold" margin-left="1mm" space-before="3pt" margin-bottom="6pt" keep-with-next="always">
749
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-left="1mm" space-before="3pt" margin-bottom="6pt" keep-with-next="always" role="H{$level}">
745
750
  <xsl:apply-templates/>
751
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
746
752
  </fo:block>
747
753
  </xsl:otherwise>
748
754
  </xsl:choose>
@@ -769,7 +775,7 @@
769
775
  <xsl:choose>
770
776
  <xsl:when test="ancestor::un:sections and $level = 1">
771
777
  <fo:block-container margin-left="-16mm">
772
- <fo:block font-size="{$font-size}" font-weight="bold" margin-left="16mm" space-before="16pt" margin-bottom="13pt" keep-with-next="always">
778
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-left="16mm" space-before="16pt" margin-bottom="13pt" keep-with-next="always" role="H{$level}">
773
779
  <fo:table table-layout="fixed" width="100%">
774
780
  <fo:table-column column-width="16mm"/>
775
781
  <fo:table-column column-width="130mm"/>
@@ -788,6 +794,7 @@
788
794
  <fo:table-cell>
789
795
  <fo:block>
790
796
  <xsl:call-template name="extractTitle"/>
797
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
791
798
  </fo:block>
792
799
  </fo:table-cell>
793
800
  </fo:table-row>
@@ -797,7 +804,7 @@
797
804
  </fo:block-container>
798
805
  </xsl:when>
799
806
  <xsl:when test="ancestor::un:sections">
800
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="16pt" margin-bottom="13pt" text-indent="-8mm" keep-with-next="always">
807
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="16pt" margin-bottom="13pt" text-indent="-8mm" keep-with-next="always" role="H{$level}">
801
808
  <xsl:if test="$level = 2">
802
809
  <xsl:attribute name="margin-left">1mm</xsl:attribute>
803
810
  <xsl:attribute name="space-before">12pt</xsl:attribute>
@@ -814,8 +821,9 @@
814
821
  </fo:block>
815
822
  </xsl:when>
816
823
  <xsl:otherwise>
817
- <fo:block font-size="{$font-size}" font-weight="bold" text-align="left" keep-with-next="always">
824
+ <fo:block font-size="{$font-size}" font-weight="bold" text-align="left" keep-with-next="always" role="H{$level}">
818
825
  <xsl:apply-templates/>
826
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
819
827
  </fo:block>
820
828
  </xsl:otherwise>
821
829
  </xsl:choose>
@@ -1046,26 +1054,26 @@
1046
1054
  <!-- ============================ -->
1047
1055
 
1048
1056
  <xsl:template name="insertHeaderFooter">
1049
- <fo:static-content flow-name="header-odd">
1057
+ <fo:static-content flow-name="header-odd" role="artifact">
1050
1058
  <fo:block-container height="25mm" display-align="after" border-bottom="0.5pt solid black" margin-left="-20.5mm" margin-right="-20.5mm">
1051
1059
  <fo:block font-size="9pt" font-weight="bold" text-align="right" margin-left="21mm" margin-right="21mm" padding-bottom="0.5mm">
1052
1060
  <xsl:value-of select="$id"/>
1053
1061
  </fo:block>
1054
1062
  </fo:block-container>
1055
1063
  </fo:static-content>
1056
- <fo:static-content flow-name="footer-odd">
1064
+ <fo:static-content flow-name="footer-odd" role="artifact">
1057
1065
  <fo:block-container height="40mm" margin-left="-20.5mm" margin-right="-20.5mm">
1058
1066
  <fo:block font-size="9pt" font-weight="bold" text-align="right" margin-left="21mm" margin-right="21mm" padding-top="12mm"><fo:page-number/></fo:block>
1059
1067
  </fo:block-container>
1060
1068
  </fo:static-content>
1061
- <fo:static-content flow-name="header-even">
1069
+ <fo:static-content flow-name="header-even" role="artifact">
1062
1070
  <fo:block-container height="25mm" display-align="after" border-bottom="0.5pt solid black" margin-left="-20.5mm" margin-right="-20.5mm">
1063
1071
  <fo:block font-size="9pt" font-weight="bold" margin-left="21mm" margin-right="21mm" padding-bottom="0.5mm">
1064
1072
  <xsl:value-of select="$id"/>
1065
1073
  </fo:block>
1066
1074
  </fo:block-container>
1067
1075
  </fo:static-content>
1068
- <fo:static-content flow-name="footer-even">
1076
+ <fo:static-content flow-name="footer-even" role="artifact">
1069
1077
  <fo:block-container height="40mm" margin-left="-20.5mm" margin-right="-20.5mm">
1070
1078
  <fo:block font-size="9pt" font-weight="bold" margin-left="21mm" margin-right="21mm" padding-top="12mm"><fo:page-number/></fo:block>
1071
1079
  </fo:block-container>
@@ -1271,6 +1279,7 @@
1271
1279
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1272
1280
  <xsl:attribute name="white-space">pre</xsl:attribute>
1273
1281
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1282
+ <xsl:attribute name="role">Code</xsl:attribute>
1274
1283
 
1275
1284
 
1276
1285
 
@@ -1296,8 +1305,13 @@
1296
1305
 
1297
1306
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
1298
1307
 
1299
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1300
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1308
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1309
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1310
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1311
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1312
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1313
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1314
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1301
1315
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1302
1316
 
1303
1317
 
@@ -1465,6 +1479,11 @@
1465
1479
  <xsl:attribute name="padding-right">4mm</xsl:attribute>
1466
1480
 
1467
1481
 
1482
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
1483
+
1484
+
1485
+
1486
+
1468
1487
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1469
1488
 
1470
1489
 
@@ -1497,7 +1516,8 @@
1497
1516
 
1498
1517
 
1499
1518
 
1500
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1519
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1520
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1501
1521
 
1502
1522
 
1503
1523
 
@@ -1621,13 +1641,20 @@
1621
1641
 
1622
1642
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1623
1643
 
1624
- </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
1644
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
1645
+ <xsl:attribute name="line-height">135%</xsl:attribute>
1646
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
1625
1647
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1626
1648
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1627
1649
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1628
1650
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
1629
1651
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1630
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1652
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
1653
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1654
+ <xsl:sort select="@displayorder" data-type="number"/>
1655
+ <xsl:apply-templates select="." mode="contents"/>
1656
+ </xsl:for-each>
1657
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
1631
1658
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1632
1659
 
1633
1660
  <!-- Normative references -->
@@ -1640,13 +1667,33 @@
1640
1667
  <!-- Bibliography -->
1641
1668
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
1642
1669
 
1643
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1670
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1671
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1672
+ <xsl:sort select="@displayorder" data-type="number"/>
1673
+ <xsl:apply-templates select="." mode="contents"/>
1674
+ </xsl:for-each>
1675
+
1676
+ <xsl:for-each select="/*/*[local-name()='annex']">
1677
+ <xsl:sort select="@displayorder" data-type="number"/>
1678
+ <xsl:apply-templates select="." mode="contents"/>
1679
+ </xsl:for-each>
1680
+
1681
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1682
+ <xsl:sort select="@displayorder" data-type="number"/>
1683
+ <xsl:apply-templates select="." mode="contents"/>
1684
+ </xsl:for-each>
1685
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
1644
1686
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1645
1687
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1646
1688
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1647
1689
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1648
1690
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1649
- </xsl:template><xsl:template name="processMainSectionsDefault">
1691
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1692
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1693
+ <xsl:sort select="@displayorder" data-type="number"/>
1694
+ <xsl:apply-templates select="."/>
1695
+ </xsl:for-each>
1696
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
1650
1697
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1651
1698
 
1652
1699
  <!-- Normative references -->
@@ -1658,6 +1705,22 @@
1658
1705
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1659
1706
  <!-- Bibliography -->
1660
1707
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1708
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1709
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1710
+ <xsl:sort select="@displayorder" data-type="number"/>
1711
+ <xsl:apply-templates select="."/>
1712
+
1713
+ </xsl:for-each>
1714
+
1715
+ <xsl:for-each select="/*/*[local-name()='annex']">
1716
+ <xsl:sort select="@displayorder" data-type="number"/>
1717
+ <xsl:apply-templates select="."/>
1718
+ </xsl:for-each>
1719
+
1720
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1721
+ <xsl:sort select="@displayorder" data-type="number"/>
1722
+ <xsl:apply-templates select="."/>
1723
+ </xsl:for-each>
1661
1724
  </xsl:template><xsl:template match="text()">
1662
1725
  <xsl:value-of select="."/>
1663
1726
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -1688,7 +1751,9 @@
1688
1751
 
1689
1752
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1690
1753
 
1691
-
1754
+
1755
+
1756
+
1692
1757
 
1693
1758
  <xsl:call-template name="fn_name_display"/>
1694
1759
 
@@ -2519,9 +2584,7 @@
2519
2584
 
2520
2585
  <!-- Table's note name (NOTE, for example) -->
2521
2586
 
2522
- <fo:inline padding-right="2mm">
2523
-
2524
-
2587
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
2525
2588
 
2526
2589
 
2527
2590
 
@@ -2536,6 +2599,7 @@
2536
2599
  </xsl:if>
2537
2600
 
2538
2601
 
2602
+
2539
2603
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
2540
2604
 
2541
2605
  </fo:inline>
@@ -3141,6 +3205,8 @@
3141
3205
  <xsl:if test="$font-size != ''">
3142
3206
  <xsl:attribute name="font-size">
3143
3207
  <xsl:choose>
3208
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3209
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3144
3210
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3145
3211
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3146
3212
  </xsl:choose>
@@ -3575,16 +3641,68 @@
3575
3641
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3576
3642
  </xsl:call-template>
3577
3643
 
3644
+
3645
+
3578
3646
  <xsl:variable name="mathml">
3579
3647
  <xsl:apply-templates select="." mode="mathml"/>
3580
3648
  </xsl:variable>
3581
3649
  <fo:instream-foreign-object fox:alt-text="Math">
3582
3650
 
3583
3651
 
3652
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3653
+ <xsl:variable name="comment_text_">
3654
+ <xsl:choose>
3655
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3656
+ <xsl:value-of select="$comment_text_following"/>
3657
+ </xsl:when>
3658
+ <xsl:otherwise>
3659
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3660
+ </xsl:otherwise>
3661
+ </xsl:choose>
3662
+ </xsl:variable>
3663
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3664
+
3665
+ <xsl:if test="normalize-space($comment_text) != ''">
3666
+ <!-- put Mathin Alternate Text -->
3667
+ <xsl:attribute name="fox:alt-text">
3668
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3669
+ </xsl:attribute>
3670
+ </xsl:if>
3671
+
3672
+ <xsl:variable name="mathml_content">
3673
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3674
+ </xsl:variable>
3675
+ <!-- put MathML in Actual Text -->
3676
+ <xsl:attribute name="fox:actual-text">
3677
+ <xsl:value-of select="$mathml_content"/>
3678
+ </xsl:attribute>
3679
+
3680
+
3584
3681
  <!-- <xsl:copy-of select="."/> -->
3585
3682
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3586
3683
  </fo:instream-foreign-object>
3587
3684
  </fo:inline>
3685
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3686
+ <!-- <xsl:text>a+b</xsl:text> -->
3687
+ <xsl:text>&lt;</xsl:text>
3688
+ <xsl:value-of select="local-name()"/>
3689
+ <xsl:if test="local-name() = 'math'">
3690
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3691
+ </xsl:if>
3692
+ <xsl:for-each select="@*">
3693
+ <xsl:text> </xsl:text>
3694
+ <xsl:value-of select="local-name()"/>
3695
+ <xsl:text>="</xsl:text>
3696
+ <xsl:value-of select="."/>
3697
+ <xsl:text>"</xsl:text>
3698
+ </xsl:for-each>
3699
+ <xsl:text>&gt;</xsl:text>
3700
+ <xsl:apply-templates mode="mathml_actual_text"/>
3701
+ <xsl:text>&lt;/</xsl:text>
3702
+ <xsl:value-of select="local-name()"/>
3703
+ <xsl:text>&gt;</xsl:text>
3704
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3705
+ <xsl:value-of select="normalize-space()"/>
3588
3706
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3589
3707
  <xsl:copy>
3590
3708
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3646,7 +3764,10 @@
3646
3764
  </fo:block>
3647
3765
  <xsl:apply-templates/>
3648
3766
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3649
- <fo:inline><xsl:apply-templates/></fo:inline>
3767
+ <xsl:variable name="level">
3768
+ <xsl:call-template name="getLevel"/>
3769
+ </xsl:variable>
3770
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3650
3771
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3651
3772
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3652
3773
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3681,9 +3802,10 @@
3681
3802
 
3682
3803
  </xsl:variable>
3683
3804
 
3805
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3684
3806
  <xsl:choose>
3685
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3686
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3807
+ <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text>—</xsl:text></xsl:if></xsl:when>
3808
+ <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:if test="normalize-space($text) != ''"><xsl:text> — </xsl:text></xsl:if></xsl:otherwise>
3687
3809
  </xsl:choose>
3688
3810
  <xsl:apply-templates/>
3689
3811
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3840,7 +3962,10 @@
3840
3962
  </fo:block>
3841
3963
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3842
3964
  <xsl:if test="normalize-space() != ''">
3843
- <fo:inline>
3965
+ <xsl:variable name="level">
3966
+ <xsl:call-template name="getLevelTermName"/>
3967
+ </xsl:variable>
3968
+ <fo:inline role="H{$level}">
3844
3969
  <xsl:apply-templates/>
3845
3970
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3846
3971
  <xsl:text>.</xsl:text>
@@ -4141,6 +4266,13 @@
4141
4266
  </xsl:attribute>
4142
4267
  <xsl:apply-templates mode="svg_update"/>
4143
4268
  </xsl:copy>
4269
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
4270
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4271
+ <xsl:for-each select="*[local-name() = 'svg']">
4272
+ <xsl:call-template name="image_svg">
4273
+ <xsl:with-param name="name" select="$name"/>
4274
+ </xsl:call-template>
4275
+ </xsl:for-each>
4144
4276
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4145
4277
  <xsl:variable name="svg_content" select="document(@src)"/>
4146
4278
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4245,7 +4377,7 @@
4245
4377
  </fo:basic-link>
4246
4378
  </fo:block>
4247
4379
  </fo:block-container>
4248
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
4380
+ </xsl:template><xsl:template match="*[local-name() = 'emf']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="contents">
4249
4381
  <xsl:apply-templates mode="contents"/>
4250
4382
  <xsl:text> </xsl:text>
4251
4383
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'table']/*[local-name() = 'name'] | *[local-name() = 'permission']/*[local-name() = 'name'] | *[local-name() = 'recommendation']/*[local-name() = 'name'] | *[local-name() = 'requirement']/*[local-name() = 'name']" mode="bookmarks">
@@ -4471,6 +4603,7 @@
4471
4603
  </xsl:when>
4472
4604
  <xsl:otherwise>
4473
4605
  <xsl:apply-templates/>
4606
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4474
4607
  </xsl:otherwise>
4475
4608
  </xsl:choose>
4476
4609
  </fo:block>
@@ -4543,12 +4676,16 @@
4543
4676
  <xsl:if test="$font-size != ''">
4544
4677
  <xsl:attribute name="font-size">
4545
4678
  <xsl:choose>
4679
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4680
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4546
4681
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4547
4682
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4548
4683
  </xsl:choose>
4549
4684
  </xsl:attribute>
4550
4685
  </xsl:if>
4551
4686
 
4687
+
4688
+
4552
4689
  <xsl:apply-templates/>
4553
4690
  </fo:block>
4554
4691
 
@@ -4611,14 +4748,6 @@
4611
4748
  <fo:block>
4612
4749
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4613
4750
  </fo:block>
4614
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4615
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4616
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4617
- </fo:block>
4618
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4619
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4620
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4621
- </fo:block>
4622
4751
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4623
4752
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4624
4753
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4635,6 +4764,38 @@
4635
4764
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4636
4765
  <xsl:apply-templates/>
4637
4766
  </fo:block>
4767
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4768
+ <fo:block xsl:use-attribute-sets="subject-style">
4769
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4770
+ </fo:block>
4771
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4772
+ <fo:block xsl:use-attribute-sets="subject-style">
4773
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4774
+ </fo:block>
4775
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4776
+ <fo:block xsl:use-attribute-sets="inherit-style">
4777
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4778
+ </fo:block>
4779
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4780
+ <fo:block xsl:use-attribute-sets="description-style">
4781
+ <xsl:apply-templates/>
4782
+ </fo:block>
4783
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4784
+ <fo:block xsl:use-attribute-sets="specification-style">
4785
+ <xsl:apply-templates/>
4786
+ </fo:block>
4787
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4788
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4789
+ <xsl:apply-templates/>
4790
+ </fo:block>
4791
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4792
+ <fo:block xsl:use-attribute-sets="verification-style">
4793
+ <xsl:apply-templates/>
4794
+ </fo:block>
4795
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4796
+ <fo:block xsl:use-attribute-sets="import-style">
4797
+ <xsl:apply-templates/>
4798
+ </fo:block>
4638
4799
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4639
4800
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4640
4801
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4905,8 +5066,8 @@
4905
5066
  </xsl:if>
4906
5067
  </xsl:template><xsl:variable name="localized.source">
4907
5068
  <xsl:call-template name="getLocalizedString">
4908
- <xsl:with-param name="key">source</xsl:with-param>
4909
- </xsl:call-template>
5069
+ <xsl:with-param name="key">source</xsl:with-param>
5070
+ </xsl:call-template>
4910
5071
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4911
5072
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4912
5073
  <xsl:if test="normalize-space(@citeas) = ''">
@@ -4916,6 +5077,7 @@
4916
5077
  <fo:inline xsl:use-attribute-sets="origin-style">
4917
5078
  <xsl:apply-templates/>
4918
5079
  </fo:inline>
5080
+
4919
5081
  </fo:basic-link>
4920
5082
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4921
5083
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -4982,6 +5144,9 @@
4982
5144
 
4983
5145
  </xsl:if>
4984
5146
 
5147
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
5148
+ <xsl:variable name="text" select="normalize-space()"/>
5149
+
4985
5150
 
4986
5151
 
4987
5152
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -4996,7 +5161,9 @@
4996
5161
  <xsl:attribute name="text-decoration">underline</xsl:attribute>
4997
5162
 
4998
5163
  </xsl:if>
4999
-
5164
+
5165
+
5166
+
5000
5167
  <xsl:apply-templates/>
5001
5168
  </fo:basic-link>
5002
5169
 
@@ -5339,6 +5506,7 @@
5339
5506
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5340
5507
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5341
5508
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5509
+
5342
5510
  <xsl:apply-templates/>
5343
5511
  </fo:block>
5344
5512
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -5507,6 +5675,97 @@
5507
5675
  <fo:block-container border="1pt solid black" width="50%">
5508
5676
  <fo:block> </fo:block>
5509
5677
  </fo:block-container>
5678
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
5679
+ <xsl:param name="colwidths"/>
5680
+ <xsl:variable name="colwidths_">
5681
+ <xsl:choose>
5682
+ <xsl:when test="not($colwidths)">
5683
+ <xsl:variable name="toc_table_simple">
5684
+ <tbody>
5685
+ <xsl:apply-templates mode="toc_table_width"/>
5686
+ </tbody>
5687
+ </xsl:variable>
5688
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
5689
+ <xsl:call-template name="calculate-column-widths">
5690
+ <xsl:with-param name="cols-count" select="$cols-count"/>
5691
+ <xsl:with-param name="table" select="$toc_table_simple"/>
5692
+ </xsl:call-template>
5693
+ </xsl:when>
5694
+ <xsl:otherwise>
5695
+ <xsl:copy-of select="$colwidths"/>
5696
+ </xsl:otherwise>
5697
+ </xsl:choose>
5698
+ </xsl:variable>
5699
+ <fo:block role="TOCI" space-after="16pt">
5700
+ <fo:table width="100%" table-layout="fixed">
5701
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
5702
+ <fo:table-column column-width="proportional-column-width({.})"/>
5703
+ </xsl:for-each>
5704
+ <fo:table-body>
5705
+ <xsl:apply-templates/>
5706
+ </fo:table-body>
5707
+ </fo:table>
5708
+ </fo:block>
5709
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
5710
+ <fo:table-row min-height="5mm">
5711
+ <xsl:apply-templates/>
5712
+ </fo:table-row>
5713
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
5714
+ <xsl:apply-templates/>
5715
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
5716
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5717
+ <xsl:variable name="target" select="@target"/>
5718
+ <xsl:for-each select="*[local-name() = 'tab']">
5719
+ <xsl:variable name="current_id" select="generate-id()"/>
5720
+ <fo:table-cell>
5721
+ <fo:block>
5722
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5723
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5724
+ <xsl:choose>
5725
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5726
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
5727
+ </xsl:choose>
5728
+ </xsl:for-each>
5729
+ </fo:basic-link>
5730
+ </fo:block>
5731
+ </fo:table-cell>
5732
+ </xsl:for-each>
5733
+ <!-- last column - for page numbers -->
5734
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
5735
+ <fo:block>
5736
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5737
+ <fo:page-number-citation ref-id="{$target}"/>
5738
+ </fo:basic-link>
5739
+ </fo:block>
5740
+ </fo:table-cell>
5741
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
5742
+ <xsl:apply-templates mode="toc_table_width"/>
5743
+ </xsl:template><xsl:template match="*[local-name() = 'clause'][@type = 'toc']/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'clause'][not(@type = 'toc')]/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'li']" mode="toc_table_width">
5744
+ <tr>
5745
+ <xsl:apply-templates mode="toc_table_width"/>
5746
+ </tr>
5747
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
5748
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5749
+ <xsl:for-each select="*[local-name() = 'tab']">
5750
+ <xsl:variable name="current_id" select="generate-id()"/>
5751
+ <td>
5752
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5753
+ <xsl:copy-of select="."/>
5754
+ </xsl:for-each>
5755
+ </td>
5756
+ </xsl:for-each>
5757
+ <td>333</td> <!-- page number, just for fill -->
5758
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5759
+ <fo:inline padding-right="5mm"> </fo:inline>
5760
+ <fo:inline><xsl:apply-templates/></fo:inline>
5761
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
5762
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
5763
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
5764
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
5765
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
5766
+ </svg>
5767
+ </fo:instream-foreign-object>
5768
+ </fo:inline>
5510
5769
  </xsl:template><xsl:template name="convertDate">
5511
5770
  <xsl:param name="date"/>
5512
5771
  <xsl:param name="format" select="'short'"/>
@@ -5745,6 +6004,26 @@
5745
6004
  <xsl:value-of select="$level"/>
5746
6005
  </xsl:otherwise>
5747
6006
  </xsl:choose>
6007
+ </xsl:template><xsl:template name="getLevelTermName">
6008
+ <xsl:choose>
6009
+ <xsl:when test="normalize-space(../@depth) != ''">
6010
+ <xsl:value-of select="../@depth"/>
6011
+ </xsl:when>
6012
+ <xsl:otherwise>
6013
+ <xsl:variable name="title_level_">
6014
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
6015
+ <xsl:call-template name="getLevel"/>
6016
+ </xsl:for-each>
6017
+ </xsl:variable>
6018
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
6019
+ <xsl:choose>
6020
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
6021
+ <xsl:otherwise>
6022
+ <xsl:call-template name="getLevel"/>
6023
+ </xsl:otherwise>
6024
+ </xsl:choose>
6025
+ </xsl:otherwise>
6026
+ </xsl:choose>
5748
6027
  </xsl:template><xsl:template name="split">
5749
6028
  <xsl:param name="pText" select="."/>
5750
6029
  <xsl:param name="sep" select="','"/>