metanorma-cc 1.7.9 → 1.7.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -151,7 +151,7 @@
151
151
  <xsl:text> </xsl:text>
152
152
  </fo:block>
153
153
  </fo:block>
154
- <fo:block font-size="24pt" font-weight="bold" text-align="center">
154
+ <fo:block font-size="24pt" font-weight="bold" text-align="center" role="H1">
155
155
  <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/>
156
156
  <xsl:value-of select="$linebreak"/>
157
157
  </fo:block>
@@ -230,50 +230,52 @@
230
230
  <fo:block break-after="page"/>
231
231
 
232
232
  <fo:block-container font-weight="bold" line-height="115%">
233
- <xsl:variable name="title-toc">
234
- <xsl:call-template name="getTitle">
235
- <xsl:with-param name="name" select="'title-toc'"/>
236
- </xsl:call-template>
237
- </xsl:variable>
238
- <fo:block font-size="14pt" margin-bottom="15.5pt"><xsl:value-of select="$title-toc"/></fo:block>
239
-
240
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
233
+ <fo:block role="TOC">
234
+ <xsl:variable name="title-toc">
235
+ <xsl:call-template name="getTitle">
236
+ <xsl:with-param name="name" select="'title-toc'"/>
237
+ </xsl:call-template>
238
+ </xsl:variable>
239
+ <fo:block font-size="14pt" margin-bottom="15.5pt" role="H1"><xsl:value-of select="$title-toc"/></fo:block>
241
240
 
242
- <fo:block>
243
- <xsl:if test="@level = 1">
244
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
245
- </xsl:if>
241
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
246
242
 
247
-
248
- <fo:list-block>
249
- <xsl:attribute name="provisional-distance-between-starts">
250
- <xsl:choose>
251
- <!-- skip 0 section without subsections -->
252
- <xsl:when test="@section != ''">8mm</xsl:when> <!-- and not(@display-section = 'false') -->
253
- <xsl:otherwise>0mm</xsl:otherwise>
254
- </xsl:choose>
255
- </xsl:attribute>
256
- <fo:list-item>
257
- <fo:list-item-label end-indent="label-end()">
258
- <fo:block>
259
- <xsl:value-of select="@section"/>
260
- </fo:block>
261
- </fo:list-item-label>
262
- <fo:list-item-body start-indent="body-start()">
263
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
264
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
265
- <xsl:apply-templates select="title"/>
266
- <fo:inline keep-together.within-line="always">
267
- <fo:leader leader-pattern="dots"/>
268
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
269
- </fo:inline>
270
- </fo:basic-link>
271
- </fo:block>
272
- </fo:list-item-body>
273
- </fo:list-item>
274
- </fo:list-block>
275
- </fo:block>
276
- </xsl:for-each>
243
+ <fo:block role="TOCI">
244
+ <xsl:if test="@level = 1">
245
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
246
+ </xsl:if>
247
+
248
+
249
+ <fo:list-block>
250
+ <xsl:attribute name="provisional-distance-between-starts">
251
+ <xsl:choose>
252
+ <!-- skip 0 section without subsections -->
253
+ <xsl:when test="@section != ''">8mm</xsl:when> <!-- and not(@display-section = 'false') -->
254
+ <xsl:otherwise>0mm</xsl:otherwise>
255
+ </xsl:choose>
256
+ </xsl:attribute>
257
+ <fo:list-item>
258
+ <fo:list-item-label end-indent="label-end()">
259
+ <fo:block>
260
+ <xsl:value-of select="@section"/>
261
+ </fo:block>
262
+ </fo:list-item-label>
263
+ <fo:list-item-body start-indent="body-start()">
264
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
265
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
266
+ <xsl:apply-templates select="title"/>
267
+ <fo:inline keep-together.within-line="always">
268
+ <fo:leader leader-pattern="dots"/>
269
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
270
+ </fo:inline>
271
+ </fo:basic-link>
272
+ </fo:block>
273
+ </fo:list-item-body>
274
+ </fo:list-item>
275
+ </fo:list-block>
276
+ </fo:block>
277
+ </xsl:for-each>
278
+ </fo:block>
277
279
  </fo:block-container>
