metanorma-itu 2.2.15 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,17 +34,19 @@
34
34
  <xsl:variable name="contents_">
35
35
  <contents>
36
36
  <!-- <xsl:apply-templates select="/itu:itu-standard/itu:preface/node()" mode="contents"/> -->
37
- <xsl:apply-templates select="/itu:itu-standard/itu:sections/itu:clause[@type='scope']" mode="contents"/> <!-- @id = 'scope' -->
37
+ <!-- <xsl:apply-templates select="/itu:itu-standard/itu:sections/itu:clause[@type='scope']" mode="contents" /> -->
38
38
 
39
39
  <!-- Normative references -->
40
- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[@normative='true']" mode="contents"/> <!-- @id = 'references' -->
41
-
42
- <xsl:apply-templates select="/itu:itu-standard/itu:sections/*[not(@type='scope')]" mode="contents"/> <!-- @id != 'scope' -->
43
-
44
- <xsl:apply-templates select="/itu:itu-standard/itu:annex" mode="contents"/>
40
+ <!-- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[@normative='true']" mode="contents" />
41
+
42
+ <xsl:apply-templates select="/itu:itu-standard/itu:sections/*[not(@type='scope')]" mode="contents" />
43
+
44
+ <xsl:apply-templates select="/itu:itu-standard/itu:annex" mode="contents"/> -->
45
45
 
46
46
  <!-- Bibliography -->
47
- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[not(@normative='true')]" mode="contents"/> <!-- @id = 'bibliography' -->
47
+ <!-- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[not(@normative='true')]" mode="contents"/> -->
48
+
49
+ <xsl:call-template name="processMainSectionsDefault_Contents"/>
48
50
 
49
51
  <xsl:apply-templates select="//itu:table" mode="contents"/>
50
52
 
@@ -1069,16 +1071,16 @@
1069
1071
 
1070
1072
  <fo:flow flow-name="xsl-region-body">
1071
1073
 
1072
- <xsl:if test="$doctype != 'service-publication'">
1073
- <fo:block-container font-size="14pt">
1074
+ <!-- <xsl:if test="$doctype != 'service-publication' and 1 = 2">
1075
+ <fo:block-container font-size="14pt" >
1074
1076
  <xsl:choose>
1075
1077
  <xsl:when test="$doctype = 'resolution'">
1076
1078
  <fo:block text-align="center">
1077
1079
  <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type='resolution' and @language = $lang]"/>
1078
1080
  </fo:block>
1079
1081
  </xsl:when>
1080
- <xsl:when test="$doctype = 'implementers-guide'"/>
1081
- <xsl:when test="$doctype = 'recommendation-supplement'">
1082
+ <xsl:when test="$doctype = 'implementers-guide'"></xsl:when>
1083
+ <xsl:when test="$doctype = 'recommendation-supplement'">
1082
1084
  <fo:block font-weight="bold">
1083
1085
  <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:docidentifier[@type = 'ITU-Supplement-Internal']"/>
1084
1086
  </fo:block>
@@ -1086,30 +1088,30 @@
1086
1088
  <xsl:otherwise>
1087
1089
  <fo:block font-weight="bold">
1088
1090
  <xsl:value-of select="$doctypeTitle"/>
1089
- <xsl:text> </xsl:text>
1091
+ <xsl:text>&#xA0;</xsl:text>
1090
1092
  <xsl:value-of select="$docname"/>
1091
1093
  </fo:block>
1092
1094
  </xsl:otherwise>
1093
1095
  </xsl:choose>
1094
-
1096
+
1095
1097
  <fo:block font-weight="bold" text-align="center" margin-top="15pt" margin-bottom="15pt" role="H1">
1096
1098
  <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'main' and @language = $lang]"/>
1097
-
1099
+
1098
1100
  <xsl:variable name="subtitle" select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'subtitle' and @language = $lang]"/>
1099
1101
  <xsl:if test="$subtitle != ''">
1100
1102
  <fo:block margin-top="18pt" font-weight="normal" font-style="italic">
1101
- <xsl:if test="$lang = 'ar'"> <!-- to prevent rendering `###` due the missing Arabic glyphs in the italic font (Times New Roman) -->
1103
+ <xsl:if test="$lang = 'ar'">
1102
1104
  <xsl:attribute name="font-style">normal</xsl:attribute>
1103
1105
  </xsl:if>
1104
1106
  <xsl:value-of select="$subtitle"/>
1105
- </fo:block>
1107
+ </fo:block>
1106
1108
  </xsl:if>
