metanorma-iho 0.3.8 → 0.3.12

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
 
@@ -1226,6 +1240,7 @@
1226
1240
 
1227
1241
 
1228
1242
 
1243
+
1229
1244
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1230
1245
  <xsl:attribute name="margin-left">12.7mm</xsl:attribute>
1231
1246
 
@@ -1370,7 +1385,8 @@
1370
1385
 
1371
1386
 
1372
1387
 
1373
- </xsl:attribute-set><xsl:attribute-set name="quote-style">
1388
+ </xsl:attribute-set><xsl:attribute-set name="quote-style">
1389
+ <xsl:attribute name="role">BlockQuote</xsl:attribute>
1374
1390
 
1375
1391
 
1376
1392
 
@@ -1463,7 +1479,7 @@
1463
1479
  </xsl:attribute-set><xsl:attribute-set name="tt-style">
1464
1480
 
1465
1481
 
1466
- <xsl:attribute name="font-family">Courier</xsl:attribute>
1482
+ <xsl:attribute name="font-family">Courier New</xsl:attribute>
1467
1483
 
1468
1484
 
1469
1485
  </xsl:attribute-set><xsl:attribute-set name="sourcecode-name-style">
@@ -1508,13 +1524,20 @@
1508
1524
 
1509
1525
  </xsl:attribute-set><xsl:attribute-set name="list-style">
1510
1526
 
1511
- </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">
1527
+ </xsl:attribute-set><xsl:attribute-set name="toc-style">
1528
+ <xsl:attribute name="line-height">135%</xsl:attribute>
1529
+ </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">
1512
1530
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']" mode="contents"/>
1513
1531
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']" mode="contents"/>
1514
1532
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']" mode="contents"/>
1515
1533
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']" mode="contents"/>
1516
1534
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']" mode="contents"/>
1517
- </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1535
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault_Contents">
1536
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1537
+ <xsl:sort select="@displayorder" data-type="number"/>
1538
+ <xsl:apply-templates select="." mode="contents"/>
1539
+ </xsl:for-each>
1540
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault_Contents">
1518
1541
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']" mode="contents"/>
1519
1542
 
1520
1543
  <!-- Normative references -->
@@ -1527,13 +1550,33 @@
1527
1550
  <!-- Bibliography -->
1528
1551
  <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"/>
1529
1552
 
1530
- </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1553
+ </xsl:template><xsl:template name="processMainSectionsDefault_Contents">
1554
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1555
+ <xsl:sort select="@displayorder" data-type="number"/>
1556
+ <xsl:apply-templates select="." mode="contents"/>
1557
+ </xsl:for-each>
1558
+
1559
+ <xsl:for-each select="/*/*[local-name()='annex']">
1560
+ <xsl:sort select="@displayorder" data-type="number"/>
1561
+ <xsl:apply-templates select="." mode="contents"/>
1562
+ </xsl:for-each>
1563
+
1564
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1565
+ <xsl:sort select="@displayorder" data-type="number"/>
1566
+ <xsl:apply-templates select="." mode="contents"/>
1567
+ </xsl:for-each>
1568
+ </xsl:template><xsl:template name="OLD_processPrefaceSectionsDefault">
1531
1569
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='abstract']"/>
1532
1570
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='foreword']"/>
1533
1571
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='introduction']"/>
1534
1572
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name() != 'abstract' and local-name() != 'foreword' and local-name() != 'introduction' and local-name() != 'acknowledgements']"/>
1535
1573
  <xsl:apply-templates select="/*/*[local-name()='preface']/*[local-name()='acknowledgements']"/>
1536
- </xsl:template><xsl:template name="processMainSectionsDefault">
1574
+ </xsl:template><xsl:template name="processPrefaceSectionsDefault">
1575
+ <xsl:for-each select="/*/*[local-name()='preface']/*">
1576
+ <xsl:sort select="@displayorder" data-type="number"/>
1577
+ <xsl:apply-templates select="."/>
1578
+ </xsl:for-each>
1579
+ </xsl:template><xsl:template name="OLD_processMainSectionsDefault">
1537
1580
  <xsl:apply-templates select="/*/*[local-name()='sections']/*[local-name()='clause'][@type='scope']"/>
