metanorma-un 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 774afb2e0ab41456a24cba9f9fbac69a115a34e1f746fe54a07f10b22681f22f
4
- data.tar.gz: 3c215cc2b94107c28c5783c97e06f045b739079957e2fa55877021ff836a392f
3
+ metadata.gz: f88f7b21e9d8de071434daa7df4a9982bec263f465c574c3c97b73971d433c37
4
+ data.tar.gz: 38b237c01381f9343a62e7cbff698915372c24ebda3d5b970c762a3db8db9ebc
5
5
  SHA512:
6
- metadata.gz: 4e9934f37702e647338e603c00355a087f957537110fc56d0ba61689c49355b63b9bd31178c6a943cb8a528db6c496ab25fdc44399b27fce0c15a5c8f789f26d
7
- data.tar.gz: 90b85724afcbb49af22b4c18648074675a3f16adb22bca9579eec2af4fc674b0f3db3dbee89edd1988492d2d2351d8f06018ab1a7557a1ed31c3be9249ae3cad
6
+ metadata.gz: 9079386c7b5b8df9a4bb61d8675f8c78a83e48235588516dbaa688f1b9e34ec037ff33f5e14de7c530b480a0a42cc6cb8817974f93505b47b4e36be657882d04
7
+ data.tar.gz: 90d5141f6da4430059e474803cb5ae25ebd9b6430a31b555b29c48b37ca5312c730b8e030eb0488f1b9d3ce338e49a03d47621d152a720f402325476556645b9
@@ -158,17 +158,7 @@
158
158
  <data type="ID"/>
159
159
  </attribute>
160
160
  <oneOrMore>
161
- <choice>
162
- <ref name="formula"/>
163
- <ref name="ul"/>
164
- <ref name="ol"/>
165
- <ref name="dl"/>
166
- <ref name="quote"/>
167
- <ref name="sourcecode"/>
168
- <ref name="paragraph"/>
169
- <ref name="table"/>
170
- <ref name="figure"/>
171
- </choice>
161
+ <ref name="paragraph"/>
172
162
  </oneOrMore>
173
163
  </element>
174
164
  </define>
@@ -1028,6 +1018,9 @@
1028
1018
  <value>alphabet_upper</value>
1029
1019
  </choice>
1030
1020
  </attribute>
1021
+ <optional>
1022
+ <attribute name="start"/>
1023
+ </optional>
1031
1024
  <oneOrMore>
1032
1025
  <ref name="li"/>
1033
1026
  </oneOrMore>
@@ -64,6 +64,11 @@
64
64
  </choice>
65
65
  </attribute>
66
66
  </optional>
67
+ <optional>
68
+ <attribute name="droploc">
69
+ <data type="boolean"/>
70
+ </attribute>
71
+ </optional>
67
72
  <text/>
68
73
  </element>
69
74
  </define>
@@ -859,6 +864,13 @@
859
864
  </define>
860
865
  <define name="standard-document">
861
866
  <element name="standard-document">
867
+ <attribute name="version"/>
868
+ <attribute name="type">
869
+ <choice>
870
+ <value>semantic</value>
871
+ <value>presentation</value>
872
+ </choice>
873
+ </attribute>
862
874
  <ref name="bibdata"/>
863
875
  <optional>
864
876
  <ref name="boilerplate"/>
@@ -880,7 +892,7 @@
880
892
  <oneOrMore>
881
893
  <choice>
882
894
  <ref name="content"/>
883
- <ref name="preface_abstract"/>
895
+ <ref name="abstract"/>
884
896
  <ref name="foreword"/>
885
897
  <ref name="introduction"/>
886
898
  <ref name="acknowledgements"/>
@@ -1481,11 +1493,6 @@
1481
1493
  </optional>
1482
1494
  </element>
1483
1495
  </define>
1484
- <define name="preface_abstract">
1485
- <element name="abstract">
1486
- <ref name="Basic-Section"/>
1487
- </element>
1488
- </define>
1489
1496
  <define name="term-clause">
1490
1497
  <element name="clause">
1491
1498
  <optional>
@@ -340,6 +340,13 @@
340
340
  </define>
341
341
  <define name="un-standard">
342
342
  <element name="un-standard">
343
+ <attribute name="version"/>
344
+ <attribute name="type">
345
+ <choice>
346
+ <value>semantic</value>
347
+ <value>presentation</value>
348
+ </choice>
349
+ </attribute>
343
350
  <ref name="bibdata"/>
344
351
  <optional>
345
352
  <ref name="boilerplate"/>
@@ -16,6 +16,14 @@
16
16
 
17
17
  <xsl:variable name="contents">
18
18
  <contents>
19
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
20
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
21
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
22
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
23
+
24
+ <xsl:apply-templates select="/un:un-standard/un:sections/*" mode="contents"/>
25
+ <xsl:apply-templates select="/un:un-standard/un:annex" mode="contents"/>
26
+ <xsl:apply-templates select="/un:un-standard/un:bibliography/un:references" mode="contents"/>
19
27
  </contents>
20
28
  </xsl:variable>
21
29
 
@@ -66,6 +74,10 @@
66
74
 
67
75
  <xsl:call-template name="addPDFUAmeta"/>
68
76
 
77
+ <xsl:call-template name="addBookmarks">
78
+ <xsl:with-param name="contents" select="$contents"/>
79
+ </xsl:call-template>
80
+
69
81
  <!-- Cover Page -->
70
82
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
71
83
  <fo:flow flow-name="xsl-region-body">
@@ -173,20 +185,22 @@
173
185
  </fo:block>
174
186
 
175
187
  <fo:block padding-top="1mm">
