metanorma-itu 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" version="1.0">
1
+ <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:itu="https://www.metanorma.org/ns/itu" xmlns:mathml="http://www.w3.org/1998/Math/MathML" xmlns:xalan="http://xml.apache.org/xalan" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:java="http://xml.apache.org/xalan/java" exclude-result-prefixes="java" version="1.0">
2
2
 
3
3
  <xsl:output method="xml" encoding="UTF-8" indent="no"/>
4
4
 
@@ -51,8 +51,6 @@
51
51
  <xsl:apply-templates select="/itu:itu-standard/itu:annex" mode="contents"/>
52
52
  <xsl:apply-templates select="/itu:itu-standard/itu:bibliography/itu:references[position() != 1]" mode="contents"/> <!-- @id = 'bibliography' -->
53
53
 
54
- <xsl:apply-templates select="//itu3" mode="contents"/>
55
-
56
54
  <xsl:apply-templates select="//itu:table" mode="contents"/>
57
55
 
58
56
  </contents>
@@ -131,7 +129,7 @@
131
129
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
132
130
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
133
131
  <!-- Dublin Core properties go here -->
134
- <dc:title><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type='main']"/></dc:title>
132
+ <dc:title><xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:title[@type='main']"/> </dc:title>
135
133
  <dc:creator><xsl:value-of select="/itu:iso-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/></dc:creator>
136
134
  <dc:description>
137
135
  <xsl:variable name="abstract">
@@ -140,14 +138,7 @@
140
138
  <xsl:value-of select="normalize-space($abstract)"/>
141
139
  </dc:description>
142
140
  <pdf:Keywords>
143
- <xsl:for-each select="/itu:itu-standard/itu:bibdata//itu:keyword">
144
- <xsl:sort data-type="text" order="ascending"/>
145
- <xsl:apply-templates/>
146
- <xsl:choose>
147
- <xsl:when test="position() != last()">, </xsl:when>
148
- <xsl:otherwise>.</xsl:otherwise>
149
- </xsl:choose>
150
- </xsl:for-each>
141
+ <xsl:call-template name="insertKeywords"/>
151
142
  </pdf:Keywords>
152
143
  </rdf:Description>
153
144
  <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
@@ -180,12 +171,12 @@
180
171
  <fo:table-column column-width="35.8mm"/>
181
172
  <fo:table-column column-width="67mm"/>
182
173
  <fo:table-body>
183
- <fo:table-row height="42.5mm">
174
+ <fo:table-row height="37.5mm"> <!-- 42.5mm -->
184
175
  <fo:table-cell>
185
176
  <fo:block> </fo:block>
186
177
  </fo:table-cell>
187
178
  <fo:table-cell number-columns-spanned="3">
188
- <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray" margin-top="16pt"> <!-- letter-spacing="4pt", Helvetica for letter-spacing working -->
179
+ <fo:block font-family="Arial" font-size="13pt" font-weight="bold" color="gray"> <!-- margin-top="16pt" letter-spacing="4pt", Helvetica for letter-spacing working -->
189
180
  <fo:block><xsl:value-of select="$linebreak"/></fo:block>
190
181
  <xsl:call-template name="addLetterSpacing">
191
182
  <xsl:with-param name="text" select="/itu:itu-standard/itu:bibdata/itu:contributor[itu:role/@type='author']/itu:organization/itu:name"/>
@@ -236,29 +227,31 @@
236
227
  </fo:block>
237
228
  </fo:table-cell>
238
229
  </fo:table-row>
239
- <fo:table-row height="59mm">
230
+ <fo:table-row height="64mm"> <!-- 59mm -->
240
231
  <fo:table-cell>
241
232
  <fo:block> </fo:block>
242
233
  </fo:table-cell>
243
- <fo:table-cell font-size="16pt" number-columns-spanned="3" border-bottom="0.5mm solid black" padding-right="2mm">
244
- <fo:block>
245
- <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']) != ''">
246
- <xsl:variable name="title">
247
- <xsl:text>Series </xsl:text>
248
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']"/>
249
- </xsl:variable>
250
- <xsl:value-of select="translate($title, $lower, $upper)"/>
251
- </xsl:if>
252
- </fo:block>
253
- <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
254
- <fo:block margin-top="6pt">
255
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
256
- <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
257
- <xsl:text> — </xsl:text>
258
- <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
234
+ <fo:table-cell font-size="16pt" number-columns-spanned="3" border-bottom="0.5mm solid black" padding-right="2mm" display-align="after">
235
+ <fo:block padding-bottom="7mm">
236
+ <fo:block text-transform="uppercase">
237
+ <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']) != ''">
238
+ <xsl:variable name="title">
239
+ <xsl:text>Series </xsl:text>
240
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'main']"/>
241
+ </xsl:variable>
242
+ <xsl:value-of select="$title"/>
259
243
  </xsl:if>
260
244
  </fo:block>
261
- </xsl:if>
245
+ <xsl:if test="/itu:itu-standard/itu:bibdata/itu:series">
246
+ <fo:block margin-top="6pt">
247
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'secondary']"/>
248
+ <xsl:if test="normalize-space(/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']) != ''">
249
+ <xsl:text> — </xsl:text>
250
+ <xsl:value-of select="/itu:itu-standard/itu:bibdata/itu:series[@type = 'tertiary']"/>
251
+ </xsl:if>
252
+ </fo:block>
253
+ </xsl:if>
254
+ </fo:block>
262
255
  </fo:table-cell>
263
256
  </fo:table-row>
264
257
  <fo:table-row height="40mm">
@@ -346,17 +339,10 @@
346
339
  <xsl:value-of select="$linebreak"/>
347
340
  </fo:block>
348
341
  <fo:block font-weight="bold" margin-top="18pt" margin-bottom="18pt">
349
- <xsl:text>Keywords</xsl:text>
342
+ <xsl:value-of select="$title-keywords"/>
350
343
  </fo:block>
351
344
  <fo:block>
352
- <xsl:for-each select="/itu:itu-standard/itu:bibdata//itu:keyword">
353
- <xsl:sort data-type="text" order="ascending"/>
354
- <xsl:apply-templates/>
355
- <xsl:choose>
356
- <xsl:when test="position() != last()">, </xsl:when>
357
- <xsl:otherwise>.</xsl:otherwise>
358
- </xsl:choose>
359
- </xsl:for-each>
345
+ <xsl:call-template name="insertKeywords"/>
360
346
  </fo:block>
361
347
  </xsl:if>
362
348
 
@@ -379,8 +365,8 @@
379
365
  <xsl:if test="xalan:nodeset($contents)//item">
380
366
  <fo:block break-after="page"/>
381
367
  <fo:block-container>
382
- <fo:block margin-top="6pt" text-align="center" font-weight="bold">Table of Contents</fo:block>
383
- <fo:block margin-top="6pt" text-align="right" font-weight="bold">Page</fo:block>
368
+ <fo:block margin-top="6pt" text-align="center" font-weight="bold"><xsl:value-of select="$title-toc"/></fo:block>
369
+ <fo:block margin-top="6pt" text-align="right" font-weight="bold"><xsl:value-of select="$title-page"/></fo:block>
384
370
 
385
371
  <xsl:for-each select="xalan:nodeset($contents)//item">
386
372
  <xsl:if test="@display = 'true'">
@@ -625,7 +611,7 @@
625
611
  <xsl:template match="itu:figure" mode="contents">
626
612
  <xsl:param name="sectionNum"/>
627
613
  <item level="" id="{@id}" display="false" type="figure">
628
- <xsl:variable name="title">Figure </xsl:variable>
614
+ <xsl:variable name="title" select="$title-figure"/>
629
615
  <xsl:attribute name="section">
630
616
  <xsl:call-template name="getSection">
631
617
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
@@ -635,6 +621,11 @@
635
621
  <xsl:with-param name="brackets" select="'false'"/>
636
622
  </xsl:call-template> -->
637
623
  </xsl:attribute>
624
+ <xsl:attribute name="topsection">
625
+ <xsl:call-template name="getTopSection">
626
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
627
+ </xsl:call-template>
628
+ </xsl:attribute>
638
629
  <xsl:value-of select="$title"/>
639
630
  <xsl:call-template name="getItemNumber">
640
631
  <xsl:with-param name="brackets" select="'false'"/>
@@ -648,7 +639,7 @@
648
639
  <xsl:template match="itu:table" mode="contents">
649
640
  <xsl:param name="sectionNum"/>
650
641
  <item level="" id="{@id}" display="false" type="table">
651
- <xsl:variable name="title">Table </xsl:variable>
642
+ <xsl:variable name="title" select="$title-table"/>
652
643
  <xsl:attribute name="section">
653
644
  <xsl:call-template name="getSection">
654
645
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
@@ -656,6 +647,11 @@
656
647
  <!-- <xsl:text>Table </xsl:text>
657
648
  <xsl:call-template name="getItemNumber"/> -->
658
649
  </xsl:attribute>
650
+ <xsl:attribute name="topsection">
651
+ <xsl:call-template name="getTopSection">
652
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
653
+ </xsl:call-template>
654
+ </xsl:attribute>
659
655
  <xsl:value-of select="$title"/>
660
656
  <xsl:call-template name="getItemNumber">
661
657
  <xsl:with-param name="brackets" select="'false'"/>
@@ -672,21 +668,22 @@
672
668
  <item level="" id="{@id}" display="false" type="formula">
673
669
  <xsl:variable name="title">
674
670
  <xsl:choose>
675
- <xsl:when test="@inequality = 'true'">Inequality </xsl:when>
676
- <xsl:otherwise>Equation </xsl:otherwise>
671
+ <xsl:when test="@inequality = 'true'"><xsl:value-of select="$title-inequality"/></xsl:when>
672
+ <xsl:otherwise><xsl:value-of select="$title-equation"/></xsl:otherwise>
677
673
  </xsl:choose>
678
674
  </xsl:variable>
679
- <xsl:attribute name="section">
675
+ <xsl:variable name="section">
680
676
  <xsl:call-template name="getSection">
681
677
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
682
678
  </xsl:call-template>
683
- <!-- <xsl:value-of select="$title"/>
684
- <xsl:call-template name="getItemNumber"/> -->
685
- </xsl:attribute>
679
+ </xsl:variable>
680
+ <xsl:attribute name="section">
681
+ <xsl:value-of select="$section"/>
682
+ </xsl:attribute>
686
683
  <xsl:variable name="parent-element" select="local-name(..)"/>