1538
1581
 
1539
1582
  <!-- Normative references -->
@@ -1545,6 +1588,22 @@
1545
1588
  <xsl:apply-templates select="/*/*[local-name()='annex']"/>
1546
1589
  <!-- Bibliography -->
1547
1590
  <xsl:apply-templates select="/*/*[local-name()='bibliography']/*[local-name()='references'][not(@normative='true')]"/>
1591
+ </xsl:template><xsl:template name="processMainSectionsDefault">
1592
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
1593
+ <xsl:sort select="@displayorder" data-type="number"/>
1594
+ <xsl:apply-templates select="."/>
1595
+
1596
+ </xsl:for-each>
1597
+
1598
+ <xsl:for-each select="/*/*[local-name()='annex']">
1599
+ <xsl:sort select="@displayorder" data-type="number"/>
1600
+ <xsl:apply-templates select="."/>
1601
+ </xsl:for-each>
1602
+
1603
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
1604
+ <xsl:sort select="@displayorder" data-type="number"/>
1605
+ <xsl:apply-templates select="."/>
1606
+ </xsl:for-each>
1548
1607
  </xsl:template><xsl:template match="text()">
1549
1608
  <xsl:value-of select="."/>
1550
1609
  </xsl:template><xsl:template match="*[local-name()='br']">
@@ -1575,7 +1634,9 @@
1575
1634
 
1576
1635
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
1577
1636
 
1578
-
1637
+
1638
+
1639
+
1579
1640
 
1580
1641
  <xsl:call-template name="fn_name_display"/>
1581
1642
 
@@ -1701,6 +1762,8 @@
1701
1762
  <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
1702
1763
  </xsl:if>
1703
1764
 
1765
+
1766
+
1704
1767
  <xsl:choose>
1705
1768
  <xsl:when test="*[local-name()='colgroup']/*[local-name()='col']">
1706
1769
  <xsl:for-each select="*[local-name()='colgroup']/*[local-name()='col']">
@@ -1988,9 +2051,9 @@
1988
2051
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']" mode="presentation">
1989
2052
  <xsl:with-param name="continued">true</xsl:with-param>
1990
2053
  </xsl:apply-templates>
1991
- <xsl:for-each select="ancestor::*[local-name()='table'][1]">
1992
- <xsl:call-template name="fn_name_display"/>
1993
- </xsl:for-each>
2054
+
2055
+
2056
+
1994
2057
 
1995
2058
  </fo:table-cell>
1996
2059
  </fo:table-row>
@@ -2072,7 +2135,11 @@
2072
2135
 
2073
2136
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2074
2137
 
2075
- <xsl:if test="$isNoteOrFnExist = 'true'">
2138
+ <xsl:variable name="isNoteOrFnExistShowAfterTable">
2139
+
2140
+ </xsl:variable>
2141
+
2142
+ <xsl:if test="$isNoteOrFnExist = 'true' or normalize-space($isNoteOrFnExistShowAfterTable) = 'true'">
2076
2143
 
2077
2144
  <xsl:variable name="cols-count">
2078
2145
  <xsl:choose>
@@ -2213,6 +2280,19 @@
2213
2280
 
2214
2281
  </fo:table-body>
2215
2282
 
2283
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/text()[1]" priority="2" mode="presentation_name">
2284
+ <xsl:choose>
2285
+ <xsl:when test="substring-after(., '—') != ''">
2286
+ <xsl:text>—</xsl:text><xsl:value-of select="substring-after(., '—')"/>
2287
+ </xsl:when>
2288
+ <xsl:otherwise>
2289
+ <xsl:value-of select="."/>
2290
+ </xsl:otherwise>
2291
+ </xsl:choose>
2292
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="presentation_name">
2293
+ <xsl:apply-templates mode="presentation_name"/>
2294
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']/node()" mode="presentation_name">
2295
+ <xsl:apply-templates select="."/>
2216
2296
  </xsl:template><xsl:template match="*[local-name()='tr']">