176
- <fo:instream-foreign-object fox:alt-text="Barcode">
177
- <barcode:barcode message="{$code}">
178
- <barcode:code39>
179
- <barcode:height>8.5mm</barcode:height>
180
- <barcode:module-width>0.24mm</barcode:module-width>
181
- <barcode:human-readable>
182
- <barcode:placement>none</barcode:placement>
183
- <!--<barcode:pattern>* _ _ _ _ _ _ _ _ _ *</barcode:pattern>
184
- <barcode:font-name>Arial</barcode:font-name>
185
- <barcode:font-size>9.7pt</barcode:font-size> -->
186
- </barcode:human-readable>
187
- </barcode:code39>
188
- </barcode:barcode>
189
- </fo:instream-foreign-object>
188
+ <xsl:if test="normalize-space($code) != ''">
189
+ <fo:instream-foreign-object fox:alt-text="Barcode">
190
+ <barcode:barcode message="{$code}">
191
+ <barcode:code39>
192
+ <barcode:height>8.5mm</barcode:height>
193
+ <barcode:module-width>0.24mm</barcode:module-width>
194
+ <barcode:human-readable>
195
+ <barcode:placement>none</barcode:placement>
196
+ <!--<barcode:pattern>* _ _ _ _ _ _ _ _ _ *</barcode:pattern>
197
+ <barcode:font-name>Arial</barcode:font-name>
198
+ <barcode:font-size>9.7pt</barcode:font-size> -->
199
+ </barcode:human-readable>
200
+ </barcode:code39>
201
+ </barcode:barcode>
202
+ </fo:instream-foreign-object>
203
+ </xsl:if>
190
204
  </fo:block>
191
205
  <fo:block padding-top="-0.8mm" text-align="left" font-family="Arial" font-size="8pt" letter-spacing="1.8mm">
192
206
  <xsl:value-of select="concat('*', $code, '*')"/>
@@ -200,14 +214,16 @@
200
214
  </fo:block-container>
201
215
  <fo:block-container absolute-position="fixed" left="170mm" top="253mm">
202
216
  <fo:block>
203
- <fo:instream-foreign-object fox:alt-text="Barcode">
204
- <barcode:barcode message="{concat('http://undocs.org/', /un:un-standard/un:bibdata/un:ext/un:session/un:id)}">
205
- <barcode:qr>
206
- <barcode:module-width>0.55mm</barcode:module-width>
207
- <barcode:ec-level>M</barcode:ec-level>
208
- </barcode:qr>
209
- </barcode:barcode>
210
- </fo:instream-foreign-object>
217
+ <xsl:if test="normalize-space(/un:un-standard/un:bibdata/un:ext/un:session/un:id) != ''">
218
+ <fo:instream-foreign-object fox:alt-text="Barcode">
219
+ <barcode:barcode message="{concat('http://undocs.org/', /un:un-standard/un:bibdata/un:ext/un:session/un:id)}">
220
+ <barcode:qr>
221
+ <barcode:module-width>0.55mm</barcode:module-width>
222
+ <barcode:ec-level>M</barcode:ec-level>
223
+ </barcode:qr>
224
+ </barcode:barcode>
225
+ </fo:instream-foreign-object>
226
+ </xsl:if>
211
227
  </fo:block>
212
228
  </fo:block-container>
213
229
 
@@ -262,6 +278,65 @@
262
278
  </xsl:template>
263
279
 
264
280
 
281
+
282
+ <!-- ============================= -->
283
+ <!-- CONTENTS -->
284
+ <!-- ============================= -->
285
+ <xsl:template match="node()" mode="contents">
286
+ <xsl:apply-templates mode="contents"/>
287
+ </xsl:template>
288
+
289
+ <!-- element with title -->
290
+ <xsl:template match="*[un:title]" mode="contents">
291
+ <xsl:variable name="level">
292
+ <xsl:call-template name="getLevel">
293
+ <xsl:with-param name="depth" select="un:title/@depth"/>
294
+ </xsl:call-template>
295
+ </xsl:variable>
296
+
297
+ <xsl:variable name="display">
298
+ <xsl:choose>
299
+ <xsl:when test="$level &gt; 3">false</xsl:when>
300
+ <xsl:otherwise>true</xsl:otherwise>
301
+ </xsl:choose>
302
+ </xsl:variable>
303
+
304
+ <xsl:variable name="skip">
305
+ <xsl:choose>
306
+ <xsl:when test="ancestor-or-self::un:bibitem">true</xsl:when>
307
+ <xsl:when test="ancestor-or-self::un:term">true</xsl:when>
308
+ <xsl:when test="@inline-header = 'true'">true</xsl:when>
309
+ <xsl:otherwise>false</xsl:otherwise>
310
+ </xsl:choose>
311
+ </xsl:variable>
312
+
313
+ <xsl:if test="$skip = 'false'">
314
+
315
+ <xsl:variable name="section">
316
+ <xsl:call-template name="getSection"/>
317
+ </xsl:variable>
318
+
319
+ <xsl:variable name="title">
320
+ <xsl:call-template name="getName"/>
321
+ </xsl:variable>
322
+
323
+ <xsl:variable name="type">
324
+ <xsl:value-of select="local-name()"/>
325
+ </xsl:variable>
326
+
327
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" display="{$display}">
328
+ <title>
329
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
330
+ </title>
331
+ <xsl:apply-templates mode="contents"/>
332
+ </item>
333
+ </xsl:if>
334
+
335
+ </xsl:template>
336
+ <xsl:template match="un:references[not(@normative='true')]/un:bibitem" mode="contents"/>
337
+ <!-- ============================= -->
338
+ <!-- ============================= -->
339
+
265
340
 
266
341
  <!-- ============================= -->
267
342
  <!-- PARAGRAPHS -->
@@ -1104,6 +1179,12 @@
1104
1179
 
1105
1180
  </title-edition>
1106
1181
 
1182
+ <title-edition lang="fr">
1183
+
1184
+ <xsl:text>Édition </xsl:text>
1185
+
1186
+ </title-edition>
1187
+
1107
1188
 
1108
1189
  <title-toc lang="en">
1109
1190
 
@@ -1210,7 +1291,9 @@
1210
1291
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1211
1292
  </xsl:otherwise>
1212
1293
  </xsl:choose>
1213
- </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
1294
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
1295
+
1296
+ </xsl:attribute-set><xsl:attribute-set name="link-style">
1214
1297
 
1215
1298
 
1216
1299
 
@@ -3150,12 +3233,101 @@
3150
3233
 
3151
3234
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3152
3235
  </fo:block>
3153
- </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">
3236
+ </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">
3154
3237
  <xsl:apply-templates mode="contents"/>
3155
3238
  <xsl:text> </xsl:text>