687
684
  <xsl:attribute name="parent">
688
685
  <xsl:choose>
689
- <xsl:when test="$parent-element = 'clause'">Clause</xsl:when>
686
+ <xsl:when test="$parent-element = 'clause'"><xsl:value-of select="normalize-space($title-clause)"/></xsl:when>
690
687
  <xsl:otherwise/>
691
688
  </xsl:choose>
692
689
  </xsl:attribute>
@@ -698,6 +695,11 @@
698
695
  <xsl:attribute name="number">
699
696
  <xsl:value-of select="$itemNumber"/>
700
697
  </xsl:attribute>
698
+ <xsl:attribute name="topsection">
699
+ <xsl:call-template name="getTopSection">
700
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
701
+ </xsl:call-template>
702
+ </xsl:attribute>
701
703
  <xsl:value-of select="$title"/>
702
704
  <xsl:value-of select="$itemNumber"/>
703
705
  </item>
@@ -794,10 +796,15 @@
794
796
  <item level="" id="{@id}" display="false" type="example" section="{$section}">
795
797
  <xsl:attribute name="parent">
796
798
  <xsl:choose>
797
- <xsl:when test="$parent-element = 'clause'">Clause</xsl:when>
799
+ <xsl:when test="$parent-element = 'clause'"><xsl:value-of select="normalize-space($title-clause)"/></xsl:when>
798
800
  <xsl:otherwise/>
799
801
  </xsl:choose>
800
802
  </xsl:attribute>
803
+ <xsl:attribute name="topsection">
804
+ <xsl:call-template name="getTopSection">
805
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
806
+ </xsl:call-template>
807
+ </xsl:attribute>
801
808
  </item>
802
809
  <xsl:apply-templates mode="contents">
803
810
  <xsl:with-param name="sectionNum" select="$sectionNum"/>
@@ -816,6 +823,11 @@
816
823
  </xsl:call-template>
817
824
  </xsl:variable>
818
825
  <item level="" id="{@id}" display="false" type="note" section="{$section}">
826
+ <xsl:attribute name="topsection">
827
+ <xsl:call-template name="getTopSection">
828
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
829
+ </xsl:call-template>
830
+ </xsl:attribute>
819
831
  <xsl:number/>
820
832
  </item>
821
833
  <xsl:apply-templates mode="contents">
@@ -823,23 +835,6 @@
823
835
  </xsl:apply-templates>
824
836
  </xsl:template>
825
837
 
826
- <xsl:template match="itu:termnote" mode="contents">
827
- <xsl:param name="sectionNum"/>
828
- <xsl:variable name="level">
829
- <xsl:call-template name="getLevel"/>
830
- </xsl:variable>
831
- <xsl:variable name="section">
832
- <xsl:call-template name="getSection">
833
- <xsl:with-param name="sectionNum" select="$sectionNum"/>
834
- </xsl:call-template>
835
- </xsl:variable>
836
- <item level="" id="{@id}" display="false" type="note" section="{$section}">
837
- <xsl:number/>
838
- </item>
839
- <xsl:apply-templates mode="contents">
840
- <xsl:with-param name="sectionNum" select="$sectionNum"/>
841
- </xsl:apply-templates>
842
- </xsl:template>
843
838
 
844
839
  <xsl:template match="itu:note" mode="contents">
845
840
  <xsl:param name="sectionNum"/>
@@ -854,6 +849,11 @@
854
849
  </xsl:for-each>
855
850
  </xsl:variable>
856
851
  <item level="" id="{@id}" display="false" type="note" section="{$section}">
852
+ <xsl:attribute name="topsection">
853
+ <xsl:call-template name="getTopSection">
854
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
855
+ </xsl:call-template>
856
+ </xsl:attribute>
857
857
  <xsl:number/>
858
858
  </item>
859
859
  <xsl:apply-templates mode="contents">
@@ -910,6 +910,18 @@
910
910
  </xsl:otherwise>
911
911
  </xsl:choose>
912
912
  </xsl:template>
913
+
914
+ <xsl:template match="itu:xref" mode="contents">
915
+ <xsl:param name="sectionNum"/>
916
+ <item level="" id="{generate-id()}" display="false" type="xref">
917
+
918
+ <xsl:attribute name="topsection">
919
+ <xsl:call-template name="getTopSection">
920
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
921
+ </xsl:call-template>
922
+ </xsl:attribute>
923
+ </item>
924
+ </xsl:template>
913
925
 
914
926
  <!-- ============================= -->
915
927
  <!-- ============================= -->
@@ -952,14 +964,23 @@
952
964
  <!-- PARAGRAPHS -->
953
965
  <!-- ============================= -->
954
966
  <xsl:template match="itu:p | itu:sections/itu:p">
967
+ <xsl:param name="sectionNum"/>
955
968
  <fo:block margin-top="6pt">
956
969
  <xsl:attribute name="text-align">
957
970
  <xsl:choose>
958
971
  <xsl:when test="@align"><xsl:value-of select="@align"/></xsl:when>
972
+ <xsl:when test="ancestor::*[1][local-name() = 'td']/@align">
973
+ <xsl:value-of select="ancestor::*[1][local-name() = 'td']/@align"/>
974
+ </xsl:when>
975
+ <xsl:when test="ancestor::*[1][local-name() = 'th']/@align">
976
+ <xsl:value-of select="ancestor::*[1][local-name() = 'th']/@align"/>
977
+ </xsl:when>
959
978
  <xsl:otherwise>justify</xsl:otherwise>
960
979
  </xsl:choose>
961
980
  </xsl:attribute>
962
- <xsl:apply-templates/>
981
+ <xsl:apply-templates>
982
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
983
+ </xsl:apply-templates>
963
984
  </fo:block>
964
985
  </xsl:template>
965
986
 
@@ -974,8 +995,8 @@
974
995
  <fo:block font-size="11pt" space-before="4pt" text-align="justify">
975
996
  <xsl:if test="ancestor::itu:figure">
976
997
  <xsl:attribute name="keep-with-previous">always</xsl:attribute>
977
- </xsl:if>
978
- <xsl:text>NOTE </xsl:text>
998
+ </xsl:if>
999
+ <xsl:value-of select="$title-note"/>
979
1000
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
980
1001
  <xsl:if test="count(//itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]) &gt; 1">
981
1002
  <xsl:number count="itu:note[ancestor::*[local-name() = 'clause'][1][@id = $id] and not (ancestor::itu:table)]" level="any"/>
@@ -1239,7 +1260,15 @@
1239
1260
  <xsl:apply-templates/>
1240
1261
  </fo:inline>
1241
1262
  <xsl:if test="../itu:termsource/itu:origin">
1242
- <xsl:text> [</xsl:text><xsl:value-of select="../itu:termsource/itu:origin/@citeas"/><xsl:text>]</xsl:text>
1263
+ <xsl:variable name="citeas" select="../itu:termsource/itu:origin/@citeas"/>
1264
+ <xsl:choose>
1265
+ <xsl:when test="contains($citeas, '[')">
1266
+ <xsl:text> </xsl:text><xsl:value-of select="$citeas" disable-output-escaping="yes"/>
1267
+ </xsl:when>
1268
+ <xsl:otherwise>
1269
+ <xsl:text> [</xsl:text><xsl:value-of select="$citeas"/><xsl:text>]</xsl:text>
1270
+ </xsl:otherwise>
1271
+ </xsl:choose>
1243
1272
  </xsl:if>
1244
1273
  <xsl:text>: </xsl:text>
1245
1274
  <xsl:apply-templates select="following-sibling::itu:definition/node()" mode="process"/> <!-- -->
@@ -1354,10 +1383,13 @@
1354
1383
  <xsl:with-param name="brackets" select="'false'"/>
1355
1384
  </xsl:call-template>
1356
1385
  </xsl:variable>
1357
- <xsl:if test="$itemnumber != ''">
1358
- <xsl:text>Figure </xsl:text>
1359
- <xsl:value-of select="$itemnumber"/>
1360
- </xsl:if>
1386
+ <xsl:choose>
1387
+ <xsl:when test="local-name(*) = 'figure' and normalize-space(itu:name) = ''"/><!-- don't show 'Figure' for outer figure without name -->
1388
+ <xsl:when test="$itemnumber != ''">
1389
+ <xsl:value-of select="$title-figure"/>
1390
+ <xsl:value-of select="$itemnumber"/>
1391
+ </xsl:when>
1392
+ </xsl:choose>
1361
1393
  <xsl:if test="itu:name">
1362
1394
  <xsl:text> — </xsl:text>
1363
1395
  <xsl:apply-templates select="itu:name" mode="process"/>
@@ -1416,18 +1448,6 @@
1416
1448
  <xsl:template match="itu:docidentifier"/>
1417
1449
 
1418
1450
 
1419
-
1420
- <xsl:template match="itu:annex2//itu:note/itu:p">
1421
- <fo:block font-size="11pt" margin-top="4pt">
1422
- <xsl:text>NOTE </xsl:text>
1423
- <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
1424
- <xsl:number count="itu:note"/><xsl:text> </xsl:text>
1425
- <!-- </xsl:if> -->
1426
- <xsl:text>– </xsl:text>
1427
- <xsl:apply-templates/>
1428
- </fo:block>
1429
- </xsl:template>
1430
-
1431
1451
  <xsl:template match="itu:ul | itu:ol | itu:sections/itu:ul | itu:sections/itu:ol">
1432
1452
  <xsl:if test="preceding-sibling::*[1][local-name() = 'title']">
1433
1453
  <fo:block padding-top="-8pt" font-size="1pt"> </fo:block>
@@ -1439,10 +1459,15 @@
1439
1459
  </xsl:template>
1440
1460
 
1441
1461
  <xsl:template match="itu:ul//itu:note | itu:ol//itu:note"/>
1462
+ <xsl:template match="itu:ul//itu:note | itu:ol//itu:note" mode="process">
1463
+ <fo:block id="{@id}">
1464
+ <xsl:apply-templates mode="process"/>
1465
+ </fo:block>
1466
+ </xsl:template>
1442
1467
  <xsl:template match="itu:ul//itu:note/itu:p | itu:ol//itu:note/itu:p" mode="process">
