metanorma-iho 0.3.9 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -155,7 +155,7 @@
155
155
  </fo:table-cell>
156
156
  <fo:table-cell number-columns-spanned="2" border="0.5pt solid rgb(0, 21, 50)">
157
157
  <fo:block-container height="154.4mm" text-align="center" display-align="center">
158
- <fo:block font-size="28pt" font-weight="bold" color="rgb(0, 0, 76)">
158
+ <fo:block font-size="28pt" font-weight="bold" color="rgb(0, 0, 76)" role="H1">
159
159
  <xsl:value-of select="$title-en"/>
160
160
  </fo:block>
161
161
  </fo:block-container>
@@ -215,61 +215,63 @@
215
215
  <!-- Table of Contents -->
216
216
  <fo:block-container margin-right="-12.7mm">
217
217
  <fo:block-container margin-right="0mm">
218
- <fo:block color="rgb(14, 36, 133)" margin-bottom="15.5pt">
219
- <xsl:variable name="title-toc">
220
- <xsl:call-template name="getTitle">
221
- <xsl:with-param name="name" select="'title-toc'"/>
222
- </xsl:call-template>
223
- </xsl:variable>
224
- <xsl:value-of select="$title-toc"/>
225
- </fo:block>
226
- <xsl:if test="$debug = 'true'">
227
- <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
228
- DEBUG
229
- contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
230
- <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
231
- </xsl:if>
232
-
233
- <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
234
- <fo:block>
235
- <xsl:if test="@level = 1">
236
- <xsl:attribute name="margin-top">6pt</xsl:attribute>
237
- </xsl:if>
238
-
239
- <fo:list-block>
240
-
241
- <xsl:attribute name="provisional-distance-between-starts">
242
- <xsl:choose>
243
- <xsl:when test="@level &gt;= 1 and @root = 'preface'">0mm</xsl:when>
244
- <xsl:when test="@level &gt;= 1 and @root = 'annex' and not(@type = 'annex')">13mm</xsl:when>
245
- <xsl:when test="@level &gt;= 1 and not(@type = 'annex')">10mm</xsl:when>
246
- <xsl:otherwise>0mm</xsl:otherwise>
247
- </xsl:choose>
248
- </xsl:attribute>
249
- <fo:list-item>
250
- <fo:list-item-label end-indent="label-end()">
251
- <fo:block>
252
- <xsl:if test="@section != '' and not(@type = 'annex')"> <!-- output below -->
253
- <xsl:value-of select="@section"/>
254
- </xsl:if>
255
- </fo:block>
256
- </fo:list-item-label>
257
- <fo:list-item-body start-indent="body-start()">
258
- <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
259
- <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
260
- <xsl:apply-templates select="title"/>
261
- <fo:inline keep-together.within-line="always">
262
- <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
263
- <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
264
- </fo:inline>
265
- </fo:basic-link>
266
- </fo:block>
267
- </fo:list-item-body>
268
- </fo:list-item>
269
- </fo:list-block>
218
+ <fo:block role="TOC">
219
+ <fo:block color="rgb(14, 36, 133)" margin-bottom="15.5pt" role="H1">
220
+ <xsl:variable name="title-toc">
221
+ <xsl:call-template name="getTitle">
222
+ <xsl:with-param name="name" select="'title-toc'"/>
223
+ </xsl:call-template>
224
+ </xsl:variable>
225
+ <xsl:value-of select="$title-toc"/>
270
226
  </fo:block>
227
+ <xsl:if test="$debug = 'true'">
228
+ <xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
229
+ DEBUG
230
+ contents=<xsl:copy-of select="xalan:nodeset($contents)"/>
231
+ <xsl:text disable-output-escaping="yes">--&gt;</xsl:text>
232
+ </xsl:if>
271
233
 
