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.
@@ -127,7 +127,7 @@
127
127
  </fo:block>
128
128
  </fo:block>
129
129
  <fo:block-container absolute-position="fixed" left="50mm" top="30mm" width="139mm" height="40mm" text-align="right" display-align="after">
130
- <fo:block font-family="Arial" font-size="24.5pt" font-weight="bold" margin-right="3mm"> <!-- margin-top="19mm" -->
130
+ <fo:block font-family="Arial" font-size="24.5pt" font-weight="bold" margin-right="3mm" role="H1"> <!-- margin-top="19mm" -->
131
131
  <xsl:if test="string-length($title) &gt; 70">
132
132
  <xsl:attribute name="font-size">22pt</xsl:attribute>
133
133
  </xsl:if>
@@ -142,7 +142,7 @@
142
142
  <fo:flow flow-name="xsl-region-body" font-family="Arial">
143
143
  <fo:block font-size="14pt" font-weight="bold" text-align="center">United Nations Economic Commission for Europe</fo:block>
144
144
  <fo:block font-size="12pt" font-weight="normal" text-align="center" margin-top="46pt" margin-bottom="128pt" keep-together="always">United Nations Centre for Trade Facilitation and Electronic Business</fo:block>
145
- <fo:block font-size="22pt" font-weight="bold" text-align="center">
145
+ <fo:block font-size="22pt" font-weight="bold" text-align="center" role="H1">
146
146
  <xsl:value-of select="$title"/>
147
147
  <xsl:value-of select="$linebreak"/>
148
148
  <xsl:value-of select="$doctypenumber"/>
@@ -200,17 +200,17 @@
200
200
  <xsl:with-param name="name" select="'title-toc'"/>
201
201
  </xsl:call-template>
202
202
  </xsl:variable>
203
- <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt"><xsl:value-of select="$title-toc"/></fo:block>
203
+ <fo:block font-size="14pt" margin-top="4pt" margin-bottom="8pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block>
204
204
  <xsl:variable name="title-page">
205
205
  <xsl:call-template name="getTitle">
206
206
  <xsl:with-param name="name" select="'title-page'"/>
207
207
  </xsl:call-template>
208
208
  </xsl:variable>
209
209
  <fo:block font-size="9pt" text-align="right" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-page"/></fo:block>
210
- <fo:block>
210
+ <fo:block role="TOC">
211
211
  <xsl:for-each select="xalan:nodeset($contents)//item[not (@type = 'annex' or @parent = 'annex') and @display = 'true']">
212
212
 
213
- <fo:block>
213
+ <fo:block role="TOCI">
214
214
 
215
215
  <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
216
216
  <xsl:if test="@level = 2 and @section != ''">
@@ -249,7 +249,7 @@
249
249
  <xsl:if test="xalan:nodeset($contents)//item[@type = 'annex' and @display = 'true']">
250
250
  <fo:block text-align="center" margin-top="12pt" margin-bottom="12pt">ANNEXES</fo:block>
251
251
  <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'annex' and @display = 'true']">
252
- <fo:block>
252
+ <fo:block role="TOCI">
253
253
  <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
254
254
  <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
255
255
  <xsl:if test="@section != ''">
@@ -423,7 +423,10 @@
423
423
 
424
424
 
425
425
  <xsl:template match="un:legal-statement//un:clause/un:title">
426
- <fo:block font-weight="bold">
426
+ <xsl:variable name="level">
427
+ <xsl:call-template name="getLevel"/>
428
+ </xsl:variable>
429
+ <fo:block font-weight="bold" role="H{$level}">
427
430
  <xsl:choose>
428
431
  <xsl:when test="text() = 'Note'">
429
432
  <xsl:attribute name="font-size">14pt</xsl:attribute>
@@ -567,7 +570,10 @@
567
570
  </xsl:template>
568
571
 
569
572
  <xsl:template match="un:title" mode="inline-header">
