metanorma-bipm 2.6.4 → 2.6.5

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.
@@ -2617,6 +2617,7 @@
2617
2617
  </xsl:template> <!-- refine_table-style -->
2618
2618
 
2619
2619
  <xsl:attribute-set name="table-name-style">
2620
+ <xsl:attribute name="role">Caption</xsl:attribute>
2620
2621
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
2621
2622
 
2622
2623
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -2628,6 +2629,9 @@
2628
2629
 
2629
2630
  <xsl:template name="refine_table-name-style">
2630
2631
  <xsl:param name="continued"/>
2632
+ <xsl:if test="$continued = 'true'">
2633
+ <xsl:attribute name="role">SKIP</xsl:attribute>
2634
+ </xsl:if>
2631
2635
 
2632
2636
  </xsl:template> <!-- refine_table-name-style -->
2633
2637
 
@@ -4430,7 +4434,7 @@
4430
4434
  </xsl:if>
4431
4435
 
4432
4436
  </fo:block-container>
4433
- </xsl:variable>
4437
+ </xsl:variable> <!-- END: variable name="table" -->
4434
4438
 
4435
4439
  <xsl:variable name="isAdded" select="@added"/>
4436
4440
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -4440,14 +4444,14 @@
4440
4444
 
4441
4445
  <!-- centered table when table name is centered (see table-name-style) -->
4442
4446
 
4443
- <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
4447
+ <fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style" role="SKIP">
4444
4448
 
4445
4449
  <fo:table-column column-width="proportional-column-width(1)"/>
4446
4450
  <fo:table-column column-width="{@width}"/>
4447
4451
  <fo:table-column column-width="proportional-column-width(1)"/>
4448
- <fo:table-body>
4449
- <fo:table-row>
4450
- <fo:table-cell column-number="2">
4452
+ <fo:table-body role="SKIP">
4453
+ <fo:table-row role="SKIP">
4454
+ <fo:table-cell column-number="2" role="SKIP">
4451
4455
  <xsl:copy-of select="$table-preamble"/>
4452
4456
  <fo:block role="SKIP">
4453
4457
  <xsl:call-template name="setTrackChangesStyles">
@@ -4488,11 +4492,12 @@
4488
4492
 
4489
4493
  </xsl:template>
4490
4494
 
4495
+ <!-- table/name-->
4491
4496
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
4492
4497
  <xsl:param name="continued"/>
4493
4498
  <xsl:if test="normalize-space() != ''">
4494
4499
 
4495
- <fo:block xsl:use-attribute-sets="table-name-style" role="SKIP">
4500
+ <fo:block xsl:use-attribute-sets="table-name-style">
4496
4501
 
4497
4502
  <xsl:call-template name="refine_table-name-style">
4498
4503
  <xsl:with-param name="continued" select="$continued"/>
@@ -4984,7 +4989,7 @@
4984
4989
 
4985
4990
  <xsl:variable name="tableWithNotesAndFootnotes">
4986
4991
 
4987
- <fo:table keep-with-previous="always">
4992
+ <fo:table keep-with-previous="always" role="SKIP">
4988
4993
  <xsl:for-each select="xalan:nodeset($table_attributes)/table_attributes/@*">
4989
4994
  <xsl:variable name="name" select="local-name()"/>
4990
4995
  <xsl:choose>
@@ -5015,9 +5020,9 @@
5015
5020
  </xsl:otherwise>
5016
5021
  </xsl:choose>
5017
5022
 
5018
- <fo:table-body>
5019
- <fo:table-row>
5020
- <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
5023
+ <fo:table-body role="SKIP">
5024
+ <fo:table-row role="SKIP">
5025
+ <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}" role="SKIP">
5021
5026
 
5022
5027
  <xsl:call-template name="refine_table-footer-cell-style"/>
5023
5028
 
@@ -5090,7 +5095,7 @@
5090
5095
 
