metanorma-itu 2.6.3 → 2.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1808,10 +1808,11 @@
1808
1808
  <xsl:if test="$doctype != 'resolution' and $doctype != 'service-publication'">
1809
1809
  <fo:block break-after="page"/>
1810
1810
  <fo:block-container>
1811
- <fo:block role="TOC">
1812
-
1811
+ <fo:block role="SKIP">
1813
1812
  <xsl:apply-templates/>
1813
+ </fo:block>
1814
1814
 
1815
+ <fo:block role="TOC">
1815
1816
  <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
1816
1817
 
1817
1818
  <xsl:for-each select="$contents/doc[@num = $num]//item[@display = 'true']">
@@ -3715,6 +3716,7 @@
3715
3716
  </xsl:template> <!-- refine_table-style -->
3716
3717
 
3717
3718
  <xsl:attribute-set name="table-name-style">
3719
+ <xsl:attribute name="role">Caption</xsl:attribute>
3718
3720
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3719
3721
 
3720
3722
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -3725,6 +3727,9 @@
3725
3727
 
3726
3728
  <xsl:template name="refine_table-name-style">
3727
3729
  <xsl:param name="continued"/>
3730
+ <xsl:if test="$continued = 'true'">
3731
+ <xsl:attribute name="role">SKIP</xsl:attribute>
3732
+ </xsl:if>
3728
3733
 
3729
3734
  </xsl:template> <!-- refine_table-name-style -->
3730
3735
 
@@ -5545,7 +5550,7 @@
5545
5550
  </xsl:if>
5546
5551
 
5547
5552
  </fo:block-container>
5548
- </xsl:variable>
5553
+ </xsl:variable> <!-- END: variable name="table" -->
5549
5554
 
5550
5555
  <xsl:variable name="isAdded" select="@added"/>
5551
5556
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5555,14 +5560,14 @@
5555
5560
 
5556
5561
  <!-- centered table when table name is centered (see table-name-style) -->
5557
5562
 
5558
- <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
5563
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style" role="SKIP">
5559
5564
 
5560
5565
  <fo:table-column column-width="proportional-column-width(1)"/>
5561
5566
  <fo:table-column column-width="{@width}"/>
5562
5567
  <fo:table-column column-width="proportional-column-width(1)"/>
5563
- <fo:table-body>
5564
- <fo:table-row>
5565
- <fo:table-cell column-number="2">
5568
+ <fo:table-body role="SKIP">
5569
+ <fo:table-row role="SKIP">
5570
+ <fo:table-cell column-number="2" role="SKIP">
5566
5571
  <xsl:copy-of select="$table-preamble"/>
5567
5572
  <fo:block role="SKIP">
5568
5573
  <xsl:call-template name="setTrackChangesStyles">
@@ -5603,11 +5608,12 @@
5603
5608
 
5604
5609
  </xsl:template>
5605
5610
 
5611
+ <!-- table/name-->
5606
5612
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
5607
5613
  <xsl:param name="continued"/>
5608
5614
  <xsl:if test="normalize-space() != ''">
5609
5615
 
5610
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
5616
+ <fo:block xsl:use-attribute-sets="table-name-style">
5611
5617
 
5612
5618
  <xsl:call-template name="refine_table-name-style">
5613
5619
  <xsl:with-param name="continued" select="$continued"/>
@@ -6084,7 +6090,7 @@
6084
6090
 
6085
6091
  <xsl:variable name="tableWithNotesAndFootnotes">
6086
6092
 
6087
- <fo:table keep-with-previous="always">
6093
+ <fo:table keep-with-previous="always" role="SKIP">
6088
6094
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
6089
6095
  <xsl:variable name="name" select="local-name()"/>
6090
6096
  <xsl:choose>
@@ -6122,9 +6128,9 @@
6122
6128
  </xsl:otherwise>
6123
6129
  </xsl:choose>
6124
6130
 
6125
- <fo:table-body>
6126
- <fo:table-row>
6127
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
6131
+ <fo:table-body role="SKIP">
6132
+ <fo:table-row role="SKIP">
6133
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
6128
6134
 
6129
6135
  <xsl:call-template name="refine_table-footer-cell-style"/>
6130
6136
 
@@ -6531,6 +6537,7 @@
6531
6537
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
6532
6538
  <!-- fn in text -->
6533
6539
  <xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
6540
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
6534
6541
 
6535
6542
  <!-- list of unique footnotes -->
6536
6543
  <xsl:variable name="p_fn_">
@@ -6596,7 +6603,7 @@
6596
6603
  <xsl:copy-of select="$footnote_inline"/>