1443
1468
  <xsl:variable name="id" select="ancestor::*[local-name() = 'clause'][1]/@id"/>
1444
- <fo:block font-size="11pt" margin-top="4pt">
1445
- <xsl:text>NOTE </xsl:text>
1469
+ <fo:block font-size="11pt" margin-top="4pt">
1470
+ <xsl:value-of select="$title-note"/>
1446
1471
  <!-- <xsl:if test="../following-sibling::itu:note or ../preceding-sibling::itu:note"> -->
1447
1472
  <xsl:if test="count(//itu:note[ancestor::*[@id = $id] and not (ancestor::itu:table)]) &gt; 1">
1448
1473
  <xsl:number count="itu:note[ancestor::*[@id = $id] and not (ancestor::itu:table)]" level="any"/>
@@ -1467,10 +1492,13 @@
1467
1492
  <xsl:attribute name="margin-left">18mm</xsl:attribute>
1468
1493
  </xsl:if>
1469
1494
  <xsl:if test="local-name(..) = 'ul'">
1470
- <xsl:attribute name="margin-left">15mm</xsl:attribute>
1471
- <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1">
1472
- <xsl:attribute name="margin-left">7mm</xsl:attribute>
1495
+ <xsl:attribute name="margin-left">7mm</xsl:attribute><!-- 15mm -->
1496
+ <xsl:if test="ancestor::itu:table">
1497
+ <xsl:attribute name="margin-left">4.5mm</xsl:attribute>
1473
1498
  </xsl:if>
1499
+ <!-- <xsl:if test="count(ancestor::itu:ol) + count(ancestor::itu:ul) &gt; 1">
1500
+ <xsl:attribute name="margin-left">7mm</xsl:attribute>
1501
+ </xsl:if> -->
1474
1502
  </xsl:if>
1475
1503
  <fo:block-container margin-left="0mm">
1476
1504
  <xsl:apply-templates/>
@@ -1481,7 +1509,7 @@
1481
1509
  </fo:list-item>
1482
1510
  </xsl:template>
1483
1511
 
1484
- <xsl:template match="itu:li//itu:p">
1512
+ <xsl:template match="itu:li//itu:p[not(parent::itu:dd)]">
1485
1513
  <fo:block margin-bottom="0pt"> <!-- margin-bottom="6pt" -->
1486
1514
  <!-- <xsl:if test="local-name(ancestor::itu:li[1]/..) = 'ul'">
1487
1515
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
@@ -1493,11 +1521,9 @@
1493
1521
  <xsl:template match="itu:link" priority="2">
1494
1522
  <fo:inline color="blue">
1495
1523
  <xsl:if test="local-name(..) = 'formattedref' or ancestor::itu:preface">
1496
- <xsl:attribute name="font-family">Arial</xsl:attribute>
1497
- <xsl:attribute name="font-size">8pt</xsl:attribute>
1498
- <xsl:if test="local-name(..) = 'formattedref'">
1499
- <xsl:attribute name="text-decoration">underline</xsl:attribute>
1500
- </xsl:if>
1524
+ <xsl:attribute name="text-decoration">underline</xsl:attribute>
1525
+ <!-- <xsl:attribute name="font-family">Arial</xsl:attribute>
1526
+ <xsl:attribute name="font-size">8pt</xsl:attribute> -->
1501
1527
  </xsl:if>
1502
1528
  <xsl:call-template name="link"/>
1503
1529
  </fo:inline>
@@ -1505,8 +1531,8 @@
1505
1531
 
1506
1532
 
1507
1533
  <xsl:template match="itu:termnote">
1508
- <fo:block id="{@id}" margin-top="4pt">
1509
- <xsl:text>NOTE </xsl:text>
1534
+ <fo:block id="{@id}" margin-top="4pt">
1535
+ <xsl:value-of select="$title-note"/>
1510
1536
  <xsl:if test="following-sibling::itu:termnote or preceding-sibling::itu:termnote">
1511
1537
  <xsl:number/><xsl:text> </xsl:text>
1512
1538
  </xsl:if>
@@ -1549,7 +1575,7 @@
1549
1575
 
1550
1576
  <xsl:template match="itu:formula" name="formula">
1551
1577
  <xsl:param name="sectionNum"/>
1552
- <fo:block id="{@id}" margin-top="6pt"> <!-- text-align="center" -->
1578
+ <fo:block id="{@id}" margin-top="6pt" margin-bottom="6pt"> <!-- text-align="center" -->
1553
1579
  <xsl:apply-templates/>
1554
1580
  <fo:inline keep-together.within-line="always">
1555
1581
  </fo:inline>
@@ -1599,18 +1625,22 @@
1599
1625
  <xsl:param name="sectionNum"/>
1600
1626
 
1601
1627
  <xsl:variable name="section" select="xalan:nodeset($contents)//item[@id = current()/@target]/@section"/>
1628
+ <xsl:variable name="topsection" select="xalan:nodeset($contents)//item[@id = current()/@target]/@topsection"/>
1629
+ <xsl:variable name="xref_id" select="generate-id()"/>
1630
+ <xsl:variable name="xreftopsection" select="xalan:nodeset($contents)//item[@id = $xref_id]/@topsection"/>
1602
1631
 
1603
1632
  <xsl:variable name="text" select="xalan:nodeset($contents)//item[@id = current()/@target]/text()"/>
1604
1633
 
1605
1634
  <fo:basic-link internal-destination="{@target}" color="blue" text-decoration="underline" fox:alt-text="{@target}">
1606
1635
  <xsl:variable name="type" select="xalan:nodeset($contents)//item[@id = current()/@target]/@type"/>
1636
+ <xsl:variable name="level" select="xalan:nodeset($contents)//item[@id =current()/@target]/@level"/>
1607
1637
  <xsl:choose>
1608
- <xsl:when test="$type = 'clause'">Clause </xsl:when><!-- and not (ancestor::annex) -->
1638
+ <xsl:when test="($type = 'clause' or $type = 'term') and $level = 1"><xsl:value-of select="$title-clause"/></xsl:when><!-- and not (ancestor::annex) -->
1639
+ <xsl:when test="($type = 'clause' or $type = 'term') and $level &gt; 1"><xsl:value-of select="translate($title-clause, $upper, $lower)"/></xsl:when>
1609
1640
  <xsl:when test="$type = 'example'">Example </xsl:when>
1610
1641
  <xsl:when test="$type = 'figure'"/>
1611
1642
  <xsl:when test="$type = 'formula'"/>
1612
1643
  <xsl:when test="$type = 'table'"/>
1613
- <xsl:when test="$type = 'term'">Clause </xsl:when>
1614
1644
  <xsl:when test="$type = 'note'"><xsl:text>Note </xsl:text><xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/text()"/></xsl:when>
1615
1645
 
1616
1646
  <xsl:otherwise/> <!-- <xsl:value-of select="$type"/> -->
@@ -1623,8 +1653,10 @@
1623
1653
  </xsl:variable>
1624
1654
  <xsl:if test="not(contains($section, $currentSection))">
1625
1655
  <xsl:text>in </xsl:text>
1626
- <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1627
- <xsl:text> </xsl:text>
1656
+ <xsl:if test="$level = 1">
1657
+ <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1658
+ <xsl:text> </xsl:text>
1659
+ </xsl:if>
1628
1660
  <xsl:value-of select="$section"/>
1629
1661
  </xsl:if>
1630
1662
  </xsl:when>
@@ -1635,13 +1667,17 @@
1635
1667
 
1636
1668
  <xsl:when test="$type = 'formula'">
1637
1669
  <xsl:value-of select="$text"/>
1638
- <xsl:variable name="currentSection">
1670
+ <!-- <xsl:variable name="currentSection">
1639
1671
  <xsl:call-template name="getSection"/>
1640
- </xsl:variable>
1641
- <xsl:if test="not(contains($section, $currentSection))">
1672
+ </xsl:variable>
1673
+
1674
+ <xsl:if test="not(contains($section, $currentSection))"> -->
1675
+ <xsl:if test="$topsection != $xreftopsection">
1642
1676
  <xsl:text> in </xsl:text>
1643
- <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1644
- <xsl:text> </xsl:text>
1677
+ <xsl:if test="$level = 1">
1678
+ <xsl:value-of select="xalan:nodeset($contents)//item[@id = current()/@target]/@parent"/>
1679
+ <xsl:text> </xsl:text>
1680
+ </xsl:if>
1645
1681
  <xsl:value-of select="$section"/>
1646
1682
  </xsl:if>
1647
1683
  </xsl:when>
@@ -1655,7 +1691,11 @@
1655
1691
  <xsl:call-template name="getSection"/>
1656
1692
  </xsl:variable>
1657
1693
  <xsl:if test="not(contains($section, $currentSection))">
1658
- <xsl:text> in Clause </xsl:text>
1694
+ <xsl:text> in </xsl:text>
1695
+ <xsl:choose>
1696
+ <xsl:when test="$level = 1"><xsl:value-of select="$title-clause"/></xsl:when>
1697
+ <xsl:when test="$level &gt; 1"><xsl:value-of select="translate($title-clause, $upper, $lower)"/></xsl:when>
1698
+ </xsl:choose>
1659
1699
  <xsl:value-of select="$section"/>
1660
1700
  </xsl:if>
1661
1701
  </xsl:when>
@@ -1696,8 +1736,8 @@
1696
1736
  </xsl:template>
1697
1737
 
1698
1738
  <xsl:template match="itu:example/itu:name">
1699
- <fo:block font-weight="bold">
1700
- <xsl:text>EXAMPLE</xsl:text>
1739
+ <fo:block font-weight="bold">
1740
+ <xsl:value-of select="normalize-space($title-example)"/>
1701
1741
  <xsl:if test="count(ancestor::itu:clause[1]/itu:example) &gt; 1">
1702
1742
  <xsl:text> </xsl:text><xsl:number count="itu:example"/>
1703
1743
  </xsl:if>
@@ -1750,18 +1790,30 @@
1750
1790
  <xsl:apply-templates/>
1751
1791
  </xsl:template>
1752
1792
 