570
- <fo:inline>
573
+ <xsl:variable name="level">
574
+ <xsl:call-template name="getLevel"/>
575
+ </xsl:variable>
576
+ <fo:inline role="H{$level}">
571
577
  <xsl:apply-templates/>
572
578
  </fo:inline>
573
579
  </xsl:template>
@@ -739,8 +745,9 @@
739
745
  <xsl:otherwise>12pt</xsl:otherwise>
740
746
  </xsl:choose>
741
747
  </xsl:variable>
742
- <fo:block font-size="{$font-size}" font-weight="bold" margin-top="30pt" margin-bottom="16pt" keep-with-next="always">
748
+ <fo:block font-size="{$font-size}" font-weight="bold" margin-top="30pt" margin-bottom="16pt" keep-with-next="always" role="H{$level}">
743
749
  <xsl:apply-templates/>
750
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
744
751
  </fo:block>
745
752
  </xsl:template>
746
753
 
@@ -758,12 +765,13 @@
758
765
 
759
766
  <xsl:choose>
760
767
  <xsl:when test="$level = 1">
761
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-top="12pt" margin-bottom="16pt" keep-with-next="always" line-height="18pt">
768
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-top="12pt" margin-bottom="16pt" keep-with-next="always" line-height="18pt" role="H{$level}">
762
769
  <xsl:apply-templates/>
770
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
763
771
  </fo:block>
764
772
  </xsl:when>
765
773
  <xsl:when test="$level &gt;= 2">
766
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always"> <!-- line-height="14.5pt" text-indent="-9.5mm" -->
774
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always" role="H{$level}"> <!-- line-height="14.5pt" text-indent="-9.5mm" -->
767
775
  <xsl:if test="$level = 2">
768
776
  <xsl:attribute name="margin-top">16pt</xsl:attribute>
769
777
  </xsl:if>
@@ -796,7 +804,7 @@
796
804
 
797
805
  <xsl:choose>
798
806
  <xsl:when test="ancestor::un:sections">
799
- <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always"> <!-- line-height="14.5pt" text-indent="-9.5mm" -->
807
+ <fo:block font-size="{$font-size}" font-weight="bold" space-before="3pt" margin-bottom="12pt" margin-left="-9.5mm" line-height="108%" keep-with-next="always" role="H{$level}"> <!-- line-height="14.5pt" text-indent="-9.5mm" -->
800
808
  <xsl:if test="$level = 1">
801
809
  <!-- <xsl:attribute name="margin-left">-8.5mm</xsl:attribute> -->
802
810
  <xsl:attribute name="margin-top">18pt</xsl:attribute>
@@ -813,8 +821,9 @@
813
821
  </xsl:when>
814
822
 
815
823
  <xsl:otherwise>
816
- <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}">
817
825
  <xsl:apply-templates/>
826
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
818
827
  </fo:block>
819
828
  </xsl:otherwise>
820
829
  </xsl:choose>
@@ -1017,7 +1026,7 @@
1017
1026
  <!-- ============================ -->
1018
1027
 
1019
1028
  <xsl:template name="insertHeaderPreface">
1020
- <fo:static-content flow-name="header">
1029
+ <fo:static-content flow-name="header" role="artifact">
1021
1030
  <fo:block-container height="25.5mm" display-align="before" border-bottom="0.5pt solid black">
1022
1031
  <fo:block font-weight="bold" padding-top="20.5mm" text-align="center">
1023
1032
  <!-- <xsl:text>UN/CEFACT </xsl:text> -->
@@ -1028,7 +1037,7 @@
1028
1037
  </xsl:template>
1029
1038
 
1030
1039
  <xsl:template name="insertHeader">
1031
- <fo:static-content flow-name="header">
1040
+ <fo:static-content flow-name="header" role="artifact">
1032
1041
  <fo:block-container height="28.5mm" display-align="before" border-bottom="0.5pt solid black">
1033
1042
  <fo:block font-weight="bold" padding-top="20.5mm" text-align="center">