278
280
 
279
281
  <!-- Foreword, Introduction -->
@@ -292,7 +294,7 @@
292
294
  </fo:static-content>
293
295
  <xsl:call-template name="insertHeaderFooter"/>
294
296
  <fo:flow flow-name="xsl-region-body">
295
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="17pt">
297
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="17pt" role="H1">
296
298
  <xsl:value-of select="/csd:csd-standard/csd:bibdata/csd:title[@language = 'en']"/>
297
299
  </fo:block>
298
300
  <fo:block>
@@ -366,7 +368,10 @@
366
368
 
367
369
 
368
370
  <xsl:template match="csd:license-statement//csd:title">
369
- <fo:block text-align="center" font-weight="bold">
371
+ <xsl:variable name="level">
372
+ <xsl:call-template name="getLevel"/>
373
+ </xsl:variable>
374
+ <fo:block text-align="center" font-weight="bold" role="H{$level}">
370
375
  <xsl:apply-templates/>
371
376
  </fo:block>
372
377
  </xsl:template>
@@ -446,7 +451,9 @@
446
451
  <xsl:if test="ancestor::csd:sections">
447
452
  <xsl:attribute name="margin-top">13.5pt</xsl:attribute>
448
453
  </xsl:if>
454
+ <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
449
455
  <xsl:apply-templates/>
456
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
450
457
  </xsl:element>
451
458
  </xsl:template>
452
459
 
@@ -637,7 +644,10 @@
637
644
  <xsl:otherwise>12pt</xsl:otherwise>
638
645
  </xsl:choose>
639
646
  </xsl:variable>
640
- <fo:block font-size="{$font-size}" line-height="1.1">
647
+ <xsl:variable name="levelTerm">
648
+ <xsl:call-template name="getLevelTermName"/>
649
+ </xsl:variable>
650
+ <fo:block font-size="{$font-size}" line-height="1.1" role="H{$levelTerm}">
641
651
  <fo:block font-weight="bold" keep-with-next="always">
642
652
  <xsl:apply-templates select="ancestor::csd:term/csd:name" mode="presentation"/>
643
653
  </fo:block>
@@ -754,14 +764,14 @@
754
764
 
755
765
 
756
766
  <xsl:template name="insertHeaderFooter">
757
- <fo:static-content flow-name="header-even">
767
+ <fo:static-content flow-name="header-even" role="artifact">
758
768
  <fo:block-container height="17mm" display-align="before">
759
769
  <fo:block padding-top="12.5mm">
760
770
  <xsl:value-of select="$header"/>
761
771
  </fo:block>
762
772
  </fo:block-container>
763
773
  </fo:static-content>
764
- <fo:static-content flow-name="footer-even">
774
+ <fo:static-content flow-name="footer-even" role="artifact">
765
775
  <fo:block-container font-size="10pt" height="100%" display-align="after">
766
776
  <fo:table table-layout="fixed" width="100%">
767
777
  <fo:table-column column-width="10%"/>
@@ -779,14 +789,14 @@
779
789
  </fo:table>
780
790
  </fo:block-container>
781
791
  </fo:static-content>
782
- <fo:static-content flow-name="header-odd">
792
+ <fo:static-content flow-name="header-odd" role="artifact">
783
793
  <fo:block-container height="17mm" display-align="before">
784
794
  <fo:block text-align="right" padding-top="12.5mm">
785
795
  <xsl:value-of select="$header"/>
786
796
  </fo:block>
787
797
  </fo:block-container>
788
798
  </fo:static-content>
789
- <fo:static-content flow-name="footer-odd">
799
+ <fo:static-content flow-name="footer-odd" role="artifact">
790
800
  <fo:block-container font-size="10pt" height="100%" display-align="after">
791
801
  <fo:table table-layout="fixed" width="100%">