1753
- <xsl:template match="itu:sourcecode">
1754
- <fo:block font-family="Courier" font-size="10pt" margin-top="6pt" margin-bottom="6pt">
1755
- <xsl:choose>
1756
- <xsl:when test="@lang = 'en'"/>
1757
- <xsl:otherwise>
1758
- <xsl:attribute name="white-space">pre</xsl:attribute>
1759
- </xsl:otherwise>
1760
- </xsl:choose>
1761
- <xsl:apply-templates/>
1793
+ <xsl:template match="itu:quote">
1794
+ <fo:block margin-top="6pt" margin-left="12mm" margin-right="12mm">
1795
+ <xsl:apply-templates select=".//itu:p"/>
1762
1796
  </fo:block>
1797
+ <xsl:if test="itu:author or itu:source">
1798
+ <fo:block text-align="right">
1799
+ <!-- — ISO, ISO 7301:2011, Clause 1 -->
1800
+ <xsl:text>— </xsl:text>
1801
+ <xsl:value-of select="itu:author"/>
1802
+ <xsl:if test="itu:author and itu:source">
1803
+ <xsl:text>, </xsl:text>
1804
+ </xsl:if>
1805
+ <xsl:apply-templates select="itu:source"/>
1806
+ </fo:block>
1807
+ </xsl:if>
1763
1808
  </xsl:template>
1764
1809
 
1810
+ <xsl:template match="itu:source">
1811
+ <fo:basic-link internal-destination="{@bibitemid}" fox:alt-text="{@citeas}">
1812
+ <xsl:value-of select="@citeas" disable-output-escaping="yes"/>
1813
+ <xsl:apply-templates select="itu:localityStack"/>
1814
+ </fo:basic-link>
1815
+ </xsl:template>
1816
+
1765
1817
  <xsl:template name="insertHeaderFooter">
1766
1818
  <fo:static-content flow-name="footer-even" font-family="Times New Roman" font-size="11pt">
1767
1819
  <fo:block-container height="19mm" display-align="after">
@@ -2322,6 +2374,14 @@
2322
2374
  <xsl:variable name="num">
2323
2375
  <xsl:number format=".1" level="multiple" count="itu:clause/itu:clause | itu:clause/itu:terms | itu:terms/itu:term | itu:clause/itu:term | itu:clause/itu:definitions"/>
2324
2376
  </xsl:variable>
2377
+ <!-- <xsl:variable name="sectionNum_">
2378
+ <xsl:choose>
2379
+ <xsl:when test="normalize-space($sectionNum) = ''"><xsl:number format="1" count="itu:sections/*"/></xsl:when>
2380
+ <xsl:otherwise>
2381
+ <xsl:value-of select="$sectionNum"/>
2382
+ </xsl:otherwise>
2383
+ </xsl:choose>
2384
+ </xsl:variable> -->
2325
2385
  <xsl:value-of select="concat($sectionNum, $num)"/>
2326
2386
  </xsl:when>
2327
2387
  <xsl:otherwise>
@@ -2331,8 +2391,8 @@
2331
2391
  </xsl:when>
2332
2392
  <xsl:when test="ancestor::itu:annex[@obligation = 'informative']">
2333
2393
  <xsl:choose>
2334
- <xsl:when test="$level = 1">
2335
- <xsl:text>Appendix </xsl:text>
2394
+ <xsl:when test="$level = 1">
2395
+ <xsl:value-of select="$title-appendix"/><xsl:text> </xsl:text>
2336
2396
  <xsl:number format="I" level="any" count="itu:annex[@obligation = 'informative']"/>
2337
2397
  </xsl:when>
2338
2398
  <xsl:otherwise>
@@ -2342,8 +2402,8 @@
2342
2402
  </xsl:when>
2343
2403
  <xsl:when test="ancestor::itu:annex[not(@obligation) or @obligation != 'informative']">
2344
2404
  <xsl:choose>
2345
- <xsl:when test="$level = 1">
2346
- <xsl:text>Annex </xsl:text>
2405
+ <xsl:when test="$level = 1">
2406
+ <xsl:value-of select="$title-annex"/>
2347
2407
  <xsl:choose>
2348
2408
  <xsl:when test="count(//itu:annex) = 1">
2349
2409
  <xsl:choose>
@@ -2400,17 +2460,95 @@
2400
2460
  </xsl:otherwise>
2401
2461
  </xsl:choose>
2402
2462
  </xsl:template>
2463
+
2464
+ <xsl:template name="getTopSection">
2465
+ <xsl:param name="sectionNum"/>
2466
+ <xsl:variable name="section">
2467
+ <xsl:call-template name="getSection">
2468
+ <xsl:with-param name="sectionNum" select="$sectionNum"/>
2469
+ </xsl:call-template>
2470
+ </xsl:variable>
2471
+ <xsl:variable name="topsection_" select="normalize-space(translate($section, '().-',' '))"/>
2472
+ <xsl:choose>
2473
+ <xsl:when test="contains($topsection_, ' ')">
2474
+ <xsl:value-of select="substring-before($topsection_, ' ')"/>
2475
+ </xsl:when>
2476
+ <xsl:otherwise>
2477
+ <xsl:value-of select="$topsection_"/>
2478
+ </xsl:otherwise>
2479
+ </xsl:choose>
2480
+ </xsl:template>
2403
2481
 
2404
- <xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="linebreak" select="'&#8232;'"/><xsl:attribute-set xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="link-style">
2482
+ <xsl:variable name="title-table">
2483
+
2484
+ <xsl:text>Table </xsl:text>
2485
+
2486
+
2487
+ </xsl:variable><xsl:variable name="title-note">
2488
+
2489
+ <xsl:text>NOTE </xsl:text>
2490
+
2491
+
2492
+ </xsl:variable><xsl:variable name="title-figure">
2493
+
2494
+ <xsl:text>Figure </xsl:text>
2495
+
2496
+
2497
+ </xsl:variable><xsl:variable name="title-example">
2498
+
2499
+ <xsl:text>EXAMPLE </xsl:text>
2500
+
2501
+
2502
+ </xsl:variable><xsl:variable name="title-inequality">Inequality </xsl:variable><xsl:variable name="title-equation">Equation </xsl:variable><xsl:variable name="title-annex">
2405
2503
 
2504
+ <xsl:text>Annex </xsl:text>
2406
2505
 
2407
- </xsl:attribute-set><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()">
2506
+
2507
+ </xsl:variable><xsl:variable name="title-appendix">
2508
+ <xsl:text>Appendix </xsl:text>
2509
+ </xsl:variable><xsl:variable name="title-clause">
2510
+
2511
+ <xsl:text>Clause </xsl:text>
2512
+
2513
+
2514
+ </xsl:variable><xsl:variable name="title-edition">
2515
+ <xsl:text>Edition </xsl:text>
2516
+ </xsl:variable><xsl:variable name="title-toc">
2517
+
2518
+ Table of Contents
2519
+ </xsl:variable><xsl:variable name="title-page">Page</xsl:variable><xsl:variable name="title-key">Key</xsl:variable><xsl:variable name="title-where">where</xsl:variable><xsl:variable name="title-descriptors">Descriptors</xsl:variable><xsl:variable name="title-part-en">Part </xsl:variable><xsl:variable name="title-part-fr">Partie </xsl:variable><xsl:variable name="title-note-to-entry">Note # to entry: </xsl:variable><xsl:variable name="title-modified">modified</xsl:variable><xsl:variable name="title-source">SOURCE</xsl:variable><xsl:variable name="title-keywords">Keywords</xsl:variable><xsl:variable name="lower">abcdefghijklmnopqrstuvwxyz</xsl:variable><xsl:variable name="upper">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable><xsl:variable name="en_chars" select="concat($lower,$upper,',.`1234567890-=~!@#$%^*()_+[]{}\|?/')"/><xsl:variable name="linebreak" select="'&#8232;'"/><xsl:attribute-set name="link-style">
2520
+
2521
+
2522
+ </xsl:attribute-set><xsl:attribute-set name="sourcecode-style">
2523
+
2524
+
2525
+
2526
+
2527
+
2528
+ <xsl:attribute name="font-family">Courier</xsl:attribute>
2529
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
2530
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
2531
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2532
+
2533
+
2534
+
2535
+
2536
+ </xsl:attribute-set><xsl:attribute-set name="appendix-style">
2537
+
2538
+
2539
+
2540
+ </xsl:attribute-set><xsl:attribute-set name="appendix-example-style">
2541
+
2542
+
2543
+
2544
+ </xsl:attribute-set><xsl:template match="text()">
2408
2545
  <xsl:value-of select="."/>
2409
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='br']">
2546
+ </xsl:template><xsl:template match="*[local-name()='br']">
2410
2547
  <xsl:value-of select="$linebreak"/>
2411
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2412
- <xsl:call-template name="add-zero-spaces"/>
2413
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']">
2548
+ </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2549
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2550
+ <xsl:call-template name="add-zero-spaces-java"/>
2551
+ </xsl:template><xsl:template match="*[local-name()='table']">
2414
2552
 
2415
2553
  <xsl:variable name="simple-table">
2416
2554
  <!-- <xsl:copy> -->
@@ -2444,44 +2582,13 @@
2444
2582
 
2445
2583
 
2446
2584
 
2447
- <xsl:text>Table </xsl:text>
2448
- <xsl:choose>
2449
- <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2450
- <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2451
- </xsl:when>
2452
- <xsl:when test="ancestor::*[local-name()='annex']">
2453
-
2454
-
2455
-
2456
-
2457
- <xsl:choose>
2458
- <xsl:when test="ancestor::itu:annex[@obligation = 'informative']">
2459
- <xsl:variable name="annex-id" select="ancestor::itu:annex/@id"/>
2460
- <!-- Table in Appendix -->
2461
- <xsl:number format="I-" count="itu:annex[@obligation = 'informative']"/>
2462
- <xsl:number format="1" level="any" count="itu:table[(not(@unnumbered) or @unnumbered != 'true') and ancestor::itu:annex[@id = $annex-id]]"/>
2463
- </xsl:when>
2464
- <!-- Table in Annex -->
2465
- <xsl:when test="ancestor::itu:annex[not(@obligation) or @obligation != 'informative']">
2466
- <xsl:variable name="annex-id" select="ancestor::itu:annex/@id"/>
2467
- <xsl:number format="A-" count="itu:annex[not(@obligation) or @obligation != 'informative']"/>
2468
- <xsl:number format="1" level="any" count="itu:table[(not(@unnumbered) or @unnumbered != 'true') and ancestor::itu:annex[@id = $annex-id]]"/>
2469
- </xsl:when>
2470
- </xsl:choose>
2471
-
2472
-
2473
-
2474
-
2475
-
2476
- </xsl:when>
2477
- <xsl:otherwise>
2478
-
2479
-
2480
- <xsl:number format="A." count="*[local-name()='annex']"/>
2481
- <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
2482
-
2483
- </xsl:otherwise>
2484
- </xsl:choose>
2585
+
2586
+
2587
+ <xsl:value-of select="$title-table"/>
2588
+
2589
+ <xsl:call-template name="getTableNumber"/>
2590
+
2591
+
2485
2592
  <xsl:if test="*[local-name()='name']">
