metanorma-bipm 1.1.5 → 1.1.8

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: ce04d9fdc61d348dfd6047b1ea0ceb1baa3e19ce43234eba3e4e34cd4b919e25
4
- data.tar.gz: 4a17c9886bb369033e5abed5f4d1b287d3aca8e7bb18e1b3f2b489ee5806b14f
3
+ metadata.gz: 0f258a2387575d227d79ffe3950fa8768f29cd319eaf4e929197a635304ef247
4
+ data.tar.gz: e4f8f7a88bdec337362131fd8535a96f904dba6b703fcc8d9604fca5026563e9
5
5
  SHA512:
6
- metadata.gz: 5ae9001cd216cf9b16e3561e41707424027a8844a250d5af55ba4f1c1197877f947091877db0d6363932583cd9ea3f7361996facc3124d077dacc5470cd44ea0
7
- data.tar.gz: 5f3057a4a8666527a916251a659d2f49cd43ebd2d45a9f2e1b280eded7af3c94d2ea9fae8aeed358f4ae0cda4d64f5dcc9e58b6c46444ed6f97283f27cd3f1a8
6
+ metadata.gz: 2f3819a2b709b1befe0df2ed04f53647b12cee97be3494b8477e3326f5ec531f2558274e1fae49b5be4071117e0e34cef0ff47a4dacadee28ec46be064cb61b2
7
+ data.tar.gz: '031558adb23c13e72bf4995e78a7979c26b0438f897ae85f4181dfa03870d2062701df86f80ab3e894f5816aaabbc9c7e3ad5b3865f4febc265821c02dd08244'
@@ -32,6 +32,18 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="section-title">
36
+ <element name="title">
37
+ <zeroOrMore>
38
+ <ref name="TextElement"/>
39
+ </zeroOrMore>
40
+ </element>
41
+ <zeroOrMore>
42
+ <element name="variant-title">
43
+ <ref name="TypedTitleString"/>
44
+ </element>
45
+ </zeroOrMore>
46
+ </define>
35
47
  <define name="hyperlink">
36
48
  <element name="link">
37
49
  <attribute name="target">
@@ -158,15 +170,17 @@
158
170
  <data type="boolean"/>
159
171
  </attribute>
160
172
  </optional>
161
- <attribute name="type">
162
- <choice>
163
- <value>roman</value>
164
- <value>alphabet</value>
165
- <value>arabic</value>
166
- <value>roman_upper</value>
167
- <value>alphabet_upper</value>
168
- </choice>
169
- </attribute>
173
+ <optional>
174
+ <attribute name="type">
175
+ <choice>
176
+ <value>roman</value>
177
+ <value>alphabet</value>
178
+ <value>arabic</value>
179
+ <value>roman_upper</value>
180
+ <value>alphabet_upper</value>
181
+ </choice>
182
+ </attribute>
183
+ </optional>
170
184
  <oneOrMore>
171
185
  <ref name="li"/>
172
186
  </oneOrMore>
@@ -1011,8 +1025,14 @@
1011
1025
  <ref name="imagemap"/>
1012
1026
  <ref name="svgmap"/>
1013
1027
  <ref name="inputform"/>
1028
+ <ref name="toc"/>
1014
1029
  </choice>
1015
1030
  </define>
1031
+ <define name="toc">
1032
+ <element name="toc">
1033
+ <ref name="ul"/>
1034
+ </element>
1035
+ </define>
1016
1036
  <define name="inputform">
1017
1037
  <element name="form">
1018
1038
  <attribute name="id">
@@ -1254,6 +1274,12 @@
1254
1274
  <optional>
1255
1275
  <attribute name="type"/>
1256
1276
  </optional>
1277
+ <optional>
1278
+ <attribute name="identifier"/>
1279
+ </optional>
1280
+ <optional>
1281
+ <attribute name="prefix"/>
1282
+ </optional>
1257
1283
  <text/>
1258
1284
  </define>
1259
1285
  <define name="ics">
@@ -64,9 +64,9 @@
64
64
  <optional>
65
65
  <ref name="label"/>
66
66
  </optional>
67
- <optional>
67
+ <zeroOrMore>
68
68
  <ref name="subject"/>
69
- </optional>
69
+ </zeroOrMore>
70
70
  <zeroOrMore>
71
71
  <ref name="reqinherit"/>
72
72
  </zeroOrMore>
@@ -80,6 +80,7 @@
80
80
  <ref name="verification"/>
81
81
  <ref name="import"/>
82
82
  <ref name="description"/>
83
+ <ref name="component"/>
83
84
  </choice>
84
85
  </zeroOrMore>
85
86
  <optional>
@@ -105,12 +106,16 @@
105
106
  </define>
106
107
  <define name="subject">
107
108
  <element name="subject">
108
- <text/>
109
+ <oneOrMore>
110
+ <ref name="TextElement"/>
111
+ </oneOrMore>
109
112
  </element>
110
113
  </define>
111
114
  <define name="reqinherit">
112
115
  <element name="inherit">
113
- <text/>
116
+ <oneOrMore>
117
+ <ref name="TextElement"/>
118
+ </oneOrMore>
114
119
  </element>
115
120
  </define>
116
121
  <define name="measurementtarget">
@@ -138,6 +143,12 @@
138
143
  <ref name="RequirementSubpart"/>
139
144
  </element>
140
145
  </define>
146
+ <define name="component">
147
+ <element name="component">
148
+ <attribute name="class"/>
149
+ <ref name="RequirementSubpart"/>
150
+ </element>
151
+ </define>
141
152
  <define name="reqt_references">
142
153
  <element name="references">
143
154
  <oneOrMore>
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bipm="https://www.metanorma.org/ns/bipm" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bipm="https://www.metanorma.org/ns/bipm" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output version="1.0" method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -13,6 +13,10 @@
13
13
  <!-- param for second pass -->
14
14
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
15
15
 
16
+ <xsl:param name="add_math_as_text">true</xsl:param>
17
+
18
+ <xsl:param name="add_math_as_attachment">true</xsl:param>
19
+
16
20
  <xsl:variable name="first_pass" select="count($index//item) = 0"/>
17
21
 
18
22
  <xsl:variable name="pageWidth" select="210"/>
@@ -206,6 +210,37 @@
206
210
  </xsl:template>
207
211
 
208
212
 