272
- </xsl:for-each>
234
+ <xsl:for-each select="xalan:nodeset($contents)//item[@display = 'true']"><!-- [not(@level = 2 and starts-with(@section, '0'))] skip clause from preface -->
235
+ <fo:block role="TOCI">
236
+ <xsl:if test="@level = 1">
237
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
238
+ </xsl:if>
239
+
240
+ <fo:list-block>
241
+
242
+ <xsl:attribute name="provisional-distance-between-starts">
243
+ <xsl:choose>
244
+ <xsl:when test="@level &gt;= 1 and @root = 'preface'">0mm</xsl:when>
245
+ <xsl:when test="@level &gt;= 1 and @root = 'annex' and not(@type = 'annex')">13mm</xsl:when>
246
+ <xsl:when test="@level &gt;= 1 and not(@type = 'annex')">10mm</xsl:when>
247
+ <xsl:otherwise>0mm</xsl:otherwise>
248
+ </xsl:choose>
249
+ </xsl:attribute>
250
+ <fo:list-item>
251
+ <fo:list-item-label end-indent="label-end()">
252
+ <fo:block>
253
+ <xsl:if test="@section != '' and not(@type = 'annex')"> <!-- output below -->
254
+ <xsl:value-of select="@section"/>
255
+ </xsl:if>
256
+ </fo:block>
257
+ </fo:list-item-label>
258
+ <fo:list-item-body start-indent="body-start()">
259
+ <fo:block text-align-last="justify" margin-left="12mm" text-indent="-12mm">
260
+ <fo:basic-link internal-destination="{@id}" fox:alt-text="{title}">
261
+ <xsl:apply-templates select="title"/>
262
+ <fo:inline keep-together.within-line="always">
263
+ <fo:leader font-size="9pt" font-weight="normal" leader-pattern="dots"/>
264
+ <fo:inline><fo:page-number-citation ref-id="{@id}"/></fo:inline>
265
+ </fo:inline>
266
+ </fo:basic-link>
267
+ </fo:block>
268
+ </fo:list-item-body>
269
+ </fo:list-item>
270
+ </fo:list-block>
271
+ </fo:block>
272
+
273
+ </xsl:for-each>
274
+ </fo:block>
273
275
  </fo:block-container>
274
276
  </fo:block-container>
275
277
 
@@ -297,7 +299,7 @@
297
299
  <fo:flow flow-name="xsl-region-body">
298
300
  <fo:block-container>
299
301
 
300
- <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt"><xsl:value-of select="$title-en"/></fo:block>
302
+ <fo:block font-size="16pt" font-weight="bold" margin-bottom="18pt" role="H1"><xsl:value-of select="$title-en"/></fo:block>
301
303
 
302
304
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
303
305
  <!-- Normative references -->
@@ -453,13 +455,14 @@
453
455
  <!-- ====== -->
454
456
 
455
457
  <xsl:template match="iho:annex/iho:title">
456
- <fo:block font-size="13pt" font-weight="bold" text-align="center" margin-bottom="12pt" keep-with-next="always">
458
+ <fo:block font-size="13pt" font-weight="bold" text-align="center" margin-bottom="12pt" keep-with-next="always" role="H1">
457
459
  <xsl:apply-templates/>
460
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
458
461
  </fo:block>
459
462
  </xsl:template>
460
463
 
461
464
  <xsl:template match="iho:bibliography/iho:references[not(@normative='true')]/iho:title">
462
- <fo:block font-size="16pt" font-weight="bold" text-align="center" margin-top="6pt" margin-bottom="36pt" keep-with-next="always">
465
+ <fo:block font-size="16pt" font-weight="bold" text-align="center" margin-top="6pt" margin-bottom="36pt" keep-with-next="always" role="H1">
463
466
  <xsl:apply-templates/>
464
467
  </fo:block>
465
468
  </xsl:template>
@@ -504,7 +507,10 @@
504
507
 
505
508
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
506
509
 
510
+ <xsl:attribute name="role">H<xsl:value-of select="$level"/></xsl:attribute>
511
+
507
512
  <xsl:apply-templates/>