3156
- </xsl:template><xsl:template match="text()" mode="contents">
3239
+ </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">
3240
+ <xsl:apply-templates mode="bookmarks"/>
3241
+ <xsl:text> </xsl:text>
3242
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3243
+ <xsl:value-of select="."/>
3244
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3157
3245
  <xsl:value-of select="."/>
3158
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3246
+ </xsl:template><xsl:template match="node()" mode="contents">
3247
+ <xsl:apply-templates mode="contents"/>
3248
+ </xsl:template><xsl:template match="node()" mode="bookmarks">
3249
+ <xsl:apply-templates mode="bookmarks"/>
3250
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3251
+ <xsl:apply-templates select="."/>
3252
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3253
+ <xsl:apply-templates mode="bookmarks"/>
3254
+ </xsl:template><xsl:template name="addBookmarks">
3255
+ <xsl:param name="contents"/>
3256
+ <xsl:if test="xalan:nodeset($contents)//item">
3257
+ <fo:bookmark-tree>
3258
+ <xsl:choose>
3259
+ <xsl:when test="xalan:nodeset($contents)/doc">
3260
+ <xsl:choose>
3261
+ <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3262
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3263
+ <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3264
+ <fo:bookmark-title>
3265
+ <xsl:variable name="bookmark-title_">
3266
+ <xsl:choose>
3267
+ <xsl:when test="@lang = 'en'">
3268
+
3269
+
3270
+ </xsl:when>
3271
+ <xsl:when test="@lang = 'fr'">
3272
+
3273
+
3274
+ </xsl:when>
3275
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3276
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3277
+ </xsl:choose>
3278
+ </xsl:variable>
3279
+ <xsl:choose>
3280
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3281
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3282
+ </xsl:when>
3283
+ <xsl:otherwise>
3284
+ <xsl:choose>
3285
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3286
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3287
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3288
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3289
+ </xsl:choose>
3290
+ </xsl:otherwise>
3291
+ </xsl:choose>
3292
+ </fo:bookmark-title>
3293
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3294
+ </fo:bookmark>
3295
+
3296
+ </xsl:for-each>
3297
+ </xsl:when>
3298
+ <xsl:otherwise>
3299
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3300
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3301
+ </xsl:for-each>
3302
+ </xsl:otherwise>
3303
+ </xsl:choose>
3304
+ </xsl:when>
3305
+ <xsl:otherwise>
3306
+ <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
3307
+ </xsl:otherwise>
3308
+ </xsl:choose>
3309
+
3310
+
3311
+
3312
+
3313
+
3314
+
3315
+
3316
+
3317
+ </fo:bookmark-tree>
3318
+ </xsl:if>
3319
+ </xsl:template><xsl:template match="item" mode="bookmark">
3320
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
3321
+ <fo:bookmark-title>
3322
+ <xsl:if test="@section != ''">
3323
+ <xsl:value-of select="@section"/>
3324
+ <xsl:text> </xsl:text>
3325
+ </xsl:if>
3326
+ <xsl:value-of select="normalize-space(title)"/>
3327
+ </fo:bookmark-title>
3328
+ <xsl:apply-templates mode="bookmark"/>
3329
+ </fo:bookmark>
3330
+ </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3159
3331
  <xsl:if test="normalize-space() != ''">
3160
3332
  <fo:block xsl:use-attribute-sets="figure-name-style">
3161
3333
 
@@ -3213,7 +3385,7 @@
3213
3385
  <xsl:apply-templates/>
3214
3386
  </xsl:otherwise>
3215
3387
  </xsl:choose>
3216
- </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
3388
+ </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
3217
3389
  <xsl:text> </xsl:text>
3218
3390
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
3219
3391
  <xsl:copy>
@@ -3824,20 +3996,29 @@
3824
3996
  <!-- 0xA0 to space replacement -->
3825
3997
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
3826
3998
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
3827
- <fo:block-container margin-left="0mm">
3828
- <xsl:if test="parent::*[local-name() = 'note']">
3829
- <xsl:attribute name="margin-left">
3830
- <xsl:choose>
3831
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3832
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3833
- </xsl:choose>
3834
- </xsl:attribute>
3835
-
3836
- </xsl:if>
3837
- <fo:block-container margin-left="0mm">
3838
- <xsl:apply-templates select="." mode="ul_ol"/>
3839
- </fo:block-container>
3840
- </fo:block-container>
3999
+ <xsl:choose>
4000
+ <xsl:when test="parent::*[local-name() = 'note']">
4001
+ <fo:block-container>
4002
+ <xsl:attribute name="margin-left">
4003
+ <xsl:choose>
4004
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
4005
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
4006
+ </xsl:choose>
4007
+ </xsl:attribute>
4008
+
4009
+ <fo:block-container margin-left="0mm">
4010
+ <fo:block>
4011
+ <xsl:apply-templates select="." mode="ul_ol"/>
4012
+ </fo:block>
4013
+ </fo:block-container>
4014
+ </fo:block-container>
4015
+ </xsl:when>
4016
+ <xsl:otherwise>
4017
+ <fo:block>
4018
+ <xsl:apply-templates select="." mode="ul_ol"/>
4019
+ </fo:block>
4020
+ </xsl:otherwise>
4021
+ </xsl:choose>
3841
4022
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
3842
4023
  <!-- <row>
3843
4024
  <date>05-07-2013</date>
@@ -4133,6 +4314,7 @@
4133
4314
 
4134
4315
 
4135
4316
 
4317
+
4136
4318
  </xsl:variable>
4137
4319
  <xsl:if test="$documentNS != $XSLNS">
4138
4320
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4158,4 +4340,21 @@
4158
4340
  </xsl:otherwise>
4159
4341
  </xsl:choose>
4160
4342
  </xsl:attribute>