6597
6604
  </xsl:when>
6598
6605
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
6599
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
6606
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
6600
6607
 
6601
6608
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
6602
6609
  <xsl:copy-of select="$footnote_inline"/>
@@ -7007,39 +7014,51 @@
7007
7014
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
7008
7015
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
7009
7016
  <xsl:template match="*[local-name()='fn']">
7010
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
7017
+ <xsl:variable name="target" select="@target"/>
7018
+ <xsl:choose>
7019
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
7020
+ <xsl:when test="not(ancestor::*[local-name() = 'table'][1]/*[local-name() = 'fmt-footnote-container']/*[local-name() = 'fmt-fn-body'][@id = $target]) and $footnotes/*[local-name() = 'fmt-fn-body'][@id = $target]">
7021
+ <xsl:call-template name="fn">
7022
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
7023
+ </xsl:call-template>
7024
+ </xsl:when>
7025
+ <xsl:otherwise>
7011
7026
 
7012
- <xsl:call-template name="refine_fn-reference-style"/>
7027
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
7013
7028
 
7014
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7015
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
7016
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
7017
- <!-- <xsl:attribute name="internal-destination">
7018
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
7019
- </xsl:attribute>
7020
- </xsl:if>
7021
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
7022
- <xsl:attribute name="internal-destination">
7023
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
7024
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
7025
- </xsl:attribute>
7026
- </xsl:if> -->
7027
- <!-- <xsl:if test="$namespace = 'plateau'">
7028
- <xsl:text>※</xsl:text>
7029
- </xsl:if> -->
7030
- <!-- <xsl:value-of select="@reference"/> -->
7029
+ <xsl:call-template name="refine_fn-reference-style"/>
7031
7030
 
7032
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
7033
-
7034
- <!-- <xsl:if test="$namespace = 'bsi'">
7035
- <xsl:text>)</xsl:text>
7036
- </xsl:if> -->
7037
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
7038
- <!-- <xsl:if test="$namespace = 'jis'">
7039
- <fo:inline font-weight="normal">)</fo:inline>
7040
- </xsl:if> -->
7041
- </fo:basic-link>
7042
- </fo:inline>
7031
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
7032
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
7033
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
7034
+ <!-- <xsl:attribute name="internal-destination">
7035
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
7036
+ </xsl:attribute>
7037
+ </xsl:if>
7038
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
7039
+ <xsl:attribute name="internal-destination">
7040
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
7041
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
7042
+ </xsl:attribute>
7043
+ </xsl:if> -->
7044
+ <!-- <xsl:if test="$namespace = 'plateau'">
7045
+ <xsl:text>※</xsl:text>
7046
+ </xsl:if> -->
7047
+ <!-- <xsl:value-of select="@reference"/> -->
7048
+
7049
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
7050
+
7051
+ <!-- <xsl:if test="$namespace = 'bsi'">
7052
+ <xsl:text>)</xsl:text>
7053
+ </xsl:if> -->
7054
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
7055
+ <!-- <xsl:if test="$namespace = 'jis'">
7056
+ <fo:inline font-weight="normal">)</fo:inline>
7057
+ </xsl:if> -->
7058
+ </fo:basic-link>
7059
+ </fo:inline>
7060
+ </xsl:otherwise>
7061
+ </xsl:choose>
7043
7062
  </xsl:template> <!-- fn -->
7044
7063
 
7045
7064
  <!-- fn/text() -->
@@ -11083,6 +11102,13 @@
11083
11102
  <xsl:apply-templates select="."/>
11084
11103
  </xsl:template>
11085
11104
 
11105
+ <!-- prevent missing stem for table and figures in ToC -->
11106
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
11107
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
11108
+ <xsl:apply-templates select="."/>
11109
+ </xsl:if>
11110
+ </xsl:template>
11111
+
11086
11112
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
11087
11113
 
11088
11114
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -11306,7 +11332,8 @@
11306
11332
 
11307
11333
  <xsl:for-each select="$contents_nodes//tables/table">
11308
11334
  <fo:bookmark internal-destination="{@id}">
11309
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
11335
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
11336
+ <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
11310
11337
  </fo:bookmark>
11311
11338
  </xsl:for-each>
11312
11339
  </fo:bookmark>
@@ -11315,6 +11342,26 @@
11315
11342
  </xsl:template> <!-- insertTableBookmarks -->
11316
11343
  <!-- End Bookmarks -->
11317
11344
 