513
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
508
514
  </xsl:element>
509
515
 
510
516
  <xsl:if test="$element-name = 'fo:inline' and not(following-sibling::iho:p)">
@@ -806,8 +812,10 @@
806
812
 
807
813
 
808
814
  <xsl:template match="iho:preferred">
809
-
810
- <fo:block line-height="1.1">
815
+ <xsl:variable name="levelTerm">
816
+ <xsl:call-template name="getLevelTermName"/>
817
+ </xsl:variable>
818
+ <fo:block line-height="1.1" role="H{$levelTerm}">
811
819
  <fo:block font-weight="bold" keep-with-next="always">
812
820
  <xsl:apply-templates select="ancestor::iho:term/iho:name" mode="presentation"/>
813
821
  </fo:block>
@@ -822,14 +830,14 @@
822
830
 
823
831
  <xsl:template name="insertHeaderFooter">
824
832
  <xsl:param name="font-weight" select="'bold'"/>
825
- <fo:static-content flow-name="header-odd">
833
+ <fo:static-content flow-name="header-odd" role="artifact">
826
834
  <fo:block-container height="100%">
827
835
  <fo:block padding-top="12.5mm" text-align="right">
828
836
  <xsl:value-of select="$docidentifier"/>
829
837
  </fo:block>
830
838
  </fo:block-container>
831
839
  </fo:static-content>
832
- <fo:static-content flow-name="footer-odd">
840
+ <fo:static-content flow-name="footer-odd" role="artifact">
833
841
  <fo:block-container height="100%" margin-right="-10mm" display-align="after">
834
842
  <fo:block-container margin-right="0mm">
835
843
  <fo:block padding-bottom="17mm" font-size="10pt" text-align-last="justify">
@@ -842,14 +850,14 @@
842
850
  </fo:block-container>
843
851
  </fo:block-container>
844
852
  </fo:static-content>
845
- <fo:static-content flow-name="header-even">
853
+ <fo:static-content flow-name="header-even" role="artifact">
846
854
  <fo:block-container height="100%">
847
855
  <fo:block padding-top="12.5mm">
848
856
  <xsl:value-of select="$docidentifier"/>
849
857
  </fo:block>
850
858
  </fo:block-container>
851
859
  </fo:static-content>
852
- <fo:static-content flow-name="footer-even">
860
+ <fo:static-content flow-name="footer-even" role="artifact">
853
861
  <fo:block-container height="100%" margin-right="-10mm" display-align="after">
854
862
  <fo:block-container margin-right="0mm">
855
863
  <fo:block padding-bottom="17mm" font-size="10pt" text-align-last="justify">
@@ -1131,6 +1139,7 @@
1131
1139
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
1132
1140
  <xsl:attribute name="white-space">pre</xsl:attribute>
1133
1141
  <xsl:attribute name="wrap-option">wrap</xsl:attribute>
1142
+ <xsl:attribute name="role">Code</xsl:attribute>
1134
1143
 
1135
1144
 
1136
1145
 
@@ -1157,8 +1166,13 @@
1157
1166
 
1158
1167
  </xsl:attribute-set><xsl:attribute-set name="requirement-label-style">
1159
1168
 
1160
- </xsl:attribute-set><xsl:attribute-set name="requirement-subject-style">
1161
- </xsl:attribute-set><xsl:attribute-set name="requirement-inherit-style">
1169
+ </xsl:attribute-set><xsl:attribute-set name="subject-style">
1170
+ </xsl:attribute-set><xsl:attribute-set name="inherit-style">
1171
+ </xsl:attribute-set><xsl:attribute-set name="description-style">
1172
+ </xsl:attribute-set><xsl:attribute-set name="specification-style">
1173
+ </xsl:attribute-set><xsl:attribute-set name="measurement-target-style">
1174
+ </xsl:attribute-set><xsl:attribute-set name="verification-style">
1175
+ </xsl:attribute-set><xsl:attribute-set name="import-style">
1162
1176
  </xsl:attribute-set><xsl:attribute-set name="recommendation-style">