792
802
  <fo:table-column column-width="90%"/>
@@ -978,6 +988,7 @@
978
988
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
979
989
  <xsl:attribute name="white-space">pre</xsl:attribute>
980
990
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
991
+ <xsl:attribute name="role">Code</xsl:attribute>
981
992
 
982
993
 
983
994
 
@@ -1003,8 +1014,13 @@
1003
1014
 
1004
1015
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
1005
1016
 
1006
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1007
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1017
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1018
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1019
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1020
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1021
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1022
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1023
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1008
1024
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1009
1025
 
1010
1026
 
@@ -1185,6 +1201,11 @@
1185
1201
 
1186
1202
 
1187
1203
 
1204
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
1205
+
1206
+
1207
+
1208
+
1188
1209
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1189
1210
 
1190
1211
 
@@ -1217,7 +1238,8 @@
1217
1238
 
1218
1239
 
1219
1240
 
1220
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1241
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1242
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1221
1243
 
1222
1244
 
1223
1245
  <xsl:attribute name="margin-top">12pt</xsl:attribute>
@@ -1351,13 +1373,20 @@
1351
1373
 
1352
1374
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1353
1375
 
1354
- </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="processPrefaceSectionsDefault_Contents">
1376
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
1377
+ <xsl:attribute name="line-height">135%</xsl:attribute>
1378
+ </xsl:attribute-set><xsl:variable name="border-block-added">2.5pt solid rgb(0, 176, 80)</xsl:variable><xsl:variable name="border-block-deleted">2.5pt solid rgb(255, 0, 0)</xsl:variable><xsl:template name="OLD_processPrefaceSectionsDefault_Contents">
1355
1379
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1356
1380
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1357
1381
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1358
1382
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
1359
1383
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1360
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1384
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
1385
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1386
+ <xsl:sort select="@displayorder" data-type="number"/>
1387
+ <xsl:apply-templates select="." mode="contents"/>
1388
+ </xsl:for-each>
1389
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
1361
1390
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1362
1391
 
1363
1392
  <!-- Normative references -->
@@ -1370,13 +1399,33 @@
1370
1399
  <!-- Bibliography -->
1371
1400
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]" mode="contents"/>
1372
1401
 
1373
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1402
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1403
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1404
+ <xsl:sort select="@displayorder" data-type="number"/>
1405
+ <xsl:apply-templates select="." mode="contents"/>
1406
+ </xsl:for-each>
1407
+
1408
+ <xsl:for-each select="/*/*[local-name()='annex']">
1409
+ <xsl:sort select="@displayorder" data-type="number"/>
1410
+ <xsl:apply-templates select="." mode="contents"/>
1411
+ </xsl:for-each>
1412
+
1413
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1414
+ <xsl:sort select="@displayorder" data-type="number"/>
1415
+ <xsl:apply-templates select="." mode="contents"/>
1416
+ </xsl:for-each>
1417
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
1374
1418
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1375
1419
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1376
1420
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1377
1421
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1378
1422
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1379
- </xsl:template><xsl:template name="processMainSectionsDefault">
1423
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1424
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1425
+ <xsl:sort select="@displayorder" data-type="number"/>
1426
+ <xsl:apply-templates select="."/>
1427
+ </xsl:for-each>
1428
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
1380
1429
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1381
1430
 
1382
1431
  <!-- Normative references -->
@@ -1388,6 +1437,22 @@
1388
1437
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1389
1438
  <!-- Bibliography -->
1390
1439
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1440
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1441
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1442
+ <xsl:sort select="@displayorder" data-type="number"/>
1443
+ <xsl:apply-templates select="."/>
1444
+
1445
+ </xsl:for-each>
1446
+
1447
+ <xsl:for-each select="/*/*[local-name()='annex']">
1448
+ <xsl:sort select="@displayorder" data-type="number"/>
1449
+ <xsl:apply-templates select="."/>
1450
+ </xsl:for-each>
1451
+
1452
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1453
+ <xsl:sort select="@displayorder" data-type="number"/>
1454
+ <xsl:apply-templates select="."/>
1455
+ </xsl:for-each>
1391
1456
  </xsl:template><xsl:template match="text()">