2486
2593
 
2487
2594
 
@@ -2557,6 +2664,7 @@
2557
2664
 
2558
2665
 
2559
2666
 
2667
+
2560
2668
  <fo:table id="{@id}" table-layout="fixed" width="100%" margin-left="{$margin-left}mm" margin-right="{$margin-left}mm" table-omit-footer-at-break="true">
2561
2669
 
2562
2670
 
@@ -2573,9 +2681,10 @@
2573
2681
  <xsl:attribute name="font-size">10pt</xsl:attribute>
2574
2682
 
2575
2683
 
2684
+
2576
2685
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
2577
2686
  <xsl:choose>
2578
- <xsl:when test=". = 1">
2687
+ <xsl:when test=". = 1 or . = 0">
2579
2688
  <fo:table-column column-width="proportional-column-width(2)"/>
2580
2689
  </xsl:when>
2581
2690
  <xsl:otherwise>
@@ -2589,15 +2698,53 @@
2589
2698
 
2590
2699
 
2591
2700
  </fo:block-container>
2592
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='name']" mode="process">
2701
+ </xsl:template><xsl:template name="getTableNumber">
2702
+ <xsl:choose>
2703
+ <xsl:when test="ancestor::*[local-name()='executivesummary']"> <!-- NIST -->
2704
+ <xsl:text>ES-</xsl:text><xsl:number format="1" count="*[local-name()='executivesummary']//*[local-name()='table'][not(@unnumbered) or @unnumbered != 'true']"/>
2705
+ </xsl:when>
2706
+ <xsl:when test="ancestor::*[local-name()='annex']">
2707
+
2708
+
2709
+
2710
+
2711
+ <xsl:choose>
2712
+ <xsl:when test="ancestor::*[local-name()='annex'][@obligation = 'informative']">
2713
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2714
+ <!-- Table in Appendix -->
2715
+ <xsl:number format="I-" count="*[local-name()='annex'][@obligation = 'informative']"/>
2716
+ <xsl:number format="1" level="any" count="*[local-name()='table'][(not(@unnumbered) or @unnumbered != 'true') and ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2717
+ </xsl:when>
2718
+ <!-- Table in Annex -->
2719
+ <xsl:when test="ancestor::*[local-name()='annex'][not(@obligation) or @obligation != 'informative']">
2720
+ <xsl:variable name="annex-id" select="ancestor::*[local-name()='annex']/@id"/>
2721
+ <xsl:number format="A-" count="*[local-name()='annex'][not(@obligation) or @obligation != 'informative']"/>
2722
+ <xsl:number format="1" level="any" count="*[local-name()='table'][(not(@unnumbered) or @unnumbered != 'true') and ancestor::*[local-name()='annex'][@id = $annex-id]]"/>
2723
+ </xsl:when>
2724
+ </xsl:choose>
2725
+
2726
+
2727
+
2728
+
2729
+
2730
+ </xsl:when>
2731
+ <xsl:otherwise>
2732
+
2733
+
2734
+ <xsl:number format="A." count="*[local-name()='annex']"/>
2735
+ <xsl:number format="1" level="any" count="//*[local-name()='table'] [not(ancestor::*[local-name()='annex']) and not(ancestor::*[local-name()='executivesummary']) and not(ancestor::*[local-name()='bibdata'])] [not(@unnumbered) or @unnumbered != 'true']"/>
2736
+
2737
+ </xsl:otherwise>
2738
+ </xsl:choose>
2739
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='name']"/><xsl:template match="*[local-name()='table']/*[local-name()='name']" mode="process">
2593
2740
  <xsl:apply-templates/>
2594
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-columns-numbers">
2741
+ </xsl:template><xsl:template name="calculate-columns-numbers">
2595
2742
  <xsl:param name="table-row"/>
2596
2743
  <xsl:variable name="columns-count" select="count($table-row/*)"/>
2597
2744
  <xsl:variable name="sum-colspans" select="sum($table-row/*/@colspan)"/>
2598
2745
  <xsl:variable name="columns-with-colspan" select="count($table-row/*[@colspan])"/>
2599
2746
  <xsl:value-of select="$columns-count + $sum-colspans - $columns-with-colspan"/>
2600
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="calculate-column-widths">
2747
+ </xsl:template><xsl:template name="calculate-column-widths">
2601
2748
  <xsl:param name="table"/>
2602
2749
  <xsl:param name="cols-count"/>
2603
2750
  <xsl:param name="curr-col" select="1"/>
@@ -2606,7 +2753,7 @@
2606
2753
  <xsl:if test="$curr-col &lt;= $cols-count">
2607
2754
  <xsl:variable name="widths">
2608
2755
  <xsl:choose>
2609
- <xsl:when test="not($table)">
2756
+ <xsl:when test="not($table)"><!-- this branch is not using in production, for debug only -->
2610
2757
  <xsl:for-each select="*[local-name()='thead']//*[local-name()='tr']">
2611
2758
  <xsl:variable name="words">
2612
2759
  <xsl:call-template name="tokenize">
@@ -2645,9 +2792,16 @@
2645
2792
  <xsl:apply-templates select="td[$curr-col]" mode="td_text"/>
2646
2793
  </xsl:variable>
2647
2794
  <xsl:variable name="words">
2795
+ <xsl:variable name="string_with_added_zerospaces">
2796
+ <xsl:call-template name="add-zero-spaces-java">
2797
+ <xsl:with-param name="text" select="$td_text"/>
2798
+ </xsl:call-template>
2799
+ </xsl:variable>
2648
2800
  <xsl:call-template name="tokenize">
2649
2801
  <!-- <xsl:with-param name="text" select="translate(td[$curr-col],'- —:', ' ')"/> -->
2650
- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/>
2802
+ <!-- 2009 thinspace -->
2803
+ <!-- <xsl:with-param name="text" select="translate(normalize-space($td_text),'- —:', ' ')"/> -->
2804
+ <xsl:with-param name="text" select="normalize-space(translate($string_with_added_zerospaces, '​', ' '))"/>
2651
2805
  </xsl:call-template>
2652
2806
  </xsl:variable>
2653
2807
  <xsl:variable name="max_length">
@@ -2688,17 +2842,24 @@
2688
2842
  <xsl:with-param name="table" select="$table"/>
2689
2843
  </xsl:call-template>
2690
2844
  </xsl:if>
2691
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()" mode="td_text">
2845
+ </xsl:template><xsl:template match="text()" mode="td_text">
2692
2846
  <xsl:variable name="zero-space">​</xsl:variable>
2693
2847
  <xsl:value-of select="translate(., $zero-space, ' ')"/><xsl:text> </xsl:text>
2694
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table2']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead']" mode="process">
2848
+ </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
2849
+ <xsl:value-of select="*[local-name()='origin']/@citeas"/>
2850
+ </xsl:template><xsl:template match="*[local-name()='link']" mode="td_text">
2851
+ <xsl:value-of select="@target"/>
2852
+ </xsl:template><xsl:template match="*[local-name()='table2']"/><xsl:template match="*[local-name()='thead']"/><xsl:template match="*[local-name()='thead']" mode="process">
2853
+ <xsl:param name="cols-count"/>
2695
2854
  <!-- font-weight="bold" -->
2696
- <fo:table-header>
2855
+ <fo:table-header>
2856
+
2697
2857
  <xsl:apply-templates/>
2698
2858
  </fo:table-header>
2699
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tfoot']" mode="process">
2859
+ </xsl:template><xsl:template match="*[local-name()='tfoot']"/><xsl:template match="*[local-name()='tfoot']" mode="process">
2700
2860
  <xsl:apply-templates/>
2701
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="insertTableFooter">
2861
+ </xsl:template><xsl:template name="insertTableFooter">
2862
+ <xsl:param name="cols-count"/>
2702
2863
  <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ..//*[local-name()='fn'][local-name(..) != 'name']"/>
2703
2864
  <xsl:if test="../*[local-name()='tfoot'] or $isNoteOrFnExist = 'true'">
2704
2865
 
@@ -2709,22 +2870,7 @@
2709
2870
  <!-- if there are note(s) or fn(s) then create footer row -->
2710
2871
  <xsl:if test="$isNoteOrFnExist = 'true'">
2711
2872
 
2712
- <xsl:variable name="cols-count">
2713
- <xsl:choose>
2714
- <xsl:when test="../*[local-name()='thead']">
2715
- <!-- <xsl:value-of select="count(../*[local-name()='thead']/*[local-name()='tr']/*[local-name()='th'])"/> -->
2716
- <xsl:call-template name="calculate-columns-numbers">
2717
- <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2718
- </xsl:call-template>
2719
- </xsl:when>
2720
- <xsl:otherwise>
2721
- <!-- <xsl:value-of select="count(./*[local-name()='tr'][1]/*[local-name()='td'])"/> -->
2722
- <xsl:call-template name="calculate-columns-numbers">
2723
- <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2724
- </xsl:call-template>
2725
- </xsl:otherwise>
2726
- </xsl:choose>
2727
- </xsl:variable>
2873
+
2728
2874
 
2729
2875
  <fo:table-row>
2730
2876
  <fo:table-cell border="solid black 1pt" padding-left="1mm" padding-right="1mm" padding-top="1mm" number-columns-spanned="{$cols-count}">
@@ -2756,11 +2902,30 @@
2756
2902
  </fo:table-footer>
2757
2903
 
2758
2904
  </xsl:if>
2759
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tbody']">
2905
+ </xsl:template><xsl:template match="*[local-name()='tbody']">
2760
2906
 