1163
1177
 
1164
1178
 
@@ -1336,6 +1350,14 @@
1336
1350
 
1337
1351
 
1338
1352
 
1353
+ </xsl:attribute-set><xsl:attribute-set name="table-note-name-style">
1354
+
1355
+
1356
+
1357
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
1358
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
1359
+
1360
+
1339
1361
  </xsl:attribute-set><xsl:attribute-set name="note-p-style">
1340
1362
 
1341
1363
 
@@ -1371,7 +1393,8 @@
1371
1393
 
1372
1394
 
1373
1395
 
1374
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1396
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1397
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1375
1398
 
1376
1399
 
1377
1400
 
@@ -1509,13 +1532,20 @@
1509
1532
 
1510
1533
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1511
1534
 
1512
- </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">
1535
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
1536
+ <xsl:attribute name="line-height">135%</xsl:attribute>
1537
+ </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">
1513
1538
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1514
1539
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1515
1540
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1516
1541
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
1517
1542
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1518
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1543
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
1544
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1545
+ <xsl:sort select="@displayorder" data-type="number"/>
1546
+ <xsl:apply-templates select="." mode="contents"/>
1547
+ </xsl:for-each>
1548
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
1519
1549
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1520
1550
 
1521
1551
  <!-- Normative references -->
@@ -1528,13 +1558,33 @@
1528
1558
  <!-- Bibliography -->
1529
1559
  <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"/>
1530
1560
 
1531
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1561
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1562
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1563
+ <xsl:sort select="@displayorder" data-type="number"/>
1564
+ <xsl:apply-templates select="." mode="contents"/>
1565
+ </xsl:for-each>
1566
+
1567
+ <xsl:for-each select="/*/*[local-name()='annex']">
1568
+ <xsl:sort select="@displayorder" data-type="number"/>
1569
+ <xsl:apply-templates select="." mode="contents"/>
1570
+ </xsl:for-each>
1571
+
1572
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1573
+ <xsl:sort select="@displayorder" data-type="number"/>
1574
+ <xsl:apply-templates select="." mode="contents"/>
1575
+ </xsl:for-each>
1576
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
1532
1577
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1533
1578
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1534
1579
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1535
1580
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1536
1581
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1537
- </xsl:template><xsl:template name="processMainSectionsDefault">
1582
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1583
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1584
+ <xsl:sort select="@displayorder" data-type="number"/>
1585
+ <xsl:apply-templates select="."/>
1586
+ </xsl:for-each>
1587
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
1538
1588
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1539
1589
 
1540
1590
  <!-- Normative references -->
@@ -1546,6 +1596,22 @@
1546
1596
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1547
1597
  <!-- Bibliography -->
1548
1598
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1599
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1600
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1601
+ <xsl:sort select="@displayorder" data-type="number"/>
1602
+ <xsl:apply-templates select="."/>
1603
+
1604
+ </xsl:for-each>
1605
+
1606
+ <xsl:for-each select="/*/*[local-name()='annex']">
1607
+ <xsl:sort select="@displayorder" data-type="number"/>
1608
+ <xsl:apply-templates select="."/>
1609
+ </xsl:for-each>
1610
+
1611
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1612
+ <xsl:sort select="@displayorder" data-type="number"/>
1613
+ <xsl:apply-templates select="."/>
1614
+ </xsl:for-each>
1549
1615
  </xsl:template><xsl:template match="text()">
1550
1616
  <xsl:value-of select="."/>
1551
1617
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -1576,7 +1642,9 @@
1576
1642
 
1577
1643
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1578
1644
 
1579
-
1645
+
1646
+
1647
+
1580
1648
 
1581
1649
  <xsl:call-template name="fn_name_display"/>
1582
1650
 
@@ -2389,13 +2457,9 @@
2389
2457
 