1392
1457
  <xsl:value-of select="."/>
1393
1458
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -1418,7 +1483,9 @@
1418
1483
 
1419
1484
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1420
1485
 
1421
-
1486
+
1487
+
1488
+
1422
1489
 
1423
1490
  <xsl:call-template name="fn_name_display"/>
1424
1491
 
@@ -2222,9 +2289,8 @@
2222
2289
 
2223
2290
  <!-- Table's note name (NOTE, for example) -->
2224
2291
 
2225
- <fo:inline padding-right="2mm">
2292
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
2226
2293
 
2227
-
2228
2294
 
2229
2295
 
2230
2296
 
@@ -2836,6 +2902,8 @@
2836
2902
  <xsl:if test="$font-size != ''">
2837
2903
  <xsl:attribute name="font-size">
2838
2904
  <xsl:choose>
2905
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
2906
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
2839
2907
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
2840
2908
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
2841
2909
  </xsl:choose>
@@ -3270,16 +3338,68 @@
3270
3338
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3271
3339
  </xsl:call-template>
3272
3340
 
3341
+
3342
+
3273
3343
  <xsl:variable name="mathml">
3274
3344
  <xsl:apply-templates select="." mode="mathml"/>
3275
3345
  </xsl:variable>
3276
3346
  <fo:instream-foreign-object fox:alt-text="Math">
3277
3347
 
3278
3348
 
3349
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3350
+ <xsl:variable name="comment_text_">
3351
+ <xsl:choose>
3352
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3353
+ <xsl:value-of select="$comment_text_following"/>
3354
+ </xsl:when>
3355
+ <xsl:otherwise>
3356
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3357
+ </xsl:otherwise>
3358
+ </xsl:choose>
3359
+ </xsl:variable>
3360
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3361
+
3362
+ <xsl:if test="normalize-space($comment_text) != ''">
3363
+ <!-- put Mathin Alternate Text -->
3364
+ <xsl:attribute name="fox:alt-text">
3365
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3366
+ </xsl:attribute>
3367
+ </xsl:if>
3368
+
3369
+ <xsl:variable name="mathml_content">
3370
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3371
+ </xsl:variable>
3372
+ <!-- put MathML in Actual Text -->
3373
+ <xsl:attribute name="fox:actual-text">
3374
+ <xsl:value-of select="$mathml_content"/>
3375
+ </xsl:attribute>
3376
+
3377
+
3279
3378
  <!-- <xsl:copy-of select="."/> -->
3280
3379
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3281
3380
  </fo:instream-foreign-object>
3282
3381
  </fo:inline>
3382
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3383
+ <!-- <xsl:text>a+b</xsl:text> -->
3384
+ <xsl:text>&lt;</xsl:text>
3385
+ <xsl:value-of select="local-name()"/>
3386
+ <xsl:if test="local-name() = 'math'">
3387
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3388
+ </xsl:if>
3389
+ <xsl:for-each select="@*">
3390
+ <xsl:text> </xsl:text>
3391
+ <xsl:value-of select="local-name()"/>
3392
+ <xsl:text>="</xsl:text>
3393
+ <xsl:value-of select="."/>
3394
+ <xsl:text>"</xsl:text>
3395
+ </xsl:for-each>
3396
+ <xsl:text>&gt;</xsl:text>
3397
+ <xsl:apply-templates mode="mathml_actual_text"/>
3398
+ <xsl:text>&lt;/</xsl:text>
3399
+ <xsl:value-of select="local-name()"/>
3400
+ <xsl:text>&gt;</xsl:text>
3401
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3402
+ <xsl:value-of select="normalize-space()"/>
3283
3403
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3284
3404
  <xsl:copy>
3285
3405
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3341,7 +3461,10 @@
3341
3461
  </fo:block>