213
+ <xsl:variable name="mathml_attachments">
214
+ <xsl:if test="$add_math_as_attachment = 'true'">
215
+ <xsl:for-each select="//mathml:math">
216
+
217
+ <xsl:variable name="sequence_number"><xsl:number level="any" format="00001"/></xsl:variable>
218
+
219
+ <xsl:variable name="clause_title_number" select="ancestor-or-self::bipm:clause[bipm:title[bipm:tab]][1]/bipm:title/node()[1]"/>
220
+
221
+ <xsl:variable name="mathml_filename">
222
+ <xsl:text>math</xsl:text>
223
+ <xsl:if test="$clause_title_number != '' and translate($clause_title_number, '.123456789', '') = ''">
224
+ <xsl:text>_</xsl:text>
225
+ <xsl:value-of select="$clause_title_number"/>
226
+ <xsl:text>_</xsl:text>
227
+ </xsl:if>
228
+ <xsl:value-of select="$sequence_number"/>
229
+ <xsl:text>.mml</xsl:text>
230
+ </xsl:variable>
231
+
232
+ <xsl:variable name="mathml_content">
233
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
234
+ </xsl:variable>
235
+
236
+ <attachment filename="{$mathml_filename}">
237
+ <xsl:value-of select="$mathml_content"/>
238
+ </attachment>
239
+
240
+ </xsl:for-each>
241
+ </xsl:if>
242
+ </xsl:variable>
243
+
209
244
 
210
245
  <xsl:template match="/">
211
246
  <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
@@ -308,6 +343,23 @@
308
343
 
309
344
  <fo:declarations>
310
345
  <xsl:call-template name="addPDFUAmeta"/>
346
+
347
+ <xsl:if test="$add_math_as_attachment = 'true'">
348
+ <xsl:for-each select="xalan:nodeset($mathml_attachments)//attachment">
349
+
350
+ <xsl:variable name="mathml_filename" select="@filename"/>
351
+ <xsl:variable name="mathml_content" select="."/>
352
+
353
+ <xsl:variable name="basepath" select="java:org.metanorma.fop.Util.saveFileToDisk($mathml_filename,$mathml_content)"/>
354
+
355
+ <xsl:variable name="url" select="concat('url(file:',$basepath, ')')"/>
356
+
357
+ <xsl:if test="normalize-space($url) != ''">
358
+ <pdf:embedded-file src="{$url}" filename="{$mathml_filename}"/>
359
+ </xsl:if>
360
+ </xsl:for-each>
361
+ </xsl:if>
362
+
311
363
  </fo:declarations>
312
364
 
313
365
  <xsl:call-template name="addBookmarks">
@@ -1066,7 +1118,7 @@
1066
1118
  </fo:block-container>
1067
1119
 
1068
1120
  <fo:block-container font-size="18pt" font-weight="bold" text-align="center">
1069
- <fo:block>
1121
+ <fo:block role="H1">
1070
1122
  <xsl:value-of select="//bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type='cover']"/>
1071
1123
  </fo:block>
1072
1124
  </fo:block-container>
@@ -1165,7 +1217,7 @@
1165
1217
 
1166
1218
  <fo:block-container margin-left="-14mm" margin-right="0mm">
1167
1219
  <fo:block-container margin-left="0mm" margin-right="0mm">
1168
- <fo:block font-family="Arial" font-size="16pt" font-weight="bold" text-align-last="justify" margin-bottom="82pt">
1220
+ <fo:block font-family="Arial" font-size="16pt" font-weight="bold" text-align-last="justify" margin-bottom="82pt" role="H1">
1169
1221
  <!-- <fo:marker marker-class-name="header-title"><xsl:value-of select="$title-toc"/></fo:marker> -->
1170
1222
  <fo:inline><xsl:value-of select="//bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type='main']"/></fo:inline>
1171
1223
  <fo:inline keep-together.within-line="always">
@@ -1179,7 +1231,7 @@
1179
1231
  </fo:block-container>
1180
1232
 
1181
1233
  <fo:block-container line-height="135%">
1182
- <fo:block>
1234
+ <fo:block role="TOC">
1183
1235
  <!-- <xsl:copy-of select="$contents"/> -->
1184
1236
 
1185
1237
  <xsl:if test="xalan:nodeset($contents)/doc[@id = $docid]//item[@display='true']">
@@ -1280,7 +1332,7 @@
1280
1332
  </fo:block-container>
1281
1333
 
1282
1334
  <fo:block-container font-size="18pt" font-weight="bold" text-align="center">
1283
- <fo:block>
1335
+ <fo:block role="H1">
1284
1336
 
1285
1337
  <!-- <xsl:variable name="title"> -->
1286
1338
  <xsl:choose>
@@ -1315,7 +1367,7 @@
1315
1367
 
1316
1368
  <xsl:variable name="part_num" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:part)"/>
1317
1369
  <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'part']">
1318
- <fo:block>
1370
+ <fo:block role="H2">
1319
1371
  <xsl:if test="$part_num != ''">
1320
1372
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-part[@lang=$curr_lang]),'#',$part_num)"/>
1321
1373
  </xsl:if>
@@ -1325,7 +1377,7 @@
1325
1377
  </xsl:if>
1326
1378
  <xsl:variable name="subpart_num" select="normalize-space(/bipm:bipm-standard/bipm:bibdata/bipm:ext/bipm:structuredidentifier/bipm:subpart)"/>
1327
1379
  <xsl:if test="/bipm:bipm-standard/bipm:bibdata/bipm:title[@language = $curr_lang and @type = 'subpart']">
1328
- <fo:block>
1380
+ <fo:block role="H3">
1329
1381
  <xsl:if test="$subpart_num != ''">
1330
1382
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($titles/title-subpart[@lang=$curr_lang]),'#',$subpart_num)"/>
1331
1383
  </xsl:if>
@@ -1464,7 +1516,7 @@
1464
1516
  <xsl:otherwise>400</xsl:otherwise>
1465
1517
  </xsl:choose>
1466
1518
  </xsl:variable>
1467
- <fo:block>
1519
+ <fo:block role="H1">
1468
1520
  <xsl:if test="$title_num != 1">
1469
1521
  <xsl:attribute name="text-align">right</xsl:attribute>
1470
1522
  </xsl:if>
@@ -1504,8 +1556,8 @@
1504
1556
 
1505
1557
  <fo:block-container absolute-position="fixed" left="12.5mm" top="60mm">