5091
5096
  <!-- if there isn't 'thead' and there is a table's title -->
5092
5097
  <xsl:if test="not(ancestor::*[local-name()='table']/*[local-name()='thead']) and ancestor::*[local-name()='table']/*[local-name()='name']">
5093
- <fo:table-header>
5098
+ <fo:table-header role="Caption">
5094
5099
  <xsl:call-template name="table-header-title">
5095
5100
  <xsl:with-param name="cols-count" select="$cols-count"/>
5096
5101
  </xsl:call-template>
@@ -5456,6 +5461,7 @@
5456
5461
  <!-- footnotes in text (title, bibliography, main body), not for tables, figures and names --> <!-- table's, figure's names -->
5457
5462
  <!-- fn in text -->
5458
5463
  <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">
5464
+ <xsl:param name="footnote_body_from_table">false</xsl:param>
5459
5465
 
5460
5466
  <!-- list of unique footnotes -->
5461
5467
  <xsl:variable name="p_fn_">
@@ -5521,7 +5527,7 @@
5521
5527
  <xsl:copy-of select="$footnote_inline"/>
5522
5528
  </xsl:when>
5523
5529
  <!-- <xsl:when test="$footnotes//*[local-name() = 'fmt-fn-body'][@id = $ref_id] or normalize-space(@skip_footnote_body) = 'false'"> -->
5524
- <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false'">
5530
+ <xsl:when test="$p_fn//fn[@gen_id = $gen_id] or normalize-space(@skip_footnote_body) = 'false' or $footnote_body_from_table = 'true'">
5525
5531
 
5526
5532
  <fo:footnote xsl:use-attribute-sets="fn-style" role="SKIP">
5527
5533
  <xsl:copy-of select="$footnote_inline"/>
@@ -5930,39 +5936,51 @@
5930
5936
  <!-- fn reference in the table rendering (for instance, 'some text 1) some text' ) -->
5931
5937
  <!-- fn --> <!-- in table --> <!-- for figure see <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/> -->
5932
5938
  <xsl:template match="*[local-name()='fn']">
5933
- <fo:inline xsl:use-attribute-sets="fn-reference-style">
5934
-
5935
- <xsl:call-template name="refine_fn-reference-style"/>
5939
+ <xsl:variable name="target" select="@target"/>
5940
+ <xsl:choose>
5941
+ <!-- case for footnotes in Requirement tables (https://github.com/metanorma/metanorma-ogc/issues/791) -->
5942
+ <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]">
5943
+ <xsl:call-template name="fn">
5944
+ <xsl:with-param name="footnote_body_from_table">true</xsl:with-param>
5945
+ </xsl:call-template>
5946
+ </xsl:when>
5947
+ <xsl:otherwise>
5936
5948
 
5937
- <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5938
- <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
5939
- <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
5940
- <!-- <xsl:attribute name="internal-destination">
5941
- <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5942
- </xsl:attribute>
5943
- </xsl:if>
5944
- <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5945
- <xsl:attribute name="internal-destination">
5946
- <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
5947
- <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5948
- </xsl:attribute>
5949
- </xsl:if> -->
5950
- <!-- <xsl:if test="$namespace = 'plateau'">
5951
- <xsl:text>※</xsl:text>
5952
- </xsl:if> -->
5953
- <!-- <xsl:value-of select="@reference"/> -->
5949
+ <fo:inline xsl:use-attribute-sets="fn-reference-style">
5954
5950
 
5955
- <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5951
+ <xsl:call-template name="refine_fn-reference-style"/>
5956
5952
 