4343
+ </xsl:template><xsl:template name="add-letter-spacing">
4344
+ <xsl:param name="text"/>
4345
+ <xsl:param name="letter-spacing" select="'0.15'"/>
4346
+ <xsl:if test="string-length($text) &gt; 0">
4347
+ <xsl:variable name="char" select="substring($text, 1, 1)"/>
4348
+ <fo:inline padding-right="{$letter-spacing}mm">
4349
+ <xsl:if test="$char = '®'">
4350
+ <xsl:attribute name="font-size">58%</xsl:attribute>
4351
+ <xsl:attribute name="baseline-shift">30%</xsl:attribute>
4352
+ </xsl:if>
4353
+ <xsl:value-of select="$char"/>
4354
+ </fo:inline>
4355
+ <xsl:call-template name="add-letter-spacing">
4356
+ <xsl:with-param name="text" select="substring($text, 2)"/>
4357
+ <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4358
+ </xsl:call-template>
4359
+ </xsl:if>
4161
4360
  </xsl:template></xsl:stylesheet>
@@ -16,6 +16,14 @@
16
16
 
17
17
  <xsl:variable name="contents">
18
18
  <contents>
19
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
20
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
21
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
22
+ <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
23
+
24
+ <xsl:apply-templates select="/un:un-standard/un:sections/*" mode="contents"/>
25
+ <xsl:apply-templates select="/un:un-standard/un:annex" mode="contents"/>
26
+ <xsl:apply-templates select="/un:un-standard/un:bibliography/un:references" mode="contents"/>
19
27
  </contents>
20
28
  </xsl:variable>
21
29
 
@@ -66,6 +74,10 @@
66
74
 
67
75
  <xsl:call-template name="addPDFUAmeta"/>
68
76
 
77
+ <xsl:call-template name="addBookmarks">
78
+ <xsl:with-param name="contents" select="$contents"/>
79
+ </xsl:call-template>
80
+
69
81
  <!-- Cover Page -->
70
82
  <fo:page-sequence master-reference="cover-page" force-page-count="no-force">
71
83
  <fo:flow flow-name="xsl-region-body">
@@ -173,20 +185,22 @@
173
185
  </fo:block>
174
186
 
175
187
  <fo:block padding-top="1mm">
176
- <fo:instream-foreign-object fox:alt-text="Barcode">
177
- <barcode:barcode message="{$code}">
178
- <barcode:code39>
179
- <barcode:height>8.5mm</barcode:height>
180
- <barcode:module-width>0.24mm</barcode:module-width>
181
- <barcode:human-readable>
182
- <barcode:placement>none</barcode:placement>
183
- <!--<barcode:pattern>* _ _ _ _ _ _ _ _ _ *</barcode:pattern>
184
- <barcode:font-name>Arial</barcode:font-name>
185
- <barcode:font-size>9.7pt</barcode:font-size> -->
186
- </barcode:human-readable>
187
- </barcode:code39>
188
- </barcode:barcode>
189
- </fo:instream-foreign-object>
188
+ <xsl:if test="normalize-space($code) != ''">
189
+ <fo:instream-foreign-object fox:alt-text="Barcode">
190
+ <barcode:barcode message="{$code}">
191
+ <barcode:code39>
192
+ <barcode:height>8.5mm</barcode:height>
193
+ <barcode:module-width>0.24mm</barcode:module-width>
194
+ <barcode:human-readable>
195
+ <barcode:placement>none</barcode:placement>
196
+ <!--<barcode:pattern>* _ _ _ _ _ _ _ _ _ *</barcode:pattern>
197
+ <barcode:font-name>Arial</barcode:font-name>
198
+ <barcode:font-size>9.7pt</barcode:font-size> -->
199
+ </barcode:human-readable>
200
+ </barcode:code39>
201
+ </barcode:barcode>
202
+ </fo:instream-foreign-object>
203
+ </xsl:if>
190
204
  </fo:block>
191
205
  <fo:block padding-top="-0.8mm" text-align="left" font-family="Arial" font-size="8pt" letter-spacing="1.8mm">
192
206
  <xsl:value-of select="concat('*', $code, '*')"/>
@@ -200,14 +214,16 @@
200
214
  </fo:block-container>
201
215
  <fo:block-container absolute-position="fixed" left="170mm" top="253mm">
202
216
  <fo:block>
203
- <fo:instream-foreign-object fox:alt-text="Barcode">
204
- <barcode:barcode message="{concat('http://undocs.org/', /un:un-standard/un:bibdata/un:ext/un:session/un:id)}">
205
- <barcode:qr>
206
- <barcode:module-width>0.55mm</barcode:module-width>
207
- <barcode:ec-level>M</barcode:ec-level>
208
- </barcode:qr>
209
- </barcode:barcode>
210
- </fo:instream-foreign-object>
217
+ <xsl:if test="normalize-space(/un:un-standard/un:bibdata/un:ext/un:session/un:id) != ''">
218
+ <fo:instream-foreign-object fox:alt-text="Barcode">
219
+ <barcode:barcode message="{concat('http://undocs.org/', /un:un-standard/un:bibdata/un:ext/un:session/un:id)}">
220
+ <barcode:qr>
221
+ <barcode:module-width>0.55mm</barcode:module-width>
222
+ <barcode:ec-level>M</barcode:ec-level>
223
+ </barcode:qr>
224
+ </barcode:barcode>
225
+ </fo:instream-foreign-object>
226
+ </xsl:if>
211
227
  </fo:block>
212
228
  </fo:block-container>
213
229
 
@@ -262,6 +278,65 @@
262
278
  </xsl:template>
263
279
 
264
280
 