1107
-
1109
+
1108
1110
  <xsl:variable name="resolution-placedate" select="/itu:itu-standard/itu:bibdata/itu:title[@type = 'resolution-placedate' and @language = $lang]"/>
1109
1111
  <xsl:if test="$doctype = 'resolution' and $resolution-placedate != ''">
1110
1112
  <fo:block font-size="11pt" margin-top="6pt" font-weight="normal">
1111
1113
  <fo:inline font-style="italic">
1112
- <xsl:if test="$lang = 'ar'"> <!-- to prevent rendering `###` due the missing Arabic glyphs in the italic font (Times New Roman) -->
1114
+ <xsl:if test="$lang = 'ar'">
1113
1115
  <xsl:attribute name="font-style">normal</xsl:attribute>
1114
1116
  </xsl:if>
1115
1117
  <xsl:text>(</xsl:text><xsl:value-of select="$resolution-placedate"/><xsl:text>)</xsl:text>
@@ -1119,22 +1121,25 @@
1119
1121
  </xsl:if>
1120
1122
  </fo:block>
1121
1123
  </fo:block-container>
1122
- </xsl:if>
1124
+ </xsl:if> -->
1123
1125
 
1124
1126
  <!-- Clause(s) -->
1125
1127
  <fo:block>
1126
1128
  <!-- Scope -->
1127
- <xsl:apply-templates select="/itu:itu-standard/itu:sections/itu:clause[@type='scope']"/> <!-- @id = 'scope' -->
1129
+ <!-- <xsl:apply-templates select="/itu:itu-standard/itu:sections/itu:clause[@type='scope']" /> -->
1128
1130
 
1129
1131
  <!-- Normative references -->
1130
- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[@normative='true']"/> <!-- @id = 'references' -->
1132
+ <!-- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[@normative='true']" />
1133
+
1134
+ <xsl:apply-templates select="/itu:itu-standard/itu:sections/*[not(@type='scope')]" />
1135
+
1136
+ <xsl:apply-templates select="/itu:itu-standard/itu:annex"/> -->
1131
1137
 
1132
- <xsl:apply-templates select="/itu:itu-standard/itu:sections/*[not(@type='scope')]"/> <!-- @id != 'scope' -->
1138
+ <!-- Bibliography -->
1139
+ <!-- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[not(@normative='true')]"/> -->
1133
1140
 
1134
- <xsl:apply-templates select="/itu:itu-standard/itu:annex"/>
1141
+ <xsl:call-template name="processMainSectionsDefault"/>
1135
1142
 
1136
- <!-- Bibliography -->
1137
- <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[not(@normative='true')]"/> <!-- @id = 'bibliography' -->
1138
1143
  </fo:block>
1139
1144
 
1140
1145
  </fo:flow>
@@ -1286,6 +1291,37 @@
1286
1291
  </fo:block>
1287
1292
  </xsl:template>
1288
1293
 
1294
+ <xsl:template match="itu:clause[@type = 'keyword']" priority="4"/>
1295
+
1296
+ <xsl:template match="itu:sections/itu:p[@class = 'zzSTDTitle1']" priority="4">
1297
+ <fo:block font-size="14pt">
1298
+ <xsl:choose>
1299
+ <xsl:when test="$doctype = 'resolution'">
1300
+ <xsl:attribute name="text-align">center</xsl:attribute>
1301
+ </xsl:when>
1302
+ <xsl:otherwise>
1303
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
1304
+ </xsl:otherwise>
1305
+ </xsl:choose>
1306
+ <xsl:apply-templates/>
1307
+ </fo:block>
1308
+ </xsl:template>
1309
+
1310
+ <xsl:template match="itu:sections/itu:p[@class = 'zzSTDTitle2']" priority="4">
1311
+ <fo:block font-size="14pt" font-weight="bold" text-align="center" margin-top="15pt" margin-bottom="15pt" role="H1">
1312
+ <xsl:if test="$lang = 'ar'"> <!-- to prevent rendering `###` due the missing Arabic glyphs in the italic font (Times New Roman) -->
1313
+ <xsl:attribute name="font-style">normal</xsl:attribute>
1314
+ </xsl:if>
1315
+ <!-- Example: <p align="center" class="zzSTDTitle2" displayorder="4"><em>(Hammamet, 2016</em>) -->
1316
+ <xsl:if test="@align = 'center'">
1317
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
1318
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
1319
+ <xsl:attribute name="font-weight">normal</xsl:attribute>
1320
+ </xsl:if>
1321
+ <xsl:apply-templates/>
1322
+ </fo:block>
1323
+ </xsl:template>
1324
+
1289
1325
  <xsl:template match="node()">
