metanorma-iso 3.0.3 → 3.0.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.
@@ -86,14 +86,15 @@
86
86
  <xsl:value-of select="$i18n_all_rights_reserved"/>
87
87
  </xsl:variable>
88
88
 
89
+ <xsl:variable name="iso_reference_" select="normalize-space(/iso:metanorma/iso:bibdata/iso:docidentifier[@type = 'iso-reference'])"/>
90
+ <xsl:variable name="iso_reference"><xsl:value-of select="$iso_reference_"/><xsl:if test="$iso_reference_ = ''"><xsl:value-of select="$docidentifier_iso"/></xsl:if></xsl:variable>
91
+
89
92
  <xsl:variable name="docidentifier_iso_with_lang_" select="normalize-space(/iso:metanorma/iso:bibdata/iso:docidentifier[@type = 'iso-with-lang'])"/>
90
- <xsl:variable name="docidentifier_iso_with_lang"><xsl:value-of select="$docidentifier_iso_with_lang_"/><xsl:if test="$docidentifier_iso_with_lang_ = ''"><xsl:value-of select="$docidentifier_iso"/></xsl:if></xsl:variable>
93
+ <xsl:variable name="docidentifier_iso_with_lang"><xsl:value-of select="$docidentifier_iso_with_lang_"/><xsl:if test="$docidentifier_iso_with_lang_ = ''"><xsl:value-of select="$iso_reference"/></xsl:if></xsl:variable>
91
94
 
92
95
  <xsl:variable name="lang-1st-letter_tmp" select="substring-before(substring-after($docidentifier_iso_with_lang, '('), ')')"/>
93
96
  <xsl:variable name="lang-1st-letter" select="concat('(', $lang-1st-letter_tmp , ')')"/>
94
97
 
95
- <xsl:variable name="iso_reference_" select="normalize-space(/iso:metanorma/iso:bibdata/iso:docidentifier[@type = 'iso-reference'])"/>
96
- <xsl:variable name="iso_reference"><xsl:value-of select="$iso_reference_"/><xsl:if test="$iso_reference_ = ''"><xsl:value-of select="$docidentifier_iso"/></xsl:if></xsl:variable>
97
98
  <xsl:variable name="anotherNumbers">
98
99
  <xsl:variable name="year_iso_reference" select="concat(':',substring-after($iso_reference,':'))"/>
99
100
  <xsl:for-each select="/iso:metanorma/iso:bibdata/iso:docidentifier[@type != '' and @type != 'ISO' and not(starts-with(@type, 'iso-')) and @type != 'URN']">
@@ -155,6 +156,8 @@
155
156
  <xsl:variable name="stagename" select="normalize-space(/iso:metanorma/iso:bibdata/iso:ext/iso:stagename)"/>
156
157
  <xsl:variable name="stagename_abbreviation" select="normalize-space(/iso:metanorma/iso:bibdata/iso:ext/iso:stagename/@abbreviation)"/>
157
158
  <xsl:variable name="stagename_localized" select="normalize-space(/iso:metanorma/iso:bibdata/iso:status/iso:stage[@language = $lang])"/>
159
+ <xsl:variable name="stagename_localized_coverpage"><xsl:copy-of select="/iso:metanorma/iso:bibdata/iso:status/iso:stage[@language = $lang and @type = 'coverpage']/node()"/></xsl:variable>
160
+ <xsl:variable name="stagename_localized_firstpage"><xsl:copy-of select="/iso:metanorma/iso:bibdata/iso:status/iso:stage[@language = $lang and @type = 'firstpage']/node()"/></xsl:variable>
158
161
  <xsl:variable name="abbreviation" select="normalize-space(/iso:metanorma/iso:bibdata/iso:status/iso:stage/@abbreviation)"/>
159
162
  <xsl:variable name="abbreviation_uppercased" select="java:toUpperCase(java:java.lang.String.new($abbreviation))"/>
160
163
 
@@ -1871,17 +1874,9 @@
1871
1874
  <xsl:choose>
1872
1875
  <xsl:when test="$stage-abbreviation = 'DIS'"> <!-- or $stage-abbreviation = 'DAMD' or $stage-abbreviation = 'DAM' -->