281
+
282
+ <!-- ============================= -->
283
+ <!-- CONTENTS -->
284
+ <!-- ============================= -->
285
+ <xsl:template match="node()" mode="contents">
286
+ <xsl:apply-templates mode="contents"/>
287
+ </xsl:template>
288
+
289
+ <!-- element with title -->
290
+ <xsl:template match="*[un:title]" mode="contents">
291
+ <xsl:variable name="level">
292
+ <xsl:call-template name="getLevel">
293
+ <xsl:with-param name="depth" select="un:title/@depth"/>
294
+ </xsl:call-template>
295
+ </xsl:variable>
296
+
297
+ <xsl:variable name="display">
298
+ <xsl:choose>
299
+ <xsl:when test="$level &gt; 3">false</xsl:when>
300
+ <xsl:otherwise>true</xsl:otherwise>
301
+ </xsl:choose>
302
+ </xsl:variable>
303
+
304
+ <xsl:variable name="skip">
305
+ <xsl:choose>
306
+ <xsl:when test="ancestor-or-self::un:bibitem">true</xsl:when>
307
+ <xsl:when test="ancestor-or-self::un:term">true</xsl:when>
308
+ <xsl:when test="@inline-header = 'true'">true</xsl:when>
309
+ <xsl:otherwise>false</xsl:otherwise>
310
+ </xsl:choose>
311
+ </xsl:variable>
312
+
313
+ <xsl:if test="$skip = 'false'">
314
+
315
+ <xsl:variable name="section">
316
+ <xsl:call-template name="getSection"/>
317
+ </xsl:variable>
318
+
319
+ <xsl:variable name="title">
320
+ <xsl:call-template name="getName"/>
321
+ </xsl:variable>
322
+
323
+ <xsl:variable name="type">
324
+ <xsl:value-of select="local-name()"/>
325
+ </xsl:variable>
326
+
327
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" display="{$display}">
328
+ <title>
329
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
330
+ </title>
331
+ <xsl:apply-templates mode="contents"/>
332
+ </item>
333
+ </xsl:if>
334
+
335
+ </xsl:template>
336
+ <xsl:template match="un:references[not(@normative='true')]/un:bibitem" mode="contents"/>
337
+ <!-- ============================= -->
338
+ <!-- ============================= -->
339
+
265
340
 
266
341
  <!-- ============================= -->
267
342
  <!-- PARAGRAPHS -->
@@ -1104,6 +1179,12 @@
1104
1179
 
1105
1180
  </title-edition>
1106
1181
 
1182
+ <title-edition lang="fr">
1183
+
1184
+ <xsl:text>Édition </xsl:text>
1185
+
1186
+ </title-edition>
1187
+
1107
1188
 
1108
1189
  <title-toc lang="en">
1109
1190
 
@@ -1210,7 +1291,9 @@
1210
1291
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1211
1292
  </xsl:otherwise>
1212
1293
  </xsl:choose>
1213
- </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
1294
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
1295
+
1296
+ </xsl:attribute-set><xsl:attribute-set name="link-style">
1214
1297
 
1215
1298
 
1216
1299
 
@@ -3150,12 +3233,101 @@
3150
3233
 
3151
3234
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3152
3235
  </fo:block>
3153
- </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">
3236
+ </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">
3154
3237
  <xsl:apply-templates mode="contents"/>
3155
3238
  <xsl:text> </xsl:text>
3156
- </xsl:template><xsl:template match="text()" mode="contents">
3239
+ </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">
3240
+ <xsl:apply-templates mode="bookmarks"/>
3241
+ <xsl:text> </xsl:text>
3242
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3243
+ <xsl:value-of select="."/>
3244
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3157
3245
  <xsl:value-of select="."/>
3158
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3246
+ </xsl:template><xsl:template match="node()" mode="contents">
3247
+ <xsl:apply-templates mode="contents"/>
3248
+ </xsl:template><xsl:template match="node()" mode="bookmarks">
3249
+ <xsl:apply-templates mode="bookmarks"/>
3250
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3251
+ <xsl:apply-templates select="."/>
3252
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3253
+ <xsl:apply-templates mode="bookmarks"/>
3254
+ </xsl:template><xsl:template name="addBookmarks">
3255
+ <xsl:param name="contents"/>
3256
+ <xsl:if test="xalan:nodeset($contents)//item">
3257
+ <fo:bookmark-tree>
3258
+ <xsl:choose>
3259
+ <xsl:when test="xalan:nodeset($contents)/doc">
3260
+ <xsl:choose>
3261
+ <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3262
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3263
+ <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3264
+ <fo:bookmark-title>
3265
+ <xsl:variable name="bookmark-title_">
3266
+ <xsl:choose>
3267
+ <xsl:when test="@lang = 'en'">
3268
+
3269
+
3270
+ </xsl:when>
3271
+ <xsl:when test="@lang = 'fr'">
3272
+
3273
+
3274
+ </xsl:when>
3275
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3276
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3277
+ </xsl:choose>
3278
+ </xsl:variable>
3279
+ <xsl:choose>
3280
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3281
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3282
+ </xsl:when>
3283
+ <xsl:otherwise>
3284
+ <xsl:choose>
3285
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3286
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3287
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3288
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3289
+ </xsl:choose>
3290
+ </xsl:otherwise>
3291
+ </xsl:choose>
3292
+ </fo:bookmark-title>
3293
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3294
+ </fo:bookmark>
3295
+
3296
+ </xsl:for-each>
3297
+ </xsl:when>
3298
+ <xsl:otherwise>
3299
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3300
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3301
+ </xsl:for-each>
3302
+ </xsl:otherwise>
3303
+ </xsl:choose>
3304
+ </xsl:when>
3305
+ <xsl:otherwise>
3306
+ <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
3307
+ </xsl:otherwise>
3308
+ </xsl:choose>
3309
+
3310
+
3311
+
3312
+
3313
+
3314
+
3315
+
3316
+
3317
+ </fo:bookmark-tree>
3318
+ </xsl:if>
3319
+ </xsl:template><xsl:template match="item" mode="bookmark">
3320
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
3321
+ <fo:bookmark-title>
3322
+ <xsl:if test="@section != ''">
3323
+ <xsl:value-of select="@section"/>
3324
+ <xsl:text> </xsl:text>
3325
+ </xsl:if>
3326
+ <xsl:value-of select="normalize-space(title)"/>
3327
+ </fo:bookmark-title>
3328
+ <xsl:apply-templates mode="bookmark"/>
3329
+ </fo:bookmark>
3330
+ </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3159
3331
  <xsl:if test="normalize-space() != ''">
3160
3332
  <fo:block xsl:use-attribute-sets="figure-name-style">
3161
3333
 
@@ -3213,7 +3385,7 @@
3213
3385
  <xsl:apply-templates/>
3214
3386
  </xsl:otherwise>
3215
3387
  </xsl:choose>
3216
- </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
3388
+ </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
3217
3389
  <xsl:text> </xsl:text>
3218
3390
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
3219
3391
  <xsl:copy>
@@ -3824,20 +3996,29 @@
3824
3996
  <!-- 0xA0 to space replacement -->