1506
1558
 
1507
- <fo:block font-size="22.2pt" font-weight="{$weight-normal}"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'main']"/></fo:block>
1508
- <fo:block font-size="22.2pt" font-weight="{$weight-bold}" margin-top="1mm"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'main']"/></fo:block>
1559
+ <fo:block font-size="22.2pt" font-weight="{$weight-normal}" role="H1"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'main']"/></fo:block>
1560
+ <fo:block font-size="22.2pt" font-weight="{$weight-bold}" margin-top="1mm" role="H1"><xsl:value-of select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'en' and @type = 'main']"/></fo:block>
1509
1561
 
1510
1562
  <xsl:variable name="edition_str">édition</xsl:variable>
1511
1563
  <!-- <xsl:choose>
@@ -1518,7 +1570,7 @@
1518
1570
 
1519
1571
  <!-- <fo:block-container height="98%" display-align="center"> -->
1520
1572
  <fo:block-container absolute-position="fixed" left="12.5mm" top="92mm" height="170mm" width="144mm" display-align="center">
1521
- <fo:block>
1573
+ <fo:block role="H1">
1522
1574
 
1523
1575
  <xsl:variable name="title_appendix_fr">
1524
1576
  <xsl:apply-templates select="(//bipm:bipm-standard)[1]/bipm:bibdata/bipm:title[@language = 'fr' and @type = 'appendix']" mode="title"/>
@@ -1823,7 +1875,7 @@
1823
1875
  </xsl:call-template>
1824
1876
  </fo:block>
1825
1877
  <fo:block-container font-size="12pt" font-weight="bold" border-top="0.5pt solid black" padding-top="2mm" width="45mm">
1826
- <fo:block>
1878
+ <fo:block role="H1">
1827
1879
  <xsl:call-template name="add-letter-spacing">
1828
1880
  <xsl:with-param name="text" select="$title"/>
1829
1881
  <xsl:with-param name="letter-spacing" select="0.09"/>
@@ -1932,7 +1984,7 @@
1932
1984
  <xsl:if test="normalize-space($space-after) != ''">
1933
1985
  <xsl:attribute name="padding-bottom"><xsl:value-of select="normalize-space($space-after)"/></xsl:attribute>
1934
1986
  </xsl:if>
1935
- <fo:block>
1987
+ <fo:block role="TOCI">
1936
1988
  <xsl:if test="@level = 1">
1937
1989
  <!-- <xsl:attribute name="space-after">6pt</xsl:attribute> -->
1938
1990
  <xsl:attribute name="font-family">Arial</xsl:attribute>
@@ -2247,7 +2299,10 @@
2247
2299
  </xsl:template>
2248
2300
 
2249
2301
  <xsl:template match="bipm:license-statement//bipm:title">
2250
- <fo:block text-decoration="underline" margin-bottom="6pt">
2302
+ <xsl:variable name="level">
2303
+ <xsl:call-template name="getLevel"/>
2304
+ </xsl:variable>
2305
+ <fo:block text-decoration="underline" margin-bottom="6pt" role="H{$level}">
2251
2306
  <xsl:apply-templates/>
2252
2307
  </fo:block>
2253
2308
  </xsl:template>
@@ -2378,19 +2433,20 @@
2378
2433
 
2379
2434
  <xsl:choose>
2380
2435
  <xsl:when test="*[local-name() = 'tab'] and not(ancestor::bipm:annex) "><!-- split number and title --> <!-- and $independentAppendix = '' -->
2381
- <fo:table table-layout="fixed" width="100%">
2436
+ <fo:table table-layout="fixed" width="100%" role="H{$level}">
2382
2437
  <fo:table-column column-width="14mm"/>
2383
2438
  <fo:table-column column-width="136mm"/>
2384
2439
  <fo:table-body>
2385
2440
  <fo:table-row>
2386
2441
  <fo:table-cell>
2387
- <fo:block>
2442
+ <fo:block role="H{$level}">
2388
2443
  <xsl:value-of select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
2389
2444
  </fo:block>
2390
2445
  </fo:table-cell>
2391
2446
  <fo:table-cell>
2392
- <fo:block line-height-shift-adjustment="disregard-shifts">
2447
+ <fo:block line-height-shift-adjustment="disregard-shifts" role="H{$level}">
2393
2448
  <xsl:call-template name="extractTitle"/>
2449
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
2394
2450
  </fo:block>
2395
2451
  </fo:table-cell>
2396
2452
  </fo:table-row>
@@ -2398,7 +2454,7 @@
2398
2454
  </fo:table>
2399
2455
  </xsl:when>
2400
2456
  <xsl:otherwise>
2401
- <fo:block>
2457
+ <fo:block role="H{$level}">
2402
2458
  <!-- <xsl:if test="$independentAppendix != ''">
2403
2459
  <xsl:attribute name="margin-left">14mm</xsl:attribute>
2404
2460
  </xsl:if> -->
@@ -2420,11 +2476,13 @@
2420
2476
  <xsl:attribute name="text-align">center</xsl:attribute>
2421
2477
  </xsl:if>
2422
2478
  <xsl:call-template name="extractTitle"/>
2479
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
2423
2480
  </xsl:when>
2424
2481
  <xsl:otherwise>
2425
2482
  <!-- <xsl:choose>
2426
2483
  <xsl:when test="$independentAppendix = ''"> -->
2427
2484
  <xsl:apply-templates/>
2485
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
2428
2486
  <!-- </xsl:when>
2429
2487
  <xsl:otherwise>
2430
2488
  <xsl:variable name="section" select="*[local-name() = 'tab'][1]/preceding-sibling::node()"/>
@@ -3039,6 +3097,7 @@
3039
3097
  <xsl:attribute name="font-family">Arial</xsl:attribute>
3040
3098
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3041
3099
  <xsl:attribute name="line-height">130%</xsl:attribute>
3100
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
3042
3101
  </xsl:if>
3043
3102
  <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
3044
3103
  <xsl:apply-templates/>
@@ -3083,6 +3142,7 @@
3083
3142
  <xsl:attribute name="font-family">Arial</xsl:attribute>
3084
3143
  <xsl:attribute name="font-size">9pt</xsl:attribute>
3085
3144
  <xsl:attribute name="line-height">130%</xsl:attribute>
3145
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
3086
3146
  </xsl:if>
3087
3147
 