1034
1043
  <!-- <xsl:text>UN/CEFACT </xsl:text> -->
@@ -1039,7 +1048,7 @@
1039
1048
  </xsl:template>
1040
1049
 
1041
1050
  <xsl:template name="insertFooter">
1042
- <fo:static-content flow-name="footer">
1051
+ <fo:static-content flow-name="footer" role="artifact">
1043
1052
  <fo:block-container height="29mm" display-align="after">
1044
1053
  <fo:block font-size="9pt" font-weight="bold" text-align="center" padding-bottom="24mm"><fo:page-number/></fo:block>
1045
1054
  </fo:block-container>
@@ -1227,6 +1236,7 @@
1227
1236
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1228
1237
  <xsl:attribute name="white-space">pre</xsl:attribute>
1229
1238
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1239
+ <xsl:attribute name="role">Code</xsl:attribute>
1230
1240
 
1231
1241
 
1232
1242
 
@@ -1252,8 +1262,13 @@
1252
1262
 
1253
1263
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
1254
1264
 
1255
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1256
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1265
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1266
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1267
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1268
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1269
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1270
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1271
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1257
1272
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1258
1273
 
1259
1274
 
@@ -1419,6 +1434,11 @@
1419
1434
 
1420
1435
 
1421
1436
 
1437
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
1438
+
1439
+
1440
+
1441
+
1422
1442
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1423
1443
 
1424
1444
 
@@ -1454,7 +1474,8 @@
1454
1474
 
1455
1475
 
1456
1476
 
1457
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1477
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1478
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1458
1479
 
1459
1480
 
1460
1481
 
@@ -1578,13 +1599,20 @@
1578
1599
 
1579
1600
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1580
1601
 
1581
- </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">
1602
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
1603
+ <xsl:attribute name="line-height">135%</xsl:attribute>
1604
+ </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">
1582
1605
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1583
1606
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1584
1607
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1585
1608
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
1586
1609
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1587
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1610
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
1611
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1612
+ <xsl:sort select="@displayorder" data-type="number"/>
1613
+ <xsl:apply-templates select="." mode="contents"/>
1614
+ </xsl:for-each>
1615
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
1588
1616
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1589
1617
 
1590
1618
  <!-- Normative references -->
@@ -1597,13 +1625,33 @@
1597
1625
  <!-- Bibliography -->
1598
1626
  <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"/>
1599
1627
 
1600
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1628
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1629
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1630
+ <xsl:sort select="@displayorder" data-type="number"/>
1631
+ <xsl:apply-templates select="." mode="contents"/>
1632
+ </xsl:for-each>
1633
+
1634
+ <xsl:for-each select="/*/*[local-name()='annex']">
1635
+ <xsl:sort select="@displayorder" data-type="number"/>
1636
+ <xsl:apply-templates select="." mode="contents"/>
1637
+ </xsl:for-each>
1638
+
1639
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1640
+ <xsl:sort select="@displayorder" data-type="number"/>
1641
+ <xsl:apply-templates select="." mode="contents"/>
1642
+ </xsl:for-each>
1643
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
1601
1644
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1602
1645
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1603
1646
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1604
1647
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1605
1648
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1606
- </xsl:template><xsl:template name="processMainSectionsDefault">
1649
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1650
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1651
+ <xsl:sort select="@displayorder" data-type="number"/>
1652
+ <xsl:apply-templates select="."/>
1653
+ </xsl:for-each>
1654
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
1607
1655
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1608
1656
 
1609
1657
  <!-- Normative references -->
@@ -1615,6 +1663,22 @@
1615
1663
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1616
1664
  <!-- Bibliography -->