3342
3462
  <xsl:apply-templates/>
3343
3463
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3344
- <fo:inline><xsl:apply-templates/></fo:inline>
3464
+ <xsl:variable name="level">
3465
+ <xsl:call-template name="getLevel"/>
3466
+ </xsl:variable>
3467
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3345
3468
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3346
3469
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3347
3470
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3376,9 +3499,10 @@
3376
3499
 
3377
3500
  </xsl:variable>
3378
3501
 
3502
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3379
3503
  <xsl:choose>
3380
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3381
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3504
+ <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>
3505
+ <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>
3382
3506
  </xsl:choose>
3383
3507
  <xsl:apply-templates/>
3384
3508
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3522,7 +3646,10 @@
3522
3646
  </fo:block>
3523
3647
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3524
3648
  <xsl:if test="normalize-space() != ''">
3525
- <fo:inline>
3649
+ <xsl:variable name="level">
3650
+ <xsl:call-template name="getLevelTermName"/>
3651
+ </xsl:variable>
3652
+ <fo:inline role="H{$level}">
3526
3653
  <xsl:apply-templates/>
3527
3654
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3528
3655
  <xsl:text>.</xsl:text>
@@ -3823,6 +3950,13 @@
3823
3950
  </xsl:attribute>
3824
3951
  <xsl:apply-templates mode="svg_update"/>
3825
3952
  </xsl:copy>
3953
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
3954
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
3955
+ <xsl:for-each select="*[local-name() = 'svg']">
3956
+ <xsl:call-template name="image_svg">
3957
+ <xsl:with-param name="name" select="$name"/>
3958
+ </xsl:call-template>
3959
+ </xsl:for-each>
3826
3960
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3827
3961
  <xsl:variable name="svg_content" select="document(@src)"/>
3828
3962
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -3927,7 +4061,7 @@
3927
4061
  </fo:basic-link>
3928
4062
  </fo:block>
3929
4063
  </fo:block-container>
3930
- </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">
4064
+ </xsl:template><xsl:template match="*[local-name() = 'emf']"/><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">
3931
4065
  <xsl:apply-templates mode="contents"/>
3932
4066
  <xsl:text> </xsl:text>
3933
4067
  </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">
@@ -4153,6 +4287,7 @@
4153
4287
  </xsl:when>
4154
4288
  <xsl:otherwise>
4155
4289
  <xsl:apply-templates/>
4290
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4156
4291
  </xsl:otherwise>
4157
4292
  </xsl:choose>
4158
4293
  </fo:block>
@@ -4225,12 +4360,16 @@
4225
4360
  <xsl:if test="$font-size != ''">
4226
4361
  <xsl:attribute name="font-size">
4227
4362
  <xsl:choose>
4363
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4364
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4228
4365
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4229
4366
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4230
4367
  </xsl:choose>
4231
4368
  </xsl:attribute>
4232
4369
  </xsl:if>
4233
4370
 
4371
+
4372
+
4234
4373
  <xsl:apply-templates/>
4235
4374
  </fo:block>
4236
4375
 
@@ -4293,14 +4432,6 @@
4293
4432
  <fo:block>
4294
4433
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4295
4434
  </fo:block>
4296
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4297
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4298
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4299
- </fo:block>
4300
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4301
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4302
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4303
- </fo:block>
4304
4435
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4305
4436
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4306
4437
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4317,6 +4448,38 @@
4317
4448
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4318
4449
  <xsl:apply-templates/>
4319
4450
  </fo:block>