2217
2297
  <xsl:variable name="parent-name" select="local-name(..)"/>
2218
2298
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
@@ -2392,14 +2472,12 @@
2392
2472
  <xsl:apply-templates/>
2393
2473
  </xsl:template><xsl:template name="fn_display">
2394
2474
  <xsl:variable name="references">
2475
+
2395
2476
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2396
- <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2397
-
2398
-
2399
- <xsl:apply-templates/>
2400
- </fn>
2477
+ <xsl:call-template name="create_fn"/>
2401
2478
  </xsl:for-each>
2402
2479
  </xsl:variable>
2480
+
2403
2481
  <xsl:for-each select="xalan:nodeset($references)//fn">
2404
2482
  <xsl:variable name="reference" select="@reference"/>
2405
2483
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
@@ -2435,6 +2513,12 @@
2435
2513
  </fo:block>
2436
2514
  </xsl:if>
2437
2515
  </xsl:for-each>
2516
+ </xsl:template><xsl:template name="create_fn">
2517
+ <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
2518
+
2519
+
2520
+ <xsl:apply-templates/>
2521
+ </fn>
2438
2522
  </xsl:template><xsl:template name="fn_name_display">
2439
2523
  <!-- <xsl:variable name="references">
2440
2524
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
@@ -3421,16 +3505,68 @@
3421
3505
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
3422
3506
  </xsl:call-template>
3423
3507
 
3508
+
3509
+
3424
3510
  <xsl:variable name="mathml">
3425
3511
  <xsl:apply-templates select="." mode="mathml"/>
3426
3512
  </xsl:variable>
3427
3513
  <fo:instream-foreign-object fox:alt-text="Math">
3428
3514
 
3429
3515
 
3516
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
3517
+ <xsl:variable name="comment_text_">
3518
+ <xsl:choose>
3519
+ <xsl:when test="normalize-space($comment_text_following) != ''">
3520
+ <xsl:value-of select="$comment_text_following"/>
3521
+ </xsl:when>
3522
+ <xsl:otherwise>
3523
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
3524
+ </xsl:otherwise>
3525
+ </xsl:choose>
3526
+ </xsl:variable>
3527
+ <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
3528
+
3529
+ <xsl:if test="normalize-space($comment_text) != ''">
3530
+ <!-- put Mathin Alternate Text -->
3531
+ <xsl:attribute name="fox:alt-text">
3532
+ <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
3533
+ </xsl:attribute>
3534
+ </xsl:if>
3535
+
3536
+ <xsl:variable name="mathml_content">
3537
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
3538
+ </xsl:variable>
3539
+ <!-- put MathML in Actual Text -->
3540
+ <xsl:attribute name="fox:actual-text">
3541
+ <xsl:value-of select="$mathml_content"/>
3542
+ </xsl:attribute>
3543
+
3544
+
3430
3545
  <!-- <xsl:copy-of select="."/> -->
3431
3546
  <xsl:copy-of select="xalan:nodeset($mathml)"/>
3432
3547
  </fo:instream-foreign-object>
3433
3548
  </fo:inline>
3549
+ </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
3550
+ <!-- <xsl:text>a+b</xsl:text> -->
3551
+ <xsl:text>&lt;</xsl:text>
3552
+ <xsl:value-of select="local-name()"/>
3553
+ <xsl:if test="local-name() = 'math'">
3554
+ <xsl:text> xmlns="http://www.w3.org/1998/Math/MathML"</xsl:text>
3555
+ </xsl:if>
3556
+ <xsl:for-each select="@*">
3557
+ <xsl:text> </xsl:text>
3558
+ <xsl:value-of select="local-name()"/>
3559
+ <xsl:text>="</xsl:text>
3560
+ <xsl:value-of select="."/>
3561
+ <xsl:text>"</xsl:text>
3562
+ </xsl:for-each>
3563
+ <xsl:text>&gt;</xsl:text>
3564
+ <xsl:apply-templates mode="mathml_actual_text"/>
3565
+ <xsl:text>&lt;/</xsl:text>
3566
+ <xsl:value-of select="local-name()"/>
3567
+ <xsl:text>&gt;</xsl:text>
3568
+ </xsl:template><xsl:template match="text()" mode="mathml_actual_text">
3569
+ <xsl:value-of select="normalize-space()"/>
3434
3570
  </xsl:template><xsl:template match="@*|node()" mode="mathml">