1617
1665
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1666
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1667
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1668
+ <xsl:sort select="@displayorder" data-type="number"/>
1669
+ <xsl:apply-templates select="."/>
1670
+
1671
+ </xsl:for-each>
1672
+
1673
+ <xsl:for-each select="/*/*[local-name()='annex']">
1674
+ <xsl:sort select="@displayorder" data-type="number"/>
1675
+ <xsl:apply-templates select="."/>
1676
+ </xsl:for-each>
1677
+
1678
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1679
+ <xsl:sort select="@displayorder" data-type="number"/>
1680
+ <xsl:apply-templates select="."/>
1681
+ </xsl:for-each>
1618
1682
  </xsl:template><xsl:template match="text()">
1619
1683
  <xsl:value-of select="."/>
1620
1684
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -1645,7 +1709,9 @@
1645
1709
 
1646
1710
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1647
1711
 
1648
-
1712
+
1713
+
1714
+
1649
1715
 
1650
1716
  <xsl:call-template name="fn_name_display"/>
1651
1717
 
@@ -2481,9 +2547,7 @@
2481
2547
 
2482
2548
  <!-- Table's note name (NOTE, for example) -->
2483
2549
 
2484
- <fo:inline padding-right="2mm">
2485
-
2486
-
2550
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
2487
2551
 
2488
2552
 
2489
2553
 
@@ -2498,6 +2562,7 @@
2498
2562
  </xsl:if>
2499
2563
 
2500
2564
 
2565
+
2501
2566
  <xsl:apply-templates select="*[local-name() = 'name']" mode="presentation"/>
2502
2567
 
2503
2568
  </fo:inline>
@@ -3103,6 +3168,8 @@
3103
3168
  <xsl:if test="$font-size != ''">
3104
3169
  <xsl:attribute name="font-size">
3105
3170
  <xsl:choose>
3171
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3172
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3106
3173
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3107
3174
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3108
3175
  </xsl:choose>
@@ -3537,16 +3604,68 @@
3537
3604
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3538
3605
  </xsl:call-template>
3539
3606
 
3607
+
3608
+
3540
3609
  <xsl:variable name="mathml">
3541
3610
  <xsl:apply-templates select="." mode="mathml"/>
3542
3611
  </xsl:variable>
3543
3612
  <fo:instream-foreign-object fox:alt-text="Math">
3544
3613
 
3545
3614
 
3615
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3616
+ <xsl:variable name="comment_text_">
3617
+ <xsl:choose>
3618
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3619
+ <xsl:value-of select="$comment_text_following"/>
3620
+ </xsl:when>
3621
+ <xsl:otherwise>
3622
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3623
+ </xsl:otherwise>
3624
+ </xsl:choose>
3625
+ </xsl:variable>
3626
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3627
+
3628
+ <xsl:if test="normalize-space($comment_text) != ''">
3629
+ <!-- put Mathin Alternate Text -->
3630
+ <xsl:attribute name="fox:alt-text">
3631
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3632
+ </xsl:attribute>
3633
+ </xsl:if>
3634
+
3635
+ <xsl:variable name="mathml_content">
3636
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3637
+ </xsl:variable>
3638
+ <!-- put MathML in Actual Text -->
3639
+ <xsl:attribute name="fox:actual-text">
3640
+ <xsl:value-of select="$mathml_content"/>
3641
+ </xsl:attribute>
3642
+
3643
+
3546
3644
  <!-- <xsl:copy-of select="."/> -->
3547
3645
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3548
3646
  </fo:instream-foreign-object>
3549
3647
  </fo:inline>
3648
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3649
+ <!-- <xsl:text>a+b</xsl:text> -->
3650
+ <xsl:text>&lt;</xsl:text>
3651
+ <xsl:value-of select="local-name()"/>
3652
+ <xsl:if test="local-name() = 'math'">
3653
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3654
+ </xsl:if>
3655
+ <xsl:for-each select="@*">
3656
+ <xsl:text> </xsl:text>
3657
+ <xsl:value-of select="local-name()"/>
3658
+ <xsl:text>="</xsl:text>
3659
+ <xsl:value-of select="."/>
3660
+ <xsl:text>"</xsl:text>
3661
+ </xsl:for-each>
3662
+ <xsl:text>&gt;</xsl:text>
3663
+ <xsl:apply-templates mode="mathml_actual_text"/>
3664
+ <xsl:text>&lt;/</xsl:text>
3665
+ <xsl:value-of select="local-name()"/>
3666
+ <xsl:text>&gt;</xsl:text>
3667
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3668
+ <xsl:value-of select="normalize-space()"/>
3550
3669
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3551
3670
  <xsl:copy>