5957
- <!-- <xsl:if test="$namespace = 'bsi'">
5958
- <xsl:text>)</xsl:text>
5959
- </xsl:if> -->
5960
- <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5961
- <!-- <xsl:if test="$namespace = 'jis'">
5962
- <fo:inline font-weight="normal">)</fo:inline>
5963
- </xsl:if> -->
5964
- </fo:basic-link>
5965
- </fo:inline>
5953
+ <!-- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> --> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5954
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="footnote {@reference}">
5955
+ <!-- <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> --> <!-- for footnotes in tables -->
5956
+ <!-- <xsl:attribute name="internal-destination">
5957
+ <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
5958
+ </xsl:attribute>
5959
+ </xsl:if>
5960
+ <xsl:if test="$namespace = 'ogc' or $namespace = 'ogc-white-paper'">
5961
+ <xsl:attribute name="internal-destination">
5962
+ <xsl:value-of select="@reference"/><xsl:text>_</xsl:text>
5963
+ <xsl:value-of select="ancestor::*[local-name()='table'][1]/@id"/>
5964
+ </xsl:attribute>
5965
+ </xsl:if> -->
5966
+ <!-- <xsl:if test="$namespace = 'plateau'">
5967
+ <xsl:text>※</xsl:text>
5968
+ </xsl:if> -->
5969
+ <!-- <xsl:value-of select="@reference"/> -->
5970
+
5971
+ <xsl:value-of select="normalize-space(*[local-name() = 'fmt-fn-label'])"/>
5972
+
5973
+ <!-- <xsl:if test="$namespace = 'bsi'">
5974
+ <xsl:text>)</xsl:text>
5975
+ </xsl:if> -->
5976
+ <!-- commented, https://github.com/metanorma/isodoc/issues/614 -->
5977
+ <!-- <xsl:if test="$namespace = 'jis'">
5978
+ <fo:inline font-weight="normal">)</fo:inline>
5979
+ </xsl:if> -->
5980
+ </fo:basic-link>
5981
+ </fo:inline>
5982
+ </xsl:otherwise>
5983
+ </xsl:choose>
5966
5984
  </xsl:template> <!-- fn -->
5967
5985
 
5968
5986
  <!-- fn/text() -->
@@ -9980,6 +9998,13 @@
9980
9998
  <xsl:apply-templates select="."/>
9981
9999
  </xsl:template>
9982
10000
 
10001
+ <!-- prevent missing stem for table and figures in ToC -->
10002
+ <xsl:template match="*[local-name() = 'name' or local-name() = 'fmt-name']//*[local-name() = 'stem']" mode="contents">
10003
+ <xsl:if test="not(following-sibling::*[1][local-name() = 'fmt-stem'])">
10004
+ <xsl:apply-templates select="."/>
10005
+ </xsl:if>
10006
+ </xsl:template>
10007
+
9983
10008
  <xsl:template match="*[local-name() = 'references'][@hidden='true']" mode="contents" priority="3"/>
9984
10009
 
9985
10010
  <xsl:template match="*[local-name() = 'references']/*[local-name() = 'bibitem']" mode="contents"/>
@@ -10203,7 +10228,8 @@
10203
10228
 
10204
10229
  <xsl:for-each select="$contents_nodes//tables/table">
10205
10230
  <fo:bookmark internal-destination="{@id}">
10206
- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title>
10231
+ <!-- <fo:bookmark-title><xsl:value-of select="normalize-space(.)"/></fo:bookmark-title> -->
10232
+ <fo:bookmark-title><xsl:apply-templates mode="bookmark_clean"/></fo:bookmark-title>
10207
10233
  </fo:bookmark>
10208
10234
  </xsl:for-each>
10209
10235
  </fo:bookmark>
@@ -10212,6 +10238,26 @@
10212
10238
  </xsl:template> <!-- insertTableBookmarks -->
10213
10239
  <!-- End Bookmarks -->
10214
10240
 