3088
3148
  <!-- last item -->
@@ -3240,16 +3300,19 @@
3240
3300
  </fo:block>
3241
3301
  </xsl:template>
3242
3302
 
3243
- <xsl:template match="bipm:preferred">
3244
- <fo:block font-weight="bold" keep-with-next="always" space-before="8pt" margin-bottom="6pt">
3245
- <xsl:if test="ancestor::bipm:term/bipm:name">
3246
- <fo:inline>
3247
- <xsl:attribute name="padding-right">2mm</xsl:attribute>
3248
- <xsl:apply-templates select="ancestor::bipm:term/bipm:name" mode="presentation"/>
3249
- </fo:inline>
3250
- </xsl:if>
3251
- <xsl:apply-templates/>
3252
- </fo:block>
3303
+ <xsl:template match="bipm:preferred">
3304
+ <fo:block font-weight="bold" keep-with-next="always" space-before="8pt" margin-bottom="6pt">
3305
+ <xsl:if test="ancestor::bipm:term/bipm:name">
3306
+ <xsl:variable name="level">
3307
+ <xsl:call-template name="getLevelTermName"/>
3308
+ </xsl:variable>
3309
+ <fo:inline role="H{$level}">
3310
+ <xsl:attribute name="padding-right">2mm</xsl:attribute>
3311
+ <xsl:apply-templates select="ancestor::bipm:term/bipm:name" mode="presentation"/>
3312
+ </fo:inline>
3313
+ </xsl:if>
3314
+ <xsl:apply-templates/>
3315
+ </fo:block>
3253
3316
  </xsl:template>
3254
3317
 
3255
3318
  <xsl:template match="bipm:bibitem">
@@ -3647,10 +3710,116 @@
3647
3710
  <xsl:value-of select="translate(., ' ', ' ')"/>
3648
3711
  </xsl:template>
3649
3712
 
3713
+ <xsl:template match="mathml:math" priority="2">
3714
+ <xsl:variable name="isAdded" select="@added"/>
3715
+ <xsl:variable name="isDeleted" select="@deleted"/>
3716
+
3717
+ <fo:inline xsl:use-attribute-sets="mathml-style">
3718
+
3719
+ <xsl:if test="ancestor::*[local-name()='table']">
3720
+ <xsl:attribute name="font-size">95%</xsl:attribute> <!-- base font in table is 10pt -->
3721
+ </xsl:if>
3722
+
3723
+ <xsl:call-template name="setTrackChangesStyles">
3724
+ <xsl:with-param name="isAdded" select="$isAdded"/>
3725
+ <xsl:with-param name="isDeleted" select="$isDeleted"/>
3726
+ </xsl:call-template>
3727
+
3728
+ <xsl:if test="$add_math_as_text = 'true'">
3729
+ <!-- set unique font-size (fiction) -->
3730
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
3731
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal">​</fo:inline> <!-- zero width space -->
3732
+ </xsl:if>
3733
+
3734
+ <!-- <fo:wrapper role="artifact"> -->
3735
+
3736
+ <xsl:variable name="mathml_content">
3737
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3738
+ </xsl:variable>
3739
+
3740
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3741
+ <xsl:variable name="comment_text_">
3742
+ <xsl:choose>
3743
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3744
+ <xsl:value-of select="$comment_text_following"/>
3745
+ </xsl:when>
3746
+ <xsl:otherwise>
3747
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3748
+ </xsl:otherwise>
3749
+ </xsl:choose>
3750
+ </xsl:variable>
3751
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3752
+
3753
+ <xsl:choose>
3754
+ <xsl:when test="$add_math_as_attachment = 'true'">
3755
+
3756
+ <xsl:variable name="filename" select="xalan:nodeset($mathml_attachments)//attachment[. = $mathml_content]/@filename"/>
3757
+ <xsl:if test="$filename != ''">
3758
+ <xsl:variable name="url" select="concat('url(embedded-file:', $filename, ')')"/>
3759
+ <fo:basic-link external-destination="{$url}" fox:alt-text="MathLink">
3760
+ <xsl:if test="normalize-space($comment_text) != ''">
3761
+ <!-- put Mathin Alternate Text -->
3762
+ <xsl:attribute name="fox:alt-text">
3763
+ <xsl:value-of select="$comment_text"/>
3764
+ </xsl:attribute>
3765
+ </xsl:if>
3766
+ <xsl:call-template name="mathml_instream_object">
3767
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
3768
+ <xsl:with-param name="comment_text" select="$comment_text"/>
3769
+ </xsl:call-template>
3770
+ </fo:basic-link>
3771
+ </xsl:if>
3772
+ </xsl:when>
3773
+ <xsl:otherwise>
3774
+ <xsl:call-template name="mathml_instream_object">
3775
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
3776
+ <xsl:with-param name="comment_text" select="$comment_text"/>
3777
+ </xsl:call-template>
3778
+ </xsl:otherwise>
3779
+ </xsl:choose>
3780
+ <!-- </fo:wrapper> -->
3781
+ </fo:inline>
3782
+ </xsl:template>
3783
+
3784
+ <xsl:template name="mathml_instream_object">
3785
+ <xsl:param name="mathml_content"/>
3786
+ <xsl:param name="comment_text"/>
3787
+
3788
+ <xsl:variable name="mathml">
3789
+ <xsl:apply-templates select="." mode="mathml"/>
3790
+ </xsl:variable>
3791
+
3792
+ <fo:instream-foreign-object fox:alt-text="Math">
3793
+
3794
+ <xsl:if test="local-name(../..) = 'formula'">
3795
+ <xsl:attribute name="width">95%</xsl:attribute>
3796
+ <xsl:attribute name="content-height">100%</xsl:attribute>
3797
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
3798
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
3799
+ </xsl:if>
3800
+
3801
+ <!-- put MathML in Actual Text -->
3802
+ <xsl:attribute name="fox:actual-text">
3803
+ <xsl:value-of select="$mathml_content"/>
3804
+ </xsl:attribute>
3805
+
3806
+ <xsl:if test="$add_math_as_text = 'true'">
3807
+ <xsl:if test="normalize-space($comment_text) != ''">
3808
+ <!-- put Mathin Alternate Text -->
3809
+ <xsl:attribute name="fox:alt-text">
3810
+ <xsl:value-of select="$comment_text"/>
3811
+ </xsl:attribute>
3812
+ </xsl:if>
3813
+ </xsl:if>
3814
+
3815
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
3816
+ </fo:instream-foreign-object>
3817
+ </xsl:template>
3818
+
3650
3819
  <xsl:template name="insertHeaderFooter">