3552
3671
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3608,7 +3727,10 @@
3608
3727
  </fo:block>
3609
3728
  <xsl:apply-templates/>
3610
3729
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3611
- <fo:inline><xsl:apply-templates/></fo:inline>
3730
+ <xsl:variable name="level">
3731
+ <xsl:call-template name="getLevel"/>
3732
+ </xsl:variable>
3733
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3612
3734
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3613
3735
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3614
3736
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3643,9 +3765,10 @@
3643
3765
 
3644
3766
  </xsl:variable>
3645
3767
 
3768
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3646
3769
  <xsl:choose>
3647
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3648
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3770
+ <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>
3771
+ <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>
3649
3772
  </xsl:choose>
3650
3773
  <xsl:apply-templates/>
3651
3774
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3806,7 +3929,10 @@
3806
3929
  </fo:block>
3807
3930
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3808
3931
  <xsl:if test="normalize-space() != ''">
3809
- <fo:inline>
3932
+ <xsl:variable name="level">
3933
+ <xsl:call-template name="getLevelTermName"/>
3934
+ </xsl:variable>
3935
+ <fo:inline role="H{$level}">
3810
3936
  <xsl:apply-templates/>
3811
3937
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3812
3938
  <xsl:text>.</xsl:text>
@@ -4112,6 +4238,13 @@
4112
4238
  </xsl:attribute>
4113
4239
  <xsl:apply-templates mode="svg_update"/>
4114
4240
  </xsl:copy>
4241
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
4242
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4243
+ <xsl:for-each select="*[local-name() = 'svg']">
4244
+ <xsl:call-template name="image_svg">
4245
+ <xsl:with-param name="name" select="$name"/>
4246
+ </xsl:call-template>
4247
+ </xsl:for-each>
4115
4248
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4116
4249
  <xsl:variable name="svg_content" select="document(@src)"/>
4117
4250
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4216,7 +4349,7 @@
4216
4349
  </fo:basic-link>
4217
4350
  </fo:block>
4218
4351
  </fo:block-container>
4219
- </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">
4352
+ </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">
4220
4353
  <xsl:apply-templates mode="contents"/>
4221
4354
  <xsl:text> </xsl:text>
4222
4355
  </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">
@@ -4442,6 +4575,7 @@
4442
4575
  </xsl:when>
4443
4576
  <xsl:otherwise>
4444
4577
  <xsl:apply-templates/>
4578
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4445
4579
  </xsl:otherwise>
4446
4580
  </xsl:choose>
4447
4581
  </fo:block>
@@ -4514,12 +4648,16 @@
4514
4648
  <xsl:if test="$font-size != ''">
4515
4649
  <xsl:attribute name="font-size">
4516
4650
  <xsl:choose>
4651
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4652
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4517
4653
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4518
4654
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4519
4655
  </xsl:choose>
4520
4656
  </xsl:attribute>
4521
4657
  </xsl:if>
4522
4658
 
4659
+
4660
+
4523
4661
  <xsl:apply-templates/>
4524
4662
  </fo:block>
4525
4663
 
@@ -4582,14 +4720,6 @@
4582
4720
  <fo:block>
4583
4721
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4584
4722
  </fo:block>
4585
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4586
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4587
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4588
- </fo:block>
4589
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4590
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4591
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4592
- </fo:block>
4593
4723
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4594
4724
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4595
4725
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4606,6 +4736,38 @@
4606
4736
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4607
4737
  <xsl:apply-templates/>