11345
+ <!-- ============================ -->
11346
+ <!-- mode="bookmark_clean" -->
11347
+ <!-- ============================ -->
11348
+ <xsl:template match="node()" mode="bookmark_clean">
11349
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
11350
+ </xsl:template>
11351
+
11352
+ <xsl:template match="text()" mode="bookmark_clean">
11353
+ <xsl:value-of select="."/>
11354
+ </xsl:template>
11355
+
11356
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
11357
+ <xsl:value-of select="normalize-space(.)"/>
11358
+ </xsl:template>
11359
+
11360
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
11361
+ <!-- ============================ -->
11362
+ <!-- END: mode="bookmark_clean" -->
11363
+ <!-- ============================ -->
11364
+
11318
11365
  <xsl:template name="getLangVersion">
11319
11366
  <xsl:param name="lang"/>
11320
11367
  <xsl:param name="doctype" select="''"/>
@@ -13328,9 +13375,15 @@
13328
13375
  <xsl:when test="local-name(..) = 'ul'">
13329
13376
  <xsl:choose>
13330
13377
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
13378
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
13379
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
13331
13380
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
13332
13381
  </xsl:choose>
13333
13382
  </xsl:when>
13383
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
13384
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
13385
+ <xsl:value-of select="@label"/>
13386
+ </xsl:when>
13334
13387
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
13335
13388
 
13336
13389
  <xsl:variable name="type" select="../@type"/>
@@ -13455,7 +13508,7 @@
13455
13508
 
13456
13509
  </xsl:otherwise>
13457
13510
  </xsl:choose>
13458
- </xsl:template>
13511
+ </xsl:template> <!-- getListItemFormat -->
13459
13512
 
13460
13513
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
13461
13514
  <xsl:param name="indent">0</xsl:param>
@@ -13587,6 +13640,11 @@
13587
13640
 
13588
13641
  <xsl:call-template name="refine_list-item-label-style"/>
13589
13642
 
13643
+ <xsl:if test="local-name(..) = 'ul'">
13644
+ <xsl:variable name="li_label" select="@label"/>
13645
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
13646
+ </xsl:if>
13647
+
13590
13648
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
13591
13649
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
13592
13650
  <xsl:call-template name="append_add-style"/>
@@ -15022,6 +15080,16 @@
15022
15080
  </xsl:choose>
15023
15081
  </xsl:template>
15024
15082
 
15083
+ <!-- li/fmt-name -->
15084
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
15085
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
15086
+ <xsl:attribute name="full">true</xsl:attribute>
15087
+ </xsl:template>
15088
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
15089
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
15090
+ <xsl:attribute name="full">true</xsl:attribute>
15091
+ </xsl:template>
15092
+
15025
15093
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
15026
15094
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
15027
15095
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -15836,6 +15904,64 @@
15836
15904
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
15837
15905
  </xsl:template>
15838
15906
 
15907
+ <!-- ===================================== -->
15908
+ <!-- ===================================== -->
15909
+ <!-- Ruby text (CJK languages) rendering -->
15910
+ <!-- ===================================== -->
15911
+ <!-- ===================================== -->
15912
+ <xsl:template match="*[local-name() = 'ruby']">
15913
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
15914
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
15915
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
15916
+ </xsl:if>
15917
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
15918
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
15919
+ <!-- Example: width="2em" -->
15920
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
15921
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
15922
+ <xsl:variable name="text_width">
15923
+ <xsl:choose>
15924
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
15925
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
15926
+ </xsl:choose>
15927
+ </xsl:variable>
15928
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
15929
+
15930
+ <xsl:choose>
15931
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
15932
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
15933
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
15934
+ </xsl:when>
15935
+ <xsl:otherwise>
15936
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
15937
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
15938
+ </xsl:otherwise>
15939
+ </xsl:choose>
15940
+
15941
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
15942
+ </fo:inline-container>
15943
+ </xsl:template>
15944
+
15945
+ <xsl:template match="*[local-name() = 'rb']">
15946
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
15947
+ </xsl:template>
15948
+
15949
+ <xsl:template match="*[local-name() = 'rt']">
15950
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
15951
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
15952
+ <xsl:attribute name="space-before">0em</xsl:attribute>
15953
+ </xsl:if>
15954
+ <xsl:apply-templates/>
15955
+ </fo:block>
15956
+
15957
+ </xsl:template>
15958
+
15959
+ <!-- ===================================== -->
15960
+ <!-- ===================================== -->
15961
+ <!-- END: Ruby text (CJK languages) rendering -->
15962
+ <!-- ===================================== -->
15963
+ <!-- ===================================== -->
15964
+
15839
15965
  <xsl:template name="printEdition">
15840
15966
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
15841
15967