metanorma-un 0.6.9 → 0.6.10

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
 
@@ -1497,7 +1511,8 @@
1497
1511
 
1498
1512
 
1499
1513
 
1500
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1514
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1515
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1501
1516
 
1502
1517
 
1503
1518
 
@@ -1688,7 +1703,9 @@
1688
1703
 
1689
1704
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1690
1705
 
1691
-
1706
+
1707
+
1708
+
1692
1709
 
1693
1710
  <xsl:call-template name="fn_name_display"/>
1694
1711
 
@@ -3575,16 +3592,68 @@
3575
3592
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3576
3593
  </xsl:call-template>
3577
3594
 
3595
+
3596
+
3578
3597
  <xsl:variable name="mathml">
3579
3598
  <xsl:apply-templates select="." mode="mathml"/>
3580
3599
  </xsl:variable>
3581
3600
  <fo:instream-foreign-object fox:alt-text="Math">
3582
3601
 
3583
3602
 
3603
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3604
+ <xsl:variable name="comment_text_">
3605
+ <xsl:choose>
3606
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3607
+ <xsl:value-of select="$comment_text_following"/>
3608
+ </xsl:when>
3609
+ <xsl:otherwise>
3610
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3611
+ </xsl:otherwise>
3612
+ </xsl:choose>
3613
+ </xsl:variable>
3614
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3615
+
3616
+ <xsl:if test="normalize-space($comment_text) != ''">
3617
+ <!-- put Mathin Alternate Text -->
3618
+ <xsl:attribute name="fox:alt-text">
3619
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3620
+ </xsl:attribute>
3621
+ </xsl:if>
3622
+
3623
+ <xsl:variable name="mathml_content">
3624
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3625
+ </xsl:variable>
3626
+ <!-- put MathML in Actual Text -->
3627
+ <xsl:attribute name="fox:actual-text">
3628
+ <xsl:value-of select="$mathml_content"/>
3629
+ </xsl:attribute>
3630
+
3631
+
3584
3632
  <!-- <xsl:copy-of select="."/> -->
3585
3633
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3586
3634
  </fo:instream-foreign-object>
3587
3635
  </fo:inline>
3636
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3637
+ <!-- <xsl:text>a+b</xsl:text> -->
3638
+ <xsl:text>&lt;</xsl:text>
3639
+ <xsl:value-of select="local-name()"/>
3640
+ <xsl:if test="local-name() = 'math'">
3641
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3642
+ </xsl:if>
3643
+ <xsl:for-each select="@*">
3644
+ <xsl:text> </xsl:text>
3645
+ <xsl:value-of select="local-name()"/>
3646
+ <xsl:text>="</xsl:text>
3647
+ <xsl:value-of select="."/>
3648
+ <xsl:text>"</xsl:text>
3649
+ </xsl:for-each>
3650
+ <xsl:text>&gt;</xsl:text>
3651
+ <xsl:apply-templates mode="mathml_actual_text"/>
3652
+ <xsl:text>&lt;/</xsl:text>
3653
+ <xsl:value-of select="local-name()"/>
3654
+ <xsl:text>&gt;</xsl:text>
3655
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3656
+ <xsl:value-of select="normalize-space()"/>
3588
3657
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3589
3658
  <xsl:copy>
3590
3659
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3646,7 +3715,10 @@
3646
3715
  </fo:block>
3647
3716
  <xsl:apply-templates/>
3648
3717
  </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>
3718
+ <xsl:variable name="level">
3719
+ <xsl:call-template name="getLevel"/>
3720
+ </xsl:variable>
3721
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3650
3722
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3651
3723
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3652
3724
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3681,9 +3753,10 @@
3681
3753
 
3682
3754
  </xsl:variable>
3683
3755
 
3756
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3684
3757
  <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>
3758
+ <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>
3759
+ <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
3760
  </xsl:choose>
3688
3761
  <xsl:apply-templates/>
3689
3762
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3840,7 +3913,10 @@
3840
3913
  </fo:block>