10241
+ <!-- ============================ -->
10242
+ <!-- mode="bookmark_clean" -->
10243
+ <!-- ============================ -->
10244
+ <xsl:template match="node()" mode="bookmark_clean">
10245
+ <xsl:apply-templates select="node()" mode="bookmark_clean"/>
10246
+ </xsl:template>
10247
+
10248
+ <xsl:template match="text()" mode="bookmark_clean">
10249
+ <xsl:value-of select="."/>
10250
+ </xsl:template>
10251
+
10252
+ <xsl:template match="*[local-name() = 'math']" mode="bookmark_clean">
10253
+ <xsl:value-of select="normalize-space(.)"/>
10254
+ </xsl:template>
10255
+
10256
+ <xsl:template match="*[local-name() = 'asciimath']" mode="bookmark_clean"/>
10257
+ <!-- ============================ -->
10258
+ <!-- END: mode="bookmark_clean" -->
10259
+ <!-- ============================ -->
10260
+
10215
10261
  <xsl:template name="getLangVersion">
10216
10262
  <xsl:param name="lang"/>
10217
10263
  <xsl:param name="doctype" select="''"/>
@@ -12228,9 +12274,15 @@
12228
12274
  <xsl:when test="local-name(..) = 'ul'">
12229
12275
  <xsl:choose>
12230
12276
  <xsl:when test="normalize-space($processing_instruction_type) = 'simple'"/>
12277
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
12278
+ <xsl:when test="@label"><xsl:value-of select="@label"/></xsl:when>
12231
12279
  <xsl:otherwise><xsl:call-template name="setULLabel"/></xsl:otherwise>
12232
12280
  </xsl:choose>
12233
12281
  </xsl:when>
12282
+ <!-- https://github.com/metanorma/isodoc/issues/675 -->
12283
+ <xsl:when test="local-name(..) = 'ol' and @label and @full = 'true'"> <!-- @full added in the template li/fmt-name -->
12284
+ <xsl:value-of select="@label"/>
12285
+ </xsl:when>
12234
12286
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
12235
12287
 
12236
12288
  <xsl:variable name="type" select="../@type"/>
@@ -12355,7 +12407,7 @@
12355
12407
 
12356
12408
  </xsl:otherwise>
12357
12409
  </xsl:choose>
12358
- </xsl:template>
12410
+ </xsl:template> <!-- getListItemFormat -->
12359
12411
 
12360
12412
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
12361
12413
  <xsl:param name="indent">0</xsl:param>
@@ -12487,6 +12539,11 @@
12487
12539
 
12488
12540
  <xsl:call-template name="refine_list-item-label-style"/>
12489
12541
 
12542
+ <xsl:if test="local-name(..) = 'ul'">
12543
+ <xsl:variable name="li_label" select="@label"/>
12544
+ <xsl:copy-of select="$ul_labels//label[. = $li_label]/@*[not(local-name() = 'level')]"/>
12545
+ </xsl:if>
12546
+
12490
12547
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
12491
12548
  <xsl:if test="*[1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
12492
12549
  <xsl:call-template name="append_add-style"/>
@@ -13893,6 +13950,16 @@
13893
13950
  </xsl:choose>
13894
13951
  </xsl:template>
13895
13952
 
13953
+ <!-- li/fmt-name -->
13954
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_step1">
13955
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
13956
+ <xsl:attribute name="full">true</xsl:attribute>
13957
+ </xsl:template>
13958
+ <xsl:template match="*[local-name() = 'li']/*[local-name() = 'fmt-name']" priority="2" mode="update_xml_pres">
13959
+ <xsl:attribute name="label"><xsl:value-of select="."/></xsl:attribute>
13960
+ <xsl:attribute name="full">true</xsl:attribute>
13961
+ </xsl:template>
13962
+
13896
13963
  <xsl:template match="*[local-name() = 'fmt-preferred']"/>
13897
13964
  <xsl:template match="*[local-name() = 'fmt-preferred'][*[local-name() = 'p']]" mode="update_xml_step1">
13898
13965
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -14707,6 +14774,64 @@
14707
14774
  <fo:inline xml:lang="none"><xsl:value-of select="."/></fo:inline>
14708
14775
  </xsl:template>
14709
14776
 