4608
4738
  </fo:block>
4739
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4740
+ <fo:block xsl:use-attribute-sets="subject-style">
4741
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4742
+ </fo:block>
4743
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4744
+ <fo:block xsl:use-attribute-sets="subject-style">
4745
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4746
+ </fo:block>
4747
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4748
+ <fo:block xsl:use-attribute-sets="inherit-style">
4749
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4750
+ </fo:block>
4751
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4752
+ <fo:block xsl:use-attribute-sets="description-style">
4753
+ <xsl:apply-templates/>
4754
+ </fo:block>
4755
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4756
+ <fo:block xsl:use-attribute-sets="specification-style">
4757
+ <xsl:apply-templates/>
4758
+ </fo:block>
4759
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4760
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4761
+ <xsl:apply-templates/>
4762
+ </fo:block>
4763
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4764
+ <fo:block xsl:use-attribute-sets="verification-style">
4765
+ <xsl:apply-templates/>
4766
+ </fo:block>
4767
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4768
+ <fo:block xsl:use-attribute-sets="import-style">
4769
+ <xsl:apply-templates/>
4770
+ </fo:block>
4609
4771
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4610
4772
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4611
4773
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4876,8 +5038,8 @@
4876
5038
  </xsl:if>
4877
5039
  </xsl:template><xsl:variable name="localized.source">
4878
5040
  <xsl:call-template name="getLocalizedString">
4879
- <xsl:with-param name="key">source</xsl:with-param>
4880
- </xsl:call-template>
5041
+ <xsl:with-param name="key">source</xsl:with-param>
5042
+ </xsl:call-template>
4881
5043
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4882
5044
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4883
5045
  <xsl:if test="normalize-space(@citeas) = ''">
@@ -4887,6 +5049,7 @@
4887
5049
  <fo:inline xsl:use-attribute-sets="origin-style">
4888
5050
  <xsl:apply-templates/>
4889
5051
  </fo:inline>
5052
+
4890
5053
  </fo:basic-link>
4891
5054
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4892
5055
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -4953,6 +5116,9 @@
4953
5116
 
4954
5117
  </xsl:if>
4955
5118
 
5119
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
5120
+ <xsl:variable name="text" select="normalize-space()"/>
5121
+
4956
5122
 
4957
5123
 
4958
5124
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -4965,7 +5131,9 @@
4965
5131
 
4966
5132
 
4967
5133
  </xsl:if>
4968
-
5134
+
5135
+
5136
+
4969
5137
  <xsl:apply-templates/>
4970
5138
  </fo:basic-link>
4971
5139
 
@@ -5310,6 +5478,7 @@
5310
5478
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5311
5479
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5312
5480
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5481
+
5313
5482
  <xsl:apply-templates/>
5314
5483
  </fo:block>
5315
5484
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -5478,6 +5647,97 @@
5478
5647
  <fo:block-container border="1pt solid black" width="50%">
5479
5648
  <fo:block> </fo:block>
5480
5649
  </fo:block-container>