2390
2458
  <!-- Table's note name (NOTE, for example) -->
2391
2459
 
2392
- <fo:inline padding-right="2mm">
2393
-
2394
-
2460
+ <fo:inline padding-right="2mm" xsl:use-attribute-sets="table-note-name-style">
2395
2461
 
2396
2462
 
2397
- <xsl:attribute name="font-size">11pt</xsl:attribute>
2398
- <xsl:attribute name="padding-right">3mm</xsl:attribute>
2399
2463
 
2400
2464
 
2401
2465
 
@@ -3011,6 +3075,8 @@
3011
3075
  <xsl:if test="$font-size != ''">
3012
3076
  <xsl:attribute name="font-size">
3013
3077
  <xsl:choose>
3078
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
3079
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
3014
3080
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
3015
3081
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
3016
3082
  </xsl:choose>
@@ -3445,16 +3511,68 @@
3445
3511
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3446
3512
  </xsl:call-template>
3447
3513
 
3514
+
3515
+
3448
3516
  <xsl:variable name="mathml">
3449
3517
  <xsl:apply-templates select="." mode="mathml"/>
3450
3518
  </xsl:variable>
3451
3519
  <fo:instream-foreign-object fox:alt-text="Math">
3452
3520
 
3453
3521
 
3522
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3523
+ <xsl:variable name="comment_text_">
3524
+ <xsl:choose>
3525
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3526
+ <xsl:value-of select="$comment_text_following"/>
3527
+ </xsl:when>
3528
+ <xsl:otherwise>
3529
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3530
+ </xsl:otherwise>
3531
+ </xsl:choose>
3532
+ </xsl:variable>
3533
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3534
+
3535
+ <xsl:if test="normalize-space($comment_text) != ''">
3536
+ <!-- put Mathin Alternate Text -->
3537
+ <xsl:attribute name="fox:alt-text">
3538
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3539
+ </xsl:attribute>
3540
+ </xsl:if>
3541
+
3542
+ <xsl:variable name="mathml_content">
3543
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3544
+ </xsl:variable>
3545
+ <!-- put MathML in Actual Text -->
3546
+ <xsl:attribute name="fox:actual-text">
3547
+ <xsl:value-of select="$mathml_content"/>
3548
+ </xsl:attribute>
3549
+
3550
+
3454
3551
  <!-- <xsl:copy-of select="."/> -->
3455
3552
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3456
3553
  </fo:instream-foreign-object>
3457
3554
  </fo:inline>
3555
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3556
+ <!-- <xsl:text>a+b</xsl:text> -->
3557
+ <xsl:text>&lt;</xsl:text>
3558
+ <xsl:value-of select="local-name()"/>
3559
+ <xsl:if test="local-name() = 'math'">
3560
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3561
+ </xsl:if>
3562
+ <xsl:for-each select="@*">
3563
+ <xsl:text> </xsl:text>
3564
+ <xsl:value-of select="local-name()"/>
3565
+ <xsl:text>="</xsl:text>
3566
+ <xsl:value-of select="."/>
3567
+ <xsl:text>"</xsl:text>
3568
+ </xsl:for-each>
3569
+ <xsl:text>&gt;</xsl:text>
3570
+ <xsl:apply-templates mode="mathml_actual_text"/>
3571
+ <xsl:text>&lt;/</xsl:text>
3572
+ <xsl:value-of select="local-name()"/>
3573
+ <xsl:text>&gt;</xsl:text>
3574
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3575
+ <xsl:value-of select="normalize-space()"/>
3458
3576
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3459
3577
  <xsl:copy>
3460
3578
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3516,7 +3634,10 @@
3516
3634
  </fo:block>
3517
3635
  <xsl:apply-templates/>
3518
3636
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3519
- <fo:inline><xsl:apply-templates/></fo:inline>
3637
+ <xsl:variable name="level">
3638
+ <xsl:call-template name="getLevel"/>
3639
+ </xsl:variable>
3640
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3520
3641
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3521
3642
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3522
3643
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3551,9 +3672,10 @@
3551
3672
 