1290
1326
  <xsl:apply-templates/>
1291
1327
  </xsl:template>
@@ -1740,25 +1776,25 @@
1740
1776
  </xsl:template> -->
1741
1777
 
1742
1778
  <!-- footnotes for title -->
1743
- <xsl:template match="itu:bibdata/itu:note[@type = 'title-footnote']" mode="title_footnote">
1779
+ <!-- <xsl:template match="itu:bibdata/itu:note[@type = 'title-footnote']" mode="title_footnote">
1744
1780
  <xsl:variable name="number" select="position()"/>
1745
1781
  <fo:footnote>
1746
1782
  <fo:inline font-size="60%" keep-with-previous.within-line="always" vertical-align="super">
1747
1783
  <fo:basic-link internal-destination="title_footnote_{$number}" fox:alt-text="titlefootnote {$number}">
1748
1784
  <xsl:value-of select="$number"/>
1749
1785
  </fo:basic-link>
1750
- <xsl:if test="position() != last()">,</xsl:if><!-- <fo:inline baseline-shift="20%">,</fo:inline> -->
1786
+ <xsl:if test="position() != last()">,</xsl:if>
1751
1787
  </fo:inline>
1752
1788
  <fo:footnote-body>
1753
1789
  <fo:block font-size="11pt" margin-bottom="12pt" text-align="justify">
1754
1790
  <fo:inline id="title_footnote_{$number}" font-size="85%" padding-right="2mm" keep-with-next.within-line="always" baseline-shift="30%">
1755
1791
  <xsl:value-of select="$number"/>
1756
1792
  </fo:inline>
1757
- <xsl:apply-templates/>
1793
+ <xsl:apply-templates />
1758
1794
  </fo:block>
1759
1795
  </fo:footnote-body>
1760
1796
  </fo:footnote>
1761
- </xsl:template>
1797
+ </xsl:template> -->
1762
1798
 
1763
1799
  <xsl:template match="*[local-name()='tt']" priority="2">
1764
1800
  <xsl:variable name="element-name">
@@ -2455,11 +2491,26 @@
2455
2491
  <xsl:value-of select="$font_extended"/><xsl:text>, </xsl:text>
2456
2492
  </xsl:if>
2457
2493
 
2458
- <xsl:value-of select="."/>
2494
+ <xsl:variable name="font_family" select="."/>
2459
2495
 
2460
- <xsl:if test="$additional_fonts != ''">
2461
- <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
2462
- </xsl:if>
2496
+ <xsl:choose>
2497
+ <xsl:when test="$additional_fonts = ''">
2498
+ <xsl:value-of select="$font_family"/>
2499
+ </xsl:when>
2500
+ <xsl:otherwise> <!-- $additional_fonts != '' -->
2501
+ <xsl:choose>
2502
+ <xsl:when test="contains($font_family, ',')">
2503
+ <xsl:value-of select="substring-before($font_family, ',')"/>
2504
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
2505
+ <xsl:text>, </xsl:text><xsl:value-of select="substring-after($font_family, ',')"/>
2506
+ </xsl:when>
2507
+ <xsl:otherwise>
2508
+ <xsl:value-of select="$font_family"/>
2509
+ <xsl:text>, </xsl:text><xsl:value-of select="$additional_fonts"/>
2510
+ </xsl:otherwise>
2511
+ </xsl:choose>
2512
+ </xsl:otherwise>
2513
+ </xsl:choose>
2463
2514
  </xsl:attribute>
2464
2515
  </xsl:when>
2465
2516
  <xsl:otherwise>
@@ -5021,21 +5072,21 @@
5021
5072
 
5022
5073
  <xsl:template match="*[local-name()='table']/*[local-name()='note' or local-name() = 'example']" priority="2">
5023
5074
 
5024
- <fo:block xsl:use-attribute-sets="table-note-style">
5075
+ <fo:block xsl:use-attribute-sets="table-note-style">
5025
5076
 
5026
- <xsl:call-template name="refine_table-note-style"/>
5077
+ <xsl:call-template name="refine_table-note-style"/>
5027
5078
 
5028
- <!-- Table's note/example name (NOTE, for example) -->
5029
- <fo:inline xsl:use-attribute-sets="table-note-name-style">
5079
+ <!-- Table's note/example name (NOTE, for example) -->
5080
+ <fo:inline xsl:use-attribute-sets="table-note-name-style">
5030
5081
 