3435
3571
  <xsl:copy>
3436
3572
  <xsl:apply-templates select="@*|node()" mode="mathml"/>
@@ -3440,19 +3576,6 @@
3440
3576
  <!-- replace start and end spaces to non-break space -->
3441
3577
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'(^ )|( $)',' ')"/>
3442
3578
  </xsl:copy>
3443
- </xsl:template><xsl:template match="mathml:mi[. = ',' and not(following-sibling::*[1][local-name() = 'mtext' and text() = ' '])]" mode="mathml">
3444
- <xsl:copy>
3445
- <xsl:apply-templates select="@*|node()" mode="mathml"/>
3446
- </xsl:copy>
3447
- <xsl:choose>
3448
- <!-- if in msub, then don't add space -->
3449
- <xsl:when test="ancestor::mathml:mrow[parent::mathml:msub and preceding-sibling::*[1][self::mathml:mrow]]"/>
3450
- <!-- if next char in digit, don't add space -->
3451
- <xsl:when test="translate(substring(following-sibling::*[1]/text(),1,1),'0123456789','') = ''"/>
3452
- <xsl:otherwise>
3453
- <mathml:mspace width="0.5ex"/>
3454
- </xsl:otherwise>
3455
- </xsl:choose>
3456
3579
  </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">
3457
3580
  <xsl:variable name="target">
3458
3581
  <xsl:choose>
@@ -3505,7 +3628,10 @@
3505
3628
  </fo:block>
3506
3629
  <xsl:apply-templates/>
3507
3630
  </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3508
- <fo:inline><xsl:apply-templates/></fo:inline>
3631
+ <xsl:variable name="level">
3632
+ <xsl:call-template name="getLevel"/>
3633
+ </xsl:variable>
3634
+ <fo:inline role="H{$level}"><xsl:apply-templates/></fo:inline>
3509
3635
  </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']" priority="2">
3510
3636
  <fo:block id="{@id}" xsl:use-attribute-sets="appendix-example-style">
3511
3637
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -3540,9 +3666,10 @@
3540
3666
 
3541
3667
  </xsl:variable>
3542
3668
 
3669
+ <xsl:variable name="text"><xsl:apply-templates/></xsl:variable>
3543
3670
  <xsl:choose>
3544
- <xsl:when test="$lang = 'zh'"><xsl:text>、</xsl:text><xsl:value-of select="$title-modified"/><xsl:text>—</xsl:text></xsl:when>
3545
- <xsl:otherwise><xsl:text>, </xsl:text><xsl:value-of select="$title-modified"/><xsl:text> — </xsl:text></xsl:otherwise>
3671
+ <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>
3672
+ <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>
3546
3673
  </xsl:choose>
3547
3674
  <xsl:apply-templates/>
3548
3675
  </xsl:template><xsl:template match="*[local-name() = 'xref']">
@@ -3690,7 +3817,10 @@
3690
3817
  </fo:block>
3691
3818
  </xsl:template><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']"/><xsl:template match="*[local-name() = 'term']/*[local-name() = 'name']" mode="presentation">
3692
3819
  <xsl:if test="normalize-space() != ''">
3693
- <fo:inline>
3820
+ <xsl:variable name="level">
3821
+ <xsl:call-template name="getLevelTermName"/>
3822
+ </xsl:variable>
3823
+ <fo:inline role="H{$level}">
3694
3824
  <xsl:apply-templates/>
3695
3825
  <!-- <xsl:if test="$namespace = 'gb' or $namespace = 'ogc'">
3696
3826
  <xsl:text>.</xsl:text>
@@ -3991,6 +4121,13 @@
3991
4121
  </xsl:attribute>