14777
+ <!-- ===================================== -->
14778
+ <!-- ===================================== -->
14779
+ <!-- Ruby text (CJK languages) rendering -->
14780
+ <!-- ===================================== -->
14781
+ <!-- ===================================== -->
14782
+ <xsl:template match="*[local-name() = 'ruby']">
14783
+ <fo:inline-container text-indent="0mm" last-line-end-indent="0mm">
14784
+ <xsl:if test="not(ancestor::*[local-name() = 'ruby'])">
14785
+ <xsl:attribute name="alignment-baseline">central</xsl:attribute>
14786
+ </xsl:if>
14787
+ <xsl:variable name="rt_text" select="*[local-name() = 'rt']"/>
14788
+ <xsl:variable name="rb_text" select=".//*[local-name() = 'rb'][not(*[local-name() = 'ruby'])]"/>
14789
+ <!-- Example: width="2em" -->
14790
+ <xsl:variable name="text_rt_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rt_text, $font_main, 6)"/>
14791
+ <xsl:variable name="text_rb_width" select="java:org.metanorma.fop.Util.getStringWidthByFontSize($rb_text, $font_main, 10)"/>
14792
+ <xsl:variable name="text_width">
14793
+ <xsl:choose>
14794
+ <xsl:when test="$text_rt_width &gt;= $text_rb_width"><xsl:value-of select="$text_rt_width"/></xsl:when>
14795
+ <xsl:otherwise><xsl:value-of select="$text_rb_width"/></xsl:otherwise>
14796
+ </xsl:choose>
14797
+ </xsl:variable>
14798
+ <xsl:attribute name="width"><xsl:value-of select="$text_width div 10"/>em</xsl:attribute>
14799
+
14800
+ <xsl:choose>
14801
+ <xsl:when test="ancestor::*[local-name() = 'ruby']">
14802
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
14803
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
14804
+ </xsl:when>
14805
+ <xsl:otherwise>
14806
+ <xsl:apply-templates select="*[local-name() = 'rt']"/>
14807
+ <xsl:apply-templates select="*[local-name() = 'rb']"/>
14808
+ </xsl:otherwise>
14809
+ </xsl:choose>
14810
+
14811
+ <xsl:apply-templates select="node()[not(local-name() = 'rt') and not(local-name() = 'rb')]"/>
14812
+ </fo:inline-container>
14813
+ </xsl:template>
14814
+
14815
+ <xsl:template match="*[local-name() = 'rb']">
14816
+ <fo:block line-height="1em" text-align="center"><xsl:apply-templates/></fo:block>
14817
+ </xsl:template>
14818
+
14819
+ <xsl:template match="*[local-name() = 'rt']">
14820
+ <fo:block font-size="0.5em" text-align="center" line-height="1.2em" space-before="-1.4em" space-before.conditionality="retain"> <!-- -->
14821
+ <xsl:if test="ancestor::*[local-name() = 'ruby'][last()]//*[local-name() = 'ruby'] or ancestor::*[local-name() = 'rb']">
14822
+ <xsl:attribute name="space-before">0em</xsl:attribute>
14823
+ </xsl:if>
14824
+ <xsl:apply-templates/>
14825
+ </fo:block>
14826
+
14827
+ </xsl:template>
14828
+
14829
+ <!-- ===================================== -->
14830
+ <!-- ===================================== -->
14831
+ <!-- END: Ruby text (CJK languages) rendering -->
14832
+ <!-- ===================================== -->
14833
+ <!-- ===================================== -->
14834
+
14710
14835
  <xsl:template name="printEdition">
14711
14836
  <xsl:variable name="edition_i18n" select="normalize-space((//*[local-name() = 'metanorma'])[1]/*[local-name() = 'bibdata']/*[local-name() = 'edition'][normalize-space(@language) != ''])"/>
14712
14837
  <xsl:text> </xsl:text>
