metanorma-un 0.6.7 → 0.6.11

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,12 +1279,13 @@
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
 
1277
1286
 
1278
1287
 
1279
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1288
+ <xsl:attribute name="font-family">Courier New</xsl:attribute>
1280
1289
  <xsl:attribute name="margin-top">6pt</xsl:attribute>
1281
1290
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
1282
1291
 
@@ -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
 
@@ -1365,6 +1379,7 @@
1365
1379
 
1366
1380
 
1367
1381
 
1382
+
1368
1383
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1369
1384
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
1370
1385
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
@@ -1379,7 +1394,9 @@
1379
1394
 
1380
1395
 
1381
1396
 
1382
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
1397
+ </xsl:attribute-set><xsl:variable name="table-border_">
1398
+
1399
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
1383
1400
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
1384
1401
 
1385
1402
 
@@ -1494,7 +1511,8 @@
1494
1511
 
1495
1512
 
1496
1513
 
1497
- </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>
1498
1516
 
1499
1517
 
1500
1518
 
@@ -1679,11 +1697,15 @@
1679
1697
  <fo:block>&#xA0;</fo:block>
1680
1698
  </xsl:if> -->
1681
1699
 
1700
+
1701
+ <!-- Display table's name before table as standalone block -->
1682
1702
  <!-- $namespace = 'iso' or -->
1683
1703
 
1684
1704
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1685
1705
 
1686
-
1706
+
1707
+
1708
+
1687
1709
 
1688
1710
  <xsl:call-template name="fn_name_display"/>
1689
1711
 
@@ -1757,6 +1779,12 @@
1757
1779
 
1758
1780
 
1759
1781
 
1782
+
1783
+
1784
+
1785
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
1786
+
1787
+
1760
1788
  <xsl:variable name="table_width">
1761
1789
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
1762
1790
 
@@ -1780,6 +1808,7 @@
1780
1808
 
1781
1809
 
1782
1810
 
1811
+
1783
1812
 
1784
1813
 
1785
1814
 
@@ -1805,6 +1834,8 @@
1805
1834
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1806
1835
  </xsl:if>
1807
1836
 
1837
+
1838
+
1808
1839
  <xsl:choose>
1809
1840
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1810
1841
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -2089,9 +2120,9 @@
2089
2120
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
2090
2121
  <xsl:with-param name="continued">true</xsl:with-param>
2091
2122
  </xsl:apply-templates>
2092
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
2093
- <xsl:call-template name="fn_name_display"/>
2094
- </xsl:for-each>
2123
+
2124
+
2125
+
2095
2126
 
2096
2127
  </fo:table-cell>
2097
2128
  </fo:table-row>
@@ -2173,7 +2204,11 @@
2173
2204
 
2174
2205
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2175
2206
 
2176
- <xsl:if test="$isNoteOrFnExist = 'true'">
2207
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
2208
+
2209
+ </xsl:variable>
2210
+
2211
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
2177
2212
 
2178
2213
  <xsl:variable name="cols-count">
2179
2214
  <xsl:choose>
@@ -2202,6 +2237,8 @@
2202
2237
  </xsl:choose>
2203
2238
  </xsl:for-each>
2204
2239
 
2240
+
2241
+
2205
2242
  <xsl:choose>
2206
2243
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
2207
2244
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -2238,6 +2275,7 @@
2238
2275
 
2239
2276
 
2240
2277
 
2278
+
2241
2279
  <!-- for BSI (not PAS) display Notes before footnotes -->
2242
2280
 
2243
2281
 
@@ -2311,6 +2349,19 @@
2311
2349
 
2312
2350
  </fo:table-body>
2313
2351
 
2352
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2353
+ <xsl:choose>
2354
+ <xsl:when test="substring-after(., '—') != ''">
2355
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2356
+ </xsl:when>
2357
+ <xsl:otherwise>
2358
+ <xsl:value-of select="."/>
2359
+ </xsl:otherwise>
2360
+ </xsl:choose>
2361
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2362
+ <xsl:apply-templates mode="presentation_name"/>
2363
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2364
+ <xsl:apply-templates select="."/>
2314
2365
  </xsl:template><xsl:template match="*[local-name()='tr']">