3825
3997
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
3826
3998
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
3827
- <fo:block-container margin-left="0mm">
3828
- <xsl:if test="parent::*[local-name() = 'note']">
3829
- <xsl:attribute name="margin-left">
3830
- <xsl:choose>
3831
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3832
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3833
- </xsl:choose>
3834
- </xsl:attribute>
3835
-
3836
- </xsl:if>
3837
- <fo:block-container margin-left="0mm">
3838
- <xsl:apply-templates select="." mode="ul_ol"/>
3839
- </fo:block-container>
3840
- </fo:block-container>
3999
+ <xsl:choose>
4000
+ <xsl:when test="parent::*[local-name() = 'note']">
4001
+ <fo:block-container>
4002
+ <xsl:attribute name="margin-left">
4003
+ <xsl:choose>
4004
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
4005
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
4006
+ </xsl:choose>
4007
+ </xsl:attribute>
4008
+
4009
+ <fo:block-container margin-left="0mm">
4010
+ <fo:block>
4011
+ <xsl:apply-templates select="." mode="ul_ol"/>
4012
+ </fo:block>
4013
+ </fo:block-container>
4014
+ </fo:block-container>
4015
+ </xsl:when>
4016
+ <xsl:otherwise>
4017
+ <fo:block>
4018
+ <xsl:apply-templates select="." mode="ul_ol"/>
4019
+ </fo:block>
4020
+ </xsl:otherwise>
4021
+ </xsl:choose>
3841
4022
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
3842
4023
  <!-- <row>
3843
4024
  <date>05-07-2013</date>
@@ -4133,6 +4314,7 @@
4133
4314
 
4134
4315
 
4135
4316
 
4317
+
4136
4318
  </xsl:variable>
4137
4319
  <xsl:if test="$documentNS != $XSLNS">
4138
4320
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4158,4 +4340,21 @@
4158
4340
  </xsl:otherwise>
4159
4341
  </xsl:choose>
4160
4342
  </xsl:attribute>
4343
+ </xsl:template><xsl:template name="add-letter-spacing">
4344
+ <xsl:param name="text"/>
4345
+ <xsl:param name="letter-spacing" select="'0.15'"/>
4346
+ <xsl:if test="string-length($text) &gt; 0">
4347
+ <xsl:variable name="char" select="substring($text, 1, 1)"/>
4348
+ <fo:inline padding-right="{$letter-spacing}mm">
4349
+ <xsl:if test="$char = '®'">
4350
+ <xsl:attribute name="font-size">58%</xsl:attribute>
4351
+ <xsl:attribute name="baseline-shift">30%</xsl:attribute>
4352
+ </xsl:if>
4353
+ <xsl:value-of select="$char"/>
4354
+ </fo:inline>
4355
+ <xsl:call-template name="add-letter-spacing">
4356
+ <xsl:with-param name="text" select="substring($text, 2)"/>
4357
+ <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4358
+ </xsl:call-template>
4359
+ </xsl:if>
4161
4360
  </xsl:template></xsl:stylesheet>
@@ -85,6 +85,9 @@
85
85
 
86
86
  <xsl:call-template name="addPDFUAmeta"/>
87
87
 
88
+ <xsl:call-template name="addBookmarks">
89
+ <xsl:with-param name="contents" select="$contents"/>
90
+ </xsl:call-template>
88
91
 
89
92
  <!-- Cover Page -->
90
93
  <fo:page-sequence master-reference="cover-page" force-page-count="even">
@@ -197,7 +200,7 @@
197
200
  </xsl:variable>
198
201
  <fo:block font-size="9pt" text-align="right" font-style="italic" margin-bottom="6pt"><xsl:value-of select="$title-page"/></fo:block>
199
202
  <fo:block>
200
- <xsl:for-each select="xalan:nodeset($contents)//item[not (@type = 'annex' or @parent = 'annex')]">
203
+ <xsl:for-each select="xalan:nodeset($contents)//item[not (@type = 'annex' or @parent = 'annex') and @display = 'true']">
201
204
 
202
205
  <fo:block>
203
206
 
@@ -208,7 +211,7 @@
208
211
  <xsl:if test="@level &gt;= 3 and @section != ''">
209
212
  <xsl:attribute name="margin-left">28mm</xsl:attribute>
210
213
  </xsl:if>
211
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
214
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
212
215
  <xsl:if test="@section != ''">
213
216
  <fo:inline>
214
217
  <xsl:attribute name="padding-right">
@@ -222,7 +225,7 @@
222
225
  </fo:inline>
223
226
  </xsl:if>
224
227
 
225
- <xsl:apply-templates/>
228
+ <xsl:apply-templates select="title"/>
226
229
  <xsl:text> </xsl:text>
227
230
 
228
231
  <fo:inline keep-together.within-line="always">
@@ -235,12 +238,12 @@
235
238
 
236
239
  </xsl:for-each>
237
240
 
238
- <xsl:if test="xalan:nodeset($contents)//item[@type = 'annex']">
241
+ <xsl:if test="xalan:nodeset($contents)//item[@type = 'annex' and @display = 'true']">
239
242
  <fo:block text-align="center" margin-top="12pt" margin-bottom="12pt">ANNEXES</fo:block>
240
- <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'annex']">
243
+ <xsl:for-each select="xalan:nodeset($contents)//item[@type = 'annex' and @display = 'true']">
241
244
  <fo:block>
242
245
  <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
243
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{text()}">
246
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{@section}">
244
247
  <xsl:if test="@section != ''">
245
248
  <fo:inline padding-right="3mm">
246
249
  <xsl:choose>
@@ -349,9 +352,7 @@
349
352
 
350
353
 
351
354
  <xsl:variable name="display">
352
- <xsl:choose>
353
- <xsl:when test="ancestor-or-self::un:bibitem">false</xsl:when>
354
- <xsl:when test="ancestor-or-self::un:term">false</xsl:when>
355
+ <xsl:choose>
355
356
  <xsl:when test="ancestor-or-self::un:annex and $level &gt;= 2">false</xsl:when>
356
357
  <xsl:when test="$level &gt; 3">false</xsl:when>
357
358
  <xsl:when test="@inline-header='true'">false</xsl:when>
@@ -359,6 +360,14 @@
359
360
  </xsl:choose>
360
361
  </xsl:variable>
361
362
 