5650
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
5651
+ <xsl:param name="colwidths"/>
5652
+ <xsl:variable name="colwidths_">
5653
+ <xsl:choose>
5654
+ <xsl:when test="not($colwidths)">
5655
+ <xsl:variable name="toc_table_simple">
5656
+ <tbody>
5657
+ <xsl:apply-templates mode="toc_table_width"/>
5658
+ </tbody>
5659
+ </xsl:variable>
5660
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
5661
+ <xsl:call-template name="calculate-column-widths">
5662
+ <xsl:with-param name="cols-count" select="$cols-count"/>
5663
+ <xsl:with-param name="table" select="$toc_table_simple"/>
5664
+ </xsl:call-template>
5665
+ </xsl:when>
5666
+ <xsl:otherwise>
5667
+ <xsl:copy-of select="$colwidths"/>
5668
+ </xsl:otherwise>
5669
+ </xsl:choose>
5670
+ </xsl:variable>
5671
+ <fo:block role="TOCI" space-after="16pt">
5672
+ <fo:table width="100%" table-layout="fixed">
5673
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
5674
+ <fo:table-column column-width="proportional-column-width({.})"/>
5675
+ </xsl:for-each>
5676
+ <fo:table-body>
5677
+ <xsl:apply-templates/>
5678
+ </fo:table-body>
5679
+ </fo:table>
5680
+ </fo:block>
5681
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
5682
+ <fo:table-row min-height="5mm">
5683
+ <xsl:apply-templates/>
5684
+ </fo:table-row>
5685
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
5686
+ <xsl:apply-templates/>
5687
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
5688
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5689
+ <xsl:variable name="target" select="@target"/>
5690
+ <xsl:for-each select="*[local-name() = 'tab']">
5691
+ <xsl:variable name="current_id" select="generate-id()"/>
5692
+ <fo:table-cell>
5693
+ <fo:block>
5694
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5695
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5696
+ <xsl:choose>
5697
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5698
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
5699
+ </xsl:choose>
5700
+ </xsl:for-each>
5701
+ </fo:basic-link>
5702
+ </fo:block>
5703
+ </fo:table-cell>
5704
+ </xsl:for-each>
5705
+ <!-- last column - for page numbers -->
5706
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
5707
+ <fo:block>
5708
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5709
+ <fo:page-number-citation ref-id="{$target}"/>
5710
+ </fo:basic-link>
5711
+ </fo:block>
5712
+ </fo:table-cell>
5713
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
5714
+ <xsl:apply-templates mode="toc_table_width"/>
5715
+ </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">
5716
+ <tr>
5717
+ <xsl:apply-templates mode="toc_table_width"/>
5718
+ </tr>
5719
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
5720
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5721
+ <xsl:for-each select="*[local-name() = 'tab']">
5722
+ <xsl:variable name="current_id" select="generate-id()"/>
5723
+ <td>
5724
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5725
+ <xsl:copy-of select="."/>
5726
+ </xsl:for-each>
5727
+ </td>
5728
+ </xsl:for-each>
5729
+ <td>333</td> <!-- page number, just for fill -->
5730
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5731
+ <fo:inline padding-right="5mm"> </fo:inline>
5732
+ <fo:inline><xsl:apply-templates/></fo:inline>
5733
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
5734
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
5735
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
5736
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
5737
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
5738
+ </svg>
5739
+ </fo:instream-foreign-object>
5740
+ </fo:inline>
5481
5741
  </xsl:template><xsl:template name="convertDate">
5482
5742
  <xsl:param name="date"/>
5483
5743
  <xsl:param name="format" select="'short'"/>
@@ -5716,6 +5976,26 @@
5716
5976
  <xsl:value-of select="$level"/>
5717
5977
  </xsl:otherwise>
5718
5978
  </xsl:choose>
5979
+ </xsl:template><xsl:template name="getLevelTermName">
5980
+ <xsl:choose>
5981
+ <xsl:when test="normalize-space(../@depth) != ''">
5982
+ <xsl:value-of select="../@depth"/>
5983
+ </xsl:when>
5984
+ <xsl:otherwise>
5985
+ <xsl:variable name="title_level_">
5986
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5987
+ <xsl:call-template name="getLevel"/>
5988
+ </xsl:for-each>
5989
+ </xsl:variable>
5990
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5991
+ <xsl:choose>
5992
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5993
+ <xsl:otherwise>
5994
+ <xsl:call-template name="getLevel"/>
5995
+ </xsl:otherwise>
5996
+ </xsl:choose>
5997
+ </xsl:otherwise>
5998
+ </xsl:choose>
5719
5999
  </xsl:template><xsl:template name="split">
5720
6000
  <xsl:param name="pText" select="."/>
5721
6001
  <xsl:param name="sep" select="','"/>