3552
3673
  </xsl:variable>
3553
3674
 
3675
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3554
3676
  <xsl:choose>
3555
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3556
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3677
+ <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>
3678
+ <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>
3557
3679
  </xsl:choose>
3558
3680
  <xsl:apply-templates/>
3559
3681
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3701,7 +3823,10 @@
3701
3823
  </fo:block>
3702
3824
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3703
3825
  <xsl:if test="normalize-space() != ''">
3704
- <fo:inline>
3826
+ <xsl:variable name="level">
3827
+ <xsl:call-template name="getLevelTermName"/>
3828
+ </xsl:variable>
3829
+ <fo:inline role="H{$level}">
3705
3830
  <xsl:apply-templates/>
3706
3831
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3707
3832
  <xsl:text>.</xsl:text>
@@ -4002,6 +4127,13 @@
4002
4127
  </xsl:attribute>
4003
4128
  <xsl:apply-templates mode="svg_update"/>
4004
4129
  </xsl:copy>
4130
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
4131
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4132
+ <xsl:for-each select="*[local-name() = 'svg']">
4133
+ <xsl:call-template name="image_svg">
4134
+ <xsl:with-param name="name" select="$name"/>
4135
+ </xsl:call-template>
4136
+ </xsl:for-each>
4005
4137
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
4006
4138
  <xsl:variable name="svg_content" select="document(@src)"/>
4007
4139
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4106,7 +4238,7 @@
4106
4238
  </fo:basic-link>
4107
4239
  </fo:block>
4108
4240
  </fo:block-container>
4109
- </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">
4241
+ </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">
4110
4242
  <xsl:apply-templates mode="contents"/>
4111
4243
  <xsl:text> </xsl:text>
4112
4244
  </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">
@@ -4332,6 +4464,7 @@
4332
4464
  </xsl:when>
4333
4465
  <xsl:otherwise>
4334
4466
  <xsl:apply-templates/>
4467
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4335
4468
  </xsl:otherwise>
4336
4469
  </xsl:choose>
4337
4470
  </fo:block>
@@ -4404,12 +4537,16 @@
4404
4537
  <xsl:if test="$font-size != ''">
4405
4538
  <xsl:attribute name="font-size">
4406
4539
  <xsl:choose>
4540
+ <xsl:when test="$font-size = 'inherit'"><xsl:value-of select="$font-size"/></xsl:when>
4541
+ <xsl:when test="contains($font-size, '%')"><xsl:value-of select="$font-size"/></xsl:when>
4407
4542
  <xsl:when test="ancestor::*[local-name()='note']"><xsl:value-of select="$font-size * 0.91"/>pt</xsl:when>
4408
4543
  <xsl:otherwise><xsl:value-of select="$font-size"/>pt</xsl:otherwise>
4409
4544
  </xsl:choose>
4410
4545
  </xsl:attribute>
4411
4546
  </xsl:if>
4412
4547
 
4548
+
4549
+
4413
4550
  <xsl:apply-templates/>
4414
4551
  </fo:block>
4415
4552
 
@@ -4472,14 +4609,6 @@
4472
4609
  <fo:block>
4473
4610
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4474
4611
  </fo:block>
4475
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4476
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4477
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4478
- </fo:block>
4479
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4480
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4481
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4482
- </fo:block>
4483
4612
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4484
4613
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4485
4614
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4496,6 +4625,38 @@
4496
4625
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4497
4626
  <xsl:apply-templates/>
4498
4627
  </fo:block>