2761
- <xsl:apply-templates select="../*[local-name()='thead']" mode="process"/>
2907
+ <xsl:variable name="cols-count">
2908
+ <xsl:choose>
2909
+ <xsl:when test="../*[local-name()='thead']">
2910
+ <xsl:call-template name="calculate-columns-numbers">
2911
+ <xsl:with-param name="table-row" select="../*[local-name()='thead']/*[local-name()='tr'][1]"/>
2912
+ </xsl:call-template>
2913
+ </xsl:when>
2914
+ <xsl:otherwise>
2915
+ <xsl:call-template name="calculate-columns-numbers">
2916
+ <xsl:with-param name="table-row" select="./*[local-name()='tr'][1]"/>
2917
+ </xsl:call-template>
2918
+ </xsl:otherwise>
2919
+ </xsl:choose>
2920
+ </xsl:variable>
2762
2921
 
2763
- <xsl:call-template name="insertTableFooter"/>
2922
+ <xsl:apply-templates select="../*[local-name()='thead']" mode="process">
2923
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2924
+ </xsl:apply-templates>
2925
+
2926
+ <xsl:call-template name="insertTableFooter">
2927
+ <xsl:with-param name="cols-count" select="$cols-count"/>
2928
+ </xsl:call-template>
2764
2929
 
2765
2930
  <fo:table-body>
2766
2931
  <xsl:apply-templates/>
@@ -2768,7 +2933,7 @@
2768
2933
 
2769
2934
  </fo:table-body>
2770
2935
 
2771
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']">
2936
+ </xsl:template><xsl:template match="*[local-name()='tr']">
2772
2937
  <xsl:variable name="parent-name" select="local-name(..)"/>
2773
2938
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
2774
2939
  <fo:table-row min-height="4mm">
@@ -2788,7 +2953,7 @@
2788
2953
 
2789
2954
  <xsl:apply-templates/>
2790
2955
  </fo:table-row>
2791
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th']">
2956
+ </xsl:template><xsl:template match="*[local-name()='th']">
2792
2957
  <fo:table-cell text-align="{@align}" font-weight="bold" border="solid black 1pt" padding-left="1mm" display-align="center">
2793
2958
 
2794
2959
 
@@ -2815,7 +2980,7 @@
2815
2980
  <xsl:apply-templates/>
2816
2981
  </fo:block>
2817
2982
  </fo:table-cell>
2818
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='td']">
2983
+ </xsl:template><xsl:template match="*[local-name()='td']">
2819
2984
  <fo:table-cell text-align="{@align}" display-align="center" border="solid black 1pt" padding-left="1mm">
2820
2985
 
2821
2986
 
@@ -2842,6 +3007,7 @@
2842
3007
  </xsl:attribute>
2843
3008
  </xsl:if>
2844
3009
  <fo:block>
3010
+
2845
3011
  <xsl:apply-templates/>
2846
3012
  </fo:block>
2847
3013
  <!-- <xsl:choose>
@@ -2857,16 +3023,18 @@
2857
3023
 
2858
3024
 
2859
3025
  </fo:table-cell>
2860
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']" mode="process">
3026
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']"/><xsl:template match="*[local-name()='table']/*[local-name()='note']" mode="process">
2861
3027
 
2862
3028
 
2863
3029
  <fo:block font-size="10pt" margin-bottom="12pt">
2864
3030
 
2865
3031
 
2866
3032
 
3033
+
2867
3034
  <fo:inline padding-right="2mm">
2868
3035
 
2869
- <xsl:text>NOTE </xsl:text>
3036
+
3037
+ <xsl:value-of select="$title-note"/>
2870
3038
 
2871
3039
  <xsl:variable name="id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
2872
3040
  <xsl:if test="count(//*[local-name()='note'][ancestor::*[@id = $id]]) &gt; 1">
@@ -2880,9 +3048,9 @@
2880
3048
  <xsl:apply-templates mode="process"/>
2881
3049
  </fo:block>
2882
3050
 
2883
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
3051
+ </xsl:template><xsl:template match="*[local-name()='table']/*[local-name()='note']/*[local-name()='p']" mode="process">
2884
3052
  <xsl:apply-templates/>
2885
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display">
3053
+ </xsl:template><xsl:template name="fn_display">
2886
3054
  <xsl:variable name="references">
2887
3055
  <xsl:for-each select="..//*[local-name()='fn'][local-name(..) != 'name']">
2888
3056
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2903,6 +3071,12 @@
2903
3071
 
2904
3072
 
2905
3073
 
3074
+
3075
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
3076
+ <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute>
3077
+ <xsl:attribute name="text-indent">-5mm</xsl:attribute>
3078
+ <xsl:attribute name="start-indent">5mm</xsl:attribute>
3079
+
2906
3080
  <fo:inline font-size="80%" padding-right="5mm" id="{@id}">
2907
3081
 
2908
3082
  <xsl:attribute name="vertical-align">super</xsl:attribute>
@@ -2912,6 +3086,7 @@
2912
3086
 
2913
3087
 
2914
3088
  <xsl:attribute name="padding-right">3mm</xsl:attribute>
3089
+ <xsl:attribute name="font-size">70%</xsl:attribute>
2915
3090
 
2916
3091
 
2917
3092
  <xsl:value-of select="@reference"/>
@@ -2928,7 +3103,7 @@
2928
3103
  </fo:block>
2929
3104
  </xsl:if>
2930
3105
  </xsl:for-each>
2931
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_name_display">
3106
+ </xsl:template><xsl:template name="fn_name_display">
2932
3107
  <!-- <xsl:variable name="references">
2933
3108
  <xsl:for-each select="*[local-name()='name']//*[local-name()='fn']">
2934
3109
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
@@ -2944,7 +3119,7 @@
2944
3119
  <xsl:apply-templates/>
2945
3120
  </fo:block>
2946
3121
  </xsl:for-each>
2947
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="fn_display_figure">
3122
+ </xsl:template><xsl:template name="fn_display_figure">
2948
3123
  <xsl:variable name="key_iso">
2949
3124
  <!-- and (not(@class) or @class !='pseudocode') -->
2950
3125
  </xsl:variable>
@@ -2995,7 +3170,7 @@
2995
3170
  </fo:block>
2996
3171
  </xsl:if>
2997
3172
 
2998
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']">
3173
+ </xsl:template><xsl:template match="*[local-name()='fn']">
2999
3174
  <!-- <xsl:variable name="namespace" select="substring-before(name(/*), '-')"/> -->
3000
3175
  <fo:inline font-size="80%" keep-with-previous.within-line="always">
3001
3176
 
@@ -3010,11 +3185,11 @@
3010
3185
  <xsl:value-of select="@reference"/>
3011
3186
  </fo:basic-link>
3012
3187
  </fo:inline>
3013
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']/*[local-name()='p']">
3188
+ </xsl:template><xsl:template match="*[local-name()='fn']/*[local-name()='p']">
3014
3189
  <fo:inline>
3015
3190
  <xsl:apply-templates/>
3016
3191
  </fo:inline>
3017
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']">
3192
+ </xsl:template><xsl:template match="*[local-name()='dl']">
3018
3193
  <xsl:variable name="parent" select="local-name(..)"/>
3019
3194
 
3020
3195
  <xsl:variable name="key_iso">
@@ -3026,8 +3201,8 @@
3026
3201
 
3027
3202
 
3028
3203
  <fo:block margin-bottom="12pt" text-align="left">
3029
-
3030
- <xsl:text>where </xsl:text>
3204
+
3205
+ <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
3031
3206
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
3032
3207
  <xsl:text/>
3033
3208
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -3042,7 +3217,7 @@
3042
3217
  <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
3043
3218
 
3044
3219
 
3045
- <xsl:text>where</xsl:text>
3220
+ <xsl:value-of select="$title-where"/>:
3046
3221
  </fo:block>
3047
3222
  </xsl:when>
3048
3223
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')">
@@ -3050,7 +3225,7 @@
3050
3225
 
3051
3226
 
3052
3227
 
3053
- <xsl:text>Key</xsl:text>
3228
+ <xsl:value-of select="$title-key"/>
3054
3229
  </fo:block>
3055
3230
  </xsl:when>
3056
3231
  </xsl:choose>
@@ -3060,14 +3235,19 @@
3060
3235
  <fo:block>
3061
3236
 
3062
3237
 
3063
- <xsl:if test="local-name(..) = 'li'">
3064
- <xsl:attribute name="margin-left">-4mm</xsl:attribute>
3238
+ <xsl:if test="$parent = 'figure' or $parent = 'formula'">
3239
+ <xsl:attribute name="margin-left">7.4mm</xsl:attribute>
3065
3240
  </xsl:if>
3241
+ <xsl:if test="$parent = 'li'">
3242
+ <!-- <xsl:attribute name="margin-left">-4mm</xsl:attribute> -->
3243
+ </xsl:if>
3244
+
3066
3245
 
3067
3246
 
3068
3247
  <fo:block>
3069
3248
 
3070
3249
 
3250
+
3071
3251
  <!-- create virtual html table for dl/[dt and dd] -->
3072
3252
  <xsl:variable name="html-table">
3073
3253
  <xsl:variable name="ns" select="substring-before(name(/*), '-')"/>
@@ -3119,7 +3299,7 @@
3119
3299
  <xsl:otherwise>
3120
3300
  <xsl:for-each select="xalan:nodeset($colwidths)//column">
3121
3301
  <xsl:choose>
3122
- <xsl:when test=". = 1">
3302
+ <xsl:when test=". = 1 or . = 0">
3123
3303
  <fo:table-column column-width="proportional-column-width(2)"/>
3124
3304
  </xsl:when>
3125
3305
  <xsl:otherwise>
@@ -3142,7 +3322,7 @@
3142
3322
  </fo:block>
3143
3323
  </fo:block>
3144
3324
  </xsl:if>
3145
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dl']/*[local-name()='note']">
3325
+ </xsl:template><xsl:template match="*[local-name()='dl']/*[local-name()='note']">
3146
3326
  <xsl:param name="key_iso"/>
3147
3327
 
3148
3328
  <!-- <tr>
@@ -3158,7 +3338,7 @@
3158
3338
  <xsl:if test="normalize-space($key_iso) = 'true'">
3159
3339
  <xsl:attribute name="margin-top">0</xsl:attribute>
3160
3340
  </xsl:if>