363
+ <xsl:variable name="skip">
364
+ <xsl:choose>
365
+ <xsl:when test="ancestor-or-self::un:bibitem">true</xsl:when>
366
+ <xsl:when test="ancestor-or-self::un:term">true</xsl:when>
367
+ <xsl:when test="@inline-header='true'">true</xsl:when>
368
+ <xsl:otherwise>false</xsl:otherwise>
369
+ </xsl:choose>
370
+ </xsl:variable>
362
371
 
363
372
  <xsl:if test="$display = 'true'">
364
373
 
@@ -374,10 +383,13 @@
374
383
  <xsl:value-of select="local-name()"/>
375
384
  </xsl:variable>
376
385
 
377
- <item id="{@id}" level="{$level}" section="{$section}" type="{$type}">
378
- <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
386
+ <item id="{@id}" level="{$level}" section="{$section}" type="{$type}" display="{$display}">
387
+ <title>
388
+ <xsl:apply-templates select="xalan:nodeset($title)" mode="contents_item"/>
389
+ </title>
390
+ <xsl:apply-templates mode="contents"/>
379
391
  </item>
380
- <xsl:apply-templates mode="contents"/>
392
+
381
393
  </xsl:if>
382
394
 
383
395
  </xsl:template>
@@ -1055,6 +1067,12 @@
1055
1067
 
1056
1068
  </title-edition>
1057
1069
 
1070
+ <title-edition lang="fr">
1071
+
1072
+ <xsl:text>Édition </xsl:text>
1073
+
1074
+ </title-edition>
1075
+
1058
1076
 
1059
1077
  <title-toc lang="en">
1060
1078
 
@@ -1163,7 +1181,9 @@
1163
1181
  <xsl:value-of select="$titles/*[local-name() = $name][@lang = 'en']"/>
1164
1182
  </xsl:otherwise>
1165
1183
  </xsl:choose>
1166
- </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
1184
+ </xsl:template><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="root-style">
1185
+
1186
+ </xsl:attribute-set><xsl:attribute-set name="link-style">
1167
1187
 
1168
1188
 
1169
1189
 
@@ -3118,12 +3138,101 @@
3118
3138
 
3119
3139
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
3120
3140
  </fo:block>
3121
- </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">
3141
+ </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">
3122
3142
  <xsl:apply-templates mode="contents"/>
3123
3143
  <xsl:text> </xsl:text>
3124
- </xsl:template><xsl:template match="text()" mode="contents">
3144
+ </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">
3145
+ <xsl:apply-templates mode="bookmarks"/>
3146
+ <xsl:text> </xsl:text>
3147
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="contents" priority="2">
3148
+ <xsl:value-of select="."/>
3149
+ </xsl:template><xsl:template match="*[local-name() = 'name']/text()" mode="bookmarks" priority="2">
3125
3150
  <xsl:value-of select="."/>