1873
1876
  <xsl:choose>
1874
- <xsl:when test="$stagename_localized != '' and contains($stagename_localized, ' ')">
1875
- <!-- Draft International Standard to DRAFT -->
1876
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring-before($stagename_localized, ' ')))"/>
1877
- <xsl:value-of select="$linebreak"/>
1878
- <xsl:value-of select="substring-after($stagename_localized, ' ')"/>
1879
- </xsl:when>
1880
- <xsl:when test="contains($stagename, ' ')">
1881
- <!-- Draft International Standard to DRAFT -->
1882
- <xsl:value-of select="java:toUpperCase(java:java.lang.String.new(substring-before($stagename, ' ')))"/>
1883
- <xsl:value-of select="$linebreak"/>
1884
- <xsl:value-of select="substring-after($stagename, ' ')"/>
1877
+ <xsl:when test="normalize-space($stagename_localized_coverpage) != ''">
1878
+ <!-- DRAFT<br/>International Standard-->
1879
+ <xsl:apply-templates select="xalan:nodeset($stagename_localized_coverpage)/node()"/>
1885
1880
  </xsl:when>
1886
1881
  <xsl:otherwise>
1887
1882
  <xsl:value-of select="java:toUpperCase(java:java.lang.String.new($stagename))"/>
@@ -2177,6 +2172,7 @@
2177
2172
  <fo:table-row height="13mm">
2178
2173
  <fo:table-cell number-columns-spanned="2" border-right="{$cover_page_border}" display-align="after" padding-bottom="-1mm" line-height="1.1">&gt;
2179
2174
  <fo:block font-size="10pt">
2175
+ <!-- Reference number -->
2180
2176
  <xsl:value-of select="$i18n_reference_number"/>
2181
2177
  </fo:block>
2182
2178
  <fo:block font-size="10pt">
@@ -4878,6 +4874,7 @@
4878
4874
  <xsl:when test="$layoutVersion = '2024'">
4879
4875
  <xsl:choose>
4880
4876
  <xsl:when test="$doctype = 'committee-document'"><xsl:value-of select="$doctype_localized"/></xsl:when>
4877
+ <xsl:when test="normalize-space($stagename_localized_firstpage) != ''"><xsl:apply-templates select="xalan:nodeset($stagename_localized_firstpage)/node()"/></xsl:when>
4881
4878
  <xsl:otherwise><xsl:value-of select="$stagename-header-firstpage"/></xsl:otherwise>
4882
4879
  </xsl:choose>
4883
4880
  </xsl:when>
@@ -6421,6 +6418,7 @@
6421
6418
  </xsl:template> <!-- refine_table-style -->
6422
6419
 
6423
6420
  <xsl:attribute-set name="table-name-style">
6421
+ <xsl:attribute name="role">Caption</xsl:attribute>
6424
6422
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
6425
6423
 
6426
6424
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -6432,6 +6430,9 @@
6432
6430
 
6433
6431
  <xsl:template name="refine_table-name-style">
6434
6432
  <xsl:param name="continued"/>
6433
+ <xsl:if test="$continued = 'true'">
6434
+ <xsl:attribute name="role">SKIP</xsl:attribute>
6435
+ </xsl:if>
6435
6436
 
6436
6437
  <xsl:if test="$continued = 'true'">
6437
6438
  <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
@@ -8368,7 +8369,7 @@
8368
8369
  </xsl:if>
8369
8370
 
8370
8371
  </fo:block-container>
8371
- </xsl:variable>
8372
+ </xsl:variable> <!-- END: variable name="table" -->
8372
8373
 
8373
8374
  <xsl:variable name="isAdded" select="@added"/>
8374
8375
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -8378,7 +8379,7 @@
8378
8379
 
8379
8380
  <!-- centered table when table name is centered (see table-name-style) -->
8380
8381
 
8381
- <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
8382
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style" role="SKIP">
8382
8383
 
8383
8384
  <xsl:if test="$layoutVersion = '1951'">
8384
8385
  <xsl:attribute name="font-size">inherit</xsl:attribute>
@@ -8391,9 +8392,9 @@
8391
8392
  <fo:table-column column-width="proportional-column-width(1)"/>