4628
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4629
+ <fo:block xsl:use-attribute-sets="subject-style">
4630
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4631
+ </fo:block>
4632
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4633
+ <fo:block xsl:use-attribute-sets="subject-style">
4634
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4635
+ </fo:block>
4636
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4637
+ <fo:block xsl:use-attribute-sets="inherit-style">
4638
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4639
+ </fo:block>
4640
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4641
+ <fo:block xsl:use-attribute-sets="description-style">
4642
+ <xsl:apply-templates/>
4643
+ </fo:block>
4644
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4645
+ <fo:block xsl:use-attribute-sets="specification-style">
4646
+ <xsl:apply-templates/>
4647
+ </fo:block>
4648
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4649
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4650
+ <xsl:apply-templates/>
4651
+ </fo:block>
4652
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4653
+ <fo:block xsl:use-attribute-sets="verification-style">
4654
+ <xsl:apply-templates/>
4655
+ </fo:block>
4656
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4657
+ <fo:block xsl:use-attribute-sets="import-style">
4658
+ <xsl:apply-templates/>
4659
+ </fo:block>
4499
4660
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4500
4661
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4501
4662
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4761,14 +4922,15 @@
4761
4922
  </xsl:if>
4762
4923
  </xsl:template><xsl:variable name="localized.source">
4763
4924
  <xsl:call-template name="getLocalizedString">
4764
- <xsl:with-param name="key">source</xsl:with-param>
4765
- </xsl:call-template>
4925
+ <xsl:with-param name="key">source</xsl:with-param>
4926
+ </xsl:call-template>
4766
4927
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4767
4928
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4768
4929
  <xsl:if test="normalize-space(@citeas) = ''">
4769
4930
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4770
4931
  </xsl:if>
4771
4932
 
4933
+
4772
4934
  <fo:inline>
4773
4935
 
4774
4936
 
@@ -4776,6 +4938,7 @@
4776
4938
 
4777
4939
 
4778
4940
 
4941
+
4779
4942
  <xsl:call-template name="getTitle">
4780
4943
  <xsl:with-param name="name" select="'title-source'"/>
4781
4944
  </xsl:call-template>
@@ -4787,6 +4950,7 @@
4787
4950
  <fo:inline xsl:use-attribute-sets="origin-style">
4788
4951
  <xsl:apply-templates/>
4789
4952
  </fo:inline>
4953
+
4790
4954
  </fo:basic-link>
4791
4955
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4792
4956
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -4853,6 +5017,9 @@
4853
5017
 
4854
5018
  </xsl:if>
4855
5019
 
5020
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
5021
+ <xsl:variable name="text" select="normalize-space()"/>
5022
+
4856
5023
 
4857
5024
 
4858
5025
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -4868,7 +5035,9 @@
4868
5035
 
4869
5036
 
4870
5037
  </xsl:if>
4871
-
5038
+
5039
+
5040
+
4872
5041
  <xsl:apply-templates/>
4873
5042
  </fo:basic-link>
4874
5043
 
@@ -5202,6 +5371,7 @@
5202
5371
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5203
5372
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5204
5373
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5374
+
5205
5375
  <xsl:apply-templates/>
5206
5376
  </fo:block>
5207
5377
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -5469,6 +5639,97 @@
5469
5639
  <fo:block-container border="1pt solid black" width="50%">
5470
5640
  <fo:block> </fo:block>
5471
5641
  </fo:block-container>