4451
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4452
+ <fo:block xsl:use-attribute-sets="subject-style">
4453
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4454
+ </fo:block>
4455
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4456
+ <fo:block xsl:use-attribute-sets="subject-style">
4457
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4458
+ </fo:block>
4459
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4460
+ <fo:block xsl:use-attribute-sets="inherit-style">
4461
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4462
+ </fo:block>
4463
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4464
+ <fo:block xsl:use-attribute-sets="description-style">
4465
+ <xsl:apply-templates/>
4466
+ </fo:block>
4467
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4468
+ <fo:block xsl:use-attribute-sets="specification-style">
4469
+ <xsl:apply-templates/>
4470
+ </fo:block>
4471
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4472
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4473
+ <xsl:apply-templates/>
4474
+ </fo:block>
4475
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4476
+ <fo:block xsl:use-attribute-sets="verification-style">
4477
+ <xsl:apply-templates/>
4478
+ </fo:block>
4479
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4480
+ <fo:block xsl:use-attribute-sets="import-style">
4481
+ <xsl:apply-templates/>
4482
+ </fo:block>
4320
4483
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4321
4484
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4322
4485
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4582,14 +4745,15 @@
4582
4745
  </xsl:if>
4583
4746
  </xsl:template><xsl:variable name="localized.source">
4584
4747
  <xsl:call-template name="getLocalizedString">
4585
- <xsl:with-param name="key">source</xsl:with-param>
4586
- </xsl:call-template>
4748
+ <xsl:with-param name="key">source</xsl:with-param>
4749
+ </xsl:call-template>
4587
4750
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4588
4751
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4589
4752
  <xsl:if test="normalize-space(@citeas) = ''">
4590
4753
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4591
4754
  </xsl:if>
4592
4755
 
4756
+
4593
4757
  <fo:inline>
4594
4758
 
4595
4759
 
@@ -4597,6 +4761,7 @@
4597
4761
 
4598
4762
 
4599
4763
 
4764
+
4600
4765
  <xsl:call-template name="getTitle">
4601
4766
  <xsl:with-param name="name" select="'title-source'"/>
4602
4767
  </xsl:call-template>
@@ -4608,6 +4773,7 @@
4608
4773
  <fo:inline xsl:use-attribute-sets="origin-style">
4609
4774
  <xsl:apply-templates/>
4610
4775
  </fo:inline>
4776
+
4611
4777
  </fo:basic-link>
4612
4778
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4613
4779
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -4674,6 +4840,9 @@
4674
4840
 
4675
4841
  </xsl:if>
4676
4842
 
4843
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
4844
+ <xsl:variable name="text" select="normalize-space()"/>
4845
+
4677
4846
 
4678
4847
 
4679
4848
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -4689,7 +4858,9 @@
4689
4858
 
4690
4859
 
4691
4860
  </xsl:if>
4692
-
4861
+
4862
+
4863
+
4693
4864
  <xsl:apply-templates/>
4694
4865
  </fo:basic-link>
4695
4866
 
@@ -5028,6 +5199,7 @@
5028
5199
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5029
5200
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5030
5201
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5202
+
5031
5203
  <xsl:apply-templates/>
5032
5204
  </fo:block>
5033
5205
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -5196,6 +5368,97 @@
5196
5368
  <fo:block-container border="1pt solid black" width="50%">
5197
5369
  <fo:block> </fo:block>
5198
5370
  </fo:block-container>