3161
- NOTE
3341
+ <xsl:value-of select="$title-note"/>
3162
3342
  </fo:block>
3163
3343
  </fo:table-cell>
3164
3344
  <fo:table-cell>
@@ -3167,7 +3347,7 @@
3167
3347
  </fo:block>
3168
3348
  </fo:table-cell>
3169
3349
  </fo:table-row>
3170
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']" mode="dl">
3350
+ </xsl:template><xsl:template match="*[local-name()='dt']" mode="dl">
3171
3351
  <tr>
3172
3352
  <td>
3173
3353
  <xsl:apply-templates/>
@@ -3180,11 +3360,16 @@
3180
3360
  </td>
3181
3361
  </tr>
3182
3362
 
3183
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dt']">
3363
+ </xsl:template><xsl:template match="*[local-name()='dt']">
3184
3364
  <xsl:param name="key_iso"/>
3185
3365
 
3186
3366
  <fo:table-row>
3187
3367
  <fo:table-cell>
3368
+
3369
+ <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
3370
+ <xsl:attribute name="padding-right">3mm</xsl:attribute>
3371
+ </xsl:if>
3372
+
3188
3373
  <fo:block margin-top="6pt">
3189
3374
 
3190
3375
 
@@ -3194,6 +3379,13 @@
3194
3379
  </xsl:if>
3195
3380
 
3196
3381
 
3382
+
3383
+
3384
+ <xsl:if test="ancestor::*[1][local-name() = 'dl']/preceding-sibling::*[1][local-name() = 'formula']">
3385
+ <xsl:attribute name="text-align">right</xsl:attribute>
3386
+ </xsl:if>
3387
+
3388
+
3197
3389
  <xsl:apply-templates/>
3198
3390
 
3199
3391
  </fo:block>
@@ -3211,37 +3403,37 @@
3211
3403
  </fo:table-cell>
3212
3404
  </fo:table-row>
3213
3405
 
3214
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="dl_process">
3406
+ </xsl:template><xsl:template match="*[local-name()='dd']" mode="dl"/><xsl:template match="*[local-name()='dd']" mode="dl_process">
3215
3407
  <xsl:apply-templates/>
3216
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']" mode="process">
3408
+ </xsl:template><xsl:template match="*[local-name()='dd']"/><xsl:template match="*[local-name()='dd']" mode="process">
3217
3409
  <xsl:apply-templates/>
3218
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3410
+ </xsl:template><xsl:template match="*[local-name()='dd']/*[local-name()='p']" mode="inline">
3219
3411
  <fo:inline><xsl:text> </xsl:text><xsl:apply-templates/></fo:inline>
3220
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='em']">
3412
+ </xsl:template><xsl:template match="*[local-name()='em']">
3221
3413
  <fo:inline font-style="italic">
3222
3414
  <xsl:apply-templates/>
3223
3415
  </fo:inline>
3224
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='strong']">
3416
+ </xsl:template><xsl:template match="*[local-name()='strong']">
3225
3417
  <fo:inline font-weight="bold">
3226
3418
  <xsl:apply-templates/>
3227
3419
  </fo:inline>
3228
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sup']">
3420
+ </xsl:template><xsl:template match="*[local-name()='sup']">
3229
3421
  <fo:inline font-size="80%" vertical-align="super">
3230
3422
  <xsl:apply-templates/>
3231
3423
  </fo:inline>
3232
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='sub']">
3424
+ </xsl:template><xsl:template match="*[local-name()='sub']">
3233
3425
  <fo:inline font-size="80%" vertical-align="sub">
3234
3426
  <xsl:apply-templates/>
3235
3427
  </fo:inline>
3236
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tt']">
3237
- <fo:inline font-family="Courier" font-size="10pt">
3428
+ </xsl:template><xsl:template match="*[local-name()='tt']">
3429
+ <fo:inline font-family="Courier" font-size="10pt">
3238
3430
  <xsl:apply-templates/>
3239
3431
  </fo:inline>
3240
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='del']">
3432
+ </xsl:template><xsl:template match="*[local-name()='del']">
3241
3433
  <fo:inline font-size="10pt" color="red" text-decoration="line-through">
3242
3434
  <xsl:apply-templates/>
3243
3435
  </fo:inline>
3244
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="text()[ancestor::*[local-name()='smallcap']]">
3436
+ </xsl:template><xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
3245
3437
  <xsl:variable name="text" select="normalize-space(.)"/>
3246
3438
  <fo:inline font-size="75%">
3247
3439
  <xsl:if test="string-length($text) &gt; 0">
@@ -3250,7 +3442,7 @@
3250
3442
  </xsl:call-template>
3251
3443
  </xsl:if>
3252
3444
  </fo:inline>
3253
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="recursiveSmallCaps">
3445
+ </xsl:template><xsl:template name="recursiveSmallCaps">
3254
3446
  <xsl:param name="text"/>
3255
3447
  <xsl:variable name="char" select="substring($text,1,1)"/>
3256
3448
  <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/>
@@ -3269,7 +3461,7 @@
3269
3461
  <xsl:with-param name="text" select="substring($text,2)"/>
3270
3462
  </xsl:call-template>
3271
3463
  </xsl:if>
3272
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="tokenize">
3464
+ </xsl:template><xsl:template name="tokenize">
3273
3465
  <xsl:param name="text"/>
3274
3466
  <xsl:param name="separator" select="' '"/>
3275
3467
  <xsl:choose>
@@ -3317,7 +3509,7 @@
3317
3509
  </xsl:call-template>
3318
3510
  </xsl:otherwise>
3319
3511
  </xsl:choose>
3320
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="max_length">
3512
+ </xsl:template><xsl:template name="max_length">
3321
3513
  <xsl:param name="words"/>
3322
3514
  <xsl:for-each select="$words//word">
3323
3515
  <xsl:sort select="." data-type="number" order="descending"/>
@@ -3325,7 +3517,11 @@
3325
3517
  <xsl:value-of select="."/>
3326
3518
  </xsl:if>
3327
3519
  </xsl:for-each>
3328
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces">
3520
+ </xsl:template><xsl:template name="add-zero-spaces-java">
3521
+ <xsl:param name="text" select="."/>
3522
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
3523
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
3524
+ </xsl:template><xsl:template name="add-zero-spaces">
3329
3525
  <xsl:param name="text" select="."/>
3330
3526
  <xsl:variable name="zero-space-after-chars">-</xsl:variable>
3331
3527
  <xsl:variable name="zero-space-after-dot">.</xsl:variable>
@@ -3378,7 +3574,7 @@
3378
3574
  <xsl:value-of select="$text"/>
3379
3575
  </xsl:otherwise>
3380
3576
  </xsl:choose>
3381
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="add-zero-spaces-equal">
3577
+ </xsl:template><xsl:template name="add-zero-spaces-equal">
3382
3578
  <xsl:param name="text" select="."/>
3383
3579
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3384
3580
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
@@ -3404,7 +3600,7 @@
3404
3600
  <xsl:value-of select="$text"/>
3405
3601
  </xsl:otherwise>
3406
3602
  </xsl:choose>
3407
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getSimpleTable">
3603
+ </xsl:template><xsl:template name="getSimpleTable">
3408
3604
  <xsl:variable name="simple-table">
3409
3605
 
3410
3606
  <!-- Step 1. colspan processing -->
@@ -3431,9 +3627,9 @@
3431
3627
  </xsl:choose> -->
3432
3628
  </xsl:variable>
3433
3629
  <xsl:copy-of select="$simple-table"/>
3434
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3630
+ </xsl:template><xsl:template match="*[local-name()='thead'] | *[local-name()='tbody']" mode="simple-table-colspan">
3435
3631
  <xsl:apply-templates mode="simple-table-colspan"/>
3436
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3632
+ </xsl:template><xsl:template match="*[local-name()='fn']" mode="simple-table-colspan"/><xsl:template match="*[local-name()='th'] | *[local-name()='td']" mode="simple-table-colspan">
3437
3633
  <xsl:choose>
3438
3634
  <xsl:when test="@colspan">
3439
3635
  <xsl:variable name="td">
@@ -3455,16 +3651,16 @@
3455
3651
  </xsl:element>
3456
3652
  </xsl:otherwise>
3457
3653
  </xsl:choose>
3458
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@colspan" mode="simple-table-colspan"/><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='tr']" mode="simple-table-colspan">
3654
+ </xsl:template><xsl:template match="@colspan" mode="simple-table-colspan"/><xsl:template match="*[local-name()='tr']" mode="simple-table-colspan">
3459
3655
  <xsl:element name="tr">
3460
3656
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
3461
3657
  <xsl:apply-templates mode="simple-table-colspan"/>
3462
3658
  </xsl:element>
3463
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-colspan">
3659
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-colspan">
3464
3660
  <xsl:copy>
3465
3661
  <xsl:apply-templates select="@*|node()" mode="simple-table-colspan"/>
3466
3662
  </xsl:copy>
3467
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="repeatNode">
3663
+ </xsl:template><xsl:template name="repeatNode">
3468
3664
  <xsl:param name="count"/>
3469
3665
  <xsl:param name="node"/>
3470
3666
 
@@ -3475,18 +3671,18 @@
3475
3671
  </xsl:call-template>
3476
3672
  <xsl:copy-of select="$node"/>
3477
3673
  </xsl:if>
3478
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="@*|node()" mode="simple-table-rowspan">
3674
+ </xsl:template><xsl:template match="@*|node()" mode="simple-table-rowspan">
3479
3675
  <xsl:copy>
3480
3676
  <xsl:apply-templates select="@*|node()" mode="simple-table-rowspan"/>
3481
3677
  </xsl:copy>
3482
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tbody" mode="simple-table-rowspan">
3678
+ </xsl:template><xsl:template match="tbody" mode="simple-table-rowspan">
3483
3679
  <xsl:copy>
3484
3680
  <xsl:copy-of select="tr[1]"/>
3485
3681
  <xsl:apply-templates select="tr[2]" mode="simple-table-rowspan">
3486
3682
  <xsl:with-param name="previousRow" select="tr[1]"/>
3487
3683
  </xsl:apply-templates>
3488
3684
  </xsl:copy>
3489
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="tr" mode="simple-table-rowspan">
3685
+ </xsl:template><xsl:template match="tr" mode="simple-table-rowspan">
3490
3686
  <xsl:param name="previousRow"/>