3126
- </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3151
+ </xsl:template><xsl:template match="node()" mode="contents">
3152
+ <xsl:apply-templates mode="contents"/>
3153
+ </xsl:template><xsl:template match="node()" mode="bookmarks">
3154
+ <xsl:apply-templates mode="bookmarks"/>
3155
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="contents">
3156
+ <xsl:apply-templates select="."/>
3157
+ </xsl:template><xsl:template match="*[local-name() = 'stem']" mode="bookmarks">
3158
+ <xsl:apply-templates mode="bookmarks"/>
3159
+ </xsl:template><xsl:template name="addBookmarks">
3160
+ <xsl:param name="contents"/>
3161
+ <xsl:if test="xalan:nodeset($contents)//item">
3162
+ <fo:bookmark-tree>
3163
+ <xsl:choose>
3164
+ <xsl:when test="xalan:nodeset($contents)/doc">
3165
+ <xsl:choose>
3166
+ <xsl:when test="count(xalan:nodeset($contents)/doc) &gt; 1">
3167
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3168
+ <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
3169
+ <fo:bookmark-title>
3170
+ <xsl:variable name="bookmark-title_">
3171
+ <xsl:choose>
3172
+ <xsl:when test="@lang = 'en'">
3173
+
3174
+
3175
+ </xsl:when>
3176
+ <xsl:when test="@lang = 'fr'">
3177
+
3178
+
3179
+ </xsl:when>
3180
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3181
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3182
+ </xsl:choose>
3183
+ </xsl:variable>
3184
+ <xsl:choose>
3185
+ <xsl:when test="normalize-space($bookmark-title_) != ''">
3186
+ <xsl:value-of select="normalize-space($bookmark-title_)"/>
3187
+ </xsl:when>
3188
+ <xsl:otherwise>
3189
+ <xsl:choose>
3190
+ <xsl:when test="@lang = 'en'">English</xsl:when>
3191
+ <xsl:when test="@lang = 'fr'">Français</xsl:when>
3192
+ <xsl:when test="@lang = 'de'">Deutsche</xsl:when>
3193
+ <xsl:otherwise><xsl:value-of select="@lang"/> version</xsl:otherwise>
3194
+ </xsl:choose>
3195
+ </xsl:otherwise>
3196
+ </xsl:choose>
3197
+ </fo:bookmark-title>
3198
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3199
+ </fo:bookmark>
3200
+
3201
+ </xsl:for-each>
3202
+ </xsl:when>
3203
+ <xsl:otherwise>
3204
+ <xsl:for-each select="xalan:nodeset($contents)/doc">
3205
+ <xsl:apply-templates select="contents/item" mode="bookmark"/>
3206
+ </xsl:for-each>
3207
+ </xsl:otherwise>
3208
+ </xsl:choose>
3209
+ </xsl:when>
3210
+ <xsl:otherwise>
3211
+ <xsl:apply-templates select="xalan:nodeset($contents)/contents/item" mode="bookmark"/>
3212
+ </xsl:otherwise>
3213
+ </xsl:choose>
3214
+
3215
+
3216
+
3217
+
3218
+
3219
+
3220
+
3221
+
3222
+ </fo:bookmark-tree>
3223
+ </xsl:if>
3224
+ </xsl:template><xsl:template match="item" mode="bookmark">
3225
+ <fo:bookmark internal-destination="{@id}" starting-state="hide">
3226
+ <fo:bookmark-title>
3227
+ <xsl:if test="@section != ''">
3228
+ <xsl:value-of select="@section"/>
3229
+ <xsl:text> </xsl:text>
3230
+ </xsl:if>
3231
+ <xsl:value-of select="normalize-space(title)"/>
3232
+ </fo:bookmark-title>
3233
+ <xsl:apply-templates mode="bookmark"/>
3234
+ </fo:bookmark>
3235
+ </xsl:template><xsl:template match="title" mode="bookmark"/><xsl:template match="text()" mode="bookmark"/><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'name'] | *[local-name() = 'image']/*[local-name() = 'name']" mode="presentation">
3127
3236
  <xsl:if test="normalize-space() != ''">
3128
3237
  <fo:block xsl:use-attribute-sets="figure-name-style">
3129
3238
 
@@ -3181,7 +3290,7 @@
3181
3290
  <xsl:apply-templates/>
3182
3291
  </xsl:otherwise>
3183
3292
  </xsl:choose>
3184
- </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
3293
+ </xsl:template><xsl:template match="*[local-name() = 'fn']" mode="contents"/><xsl:template match="*[local-name() = 'fn']" mode="bookmarks"/><xsl:template match="*[local-name() = 'fn']" mode="contents_item"/><xsl:template match="*[local-name() = 'tab']" mode="contents_item">
3185
3294
  <xsl:text> </xsl:text>
3186
3295
  </xsl:template><xsl:template match="*[local-name() = 'strong']" mode="contents_item">
3187
3296
  <xsl:copy>
@@ -3792,20 +3901,29 @@
3792
3901
  <!-- 0xA0 to space replacement -->
3793
3902
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),' ',' ')"/>
3794
3903
  </xsl:template><xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
3795
- <fo:block-container margin-left="0mm">
3796
- <xsl:if test="parent::*[local-name() = 'note']">
3797
- <xsl:attribute name="margin-left">
3798
- <xsl:choose>
3799
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3800
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3801
- </xsl:choose>
3802
- </xsl:attribute>
3803
-
3804
- </xsl:if>
3805
- <fo:block-container margin-left="0mm">
3806
- <xsl:apply-templates select="." mode="ul_ol"/>
3807
- </fo:block-container>
3808
- </fo:block-container>
3904
+ <xsl:choose>
3905
+ <xsl:when test="parent::*[local-name() = 'note']">
3906
+ <fo:block-container>
3907
+ <xsl:attribute name="margin-left">
3908
+ <xsl:choose>
3909
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
3910
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
3911
+ </xsl:choose>
3912
+ </xsl:attribute>
3913
+
3914
+ <fo:block-container margin-left="0mm">
3915
+ <fo:block>
3916
+ <xsl:apply-templates select="." mode="ul_ol"/>
3917
+ </fo:block>
3918
+ </fo:block-container>
3919
+ </fo:block-container>
3920
+ </xsl:when>
3921
+ <xsl:otherwise>
3922
+ <fo:block>
3923
+ <xsl:apply-templates select="." mode="ul_ol"/>
3924
+ </fo:block>
3925
+ </xsl:otherwise>
3926
+ </xsl:choose>
3809
3927
  </xsl:template><xsl:template match="*[local-name() = 'errata']">
3810
3928
  <!-- <row>
3811
3929
  <date>05-07-2013</date>
@@ -4101,6 +4219,7 @@
4101
4219
 
4102
4220
 
4103
4221
 
4222
+
4104
4223
  </xsl:variable>
4105
4224
  <xsl:if test="$documentNS != $XSLNS">
4106
4225
  <xsl:message>[WARNING]: Document namespace: '<xsl:value-of select="$documentNS"/>' doesn't equal to xslt namespace '<xsl:value-of select="$XSLNS"/>'</xsl:message>
@@ -4126,4 +4245,21 @@
4126
4245
  </xsl:otherwise>
4127
4246
  </xsl:choose>
4128
4247
  </xsl:attribute>
4248
+ </xsl:template><xsl:template name="add-letter-spacing">
4249
+ <xsl:param name="text"/>
4250
+ <xsl:param name="letter-spacing" select="'0.15'"/>
4251
+ <xsl:if test="string-length($text) &gt; 0">
4252
+ <xsl:variable name="char" select="substring($text, 1, 1)"/>
4253
+ <fo:inline padding-right="{$letter-spacing}mm">
4254
+ <xsl:if test="$char = '®'">
4255
+ <xsl:attribute name="font-size">58%</xsl:attribute>
4256
+ <xsl:attribute name="baseline-shift">30%</xsl:attribute>
4257
+ </xsl:if>
4258
+ <xsl:value-of select="$char"/>
4259
+ </fo:inline>
4260
+ <xsl:call-template name="add-letter-spacing">
4261
+ <xsl:with-param name="text" select="substring($text, 2)"/>
4262
+ <xsl:with-param name="letter-spacing" select="$letter-spacing"/>
4263
+ </xsl:call-template>
4264
+ </xsl:if>
4129
4265
  </xsl:template></xsl:stylesheet>
@@ -108,7 +108,7 @@ module IsoDoc
108
108
  leaf_section?(clause) and
109
109
  label_annex_leaf_section(clause, num, 1) and return
110
110
  @anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
111
- type: "clause",
111
+ type: "clause", value: num,
112
112
  xref: "#{@labels['annex']} #{num}", level: 1 }
113
113
  if a = single_annex_special_section(clause)
114
114
  annex_names1(a, "#{num}", 1)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.5.3"
3
+ VERSION = "0.5.4"
4
4
  end
5
5
  end
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "twitter_cldr"
31
31
  spec.add_dependency "iso-639"
32
32
 
33
- spec.add_dependency "metanorma-standoc", "~> 1.5.0"
33
+ spec.add_dependency "metanorma-standoc", "~> 1.6.0"
34
34
  spec.add_dependency "isodoc", "~> 1.2.0"
35
35
 
36
36
  spec.add_development_dependency "byebug", "~> 9.1"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-11 00:00:00.000000000 Z
11
+ date: 2020-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roman-numerals
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.5.0
61
+ version: 1.6.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.5.0
68
+ version: 1.6.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: isodoc
71
71
  requirement: !ruby/object:Gem::Requirement