5371
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
5372
+ <xsl:param name="colwidths"/>
5373
+ <xsl:variable name="colwidths_">
5374
+ <xsl:choose>
5375
+ <xsl:when test="not($colwidths)">
5376
+ <xsl:variable name="toc_table_simple">
5377
+ <tbody>
5378
+ <xsl:apply-templates mode="toc_table_width"/>
5379
+ </tbody>
5380
+ </xsl:variable>
5381
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
5382
+ <xsl:call-template name="calculate-column-widths">
5383
+ <xsl:with-param name="cols-count" select="$cols-count"/>
5384
+ <xsl:with-param name="table" select="$toc_table_simple"/>
5385
+ </xsl:call-template>
5386
+ </xsl:when>
5387
+ <xsl:otherwise>
5388
+ <xsl:copy-of select="$colwidths"/>
5389
+ </xsl:otherwise>
5390
+ </xsl:choose>
5391
+ </xsl:variable>
5392
+ <fo:block role="TOCI" space-after="16pt">
5393
+ <fo:table width="100%" table-layout="fixed">
5394
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
5395
+ <fo:table-column column-width="proportional-column-width({.})"/>
5396
+ </xsl:for-each>
5397
+ <fo:table-body>
5398
+ <xsl:apply-templates/>
5399
+ </fo:table-body>
5400
+ </fo:table>
5401
+ </fo:block>
5402
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
5403
+ <fo:table-row min-height="5mm">
5404
+ <xsl:apply-templates/>
5405
+ </fo:table-row>
5406
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
5407
+ <xsl:apply-templates/>
5408
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
5409
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5410
+ <xsl:variable name="target" select="@target"/>
5411
+ <xsl:for-each select="*[local-name() = 'tab']">
5412
+ <xsl:variable name="current_id" select="generate-id()"/>
5413
+ <fo:table-cell>
5414
+ <fo:block>
5415
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5416
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5417
+ <xsl:choose>
5418
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5419
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
5420
+ </xsl:choose>
5421
+ </xsl:for-each>
5422
+ </fo:basic-link>
5423
+ </fo:block>
5424
+ </fo:table-cell>
5425
+ </xsl:for-each>
5426
+ <!-- last column - for page numbers -->
5427
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
5428
+ <fo:block>
5429
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5430
+ <fo:page-number-citation ref-id="{$target}"/>
5431
+ </fo:basic-link>
5432
+ </fo:block>
5433
+ </fo:table-cell>
5434
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
5435
+ <xsl:apply-templates mode="toc_table_width"/>
5436
+ </xsl:template><xsl:template match="*[local-name() = 'clause'][@type = 'toc']/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'clause'][not(@type = 'toc')]/*[local-name() = 'title']" mode="toc_table_width"/><xsl:template match="*[local-name() = 'li']" mode="toc_table_width">
5437
+ <tr>
5438
+ <xsl:apply-templates mode="toc_table_width"/>
5439
+ </tr>
5440
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
5441
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5442
+ <xsl:for-each select="*[local-name() = 'tab']">
5443
+ <xsl:variable name="current_id" select="generate-id()"/>
5444
+ <td>
5445
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5446
+ <xsl:copy-of select="."/>
5447
+ </xsl:for-each>
5448
+ </td>
5449
+ </xsl:for-each>
5450
+ <td>333</td> <!-- page number, just for fill -->
5451
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5452
+ <fo:inline padding-right="5mm"> </fo:inline>
5453
+ <fo:inline><xsl:apply-templates/></fo:inline>
5454
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
5455
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
5456
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
5457
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
5458
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
5459
+ </svg>
5460
+ </fo:instream-foreign-object>
5461
+ </fo:inline>
5199
5462
  </xsl:template><xsl:template name="convertDate">
5200
5463
  <xsl:param name="date"/>
5201
5464
  <xsl:param name="format" select="'short'"/>
@@ -5434,6 +5697,26 @@
5434
5697
  <xsl:value-of select="$level"/>
5435
5698
  </xsl:otherwise>
5436
5699
  </xsl:choose>
5700
+ </xsl:template><xsl:template name="getLevelTermName">
5701
+ <xsl:choose>
5702
+ <xsl:when test="normalize-space(../@depth) != ''">
5703
+ <xsl:value-of select="../@depth"/>
5704
+ </xsl:when>
5705
+ <xsl:otherwise>
5706
+ <xsl:variable name="title_level_">
5707
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5708
+ <xsl:call-template name="getLevel"/>
5709
+ </xsl:for-each>
5710
+ </xsl:variable>
5711
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5712
+ <xsl:choose>
5713
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5714
+ <xsl:otherwise>
5715
+ <xsl:call-template name="getLevel"/>
5716
+ </xsl:otherwise>
5717
+ </xsl:choose>
5718
+ </xsl:otherwise>
5719
+ </xsl:choose>
5437
5720
  </xsl:template><xsl:template name="split">
5438
5721
  <xsl:param name="pText" select="."/>
5439
5722
  <xsl:param name="sep" select="','"/>