@@ -65,6 +65,18 @@ module IsoDoc
65
65
  def termsource_modification(elem)
66
66
  termsource_add_modification_text(elem.at(ns("./modification")))
67
67
  end
68
+
69
+ def ul_label_list(_elem)
70
+ %w(&#x2022; &#x2212; &#x6f;)
71
+ end
72
+
73
+ def ol_label_template(_elem)
74
+ super
75
+ .merge({
76
+ roman: %{<span class="fmt-label-delim">(</span>%<span class="fmt-label-delim">)</span>},
77
+ arabic: %{%<span class="fmt-label-delim">.</span>},
78
+ })
79
+ end
68
80
  end
69
81
  end
70
82
  end
@@ -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">
@@ -1,11 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar ns='https://www.metanorma.org/ns/standoc' xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!--
4
- VERSION v1.2.1
5
- Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
6
- we cannot have a new default namespace: we will end up with a grammar with two different
7
- namespaces, one for isostandard and one for csand additions. And we do not want that.
8
- -->
9
3
  <include href="relaton-bipm.rng"/>
10
4
  <include href="isodoc.rng">
11
5
  <define name="XrefAttributes" combine="interleave">
@@ -26,38 +20,10 @@
26
20
  </optional>
27
21
  </define>
28
22
  <define name="Clause-Section">
29
- <optional>
30
- <attribute name="id">
31
- <data type="ID"/>
32
- </attribute>
33
- </optional>
34
- <optional>
35
- <attribute name="language"/>
36
- </optional>
37
- <optional>
38
- <attribute name="script"/>
39
- </optional>
40
- <optional>
41
- <attribute name="inline-header">
42
- <data type="boolean"/>
43
- </attribute>
44
- </optional>
45
- <optional>
46
- <attribute name="obligation">
47
- <choice>
48
- <value>normative</value>
49
- <value>informative</value>
50
- </choice>
51
- </attribute>
52
- </optional>
23
+ <ref name="Section-Attributes"/>
53
24
  <optional>
54
25
  <attribute name="type"/>
55
26
  </optional>
56
- <optional>
57
- <attribute name="unnumbered">
58
- <data type="boolean"/>
59
- </attribute>
60
- </optional>
61
27
  <optional>
62
28
  <ref name="section-title"/>
63
29
  </optional>
@@ -78,47 +44,17 @@
78
44
  </zeroOrMore>
79
45
  </group>
80
46
  </define>
81
- <define name="Annex-Section-Attr" combine="interleave">
47
+ <define name="Annex-Section-Attributes" combine="interleave">
82
48
  <optional>
83
49
  <attribute name="unnumbered">
84
50
  <data type="boolean"/>
85
51
  </attribute>
86
52
  </optional>
87
53
  </define>
88
- <define name="OlAttr" combine="interleave">
54
+ <define name="OlAttributes" combine="interleave">
89
55
  <optional>
90
56
  <attribute name="start"/>
91
57
  </optional>
92
58
  </define>
93
- <define name="standard-document">
94
- <element name="metanorma">
95
- <ref name="Root-Attributes"/>
96
- <ref name="bibdata"/>
97
- <zeroOrMore>
98
- <ref name="termdocsource"/>
99
- </zeroOrMore>
100
- <optional>
101
- <ref name="misccontainer"/>
102
- </optional>
103
- <optional>
104
- <ref name="boilerplate"/>
105
- </optional>
106
- <optional>
107
- <ref name="preface"/>
108
- </optional>
109
- <oneOrMore>
110
- <ref name="sections"/>
111
- </oneOrMore>
112
- <zeroOrMore>
113
- <ref name="annex"/>
114
- </zeroOrMore>
115
- <optional>
116
- <ref name="bibliography"/>
117
- </optional>
118
- <zeroOrMore>
119
- <ref name="indexsect"/>
120
- </zeroOrMore>
121
- </element>
122
- </define>
123
59
  </include>
124
60
  </grammar>