3992
4122
  <xsl:apply-templates mode="svg_update"/>
3993
4123
  </xsl:copy>
4124
+ </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
4125
+ <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
4126
+ <xsl:for-each select="*[local-name() = 'svg']">
4127
+ <xsl:call-template name="image_svg">
4128
+ <xsl:with-param name="name" select="$name"/>
4129
+ </xsl:call-template>
4130
+ </xsl:for-each>
3994
4131
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
3995
4132
  <xsl:variable name="svg_content" select="document(@src)"/>
3996
4133
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -4095,7 +4232,7 @@
4095
4232
  </fo:basic-link>
4096
4233
  </fo:block>
4097
4234
  </fo:block-container>
4098
- </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">
4235
+ </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">
4099
4236
  <xsl:apply-templates mode="contents"/>
4100
4237
  <xsl:text> </xsl:text>
4101
4238
  </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">
@@ -4321,6 +4458,7 @@
4321
4458
  </xsl:when>
4322
4459
  <xsl:otherwise>
4323
4460
  <xsl:apply-templates/>
4461
+ <xsl:apply-templates select="following-sibling::*[1][local-name() = 'variant-title'][@type = 'sub']" mode="subtitle"/>
4324
4462
  </xsl:otherwise>
4325
4463
  </xsl:choose>
4326
4464
  </fo:block>
@@ -4461,14 +4599,6 @@
4461
4599
  <fo:block>
4462
4600
  <fo:inline padding-right="3mm">Obligation</fo:inline><xsl:value-of select="."/>
4463
4601
  </fo:block>
4464
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4465
- <fo:block xsl:use-attribute-sets="requirement-subject-style">
4466
- <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4467
- </fo:block>
4468
- </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'inherit']">
4469
- <fo:block xsl:use-attribute-sets="requirement-inherit-style">
4470
- <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4471
- </fo:block>
4472
4602
  </xsl:template><xsl:template match="*[local-name() = 'recommendation']">
4473
4603
  <fo:block id="{@id}" xsl:use-attribute-sets="recommendation-style">
4474
4604
  <xsl:apply-templates select="*[local-name()='name']" mode="presentation"/>
@@ -4485,6 +4615,38 @@
4485
4615
  <fo:block xsl:use-attribute-sets="recommendation-label-style">
4486
4616
  <xsl:apply-templates/>
4487
4617
  </fo:block>