2315
2366
  <xsl:variable name="parent-name" select="local-name(..)"/>
2316
2367
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2323,6 +2374,8 @@
2323
2374
 
2324
2375
 
2325
2376
 
2377
+
2378
+
2326
2379
  </xsl:if>
2327
2380
  <xsl:if test="$parent-name = 'tfoot'">
2328
2381
 
@@ -2341,6 +2394,8 @@
2341
2394
 
2342
2395
 
2343
2396
 
2397
+
2398
+
2344
2399
  <!-- <xsl:if test="$namespace = 'bipm'">
2345
2400
  <xsl:attribute name="height">8mm</xsl:attribute>
2346
2401
  </xsl:if> -->
@@ -2511,14 +2566,12 @@
2511
2566
  <xsl:apply-templates/>
2512
2567
  </xsl:template><xsl:template name="fn_display">
2513
2568
  <xsl:variable name="references">
2569
+
2514
2570
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2515
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2516
-
2517
-
2518
- <xsl:apply-templates/>
2519
- </fn>
2571
+ <xsl:call-template name="create_fn"/>
2520
2572
  </xsl:for-each>
2521
2573
  </xsl:variable>
2574
+
2522
2575
  <xsl:for-each select="xalan:nodeset($references)//fn">
2523
2576
  <xsl:variable name="reference" select="@reference"/>
2524
2577
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
@@ -2554,6 +2607,12 @@
2554
2607
  </fo:block>
2555
2608
  </xsl:if>
2556
2609
  </xsl:for-each>
2610
+ </xsl:template><xsl:template name="create_fn">
2611
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2612
+
2613
+
2614
+ <xsl:apply-templates/>
2615
+ </fn>
2557
2616
  </xsl:template><xsl:template name="fn_name_display">
2558
2617
  <!-- <xsl:variable name="references">
2559
2618
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -3533,16 +3592,68 @@
3533
3592
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3534
3593
  </xsl:call-template>
3535
3594
 
3595
+
3596
+
3536
3597
  <xsl:variable name="mathml">
3537
3598
  <xsl:apply-templates select="." mode="mathml"/>
3538
3599
  </xsl:variable>
3539
3600
  <fo:instream-foreign-object fox:alt-text="Math">
3540
3601
 
3541
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
+
3542
3632
  <!-- <xsl:copy-of select="."/> -->
3543
3633
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3544
3634
  </fo:instream-foreign-object>
3545
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()"/>
3546
3657
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3547
3658
  <xsl:copy>
3548
3659
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3552,19 +3663,6 @@
3552
3663
  <!-- replace start and end spaces to non-break space -->
3553
3664
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3554
3665
  </xsl:copy>
3555
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3556
- <xsl:copy>
3557
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3558
- </xsl:copy>
3559
- <xsl:choose>
3560
- <!-- if in msub, then don't add space -->
3561
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3562
- <!-- if next char in digit, don't add space -->
3563
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3564
- <xsl:otherwise>
3565
- <mathml:mspace width="0.5ex"/>
3566
- </xsl:otherwise>
3567
- </xsl:choose>
3568
3666
  </xsl:template><xsl:template match="mathml:math/*[local-name()='unit']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='prefix']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='dimension']" mode="mathml"/><xsl:template match="mathml:math/*[local-name()='quantity']" mode="mathml"/><xsl:template match="*[local-name()='localityStack']"/><xsl:template match="*[local-name()='link']" name="link">
3569
3667
  <xsl:variable name="target">
3570
3668
  <xsl:choose>
@@ -3617,7 +3715,10 @@
3617
3715
  </fo:block>
3618
3716
  <xsl:apply-templates/>
3619
3717
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3620
- <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>
3621
3722
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3622
3723
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3623
3724
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3652,9 +3753,10 @@
3652
3753
 
3653
3754
  </xsl:variable>
3654
3755
 
3756
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3655
3757
  <xsl:choose>
3656
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3657
- <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>
3658
3760
  </xsl:choose>
3659
3761
  <xsl:apply-templates/>
3660
3762
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3811,7 +3913,10 @@
3811
3913
  </fo:block>
3812
3914
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3813
3915
  <xsl:if test="normalize-space() != ''">