5642
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
5643
+ <xsl:param name="colwidths"/>
5644
+ <xsl:variable name="colwidths_">
5645
+ <xsl:choose>
5646
+ <xsl:when test="not($colwidths)">
5647
+ <xsl:variable name="toc_table_simple">
5648
+ <tbody>
5649
+ <xsl:apply-templates mode="toc_table_width"/>
5650
+ </tbody>
5651
+ </xsl:variable>
5652
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
5653
+ <xsl:call-template name="calculate-column-widths">
5654
+ <xsl:with-param name="cols-count" select="$cols-count"/>
5655
+ <xsl:with-param name="table" select="$toc_table_simple"/>
5656
+ </xsl:call-template>
5657
+ </xsl:when>
5658
+ <xsl:otherwise>
5659
+ <xsl:copy-of select="$colwidths"/>
5660
+ </xsl:otherwise>
5661
+ </xsl:choose>
5662
+ </xsl:variable>
5663
+ <fo:block role="TOCI" space-after="16pt">
5664
+ <fo:table width="100%" table-layout="fixed">
5665
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
5666
+ <fo:table-column column-width="proportional-column-width({.})"/>
5667
+ </xsl:for-each>
5668
+ <fo:table-body>
5669
+ <xsl:apply-templates/>
5670
+ </fo:table-body>
5671
+ </fo:table>
5672
+ </fo:block>
5673
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
5674
+ <fo:table-row min-height="5mm">
5675
+ <xsl:apply-templates/>
5676
+ </fo:table-row>
5677
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
5678
+ <xsl:apply-templates/>
5679
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
5680
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5681
+ <xsl:variable name="target" select="@target"/>
5682
+ <xsl:for-each select="*[local-name() = 'tab']">
5683
+ <xsl:variable name="current_id" select="generate-id()"/>
5684
+ <fo:table-cell>
5685
+ <fo:block>
5686
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5687
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5688
+ <xsl:choose>
5689
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5690
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
5691
+ </xsl:choose>
5692
+ </xsl:for-each>
5693
+ </fo:basic-link>
5694
+ </fo:block>
5695
+ </fo:table-cell>
5696
+ </xsl:for-each>
5697
+ <!-- last column - for page numbers -->
5698
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
5699
+ <fo:block>
5700
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5701
+ <fo:page-number-citation ref-id="{$target}"/>
5702
+ </fo:basic-link>
5703
+ </fo:block>
5704
+ </fo:table-cell>
5705
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
5706
+ <xsl:apply-templates mode="toc_table_width"/>
5707
+ </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">
5708
+ <tr>
5709
+ <xsl:apply-templates mode="toc_table_width"/>
5710
+ </tr>
5711
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
5712
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5713
+ <xsl:for-each select="*[local-name() = 'tab']">
5714
+ <xsl:variable name="current_id" select="generate-id()"/>
5715
+ <td>
5716
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5717
+ <xsl:copy-of select="."/>
5718
+ </xsl:for-each>
5719
+ </td>
5720
+ </xsl:for-each>
5721
+ <td>333</td> <!-- page number, just for fill -->
5722
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5723
+ <fo:inline padding-right="5mm"> </fo:inline>
5724
+ <fo:inline><xsl:apply-templates/></fo:inline>
5725
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
5726
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
5727
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
5728
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
5729
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
5730
+ </svg>
5731
+ </fo:instream-foreign-object>
5732
+ </fo:inline>
5472
5733
  </xsl:template><xsl:template name="convertDate">
5473
5734
  <xsl:param name="date"/>
5474
5735
  <xsl:param name="format" select="'short'"/>
@@ -5707,6 +5968,26 @@
5707
5968
  <xsl:value-of select="$level"/>
5708
5969
  </xsl:otherwise>
5709
5970
  </xsl:choose>
5971
+ </xsl:template><xsl:template name="getLevelTermName">
5972
+ <xsl:choose>
5973
+ <xsl:when test="normalize-space(../@depth) != ''">
5974
+ <xsl:value-of select="../@depth"/>
5975
+ </xsl:when>
5976
+ <xsl:otherwise>
5977
+ <xsl:variable name="title_level_">
5978
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5979
+ <xsl:call-template name="getLevel"/>
5980
+ </xsl:for-each>
5981
+ </xsl:variable>
5982
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5983
+ <xsl:choose>
5984
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5985
+ <xsl:otherwise>
5986
+ <xsl:call-template name="getLevel"/>
5987
+ </xsl:otherwise>
5988
+ </xsl:choose>
5989
+ </xsl:otherwise>
5990
+ </xsl:choose>
5710
5991
  </xsl:template><xsl:template name="split">
5711
5992
  <xsl:param name="pText" select="."/>
5712
5993
  <xsl:param name="sep" select="','"/>