3651
3820
  <xsl:param name="header-title"/>
3652
3821
  <xsl:param name="orientation"/>
3653
- <fo:static-content flow-name="header-odd">
3822
+ <fo:static-content flow-name="header-odd" role="artifact">
3654
3823
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3655
3824
  <fo:block text-align="right">
3656
3825
  <xsl:copy-of select="$header-title"/>
@@ -3670,7 +3839,7 @@
3670
3839
  <fo:block> </fo:block>
3671
3840
  </fo:block-container>
3672
3841
  </fo:static-content>
3673
- <fo:static-content flow-name="header-even">
3842
+ <fo:static-content flow-name="header-even" role="artifact">
3674
3843
  <fo:block-container font-family="Arial" font-size="8pt" padding-top="12.5mm">
3675
3844
  <fo:block>
3676
3845
  <fo:inline font-weight="bold"><fo:page-number/></fo:inline>
@@ -3851,7 +4020,7 @@
3851
4020
  <fo:block id="{@id}" span="all">
3852
4021
  <xsl:apply-templates select="bipm:title"/>
3853
4022
  </fo:block>
3854
- <fo:block>
4023
+ <fo:block role="Index">
3855
4024
  <xsl:apply-templates select="*[not(local-name() = 'title')]"/>
3856
4025
 
3857
4026
  <!-- TEST <xsl:variable name="alphabet" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
@@ -3877,7 +4046,7 @@
3877
4046
 
3878
4047
  <!-- <xsl:template match="bipm:clause[@type = 'index']/bipm:title" priority="4"> -->
3879
4048
  <xsl:template match="bipm:indexsect/bipm:title" priority="4">
3880
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm">
4049
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="84pt" margin-left="-18mm" role="H1">
3881
4050
  <!-- Index -->
3882
4051
  <xsl:apply-templates/>
3883
4052
  </fo:block>
@@ -4470,6 +4639,7 @@
4470
4639
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
4471
4640
  <xsl:attribute name="white-space">pre</xsl:attribute>
4472
4641
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
4642
+ <xsl:attribute name="role">Code</xsl:attribute>
4473
4643
 
4474
4644
 
4475
4645
 
@@ -4491,8 +4661,13 @@
4491
4661
 
4492
4662
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
4493
4663
 
4494
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
4495
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
4664
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
4665
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
4666
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
4667
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
4668
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
4669
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
4670
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
4496
4671
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
4497
4672
 
4498
4673
 
@@ -4563,13 +4738,16 @@
4563
4738
 
4564
4739
 
4565
4740
 
4741
+
4566
4742
  </xsl:attribute-set><xsl:attribute-set name="termexample-name-style">
4567
4743
 
4568
4744
 
4569
4745
 
4570
4746
 
4571
4747
 
4572
- </xsl:attribute-set><xsl:attribute-set name="table-name-style">
4748
+ </xsl:attribute-set><xsl:variable name="table-border_">
4749
+
4750
+ </xsl:variable><xsl:variable name="table-border" select="normalize-space($table-border_)"/><xsl:attribute-set name="table-name-style">
4573
4751
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4574
4752
 
4575
4753
 
@@ -4679,7 +4857,8 @@
4679
4857
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4680
4858
 
4681
4859
 
4682
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
4860
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
4861
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
4683
4862
 
4684
4863
 
4685
4864
 
@@ -4861,11 +5040,15 @@
4861
5040
  <fo:block>&#xA0;</fo:block>
4862
5041
  </xsl:if> -->
4863
5042
 
5043
+
5044
+ <!-- Display table's name before table as standalone block -->
4864
5045
  <!-- $namespace = 'iso' or -->
4865
5046
 
4866
5047
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
4867
5048
 
4868
-
5049
+
5050
+
5051
+
4869
5052
 
4870
5053
  <xsl:call-template name="fn_name_display"/>
4871
5054
 
@@ -4948,6 +5131,12 @@
4948
5131
  </xsl:if>
4949
5132
 
4950
5133
 
5134
+
5135
+
5136
+
5137
+ <!-- display table's name before table for PAS inside block-container (2-columnn layout) -->
5138
+
5139
+
4951
5140
  <xsl:variable name="table_width">
4952
5141
  <!-- for centered table always 100% (@width will be set for middle/second cell of outer table) -->
4953
5142
 
@@ -4971,6 +5160,7 @@
4971
5160
 
4972
5161
 
4973
5162
 
5163
+
4974
5164
 
4975
5165
 
4976
5166
 
@@ -5002,6 +5192,8 @@
5002
5192
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5003
5193
  </xsl:if>
5004
5194
 
5195
+
5196
+
5005
5197
  <xsl:choose>
5006
5198
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
5007
5199
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -5293,9 +5485,9 @@
5293
5485
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
5294
5486
  <xsl:with-param name="continued">true</xsl:with-param>
5295
5487
  </xsl:apply-templates>
5296
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
5297
- <xsl:call-template name="fn_name_display"/>
5298
- </xsl:for-each>
5488
+
5489
+
5490
+
5299
5491
 
5300
5492
  </fo:table-cell>
5301
5493
  </fo:table-row>
@@ -5379,7 +5571,11 @@
5379
5571
 
5380
5572
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
5381
5573
 
5382
- <xsl:if test="$isNoteOrFnExist = 'true'">
5574
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
5575
+
5576
+ </xsl:variable>
5577
+
5578
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
5383
5579
 
5384
5580
  <xsl:variable name="cols-count">
5385
5581
  <xsl:choose>
@@ -5408,6 +5604,8 @@
5408
5604
  </xsl:choose>
5409
5605
  </xsl:for-each>
5410
5606
 
5607
+
5608
+
5411
5609
  <xsl:choose>
5412
5610
  <xsl:when test="xalan:nodeset($colgroup)//*[local-name()='col']">
5413
5611
  <xsl:for-each select="xalan:nodeset($colgroup)//*[local-name()='col']">
@@ -5456,6 +5654,7 @@
5456
5654
 
5457
5655
 
5458
5656
 
5657
+
5459
5658
  <!-- for BSI (not PAS) display Notes before footnotes -->
5460
5659
 