3814
- <fo:inline>
3916
+ <xsl:variable name="level">
3917
+ <xsl:call-template name="getLevelTermName"/>
3918
+ </xsl:variable>
3919
+ <fo:inline role="H{$level}">
3815
3920
  <xsl:apply-templates/>
3816
3921
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3817
3922
  <xsl:text>.</xsl:text>
@@ -3884,7 +3989,24 @@
3884
3989
  </fo:instream-foreign-object>
3885
3990
  </xsl:when>
3886
3991
  <xsl:otherwise>
3887
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3992
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
3993
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
3994
+
3995
+ <xsl:variable name="img_src">
3996
+ <xsl:choose>
3997
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
3998
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
3999
+ </xsl:choose>
4000
+ </xsl:variable>
4001
+
4002
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
4003
+ <xsl:if test="number($scale) &lt; 100">
4004
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
4005
+ </xsl:if>
4006
+
4007
+ </xsl:if>
4008
+
4009
+ </fo:external-graphic>
3888
4010
  </xsl:otherwise>
3889
4011
  </xsl:choose>
3890
4012
 
@@ -4055,11 +4177,13 @@
4055
4177
  <xsl:attribute name="width">100%</xsl:attribute>
4056
4178
  <xsl:attribute name="content-height">100%</xsl:attribute>
4057
4179
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
4180
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
4181
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
4058
4182
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
4059
4183
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
4060
4184
  <!-- effective height / width = 1.48, 1.4 - with title -->
4061
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
4062
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
4185
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
4186
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
4063
4187
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
4064
4188
  </xsl:if>
4065
4189
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -4076,6 +4200,23 @@
4076
4200
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
4077
4201
  <xsl:value-of select="."/>
4078
4202
  </xsl:attribute>
4203
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4204
+ <xsl:copy>
4205
+ <xsl:apply-templates select="@*" mode="svg_update"/>
4206
+ <xsl:variable name="viewbox">
4207
+ <xsl:call-template name="split">
4208
+ <xsl:with-param name="pText" select="@viewBox"/>
4209
+ <xsl:with-param name="sep" select="' '"/>
4210
+ </xsl:call-template>
4211
+ </xsl:variable>
4212
+ <xsl:attribute name="width">
4213
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4214
+ </xsl:attribute>
4215
+ <xsl:attribute name="height">
4216
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4217
+ </xsl:attribute>
4218
+ <xsl:apply-templates mode="svg_update"/>
4219
+ </xsl:copy>
4079
4220
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4080
4221
  <xsl:variable name="svg_content" select="document(@src)"/>
4081
4222
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4406,6 +4547,7 @@
4406
4547
  </xsl:when>
4407
4548
  <xsl:otherwise>
4408
4549
  <xsl:apply-templates/>
4550
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4409
4551
  </xsl:otherwise>
4410
4552
  </xsl:choose>
4411
4553
  </fo:block>
@@ -4546,14 +4688,6 @@
4546
4688
  <fo:block>
4547
4689
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4548
4690
  </fo:block>
4549
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4550
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4551
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4552
- </fo:block>
4553
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4554
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4555
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4556
- </fo:block>
4557
4691
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4558
4692
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4559
4693
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4570,6 +4704,38 @@
4570
4704
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4571
4705
  <xsl:apply-templates/>
4572
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>
4573
4739
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4574
4740
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4575
4741
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4721,7 +4887,19 @@
4721
4887
  </fo:inline>
4722
4888
  </xsl:if>
4723
4889
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4724
- <fo:inline><xsl:apply-templates/></fo:inline>
4890
+ <xsl:variable name="element">inline
4891
+
4892
+ </xsl:variable>
4893
+ <xsl:choose>
4894
+ <xsl:when test="contains($element, 'block')">
4895
+ <fo:block xsl:use-attribute-sets="example-p-style">
4896
+ <xsl:apply-templates/>
4897
+ </fo:block>
4898
+ </xsl:when>
4899
+ <xsl:otherwise>
4900
+ <fo:inline><xsl:apply-templates/></fo:inline>
4901
+ </xsl:otherwise>
4902
+ </xsl:choose>
4725
4903
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4726
4904
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4727
4905
 
@@ -5262,6 +5440,7 @@
5262
5440
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5263
5441
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5264
5442
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5443
+
5265
5444
  <xsl:apply-templates/>