3841
3914
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3842
3915
  <xsl:if test="normalize-space() != ''">
3843
- <fo:inline>
3916
+ <xsl:variable name="level">
3917
+ <xsl:call-template name="getLevelTermName"/>
3918
+ </xsl:variable>
3919
+ <fo:inline role="H{$level}">
3844
3920
  <xsl:apply-templates/>
3845
3921
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3846
3922
  <xsl:text>.</xsl:text>
@@ -4471,6 +4547,7 @@
4471
4547
  </xsl:when>
4472
4548
  <xsl:otherwise>
4473
4549
  <xsl:apply-templates/>
4550
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4474
4551
  </xsl:otherwise>
4475
4552
  </xsl:choose>
4476
4553
  </fo:block>
@@ -4611,14 +4688,6 @@
4611
4688
  <fo:block>
4612
4689
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4613
4690
  </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
4691
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4623
4692
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4624
4693
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4635,6 +4704,38 @@
4635
4704
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4636
4705
  <xsl:apply-templates/>
4637
4706
  </fo:block>
4707
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4708
+ <fo:block xsl:use-attribute-sets="subject-style">
4709
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4710
+ </fo:block>
4711
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4712
+ <fo:block xsl:use-attribute-sets="subject-style">
4713
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4714
+ </fo:block>
4715
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4716
+ <fo:block xsl:use-attribute-sets="inherit-style">
4717
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4718
+ </fo:block>
4719
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4720
+ <fo:block xsl:use-attribute-sets="description-style">
4721
+ <xsl:apply-templates/>
4722
+ </fo:block>
4723
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4724
+ <fo:block xsl:use-attribute-sets="specification-style">
4725
+ <xsl:apply-templates/>
4726
+ </fo:block>
4727
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4728
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4729
+ <xsl:apply-templates/>
4730
+ </fo:block>
4731
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4732
+ <fo:block xsl:use-attribute-sets="verification-style">
4733
+ <xsl:apply-templates/>
4734
+ </fo:block>
4735
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4736
+ <fo:block xsl:use-attribute-sets="import-style">
4737
+ <xsl:apply-templates/>
4738
+ </fo:block>
4638
4739
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4639
4740
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4640
4741
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -5507,6 +5608,9 @@
5507
5608
  <fo:block-container border="1pt solid black" width="50%">
5508
5609
  <fo:block> </fo:block>
5509
5610
  </fo:block-container>
5611
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5612
+ <fo:inline padding-right="5mm"> </fo:inline>
5613
+ <fo:inline><xsl:apply-templates/></fo:inline>
5510
5614
  </xsl:template><xsl:template name="convertDate">
5511
5615
  <xsl:param name="date"/>
5512
5616
  <xsl:param name="format" select="'short'"/>
@@ -5745,6 +5849,26 @@
5745
5849
  <xsl:value-of select="$level"/>
5746
5850
  </xsl:otherwise>
5747
5851
  </xsl:choose>
5852
+ </xsl:template><xsl:template name="getLevelTermName">
5853
+ <xsl:choose>
5854
+ <xsl:when test="normalize-space(../@depth) != ''">
5855
+ <xsl:value-of select="../@depth"/>
5856
+ </xsl:when>
5857
+ <xsl:otherwise>
5858
+ <xsl:variable name="title_level_">
5859
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5860
+ <xsl:call-template name="getLevel"/>
5861
+ </xsl:for-each>
5862
+ </xsl:variable>
5863
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5864
+ <xsl:choose>
5865
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5866
+ <xsl:otherwise>
5867
+ <xsl:call-template name="getLevel"/>
5868
+ </xsl:otherwise>
5869
+ </xsl:choose>
5870
+ </xsl:otherwise>
5871
+ </xsl:choose>
5748
5872
  </xsl:template><xsl:template name="split">
5749
5873
  <xsl:param name="pText" select="."/>
5750
5874
  <xsl:param name="sep" select="','"/>