5461
5660
 
@@ -5529,6 +5728,19 @@
5529
5728
 
5530
5729
  </fo:table-body>
5531
5730
 
5731
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
5732
+ <xsl:choose>
5733
+ <xsl:when test="substring-after(., '—') != ''">
5734
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
5735
+ </xsl:when>
5736
+ <xsl:otherwise>
5737
+ <xsl:value-of select="."/>
5738
+ </xsl:otherwise>
5739
+ </xsl:choose>
5740
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
5741
+ <xsl:apply-templates mode="presentation_name"/>
5742
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
5743
+ <xsl:apply-templates select="."/>
5532
5744
  </xsl:template><xsl:template match="*[local-name()='tr']">
5533
5745
  <xsl:variable name="parent-name" select="local-name(..)"/>
5534
5746
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -5541,6 +5753,8 @@
5541
5753
 
5542
5754
 
5543
5755
 
5756
+
5757
+
5544
5758
  </xsl:if>
5545
5759
  <xsl:if test="$parent-name = 'tfoot'">
5546
5760
 
@@ -5562,6 +5776,8 @@
5562
5776
 
5563
5777
 
5564
5778
 
5779
+
5780
+
5565
5781
  <!-- <xsl:if test="$namespace = 'bipm'">
5566
5782
  <xsl:attribute name="height">8mm</xsl:attribute>
5567
5783
  </xsl:if> -->
@@ -5763,14 +5979,12 @@
5763
5979
  <xsl:apply-templates/>
5764
5980
  </xsl:template><xsl:template name="fn_display">
5765
5981
  <xsl:variable name="references">
5982
+
5766
5983
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
5767
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
5768
-
5769
-
5770
- <xsl:apply-templates/>
5771
- </fn>
5984
+ <xsl:call-template name="create_fn"/>
5772
5985
  </xsl:for-each>
5773
5986
  </xsl:variable>
5987
+
5774
5988
  <xsl:for-each select="xalan:nodeset($references)//fn">
5775
5989
  <xsl:variable name="reference" select="@reference"/>
5776
5990
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
@@ -5816,6 +6030,12 @@
5816
6030
  </fo:block>
5817
6031
  </xsl:if>
5818
6032
  </xsl:for-each>
6033
+ </xsl:template><xsl:template name="create_fn">
6034
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
6035
+
6036
+
6037
+ <xsl:apply-templates/>
6038
+ </fn>
5819
6039
  </xsl:template><xsl:template name="fn_name_display">
5820
6040
  <!-- <xsl:variable name="references">
5821
6041
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -6814,6 +7034,12 @@
6814
7034
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
6815
7035
  </xsl:call-template>
6816
7036
 
7037
+ <!-- insert helper tag -->
7038
+ <xsl:if test="$add_math_as_text = 'true'">
7039
+ <fo:inline color="white" font-size="1pt" font-style="normal" font-weight="normal">​</fo:inline> <!-- zero width space -->
7040
+ </xsl:if>
7041
+
7042
+
6817
7043
  <xsl:variable name="mathml">
6818
7044
  <xsl:apply-templates select="." mode="mathml"/>
6819
7045
  </xsl:variable>
@@ -6825,15 +7051,75 @@
6825
7051
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
6826
7052
  <xsl:attribute name="scaling">uniform</xsl:attribute>
6827
7053
  </xsl:if>
6828
- <!-- <xsl:attribute name="fox:alt-text">
6829
- put AsciiMath/LaTeX math
6830
- </xsl:attribute> -->
7054
+
7055
+ <xsl:if test="$add_math_as_text = 'true'">
7056
+ <!-- <xsl:variable name="comment_text" select="following-sibling::node()[1][self::comment()]"/> -->
7057
+ <xsl:variable name="comment_text" select="normalize-space(translate(.,' ⁢',' '))"/>
7058
+ <!-- <xsl:variable name="comment_text" select="normalize-space(.)"/> -->
7059
+ <xsl:if test="normalize-space($comment_text) != ''">
7060
+ <!-- put Mathin Alternate Text -->
7061
+ <xsl:attribute name="fox:alt-text">
7062
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
7063
+ <!-- <xsl:value-of select="$comment_text"/> -->
7064
+ </xsl:attribute>
7065
+ </xsl:if>
7066
+ </xsl:if>
7067
+
7068
+
7069
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
7070
+ <xsl:variable name="comment_text_">
7071
+ <xsl:choose>
7072
+ <xsl:when test="normalize-space($comment_text_following) != ''">
7073
+ <xsl:value-of select="$comment_text_following"/>
7074
+ </xsl:when>
7075
+ <xsl:otherwise>
7076
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
7077
+ </xsl:otherwise>
7078
+ </xsl:choose>
7079
+ </xsl:variable>
7080
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
7081
+
7082
+ <xsl:if test="normalize-space($comment_text) != ''">
7083
+ <!-- put Mathin Alternate Text -->
7084
+ <xsl:attribute name="fox:alt-text">
7085
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
7086
+ </xsl:attribute>
7087
+ </xsl:if>
7088
+
7089
+ <xsl:variable name="mathml_content">
7090
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
7091
+ </xsl:variable>
7092
+ <!-- put MathML in Actual Text -->
7093
+ <xsl:attribute name="fox:actual-text">
7094
+ <xsl:value-of select="$mathml_content"/>
7095
+ </xsl:attribute>
6831
7096
 
6832
7097
 
6833
7098
  <!-- <xsl:copy-of select="."/> -->
6834
7099
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
6835
7100
  </fo:instream-foreign-object>
6836
7101
  </fo:inline>
7102
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
7103
+ <!-- <xsl:text>a+b</xsl:text> -->
7104
+ <xsl:text>&lt;</xsl:text>
7105
+ <xsl:value-of select="local-name()"/>
7106
+ <xsl:if test="local-name() = 'math'">
7107
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
7108
+ </xsl:if>
7109
+ <xsl:for-each select="@*">
7110
+ <xsl:text> </xsl:text>
7111
+ <xsl:value-of select="local-name()"/>
7112
+ <xsl:text>="</xsl:text>
7113
+ <xsl:value-of select="."/>
7114
+ <xsl:text>"</xsl:text>
7115
+ </xsl:for-each>
7116
+ <xsl:text>&gt;</xsl:text>
7117
+ <xsl:apply-templates mode="mathml_actual_text"/>
7118
+ <xsl:text>&lt;/</xsl:text>
7119
+ <xsl:value-of select="local-name()"/>
7120
+ <xsl:text>&gt;</xsl:text>
7121
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
7122
+ <xsl:value-of select="normalize-space()"/>
6837
7123
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
6838
7124
  <xsl:copy>