5266
5445
  </fo:block>
5267
5446
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -5301,7 +5480,6 @@
5301
5480
  </xsl:template><xsl:template name="processBibitem">
5302
5481
 
5303
5482
 
5304
- <!-- end BIPM bibitem processing-->
5305
5483
 
5306
5484
 
5307
5485
 
@@ -5431,6 +5609,9 @@
5431
5609
  <fo:block-container border="1pt solid black" width="50%">
5432
5610
  <fo:block> </fo:block>
5433
5611
  </fo:block-container>
5612
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5613
+ <fo:inline padding-right="5mm"> </fo:inline>
5614
+ <fo:inline><xsl:apply-templates/></fo:inline>
5434
5615
  </xsl:template><xsl:template name="convertDate">
5435
5616
  <xsl:param name="date"/>
5436
5617
  <xsl:param name="format" select="'short'"/>
@@ -5669,6 +5850,26 @@
5669
5850
  <xsl:value-of select="$level"/>
5670
5851
  </xsl:otherwise>
5671
5852
  </xsl:choose>
5853
+ </xsl:template><xsl:template name="getLevelTermName">
5854
+ <xsl:choose>
5855
+ <xsl:when test="normalize-space(../@depth) != ''">
5856
+ <xsl:value-of select="../@depth"/>
5857
+ </xsl:when>
5858
+ <xsl:otherwise>
5859
+ <xsl:variable name="title_level_">
5860
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5861
+ <xsl:call-template name="getLevel"/>
5862
+ </xsl:for-each>
5863
+ </xsl:variable>
5864
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5865
+ <xsl:choose>
5866
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5867
+ <xsl:otherwise>
5868
+ <xsl:call-template name="getLevel"/>
5869
+ </xsl:otherwise>
5870
+ </xsl:choose>
5871
+ </xsl:otherwise>
5872
+ </xsl:choose>
5672
5873
  </xsl:template><xsl:template name="split">
5673
5874
  <xsl:param name="pText" select="."/>
5674
5875
  <xsl:param name="sep" select="','"/>
@@ -5766,20 +5967,40 @@
5766
5967
  </xsl:call-template>
5767
5968
  </xsl:if>
5768
5969
  </xsl:template><xsl:template name="getLocalizedString">
5769
- <xsl:param name="key"/>
5970
+ <xsl:param name="key"/>
5971
+ <xsl:param name="formatted">false</xsl:param>
5770
5972
 
5771
5973
  <xsl:variable name="curr_lang">
5772
5974
  <xsl:call-template name="getLang"/>
5773
5975
  </xsl:variable>
5774
5976
 
5775
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5977
+ <xsl:variable name="data_value">
5978
+ <xsl:choose>
5979
+ <xsl:when test="$formatted = 'true'">
5980
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5981
+ </xsl:when>
5982
+ <xsl:otherwise>
5983
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
5984
+ </xsl:otherwise>
5985
+ </xsl:choose>
5986
+ </xsl:variable>
5776
5987
 
5777
5988
  <xsl:choose>
5778
- <xsl:when test="$data_value != ''">
5779
- <xsl:value-of select="$data_value"/>
5989
+ <xsl:when test="normalize-space($data_value) != ''">
5990
+ <xsl:choose>
5991
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
5992
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
5993
+ </xsl:choose>
5780
5994
  </xsl:when>
5781
5995
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
5782
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5996
+ <xsl:choose>
5997
+ <xsl:when test="$formatted = 'true'">
5998
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
5999
+ </xsl:when>
6000
+ <xsl:otherwise>
6001
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
6002
+ </xsl:otherwise>
6003
+ </xsl:choose>
5783
6004
  </xsl:when>
5784
6005
  <xsl:otherwise>
5785
6006
  <xsl:variable name="key_">
@@ -5790,7 +6011,7 @@
5790
6011
  <xsl:value-of select="$key_"/>
5791
6012
  </xsl:otherwise>
5792
6013
  </xsl:choose>
5793
-
6014
+
5794
6015
  </xsl:template><xsl:template name="setTrackChangesStyles">
5795
6016
  <xsl:param name="isAdded"/>
5796
6017
  <xsl:param name="isDeleted"/>