8392
8393
  <fo:table-column column-width="{@width}"/>
8393
8394
  <fo:table-column column-width="proportional-column-width(1)"/>
8394
- <fo:table-body>
8395
- <fo:table-row>
8396
- <fo:table-cell column-number="2">
8395
+ <fo:table-body role="SKIP">
8396
+ <fo:table-row role="SKIP">
8397
+ <fo:table-cell column-number="2" role="SKIP">
8397
8398
  <xsl:copy-of select="$table-preamble"/>
8398
8399
  <fo:block role="SKIP">
8399
8400
  <xsl:call-template name="setTrackChangesStyles">
@@ -8439,11 +8440,12 @@
8439
8440
 
8440
8441
  </xsl:template>
8441
8442
 
8443
+ <!-- table/name-->
8442
8444
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
8443
8445
  <xsl:param name="continued"/>
8444
8446
  <xsl:if test="normalize-space() != ''">
8445
8447
 
8446
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
8448
+ <fo:block xsl:use-attribute-sets="table-name-style">
8447
8449
 
8448
8450
  <xsl:call-template name="refine_table-name-style">
8449
8451
  <xsl:with-param name="continued" select="$continued"/>
@@ -8944,7 +8946,7 @@
8944
8946
 
8945
8947
  <xsl:variable name="tableWithNotesAndFootnotes">
8946
8948
 
8947
- <fo:table keep-with-previous="always">
8949
+ <fo:table keep-with-previous="always" role="SKIP">
8948
8950
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
8949
8951
  <xsl:variable name="name" select="local-name()"/>
8950
8952
  <xsl:choose>
@@ -8975,9 +8977,9 @@
8975
8977
  </xsl:otherwise>
8976
8978
  </xsl:choose>
8977
8979
 
8978
- <fo:table-body>
8979
- <fo:table-row>
8980
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
8980
+ <fo:table-body role="SKIP">
8981
+ <fo:table-row role="SKIP">
8982
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
8981
8983
 
8982
8984
  <xsl:call-template name="refine_table-footer-cell-style"/>
8983
8985
 
@@ -9050,7 +9052,7 @@
9050
9052
 
9051
9053
  <!-- if there isn't 'thead' and there is a table's title -->