6839
7125
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -6843,19 +7129,6 @@
6843
7129
  <!-- replace start and end spaces to non-break space -->
6844
7130
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
6845
7131
  </xsl:copy>
6846
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
6847
- <xsl:copy>
6848
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
6849
- </xsl:copy>
6850
- <xsl:choose>
6851
- <!-- if in msub, then don't add space -->
6852
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
6853
- <!-- if next char in digit, don't add space -->
6854
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
6855
- <xsl:otherwise>
6856
- <mathml:mspace width="0.5ex"/>
6857
- </xsl:otherwise>
6858
- </xsl:choose>
6859
7132
  </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">
6860
7133
  <xsl:variable name="target">
6861
7134
  <xsl:choose>
@@ -6908,7 +7181,10 @@
6908
7181
  </fo:block>
6909
7182
  <xsl:apply-templates/>
6910
7183
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
6911
- <fo:inline><xsl:apply-templates/></fo:inline>
7184
+ <xsl:variable name="level">
7185
+ <xsl:call-template name="getLevel"/>
7186
+ </xsl:variable>
7187
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
6912
7188
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
6913
7189
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
6914
7190
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -6943,9 +7219,10 @@
6943
7219
 
6944
7220
  </xsl:variable>
6945
7221
 
7222
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
6946
7223
  <xsl:choose>
6947
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
6948
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
7224
+ <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>
7225
+ <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>
6949
7226
  </xsl:choose>
6950
7227
  <xsl:apply-templates/>
6951
7228
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -7105,7 +7382,10 @@
7105
7382
  </fo:block>
7106
7383
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
7107
7384
  <xsl:if test="normalize-space() != ''">
7108
- <fo:inline>
7385
+ <xsl:variable name="level">
7386
+ <xsl:call-template name="getLevelTermName"/>
7387
+ </xsl:variable>
7388
+ <fo:inline role="H{$level}">
7109
7389
  <xsl:apply-templates/>
7110
7390
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
7111
7391
  <xsl:text>.</xsl:text>
@@ -7182,7 +7462,24 @@
7182
7462
  </fo:instream-foreign-object>
7183
7463
  </xsl:when>
7184
7464
  <xsl:otherwise>
7185
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style"/>
7465
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7466
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7467
+
7468
+ <xsl:variable name="img_src">
7469
+ <xsl:choose>
7470
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7471
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7472
+ </xsl:choose>
7473
+ </xsl:variable>
7474
+
7475
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7476
+ <xsl:if test="number($scale) &lt; 100">
7477
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7478
+ </xsl:if>
7479
+
7480
+ </xsl:if>
7481
+
7482
+ </fo:external-graphic>
7186
7483
  </xsl:otherwise>
7187
7484
  </xsl:choose>
7188
7485
 
@@ -7353,11 +7650,13 @@
7353
7650
  <xsl:attribute name="width">100%</xsl:attribute>
7354
7651
  <xsl:attribute name="content-height">100%</xsl:attribute>
7355
7652
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7653
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7654
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7356
7655
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7357
7656
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7358
7657
  <!-- effective height / width = 1.48, 1.4 - with title -->
7359
- <xsl:if test="@height &gt; (@width * 1.4)"> <!-- for images with big height -->
7360
- <xsl:variable name="width" select="((@width * 1.4) div @height) * 100"/>
7658
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7659
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7361
7660
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7362
7661
  </xsl:if>
7363
7662
  <xsl:attribute name="scaling">uniform</xsl:attribute>
@@ -7374,6 +7673,23 @@
7374
7673
  <xsl:attribute name="href" namespace="http://www.w3.org/1999/xlink">
7375
7674
  <xsl:value-of select="."/>
7376
7675
  </xsl:attribute>
7676
+ </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7677
+ <xsl:copy>
7678
+ <xsl:apply-templates select="@*" mode="svg_update"/>
7679
+ <xsl:variable name="viewbox">
7680
+ <xsl:call-template name="split">
7681
+ <xsl:with-param name="pText" select="@viewBox"/>
7682
+ <xsl:with-param name="sep" select="' '"/>
7683
+ </xsl:call-template>
7684
+ </xsl:variable>
7685
+ <xsl:attribute name="width">
7686
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
7687
+ </xsl:attribute>
7688
+ <xsl:attribute name="height">
7689
+ <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
7690
+ </xsl:attribute>
7691
+ <xsl:apply-templates mode="svg_update"/>
7692
+ </xsl:copy>
7377
7693
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
7378
7694
  <xsl:variable name="svg_content" select="document(@src)"/>
7379
7695
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -7718,6 +8034,7 @@
7718
8034
  </xsl:when>
7719
8035
  <xsl:otherwise>
7720
8036
  <xsl:apply-templates/>
8037
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
7721
8038
  </xsl:otherwise>
7722
8039
  </xsl:choose>
7723
8040
  </fo:block>
@@ -7858,14 +8175,6 @@
7858
8175
  <fo:block>
7859
8176
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
7860
8177
  </fo:block>
7861
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
7862
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
7863
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
7864
- </fo:block>
7865
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
7866
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
7867
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
7868
- </fo:block>
7869
8178
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
7870
8179
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
7871
8180
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -7882,6 +8191,38 @@
7882
8191
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
7883
8192
  <xsl:apply-templates/>
7884
8193
  </fo:block>
8194
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
8195
+ <fo:block xsl:use-attribute-sets="subject-style">
8196
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
8197
+ </fo:block>
8198
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
8199
+ <fo:block xsl:use-attribute-sets="subject-style">
8200
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
8201
+ </fo:block>
8202
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
8203
+ <fo:block xsl:use-attribute-sets="inherit-style">
8204
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
8205
+ </fo:block>
8206
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
8207
+ <fo:block xsl:use-attribute-sets="description-style">
8208
+ <xsl:apply-templates/>
8209
+ </fo:block>
8210
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
8211
+ <fo:block xsl:use-attribute-sets="specification-style">
8212
+ <xsl:apply-templates/>
8213
+ </fo:block>
8214
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
8215
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
8216
+ <xsl:apply-templates/>
8217
+ </fo:block>
8218
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
8219
+ <fo:block xsl:use-attribute-sets="verification-style">
8220
+ <xsl:apply-templates/>
8221
+ </fo:block>
8222
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
8223
+ <fo:block xsl:use-attribute-sets="import-style">
8224
+ <xsl:apply-templates/>
8225
+ </fo:block>
7885
8226
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
7886
8227
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
7887
8228
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -8033,7 +8374,19 @@
8033
8374
  </fo:inline>