@@ -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
 
@@ -1454,7 +1469,8 @@
1454
1469
 
1455
1470
 
1456
1471
 
1457
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1472
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1473
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1458
1474
 
1459
1475
 
1460
1476
 
@@ -1645,7 +1661,9 @@
1645
1661
 
1646
1662
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1647
1663
 
1648
-
1664
+
1665
+
1666
+
1649
1667
 
1650
1668
  <xsl:call-template name="fn_name_display"/>
1651
1669
 
@@ -3537,16 +3555,68 @@
3537
3555
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3538
3556
  </xsl:call-template>
3539
3557
 
3558
+
3559
+
3540
3560
  <xsl:variable name="mathml">
3541
3561
  <xsl:apply-templates select="." mode="mathml"/>
3542
3562
  </xsl:variable>
3543
3563
  <fo:instream-foreign-object fox:alt-text="Math">
3544
3564
 
3545
3565
 
3566
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3567
+ <xsl:variable name="comment_text_">
3568
+ <xsl:choose>
3569
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3570
+ <xsl:value-of select="$comment_text_following"/>
3571
+ </xsl:when>
3572
+ <xsl:otherwise>
3573
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3574
+ </xsl:otherwise>
3575
+ </xsl:choose>
3576
+ </xsl:variable>
3577
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3578
+
3579
+ <xsl:if test="normalize-space($comment_text) != ''">
3580
+ <!-- put Mathin Alternate Text -->
3581
+ <xsl:attribute name="fox:alt-text">
3582
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3583
+ </xsl:attribute>
3584
+ </xsl:if>
3585
+
3586
+ <xsl:variable name="mathml_content">
3587
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3588
+ </xsl:variable>
3589
+ <!-- put MathML in Actual Text -->
3590
+ <xsl:attribute name="fox:actual-text">
3591
+ <xsl:value-of select="$mathml_content"/>
3592
+ </xsl:attribute>
3593
+
3594
+
3546
3595
  <!-- <xsl:copy-of select="."/> -->
3547
3596
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3548
3597
  </fo:instream-foreign-object>
3549
3598
  </fo:inline>
3599
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3600
+ <!-- <xsl:text>a+b</xsl:text> -->
3601
+ <xsl:text>&lt;</xsl:text>
3602
+ <xsl:value-of select="local-name()"/>
3603
+ <xsl:if test="local-name() = 'math'">
3604
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3605
+ </xsl:if>
3606
+ <xsl:for-each select="@*">
3607
+ <xsl:text> </xsl:text>
3608
+ <xsl:value-of select="local-name()"/>
3609
+ <xsl:text>="</xsl:text>
3610
+ <xsl:value-of select="."/>
3611
+ <xsl:text>"</xsl:text>
3612
+ </xsl:for-each>
3613
+ <xsl:text>&gt;</xsl:text>
3614
+ <xsl:apply-templates mode="mathml_actual_text"/>
3615
+ <xsl:text>&lt;/</xsl:text>
3616
+ <xsl:value-of select="local-name()"/>
3617
+ <xsl:text>&gt;</xsl:text>
3618
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3619
+ <xsl:value-of select="normalize-space()"/>
3550
3620
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3551
3621
  <xsl:copy>
3552
3622
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3608,7 +3678,10 @@
3608
3678
  </fo:block>
3609
3679
  <xsl:apply-templates/>
3610
3680
  </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>
3681
+ <xsl:variable name="level">
3682
+ <xsl:call-template name="getLevel"/>
3683
+ </xsl:variable>
3684
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3612
3685
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3613
3686
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3614
3687
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3643,9 +3716,10 @@
3643
3716
 
3644
3717
  </xsl:variable>
3645
3718
 
3719
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3646
3720
  <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>
3721
+ <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>
3722
+ <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
3723
  </xsl:choose>
3650
3724
  <xsl:apply-templates/>
3651
3725
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3806,7 +3880,10 @@
3806
3880
  </fo:block>