3491
3687
  <xsl:variable name="currentRow" select="."/>
3492
3688
 
@@ -3520,13 +3716,13 @@
3520
3716
  <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
3521
3717
  <xsl:with-param name="previousRow" select="$newRow"/>
3522
3718
  </xsl:apply-templates>
3523
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="getLang">
3719
+ </xsl:template><xsl:template name="getLang">
3524
3720
  <xsl:variable name="language" select="//*[local-name()='bibdata']//*[local-name()='language']"/>
3525
3721
  <xsl:choose>
3526
3722
  <xsl:when test="$language = 'English'">en</xsl:when>
3527
3723
  <xsl:otherwise><xsl:value-of select="$language"/></xsl:otherwise>
3528
3724
  </xsl:choose>
3529
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" name="capitalizeWords">
3725
+ </xsl:template><xsl:template name="capitalizeWords">
3530
3726
  <xsl:param name="str"/>
3531
3727
  <xsl:variable name="str2" select="translate($str, '-', ' ')"/>
3532
3728
  <xsl:choose>
@@ -3544,19 +3740,19 @@
3544
3740
  <xsl:value-of select="substring($str2, 2)"/>
3545
3741
  </xsl:otherwise>
3546
3742
  </xsl:choose>
3547
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="mathml:math">
3743
+ </xsl:template><xsl:template match="mathml:math">
3548
3744
  <fo:inline font-family="STIX2Math">
3549
3745
  <fo:instream-foreign-object fox:alt-text="Math">
3550
3746
  <xsl:copy-of select="."/>
3551
3747
  </fo:instream-foreign-object>
3552
3748
  </fo:inline>
3553
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='localityStack']">
3749
+ </xsl:template><xsl:template match="*[local-name()='localityStack']">
3554
3750
  <xsl:for-each select="*[local-name()='locality']">
3555
3751
  <xsl:if test="position() =1"><xsl:text>, </xsl:text></xsl:if>
3556
3752
  <xsl:apply-templates select="."/>
3557
3753
  <xsl:if test="position() != last()"><xsl:text>; </xsl:text></xsl:if>
3558
3754
  </xsl:for-each>
3559
- </xsl:template><xsl:template xmlns:iso="https://www.metanorma.org/ns/iso" xmlns:iec="https://www.metanorma.org/ns/iec" xmlns:nist="https://www.metanorma.org/ns/nist" xmlns:un="https://www.metanorma.org/ns/un" xmlns:csd="https://www.metanorma.org/ns/csd" xmlns:ogc="https://www.metanorma.org/ns/ogc" match="*[local-name()='link']" name="link">
3755
+ </xsl:template><xsl:template match="*[local-name()='link']" name="link">
3560
3756
  <xsl:variable name="target">
3561
3757
  <xsl:choose>
3562
3758
  <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
@@ -3586,4 +3782,122 @@
3586
3782
  </xsl:otherwise>
3587
3783
  </xsl:choose>
3588
3784
  </fo:inline>
3785
+ </xsl:template><xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
3786
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
3787
+ <!-- <xsl:choose>
3788
+ <xsl:when test="@lang = 'en'"></xsl:when>
3789
+ <xsl:otherwise> -->
3790
+ <xsl:attribute name="white-space">pre</xsl:attribute>
3791
+ <xsl:attribute name="wrap-option">wrap</xsl:attribute>
3792
+ <!-- </xsl:otherwise>
3793
+ </xsl:choose> -->
3794
+ <xsl:apply-templates/>
3795
+ </fo:block>
3796
+ </xsl:template><xsl:template match="*[local-name()='bookmark']">
3797
+ <fo:inline id="{@id}"/>
3798
+ </xsl:template><xsl:template match="*[local-name()='appendix']">
3799
+ <fo:block id="{@id}" xsl:use-attribute-sets="appendix-style">
3800
+ <fo:inline padding-right="5mm"><xsl:value-of select="$title-appendix"/> <xsl:number/></fo:inline>
3801
+ <xsl:apply-templates select="*[local-name()='title']" mode="process"/>
3802
+ </fo:block>
3803
+ <xsl:apply-templates/>
3804
+ </xsl:template><xsl:template match="*[local-name()='appendix']/*[local-name()='title']"/><xsl:template match="*[local-name()='appendix']/*[local-name()='title']" mode="process">
3805
+ <fo:inline><xsl:apply-templates/></fo:inline>
3806
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']">
3807
+ <fo:block xsl:use-attribute-sets="appendix-example-style">
3808
+ <xsl:variable name="claims_id" select="ancestor::*[local-name()='clause'][1]/@id"/>
3809
+ <xsl:value-of select="$title-example"/>
3810
+ <xsl:if test="count(ancestor::*[local-name()='clause'][1]//*[local-name()='example']) &gt; 1">
3811
+ <xsl:number count="*[local-name()='example'][ancestor::*[local-name()='clause'][@id = $claims_id]]" level="any"/><xsl:text> </xsl:text>
3812
+ </xsl:if>
3813
+ <xsl:if test="*[local-name()='name']">
3814
+ <xsl:text>— </xsl:text><xsl:apply-templates select="*[local-name()='name']" mode="process"/>
3815
+ </xsl:if>
3816
+ </fo:block>
3817
+ <xsl:apply-templates/>
3818
+ </xsl:template><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']"/><xsl:template match="*[local-name()='appendix']//*[local-name()='example']/*[local-name()='name']" mode="process">
3819
+ <fo:inline><xsl:apply-templates/></fo:inline>
3820
+ </xsl:template><xsl:template match="*[local-name() = 'callout']">
3821
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link>
3822
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']">
3823
+ <xsl:variable name="annotation-id" select="@id"/>
3824
+ <xsl:variable name="callout" select="//*[@target = $annotation-id]/text()"/>
3825
+ <fo:block id="{$annotation-id}" white-space="nowrap">
3826
+ <fo:inline>
3827
+ <xsl:apply-templates>
3828
+ <xsl:with-param name="callout" select="concat('&lt;', $callout, '&gt; ')"/>
3829
+ </xsl:apply-templates>
3830
+ </fo:inline>
3831
+ </fo:block>
3832
+ </xsl:template><xsl:template match="*[local-name() = 'annotation']/*[local-name() = 'p']">
3833
+ <xsl:param name="callout"/>
3834
+ <fo:inline id="{@id}">
3835
+ <!-- for first p in annotation, put <x> -->
3836
+ <xsl:if test="not(preceding-sibling::*[local-name() = 'p'])"><xsl:value-of select="$callout"/></xsl:if>
3837
+ <xsl:apply-templates/>
3838
+ </fo:inline>
3839
+ </xsl:template><xsl:template name="convertDate">
3840
+ <xsl:param name="date"/>
3841
+ <xsl:param name="format" select="'short'"/>
3842
+ <xsl:variable name="year" select="substring($date, 1, 4)"/>
3843
+ <xsl:variable name="month" select="substring($date, 6, 2)"/>
3844
+ <xsl:variable name="day" select="substring($date, 9, 2)"/>
3845
+ <xsl:variable name="monthStr">
3846
+ <xsl:choose>
3847
+ <xsl:when test="$month = '01'">January</xsl:when>
3848
+ <xsl:when test="$month = '02'">February</xsl:when>
3849
+ <xsl:when test="$month = '03'">March</xsl:when>
3850
+ <xsl:when test="$month = '04'">April</xsl:when>
3851
+ <xsl:when test="$month = '05'">May</xsl:when>
3852
+ <xsl:when test="$month = '06'">June</xsl:when>
3853
+ <xsl:when test="$month = '07'">July</xsl:when>
3854
+ <xsl:when test="$month = '08'">August</xsl:when>
3855
+ <xsl:when test="$month = '09'">September</xsl:when>
3856
+ <xsl:when test="$month = '10'">October</xsl:when>
3857
+ <xsl:when test="$month = '11'">November</xsl:when>
3858
+ <xsl:when test="$month = '12'">December</xsl:when>
3859
+ </xsl:choose>
3860
+ </xsl:variable>
3861
+ <xsl:variable name="result">
3862
+ <xsl:choose>
3863
+ <xsl:when test="$format = 'short' or $day = ''">
3864
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $year))"/>
3865
+ </xsl:when>
3866
+ <xsl:otherwise>
3867
+ <xsl:value-of select="normalize-space(concat($monthStr, ' ', $day, ', ' , $year))"/>
3868
+ </xsl:otherwise>
3869
+ </xsl:choose>
3870
+ </xsl:variable>
3871
+ <xsl:value-of select="$result"/>
3872
+ </xsl:template><xsl:template name="insertKeywords">
3873
+ <xsl:param name="sorting" select="'true'"/>
3874
+ <xsl:param name="charAtEnd" select="'.'"/>
3875
+ <xsl:param name="charDelim" select="', '"/>
3876
+ <xsl:choose>
3877
+ <xsl:when test="$sorting = 'true' or $sorting = 'yes'">
3878
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3879
+ <xsl:sort data-type="text" order="ascending"/>
3880
+ <xsl:call-template name="insertKeyword">
3881
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3882
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3883
+ </xsl:call-template>
3884
+ </xsl:for-each>
3885
+ </xsl:when>
3886
+ <xsl:otherwise>
3887
+ <xsl:for-each select="/*/*[local-name() = 'bibdata']//*[local-name() = 'keyword']">
3888
+ <xsl:call-template name="insertKeyword">
3889
+ <xsl:with-param name="charAtEnd" select="$charAtEnd"/>
3890
+ <xsl:with-param name="charDelim" select="$charDelim"/>
3891
+ </xsl:call-template>
3892
+ </xsl:for-each>
3893
+ </xsl:otherwise>
3894
+ </xsl:choose>
3895
+ </xsl:template><xsl:template name="insertKeyword">
3896
+ <xsl:param name="charAtEnd"/>
3897
+ <xsl:param name="charDelim"/>
3898
+ <xsl:apply-templates/>
3899
+ <xsl:choose>
3900
+ <xsl:when test="position() != last()"><xsl:value-of select="$charDelim"/></xsl:when>
3901
+ <xsl:otherwise><xsl:value-of select="$charAtEnd"/></xsl:otherwise>
3902
+ </xsl:choose>
3589
3903
  </xsl:template></xsl:stylesheet>