8034
8375
  </xsl:if>
8035
8376
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
8036
- <fo:inline><xsl:apply-templates/></fo:inline>
8377
+ <xsl:variable name="element">inline
8378
+
8379
+ </xsl:variable>
8380
+ <xsl:choose>
8381
+ <xsl:when test="contains($element, 'block')">
8382
+ <fo:block xsl:use-attribute-sets="example-p-style">
8383
+ <xsl:apply-templates/>
8384
+ </fo:block>
8385
+ </xsl:when>
8386
+ <xsl:otherwise>
8387
+ <fo:inline><xsl:apply-templates/></fo:inline>
8388
+ </xsl:otherwise>
8389
+ </xsl:choose>
8037
8390
  </xsl:template><xsl:template match="*[local-name() = 'example']">
8038
8391
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
8039
8392
 
@@ -8649,8 +9002,8 @@
8649
9002
 
8650
9003
  </xsl:otherwise>
8651
9004
  </xsl:choose>
9005
+ <!-- end BIPM bibitem processing-->
8652
9006
 
8653
- <!-- end BIPM bibitem processing-->
8654
9007
 
8655
9008
 
8656
9009
 
@@ -8780,6 +9133,9 @@
8780
9133
  <fo:block-container border="1pt solid black" width="50%">
8781
9134
  <fo:block> </fo:block>
8782
9135
  </fo:block-container>
9136
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
9137
+ <fo:inline padding-right="5mm"> </fo:inline>
9138
+ <fo:inline><xsl:apply-templates/></fo:inline>
8783
9139
  </xsl:template><xsl:template name="convertDate">
8784
9140
  <xsl:param name="date"/>
8785
9141
  <xsl:param name="format" select="'short'"/>
@@ -8899,7 +9255,7 @@
8899
9255
  <xsl:variable name="lang">
8900
9256
  <xsl:call-template name="getLang"/>
8901
9257
  </xsl:variable>
8902
- <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
9258
+ <pdf:catalog>
8903
9259
  <pdf:dictionary type="normal" key="ViewerPreferences">
8904
9260
  <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
8905
9261
  </pdf:dictionary>
@@ -9018,6 +9374,26 @@
9018
9374
  <xsl:value-of select="$level"/>
9019
9375
  </xsl:otherwise>
9020
9376
  </xsl:choose>
9377
+ </xsl:template><xsl:template name="getLevelTermName">
9378
+ <xsl:choose>
9379
+ <xsl:when test="normalize-space(../@depth) != ''">
9380
+ <xsl:value-of select="../@depth"/>
9381
+ </xsl:when>
9382
+ <xsl:otherwise>
9383
+ <xsl:variable name="title_level_">
9384
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
9385
+ <xsl:call-template name="getLevel"/>
9386
+ </xsl:for-each>
9387
+ </xsl:variable>
9388
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
9389
+ <xsl:choose>
9390
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
9391
+ <xsl:otherwise>
9392
+ <xsl:call-template name="getLevel"/>
9393
+ </xsl:otherwise>
9394
+ </xsl:choose>
9395
+ </xsl:otherwise>
9396
+ </xsl:choose>
9021
9397
  </xsl:template><xsl:template name="split">
9022
9398
  <xsl:param name="pText" select="."/>
9023
9399
  <xsl:param name="sep" select="','"/>
@@ -9115,20 +9491,40 @@
9115
9491
  </xsl:call-template>
9116
9492
  </xsl:if>
9117
9493
  </xsl:template><xsl:template name="getLocalizedString">
9118
- <xsl:param name="key"/>
9494
+ <xsl:param name="key"/>
9495
+ <xsl:param name="formatted">false</xsl:param>
9119
9496
 
9120
9497
  <xsl:variable name="curr_lang">
9121
9498
  <xsl:call-template name="getLang"/>
9122
9499
  </xsl:variable>
9123
9500
 
9124
- <xsl:variable name="data_value" select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9501
+ <xsl:variable name="data_value">
9502
+ <xsl:choose>
9503
+ <xsl:when test="$formatted = 'true'">
9504
+ <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9505
+ </xsl:when>
9506
+ <xsl:otherwise>
9507
+ <xsl:value-of select="normalize-space(xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang])"/>
9508
+ </xsl:otherwise>
9509
+ </xsl:choose>
9510
+ </xsl:variable>
9125
9511
 
9126
9512
  <xsl:choose>
9127
- <xsl:when test="$data_value != ''">
9128
- <xsl:value-of select="$data_value"/>
9513
+ <xsl:when test="normalize-space($data_value) != ''">
9514
+ <xsl:choose>
9515
+ <xsl:when test="$formatted = 'true'"><xsl:copy-of select="$data_value"/></xsl:when>
9516
+ <xsl:otherwise><xsl:value-of select="$data_value"/></xsl:otherwise>
9517
+ </xsl:choose>
9129
9518
  </xsl:when>
9130
9519
  <xsl:when test="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]">
9131
- <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9520
+ <xsl:choose>
9521
+ <xsl:when test="$formatted = 'true'">
9522
+ <xsl:apply-templates select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9523
+ </xsl:when>
9524
+ <xsl:otherwise>
9525
+ <xsl:value-of select="/*/*[local-name() = 'localized-strings']/*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
9526
+ </xsl:otherwise>
9527
+ </xsl:choose>
9132
9528
  </xsl:when>
9133
9529
  <xsl:otherwise>
9134
9530
  <xsl:variable name="key_">
@@ -9139,7 +9535,7 @@
9139
9535
  <xsl:value-of select="$key_"/>
9140
9536
  </xsl:otherwise>
9141
9537
  </xsl:choose>
9142
-
9538
+
9143
9539
  </xsl:template><xsl:template name="setTrackChangesStyles">
9144
9540
  <xsl:param name="isAdded"/>
9145
9541
  <xsl:param name="isDeleted"/>