3807
3881
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3808
3882
  <xsl:if test="normalize-space() != ''">
3809
- <fo:inline>
3883
+ <xsl:variable name="level">
3884
+ <xsl:call-template name="getLevelTermName"/>
3885
+ </xsl:variable>
3886
+ <fo:inline role="H{$level}">
3810
3887
  <xsl:apply-templates/>
3811
3888
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3812
3889
  <xsl:text>.</xsl:text>
@@ -4442,6 +4519,7 @@
4442
4519
  </xsl:when>
4443
4520
  <xsl:otherwise>
4444
4521
  <xsl:apply-templates/>
4522
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4445
4523
  </xsl:otherwise>
4446
4524
  </xsl:choose>
4447
4525
  </fo:block>
@@ -4582,14 +4660,6 @@
4582
4660
  <fo:block>
4583
4661
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4584
4662
  </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
4663
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4594
4664
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4595
4665
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4606,6 +4676,38 @@
4606
4676
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4607
4677
  <xsl:apply-templates/>
4608
4678
  </fo:block>
4679
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4680
+ <fo:block xsl:use-attribute-sets="subject-style">
4681
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4682
+ </fo:block>
4683
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4684
+ <fo:block xsl:use-attribute-sets="subject-style">
4685
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4686
+ </fo:block>
4687
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4688
+ <fo:block xsl:use-attribute-sets="inherit-style">
4689
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4690
+ </fo:block>
4691
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4692
+ <fo:block xsl:use-attribute-sets="description-style">
4693
+ <xsl:apply-templates/>
4694
+ </fo:block>
4695
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4696
+ <fo:block xsl:use-attribute-sets="specification-style">
4697
+ <xsl:apply-templates/>
4698
+ </fo:block>
4699
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4700
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4701
+ <xsl:apply-templates/>
4702
+ </fo:block>
4703
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4704
+ <fo:block xsl:use-attribute-sets="verification-style">
4705
+ <xsl:apply-templates/>
4706
+ </fo:block>
4707
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4708
+ <fo:block xsl:use-attribute-sets="import-style">
4709
+ <xsl:apply-templates/>
4710
+ </fo:block>
4609
4711
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4610
4712
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4611
4713
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -5478,6 +5580,9 @@
5478
5580
  <fo:block-container border="1pt solid black" width="50%">
5479
5581
  <fo:block> </fo:block>
5480
5582
  </fo:block-container>
5583
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5584
+ <fo:inline padding-right="5mm"> </fo:inline>
5585
+ <fo:inline><xsl:apply-templates/></fo:inline>
5481
5586
  </xsl:template><xsl:template name="convertDate">
5482
5587
  <xsl:param name="date"/>
5483
5588
  <xsl:param name="format" select="'short'"/>
@@ -5716,6 +5821,26 @@
5716
5821
  <xsl:value-of select="$level"/>
5717
5822
  </xsl:otherwise>
5718
5823
  </xsl:choose>
5824
+ </xsl:template><xsl:template name="getLevelTermName">
5825
+ <xsl:choose>
5826
+ <xsl:when test="normalize-space(../@depth) != ''">
5827
+ <xsl:value-of select="../@depth"/>
5828
+ </xsl:when>
5829
+ <xsl:otherwise>
5830
+ <xsl:variable name="title_level_">
5831
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5832
+ <xsl:call-template name="getLevel"/>
5833
+ </xsl:for-each>
5834
+ </xsl:variable>
5835
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5836
+ <xsl:choose>
5837
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5838
+ <xsl:otherwise>
5839
+ <xsl:call-template name="getLevel"/>
5840
+ </xsl:otherwise>
5841
+ </xsl:choose>
5842
+ </xsl:otherwise>
5843
+ </xsl:choose>
5719
5844
  </xsl:template><xsl:template name="split">
5720
5845
  <xsl:param name="pText" select="."/>
5721
5846
  <xsl:param name="sep" select="','"/>