9052
9054
  <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='thead']) and ancestor::*[local-name()='table']/*[local-name()='name']">
9053
- <fo:table-header>
9055
+ <fo:table-header role="Caption">
9054
9056
  <xsl:call-template name="table-header-title">
9055
9057
  <xsl:with-param name="cols-count" select="$cols-count"/>
9056
9058
  </xsl:call-template>
@@ -9419,6 +9421,7 @@
9419
9421
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
9420
9422
  <!-- fn in text -->
9421
9423
  <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">
9424
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
9422
9425
 
9423
9426
  <!-- list of unique footnotes -->
9424
9427
  <xsl:variable name="p_fn_">
@@ -9497,7 +9500,7 @@
9497
9500
  <xsl:copy-of select="$footnote_inline"/>
9498
9501
  </xsl:when>
9499
9502
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
9500
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
9503
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
9501
9504
 
9502
9505
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
9503
9506
  <xsl:copy-of select="$footnote_inline"/>
@@ -9906,39 +9909,51 @@
9906
9909
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
9907
9910
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
9908
9911
  <xsl:template match="*[local-name()='fn']">
9909
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
9912
+ <xsl:variable name="target" select="@target"/>
9913
+ <xsl:choose>
9914
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
9915
+ <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]">
9916
+ <xsl:call-template name="fn">
9917
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
9918
+ </xsl:call-template>
9919
+ </xsl:when>
9920
+ <xsl:otherwise>
9910
9921
 
9911
- <xsl:call-template name="refine_fn-reference-style"/>
9922
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
9912
9923
 
9913
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9914
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
9915
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
9916
- <!-- <xsl:attribute name="internal-destination">
9917
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9918
- </xsl:attribute>
9919
- </xsl:if>
9920
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9921
- <xsl:attribute name="internal-destination">
9922
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
9923
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9924
- </xsl:attribute>
9925
- </xsl:if> -->
9926
- <!-- <xsl:if test="$namespace = 'plateau'">
9927
- <xsl:text>※</xsl:text>
9928
- </xsl:if> -->
9929
- <!-- <xsl:value-of select="@reference"/> -->
9924
+ <xsl:call-template name="refine_fn-reference-style"/>
9930
9925
 
9931
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
9926
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
9927
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
9928
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
9929
+ <!-- <xsl:attribute name="internal-destination">
9930
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
9931
+ </xsl:attribute>
9932
+ </xsl:if>
9933
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
9934
+ <xsl:attribute name="internal-destination">
9935
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
9936
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
9937
+ </xsl:attribute>
9938
+ </xsl:if> -->
9939
+ <!-- <xsl:if test="$namespace = 'plateau'">
9940
+ <xsl:text>※</xsl:text>
9941
+ </xsl:if> -->
9942
+ <!-- <xsl:value-of select="@reference"/> -->
9932
9943
 
9933
- <!-- <xsl:if test="$namespace = 'bsi'">
9934
- <xsl:text>)</xsl:text>
9935
- </xsl:if> -->
9936
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9937
- <!-- <xsl:if test="$namespace = 'jis'">
9938
- <fo:inline font-weight="normal">)</fo:inline>
9939
- </xsl:if> -->
9940
- </fo:basic-link>
9941
- </fo:inline>
9944
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
9945
+
9946
+ <!-- <xsl:if test="$namespace = 'bsi'">
9947
+ <xsl:text>)</xsl:text>
9948
+ </xsl:if> -->
9949
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
9950
+ <!-- <xsl:if test="$namespace = 'jis'">
9951
+ <fo:inline font-weight="normal">)</fo:inline>
9952
+ </xsl:if> -->
9953
+ </fo:basic-link>
9954
+ </fo:inline>
9955
+ </xsl:otherwise>
9956
+ </xsl:choose>
9942
9957
  </xsl:template> <!-- fn -->
9943
9958
 
9944
9959
  <!-- fn/text() -->
@@ -14073,6 +14088,13 @@
14073
14088
  <xsl:apply-templates select="."/>
14074
14089
  </xsl:template>
14075
14090
 
14091
+ <!-- prevent missing stem for table and figures in ToC -->
14092
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
14093
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
14094
+ <xsl:apply-templates select="."/>
14095
+ </xsl:if>
14096
+ </xsl:template>
14097
+
14076
14098
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
14077
14099
 
14078
14100
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -14296,7 +14318,8 @@
14296
14318
 
14297
14319
  <xsl:for-each select="$contents_nodes//tables/table">
14298
14320
  <fo:bookmark internal-destination="{@id}">
14299
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
14321
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
14322
+ <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
14300
14323
  </fo:bookmark>
14301
14324
  </xsl:for-each>
14302
14325
  </fo:bookmark>
@@ -14305,6 +14328,26 @@
14305
14328
  </xsl:template> <!-- insertTableBookmarks -->
14306
14329
  <!-- End Bookmarks -->
14307
14330
 
14331
+ <!-- ============================ -->
14332
+ <!-- mode="bookmark_clean" -->
14333
+ <!-- ============================ -->
14334
+ <xsl:template match="node()" mode="bookmark_clean">
14335
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
14336
+ </xsl:template>
14337
+
14338
+ <xsl:template match="text()" mode="bookmark_clean">
14339
+ <xsl:value-of select="."/>
14340
+ </xsl:template>
14341
+
14342
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
14343
+ <xsl:value-of select="normalize-space(.)"/>
14344
+ </xsl:template>
14345
+
14346
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
14347
+ <!-- ============================ -->
14348
+ <!-- END: mode="bookmark_clean" -->
14349
+ <!-- ============================ -->
14350
+
14308
14351
  <xsl:template name="getLangVersion">
14309
14352
  <xsl:param name="lang"/>
14310
14353
  <xsl:param name="doctype" select="''"/>
@@ -16340,9 +16383,15 @@
16340
16383
  <xsl:when test="local-name(..) = 'ul'">
16341
16384
  <xsl:choose>
16342
16385
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
16386
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
16387
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
16343
16388
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
16344
16389
  </xsl:choose>
16345
16390
  </xsl:when>
16391
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
16392
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
16393
+ <xsl:value-of select="@label"/>
16394
+ </xsl:when>
16346
16395
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
16347
16396
 
16348
16397
  <xsl:variable name="type" select="../@type"/>
@@ -16474,7 +16523,7 @@
16474
16523
 
16475
16524
  </xsl:otherwise>
16476
16525
  </xsl:choose>
16477
- </xsl:template>
16526
+ </xsl:template> <!-- getListItemFormat -->
16478
16527
 
16479
16528
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
16480
16529
  <xsl:param name="indent">0</xsl:param>
@@ -16636,6 +16685,11 @@
16636
16685
 
16637
16686
  <xsl:call-template name="refine_list-item-label-style"/>
16638
16687
 
16688
+ <xsl:if test="local-name(..) = 'ul'">
16689
+ <xsl:variable name="li_label" select="@label"/>
16690
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
16691
+ </xsl:if>
16692
+
16639
16693
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
16640
16694
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
16641
16695
  <xsl:call-template name="append_add-style"/>
@@ -18044,6 +18098,16 @@
18044
18098
  </xsl:choose>
18045
18099
  </xsl:template>
18046
18100
 
18101
+ <!-- li/fmt-name -->
18102
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
18103
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
18104
+ <xsl:attribute name="full">true</xsl:attribute>
18105
+ </xsl:template>
18106
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
18107
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
18108
+ <xsl:attribute name="full">true</xsl:attribute>
18109
+ </xsl:template>
18110
+
18047
18111
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
18048
18112
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
18049
18113
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -18981,6 +19045,64 @@
18981
19045
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
18982
19046
  </xsl:template>
18983
19047
 
19048
+ <!-- ===================================== -->
19049
+ <!-- ===================================== -->
19050
+ <!-- Ruby text (CJK languages) rendering -->
19051
+ <!-- ===================================== -->
19052
+ <!-- ===================================== -->
19053
+ <xsl:template match="*[local-name() = 'ruby']">
19054
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
19055
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
19056
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
19057
+ </xsl:if>
19058
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
19059
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
19060
+ <!-- Example: width="2em" -->
19061
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
19062
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
19063
+ <xsl:variable name="text_width">
19064
+ <xsl:choose>
19065
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
19066
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
19067
+ </xsl:choose>
19068
+ </xsl:variable>
19069
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
19070
+
19071
+ <xsl:choose>
19072
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
19073
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
19074
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
19075
+ </xsl:when>
19076
+ <xsl:otherwise>
19077
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
19078
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
19079
+ </xsl:otherwise>
19080
+ </xsl:choose>
19081
+
19082
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
19083
+ </fo:inline-container>
19084
+ </xsl:template>
19085
+
19086
+ <xsl:template match="*[local-name() = 'rb']">
19087
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
19088
+ </xsl:template>
19089
+
19090
+ <xsl:template match="*[local-name() = 'rt']">
19091
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
19092
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
19093
+ <xsl:attribute name="space-before">0em</xsl:attribute>
19094
+ </xsl:if>
19095
+ <xsl:apply-templates/>
19096
+ </fo:block>
19097
+
19098
+ </xsl:template>
19099
+
19100
+ <!-- ===================================== -->
19101
+ <!-- ===================================== -->
19102
+ <!-- END: Ruby text (CJK languages) rendering -->
19103
+ <!-- ===================================== -->
19104
+ <!-- ===================================== -->
19105
+
18984
19106
  <xsl:template name="printEdition">
18985
19107
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
18986
19108
 
@@ -95,12 +95,7 @@ module IsoDoc
95
95
 
96
96
  def ol_depth(node)
97
97
  depth = node.ancestors(@iso_class ? "ol" : "ul, ol").size + 1
98
- type = :alphabet
99
- type = :arabic if [2, 7].include? depth
100
- type = :roman if [3, 8].include? depth
101
- type = :alphabet_upper if [4, 9].include? depth
102
- type = :roman_upper if [5, 10].include? depth
103
- type
98
+ @counter.ol_type(node, depth)
104
99
  end
105
100
 
106
101
  def note1(elem)
@@ -184,6 +179,23 @@ module IsoDoc
184
179
  end
185
180
  end
186
181
 
182
+ def ul_label_list(_elem)
183
+ if @docscheme == "1951"
184
+ %w(&#x2013;)
185
+ else
186
+ %w(&#x2014;)
187
+ end
188
+ end
189
+
190
+ def ol_label_template(_elem)
191
+ ret = super
192
+ @docscheme == "1951" and
193
+ ret[:alphabet] = <<~SPAN.strip
194
+ <span class="fmt-label-delim">(</span>%<span class="fmt-label-delim">)</span>
195
+ SPAN
196
+ ret
197
+ end
198
+
187
199
  def fn_ref_label(fnote)
188
200
  if fnote.ancestors("table, figure").empty? ||
189
201
  !fnote.ancestors("name, fmt-name").empty?
@@ -1701,16 +1701,22 @@ which can be bookmarks as well as block or section references</a:documentation>
1701
1701
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
1702
1702
  The target of a footnote is the location it is embedded in within the text</a:documentation>
1703
1703
  <element name="fn">
1704
- <attribute name="reference">
1705
- <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
1706
- </attribute>
1707
- <oneOrMore>
1708
- <ref name="paragraph">
1709
- <a:documentation>The content of the footnote</a:documentation>
1710
- </ref>
1711
- </oneOrMore>
1704
+ <ref name="FnAttributes"/>
1705
+ <ref name="FnBody"/>
1712
1706
  </element>
1713
1707
  </define>
1708
+ <define name="FnBody">
1709
+ <oneOrMore>
1710
+ <ref name="paragraph">
1711
+ <a:documentation>The content of the footnote</a:documentation>
1712
+ </ref>
1713
+ </oneOrMore>
1714
+ </define>
1715
+ <define name="FnAttributes">
1716
+ <attribute name="reference">
1717
+ <a:documentation>The number of the footnote, used to identify it visually</a:documentation>
1718
+ </attribute>
1719
+ </define>
1714
1720
  <define name="callout">
1715
1721
  <a:documentation>Inline reference to a paragraph or paragraphs, appearing as annotation of source code</a:documentation>
1716
1722
  <element name="callout">
@@ -1,13 +1,14 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
3
- <!--
4
- Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
5
- of relaton
6
-
7
- Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
8
- (SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
9
- -->
10
3
  <include href="biblio.rng">
4
+ <!-- ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix -->
5
+ <!--
6
+ Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
7
+ of relaton
8
+
9
+ Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
10
+ (SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
11
+ -->
11
12
  <define name="BibData">
12
13
  <a:documentation>The bibliographic description of a standardisation document</a:documentation>
13
14
  <ref name="StandardBibliographicItem"/>
@@ -91,6 +92,9 @@ a standards definition organization</a:documentation>
91
92
  <a:documentation>Representation of the identifier for the standardisation document, giving its individual semantic components</a:documentation>
92
93
  </ref>
93
94
  </zeroOrMore>
95
+ <ref name="DocumentImages">
96
+ <a:documentation>Coverpage and other images to be rendered with document</a:documentation>
97
+ </ref>
94
98
  </define>
95
99
  <define name="doctype">
96
100
  <a:documentation>Classification of the standardisation document</a:documentation>
@@ -268,6 +272,32 @@ and not those document components</a:documentation>
268
272
  </optional>
269
273
  </element>
270
274
  </define>
275
+ <define name="DocumentImages">
276
+ <zeroOrMore>
277
+ <element name="coverpage-image">
278
+ <a:documentation>Images to be displayed on the coverpage of the document</a:documentation>
279
+ <ref name="image-no-id"/>
280
+ </element>
281
+ </zeroOrMore>
282
+ <zeroOrMore>
283
+ <element name="innercoverpage-image">
284
+ <a:documentation>Images to be displayed on the inner coverpage of the document</a:documentation>
285
+ <ref name="image-no-id"/>
286
+ </element>
287
+ </zeroOrMore>
288
+ <zeroOrMore>
289
+ <element name="tocside-image">
290
+ <a:documentation>Images to be displayed on the Table of Contents page of the document</a:documentation>
291
+ <ref name="image-no-id"/>
292
+ </element>
293
+ </zeroOrMore>
294
+ <zeroOrMore>
295
+ <element name="backpage-image">
296
+ <a:documentation>Images to be displayed on the backpage of the document</a:documentation>
297
+ <ref name="image-no-id"/>
298
+ </element>
299
+ </zeroOrMore>
300
+ </define>
271
301
  <define name="StandardBibliographicItem">
272
302
  <ref name="BibliographicItem"/>
273
303
  <zeroOrMore>
@@ -1,23 +1,25 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- instantiations of this grammar may replace leaf strings
4
- with more elaborated types; e.g. title (text) replaced with
5
- title-main, title-intro, title-part; type replaced with
6
- enum.
7
-
8
- some renaming at leaf nodes is permissible
9
-
10
- obligations can change both from optional to mandatory,
11
- and from mandatory to optional; optional elements may
12
- be omitted; freely positioned alternatives may be replaced
13
- with strict ordering
14
-
15
- DO NOT introduce a namespace here. We do not want a distinct namespace
16
- for these elements, and a distinct namespace for any grammar inheriting
17
- these elements; we just want one namespace for any child grammars
18
- of this.
19
- -->
20
2
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <!--
4
+ ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix
5
+
6
+ Instantiations of this grammar may replace leaf strings
7
+ with more elaborated types; e.g. title (text) replaced with
8
+ title-main, title-intro, title-part; type replaced with
9
+ enum.
10
+
11
+ Some renaming at leaf nodes is permissible
12
+
13
+ Obligations can change both from optional to mandatory,
14
+ and from mandatory to optional; optional elements may
15
+ be omitted; freely positioned alternatives may be replaced
16
+ with strict ordering
17
+
18
+ DO NOT introduce a namespace here. We do not want a distinct namespace
19
+ for these elements, and a distinct namespace for any grammar inheriting
20
+ these elements; we just want one namespace for any child grammars
21
+ of this.
22
+ -->
21
23
  <!--
22
24
  https://www.myintervals.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
23
25
  iso8601date = xsd:string { pattern = "([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?" }
@@ -1241,6 +1243,11 @@ Refer to `BibliographicItem` for definitions</a:documentation>
1241
1243
  </define>
1242
1244
  <define name="formattedref">
1243
1245
  <element name="formattedref">
1246
+ <optional>
1247
+ <attribute name="format">
1248
+ <a:documentation>format of formatted reference; Metanorma assumes references are formatted as Metanorma XML</a:documentation>
1249
+ </attribute>
1250
+ </optional>
1244
1251
  <oneOrMore>
1245
1252
  <ref name="TextElement"/>
1246
1253
  </oneOrMore>
@@ -1812,6 +1819,11 @@ May be used to differentiate rendering of notes in bibliographies</a:documentati
1812
1819
  <a:documentation>Abstract of bibliographic item</a:documentation>
1813
1820
  <element name="abstract">
1814
1821
  <ref name="LocalizedStringAttributes"/>
1822
+ <optional>
1823
+ <attribute name="format">
1824
+ <a:documentation>What format the formatted abstract is in. In Metanorma, assumed to be Metanorma XML</a:documentation>
1825
+ </attribute>
1826
+ </optional>
1815
1827
  <choice>
1816
1828
  <oneOrMore>
1817
1829
  <ref name="BasicBlockNoId">
@@ -16,7 +16,7 @@ module Metanorma
16
16
  end
17
17
 
18
18
  def metadata_ext_iso(node, xml)
19
- structured_id(node, xml)
19
+ a = node.attr("horizontal") and xml.horizontal a
20
20
  metadata_stage(node, xml)
21
21
  @amd && a = node.attr("updates-document-type") and
22
22
  xml.updates_document_type a
@@ -53,11 +53,6 @@ module Metanorma
53
53
  end
54
54
  end
55
55
 
56
- def metadata_flavor(node, xml)
57
- super
58
- a = node.attr("horizontal") and xml.horizontal a
59
- end
60
-
61
56
  def metadata_status(node, xml)
62
57
  stage = get_stage(node)
63
58
  substage = get_substage(node)