4618
+ </xsl:template><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" priority="2"/><xsl:template match="*[local-name() = 'requirement']/*[local-name() = 'subject']" mode="presentation">
4619
+ <fo:block xsl:use-attribute-sets="subject-style">
4620
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4621
+ </fo:block>
4622
+ </xsl:template><xsl:template match="*[local-name() = 'subject']">
4623
+ <fo:block xsl:use-attribute-sets="subject-style">
4624
+ <xsl:text>Target Type </xsl:text><xsl:apply-templates/>
4625
+ </fo:block>
4626
+ </xsl:template><xsl:template match="*[local-name() = 'inherit'] | *[local-name() = 'component'][@class = 'inherit']">
4627
+ <fo:block xsl:use-attribute-sets="inherit-style">
4628
+ <xsl:text>Dependency </xsl:text><xsl:apply-templates/>
4629
+ </fo:block>
4630
+ </xsl:template><xsl:template match="*[local-name() = 'description'] | *[local-name() = 'component'][@class = 'description']">
4631
+ <fo:block xsl:use-attribute-sets="description-style">
4632
+ <xsl:apply-templates/>
4633
+ </fo:block>
4634
+ </xsl:template><xsl:template match="*[local-name() = 'specification'] | *[local-name() = 'component'][@class = 'specification']">
4635
+ <fo:block xsl:use-attribute-sets="specification-style">
4636
+ <xsl:apply-templates/>
4637
+ </fo:block>
4638
+ </xsl:template><xsl:template match="*[local-name() = 'measurement-target'] | *[local-name() = 'component'][@class = 'measurement-target']">
4639
+ <fo:block xsl:use-attribute-sets="measurement-target-style">
4640
+ <xsl:apply-templates/>
4641
+ </fo:block>
4642
+ </xsl:template><xsl:template match="*[local-name() = 'verification'] | *[local-name() = 'component'][@class = 'verification']">
4643
+ <fo:block xsl:use-attribute-sets="verification-style">
4644
+ <xsl:apply-templates/>
4645
+ </fo:block>
4646
+ </xsl:template><xsl:template match="*[local-name() = 'import'] | *[local-name() = 'component'][@class = 'import']">
4647
+ <fo:block xsl:use-attribute-sets="import-style">
4648
+ <xsl:apply-templates/>
4649
+ </fo:block>
4488
4650
  </xsl:template><xsl:template match="*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
4489
4651
  <fo:block-container margin-left="0mm" margin-right="0mm" margin-bottom="12pt">
4490
4652
  <xsl:if test="ancestor::*[local-name() = 'table'][@class = 'recommendation' or @class='requirement' or @class='permission']">
@@ -4636,7 +4798,19 @@
4636
4798
  </fo:inline>
4637
4799
  </xsl:if>
4638
4800
  </xsl:template><xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'p']">
4639
- <fo:inline><xsl:apply-templates/></fo:inline>
4801
+ <xsl:variable name="element">inline
4802
+
4803
+ </xsl:variable>
4804
+ <xsl:choose>
4805
+ <xsl:when test="contains($element, 'block')">
4806
+ <fo:block xsl:use-attribute-sets="example-p-style">
4807
+ <xsl:apply-templates/>
4808
+ </fo:block>
4809
+ </xsl:when>
4810
+ <xsl:otherwise>
4811
+ <fo:inline><xsl:apply-templates/></fo:inline>
4812
+ </xsl:otherwise>
4813
+ </xsl:choose>
4640
4814
  </xsl:template><xsl:template match="*[local-name() = 'example']">
4641
4815
  <fo:block id="{@id}" xsl:use-attribute-sets="example-style">
4642
4816
 
@@ -4738,14 +4912,15 @@
4738
4912
  </xsl:if>
4739
4913
  </xsl:template><xsl:variable name="localized.source">
4740
4914
  <xsl:call-template name="getLocalizedString">
4741
- <xsl:with-param name="key">source</xsl:with-param>
4742
- </xsl:call-template>
4915
+ <xsl:with-param name="key">source</xsl:with-param>
4916
+ </xsl:call-template>
4743
4917
  </xsl:variable><xsl:template match="*[local-name() = 'origin']">
4744
4918
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
4745
4919
  <xsl:if test="normalize-space(@citeas) = ''">
4746
4920
  <xsl:attribute name="fox:alt-text"><xsl:value-of select="@bibitemid"/></xsl:attribute>
4747
4921
  </xsl:if>
4748
4922
 
4923
+
4749
4924
  <fo:inline>
4750
4925
 
4751
4926
 
@@ -4753,6 +4928,7 @@
4753
4928
 
4754
4929
 
4755
4930
 
4931
+
4756
4932
  <xsl:call-template name="getTitle">
4757
4933
  <xsl:with-param name="name" select="'title-source'"/>
4758
4934
  </xsl:call-template>
@@ -4764,6 +4940,7 @@
4764
4940
  <fo:inline xsl:use-attribute-sets="origin-style">
4765
4941
  <xsl:apply-templates/>
4766
4942
  </fo:inline>
4943
+
4767
4944
  </fo:basic-link>
4768
4945
  </xsl:template><xsl:template match="*[local-name() = 'modification']/*[local-name() = 'p']">
4769
4946
  <fo:inline><xsl:apply-templates/></fo:inline>
@@ -4830,6 +5007,9 @@
4830
5007
 
4831
5008
  </xsl:if>
4832
5009
 
5010
+ <xsl:variable name="citeas" select="java:replaceAll(java:java.lang.String.new(@citeas),'^\[?(.+?)\]?$','$1')"/> <!-- remove leading and trailing brackets -->
5011
+ <xsl:variable name="text" select="normalize-space()"/>
5012
+
4833
5013
 
4834
5014
 
4835
5015
  <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
@@ -4845,7 +5025,9 @@
4845
5025
 
4846
5026
 
4847
5027
  </xsl:if>
4848
-
5028
+
5029
+
5030
+
4849
5031
  <xsl:apply-templates/>
4850
5032
  </fo:basic-link>
4851
5033
 
@@ -5179,6 +5361,7 @@
5179
5361
  </xsl:template><xsl:template match="*[local-name() = 'indexsect']//*[local-name() = 'li']" priority="4">
5180
5362
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
5181
5363
  <fo:block start-indent="{5 * $level}mm" text-indent="-5mm">
5364
+
5182
5365
  <xsl:apply-templates/>
5183
5366
  </fo:block>
5184
5367
  </xsl:template><xsl:template match="*[local-name() = 'bookmark']" name="bookmark">
@@ -5218,7 +5401,6 @@
5218
5401
  </xsl:template><xsl:template name="processBibitem">
5219
5402
 
5220
5403
 
5221
- <!-- end BIPM bibitem processing-->
5222
5404
 
5223
5405
 
5224
5406
 
@@ -5447,6 +5629,97 @@
5447
5629
  <fo:block-container border="1pt solid black" width="50%">
5448
5630
  <fo:block> </fo:block>
5449
5631
  </fo:block-container>
5632
+ </xsl:template><xsl:template match="*[local-name() = 'toc']">
5633
+ <xsl:param name="colwidths"/>
5634
+ <xsl:variable name="colwidths_">
5635
+ <xsl:choose>
5636
+ <xsl:when test="not($colwidths)">
5637
+ <xsl:variable name="toc_table_simple">
5638
+ <tbody>
5639
+ <xsl:apply-templates mode="toc_table_width"/>
5640
+ </tbody>
5641
+ </xsl:variable>
5642
+ <xsl:variable name="cols-count" select="count(xalan:nodeset($toc_table_simple)/*/tr[1]/td)"/>
5643
+ <xsl:call-template name="calculate-column-widths">
5644
+ <xsl:with-param name="cols-count" select="$cols-count"/>
5645
+ <xsl:with-param name="table" select="$toc_table_simple"/>
5646
+ </xsl:call-template>
5647
+ </xsl:when>
5648
+ <xsl:otherwise>
5649
+ <xsl:copy-of select="$colwidths"/>
5650
+ </xsl:otherwise>
5651
+ </xsl:choose>
5652
+ </xsl:variable>
5653
+ <fo:block role="TOCI" space-after="16pt">
5654
+ <fo:table width="100%" table-layout="fixed">
5655
+ <xsl:for-each select="xalan:nodeset($colwidths_)/column">
5656
+ <fo:table-column column-width="proportional-column-width({.})"/>
5657
+ </xsl:for-each>
5658
+ <fo:table-body>
5659
+ <xsl:apply-templates/>
5660
+ </fo:table-body>
5661
+ </fo:table>
5662
+ </fo:block>
5663
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']">
5664
+ <fo:table-row min-height="5mm">
5665
+ <xsl:apply-templates/>
5666
+ </fo:table-row>
5667
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'li']/*[local-name() = 'p']">
5668
+ <xsl:apply-templates/>
5669
+ </xsl:template><xsl:template match="*[local-name() = 'toc']//*[local-name() = 'xref']" priority="3">
5670
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5671
+ <xsl:variable name="target" select="@target"/>
5672
+ <xsl:for-each select="*[local-name() = 'tab']">
5673
+ <xsl:variable name="current_id" select="generate-id()"/>
5674
+ <fo:table-cell>
5675
+ <fo:block>
5676
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5677
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5678
+ <xsl:choose>
5679
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
5680
+ <xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
5681
+ </xsl:choose>
5682
+ </xsl:for-each>
5683
+ </fo:basic-link>
5684
+ </fo:block>
5685
+ </fo:table-cell>
5686
+ </xsl:for-each>
5687
+ <!-- last column - for page numbers -->
5688
+ <fo:table-cell text-align="right" font-size="10pt" font-weight="bold" font-family="Arial">
5689
+ <fo:block>
5690
+ <fo:basic-link internal-destination="{$target}" fox:alt-text="{.}">
5691
+ <fo:page-number-citation ref-id="{$target}"/>
5692
+ </fo:basic-link>
5693
+ </fo:block>
5694
+ </fo:table-cell>
5695
+ </xsl:template><xsl:template match="*" mode="toc_table_width">
5696
+ <xsl:apply-templates mode="toc_table_width"/>
5697
+ </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">
5698
+ <tr>
5699
+ <xsl:apply-templates mode="toc_table_width"/>
5700
+ </tr>
5701
+ </xsl:template><xsl:template match="*[local-name() = 'xref']" mode="toc_table_width">
5702
+ <!-- <xref target="cgpm9th1948r6">1.6.3<tab/>&#8220;9th CGPM, 1948:<tab/>decision to establish the SI&#8221;</xref> -->
5703
+ <xsl:for-each select="*[local-name() = 'tab']">
5704
+ <xsl:variable name="current_id" select="generate-id()"/>
5705
+ <td>
5706
+ <xsl:for-each select="following-sibling::node()[not(self::*[local-name() = 'tab']) and preceding-sibling::*[local-name() = 'tab'][1][generate-id() = $current_id]]">
5707
+ <xsl:copy-of select="."/>
5708
+ </xsl:for-each>
5709
+ </td>
5710
+ </xsl:for-each>
5711
+ <td>333</td> <!-- page number, just for fill -->
5712
+ </xsl:template><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']"/><xsl:template match="*[local-name() = 'variant-title'][@type = 'sub']" mode="subtitle">
5713
+ <fo:inline padding-right="5mm"> </fo:inline>
5714
+ <fo:inline><xsl:apply-templates/></fo:inline>
5715
+ </xsl:template><xsl:template match="*[local-name() = 'blacksquare']" name="blacksquare">
5716
+ <fo:inline padding-right="2.5mm" baseline-shift="5%">
5717
+ <fo:instream-foreign-object content-height="2mm" content-width="2mm" fox:alt-text="Quad">
5718
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" viewBox="0 0 2 2">
5719
+ <rect x="0" y="0" width="2" height="2" fill="black"/>
5720
+ </svg>
5721
+ </fo:instream-foreign-object>
5722
+ </fo:inline>
5450
5723
  </xsl:template><xsl:template name="convertDate">
5451
5724
  <xsl:param name="date"/>
5452
5725
  <xsl:param name="format" select="'short'"/>
@@ -5685,6 +5958,26 @@
5685
5958
  <xsl:value-of select="$level"/>
5686
5959
  </xsl:otherwise>
5687
5960
  </xsl:choose>
5961
+ </xsl:template><xsl:template name="getLevelTermName">
5962
+ <xsl:choose>
5963
+ <xsl:when test="normalize-space(../@depth) != ''">
5964
+ <xsl:value-of select="../@depth"/>
5965
+ </xsl:when>
5966
+ <xsl:otherwise>
5967
+ <xsl:variable name="title_level_">
5968
+ <xsl:for-each select="../preceding-sibling::*[local-name() = 'title'][1]">
5969
+ <xsl:call-template name="getLevel"/>
5970
+ </xsl:for-each>
5971
+ </xsl:variable>
5972
+ <xsl:variable name="title_level" select="normalize-space($title_level_)"/>
5973
+ <xsl:choose>
5974
+ <xsl:when test="$title_level != ''"><xsl:value-of select="$title_level + 1"/></xsl:when>
5975
+ <xsl:otherwise>
5976
+ <xsl:call-template name="getLevel"/>
5977
+ </xsl:otherwise>
5978
+ </xsl:choose>
5979
+ </xsl:otherwise>
5980
+ </xsl:choose>
5688
5981
  </xsl:template><xsl:template name="split">
5689
5982
  <xsl:param name="pText" select="."/>
5690
5983
  <xsl:param name="sep" select="','"/>