5031
- <xsl:call-template name="refine_table-note-name-style"/>
5082
+ <xsl:call-template name="refine_table-note-name-style"/>
5032
5083
 
5033
- <xsl:apply-templates select="*[local-name() = 'name']"/>
5084
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
5034
5085
 
5035
- </fo:inline>
5086
+ </fo:inline>
5036
5087
 
5037
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
5038
- </fo:block>
5088
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
5089
+ </fo:block>
5039
5090
 
5040
5091
  </xsl:template> <!-- table/note -->
5041
5092
 
@@ -6114,6 +6165,9 @@
6114
6165
  <!-- END Definition List -->
6115
6166
  <!-- ===================== -->
6116
6167
 
6168
+ <!-- default: ignore title in sections/p -->
6169
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]" priority="3"/>
6170
+
6117
6171
  <!-- ========================= -->
6118
6172
  <!-- Rich text formatting -->
6119
6173
  <!-- ========================= -->
@@ -8170,8 +8224,12 @@
8170
8224
  <xsl:variable name="isAdded" select="../@added"/>
8171
8225
  <xsl:variable name="isDeleted" select="../@deleted"/>
8172
8226
  <xsl:choose>
8173
- <xsl:when test="ancestor::*[local-name() = 'title']">
8227
+ <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
8174
8228
  <fo:inline padding-left="1mm" padding-right="1mm">
8229
+ <xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
8230
+ <xsl:attribute name="padding-left">0mm</xsl:attribute>
8231
+ <xsl:attribute name="padding-right">0mm</xsl:attribute>
8232
+ </xsl:if>
8175
8233
  <xsl:variable name="src">
8176
8234
  <xsl:call-template name="image_src"/>
8177
8235
  </xsl:variable>
@@ -8204,25 +8262,45 @@
8204
8262
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
8205
8263
  <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
8206
8264
 
8207
- <xsl:variable name="img_src">
8208
- <xsl:choose>
8209
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8210
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8211
- </xsl:choose>
8212
- </xsl:variable>
8265
+ <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
8266
+ <xsl:attribute name="width">
8267
+ <xsl:value-of select="@width"/>
8268
+ </xsl:attribute>
8269
+ </xsl:if>
8213
8270
 
8214
- <xsl:variable name="image_width_effective">
8271
+ <xsl:if test="@height != '' and @height != 'auto'">
8272
+ <xsl:attribute name="height">
8273
+ <xsl:value-of select="@height"/>
8274
+ </xsl:attribute>
8275
+ </xsl:if>
8215
8276
 
8216
- <xsl:value-of select="$width_effective"/>
8277
+ <xsl:choose>
8278
+ <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
8279
+ <xsl:attribute name="scaling">non-uniform</xsl:attribute>
8280
+ </xsl:when>
8281
+ <xsl:otherwise>
8217
8282
 
8218
- </xsl:variable>
8283
+ <xsl:variable name="img_src">
8284
+ <xsl:choose>
8285
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8286
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8287
+ </xsl:choose>
8288
+ </xsl:variable>
8219
8289
 
8220
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8221
- <xsl:if test="number($scale) &lt; 100">
8290
+ <xsl:variable name="image_width_effective">
8222
8291
 
8223
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
8292
+ <xsl:value-of select="$width_effective"/>
8224
8293
 
8225
- </xsl:if>
8294
+ </xsl:variable>
8295
+
8296
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8297
+ <xsl:if test="number($scale) &lt; 100">
8298
+
8299
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
8300
+
8301
+ </xsl:if>
8302
+ </xsl:otherwise>
8303
+ </xsl:choose>
8226
8304
 
8227
8305
  </xsl:if>
8228
8306
 
@@ -11911,7 +11989,7 @@
11911
11989
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
11912
11990
  <xsl:apply-templates mode="update_xml_step1"/>
11913
11991
  </xsl:template>
11914
- <xsl:template match="*[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11992
+ <xsl:template match="*[local-name() = 'sections']/*[local-name() = 'p'][starts-with(@class, 'zzSTDTitle')]/*[local-name() = 'span'][@class] | *[local-name() = 'sourcecode']//*[local-name() = 'span'][@class]" mode="update_xml_step1" priority="2">
11915
11993
  <xsl:copy>
11916
11994
  <xsl:copy-of select="@*"/>
11917
11995
  <xsl:apply-templates mode="update_xml_step1"/>