metanorma-un 0.12.5 → 0.12.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -851,17 +851,30 @@
851
851
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
852
852
 
853
853
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
854
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
854
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
855
855
  <!-- Example: <tables>
856
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
857
- <tbody>
858
- <tr>
859
- <td id="tab-symdu_1_1">
860
- <p_len>6</p_len>
861
- <p_len>100</p_len> for 2nd paragraph
862
- <word_len>6</word_len>
863
- <word_len>20</word_len>
864
- ...
856
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
857
+ <column width_max="39354" width_min="39354"/>
858
+ <column width_max="75394" width_min="75394"/>
859
+ <column width_max="108813" width_min="108813"/>
860
+ <tbody>
861
+ <tr>
862
+ <td width_max="39354" width_min="39354">
863
+ <p_len>39354</p_len>
864
+ <word_len>39354</word_len>
865
+ </td>
866
+
867
+ OLD:
868
+ <tables>
869
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
870
+ <tbody>
871
+ <tr>
872
+ <td id="tab-symdu_1_1">
873
+ <p_len>6</p_len>
874
+ <p_len>100</p_len> for 2nd paragraph
875
+ <word_len>6</word_len>
876
+ <word_len>20</word_len>
877
+ ...
865
878
  -->
866
879
 
867
880
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -1080,6 +1093,10 @@
1080
1093
  <xsl:variable name="zero_width_space">​</xsl:variable>
1081
1094
  <xsl:variable name="hair_space"> </xsl:variable>
1082
1095
  <xsl:variable name="en_dash">–</xsl:variable>
1096
+ <xsl:variable name="em_dash">—</xsl:variable>
1097
+ <xsl:variable name="cr">&#13;</xsl:variable>
1098
+ <xsl:variable name="lf">
1099
+ </xsl:variable>
1083
1100
 
1084
1101
  <xsl:template name="getTitle">
1085
1102
  <xsl:param name="name"/>
@@ -1387,6 +1404,10 @@
1387
1404
 
1388
1405
  </xsl:attribute-set> <!-- example-name-style -->
1389
1406
 
1407
+ <xsl:template name="refine_example-name-style">
1408
+
1409
+ </xsl:template>
1410
+
1390
1411
  <xsl:attribute-set name="example-p-style">
1391
1412
 
1392
1413
  <xsl:attribute name="font-size">11pt</xsl:attribute>
@@ -1409,6 +1430,10 @@
1409
1430
 
1410
1431
  </xsl:attribute-set> <!-- termexample-name-style -->
1411
1432
 
1433
+ <xsl:template name="refine_termexample-name-style">
1434
+
1435
+ </xsl:template>
1436
+
1412
1437
  <!-- ========================== -->
1413
1438
  <!-- Table styles -->
1414
1439
  <!-- ========================== -->
@@ -1609,6 +1634,10 @@
1609
1634
 
1610
1635
  </xsl:attribute-set> <!-- table-fn-style -->
1611
1636
 
1637
+ <xsl:template name="refine_table-fn-style">
1638
+
1639
+ </xsl:template>
1640
+
1612
1641
  <xsl:attribute-set name="table-fn-number-style">
1613
1642
  <xsl:attribute name="font-size">80%</xsl:attribute>
1614
1643
  <xsl:attribute name="padding-right">5mm</xsl:attribute>
@@ -1617,6 +1646,10 @@
1617
1646
 
1618
1647
  </xsl:attribute-set> <!-- table-fn-number-style -->
1619
1648
 
1649
+ <xsl:template name="refine_table-fn-number-style">
1650
+
1651
+ </xsl:template>
1652
+
1620
1653
  <xsl:attribute-set name="fn-container-body-style">
1621
1654
  <xsl:attribute name="text-indent">0</xsl:attribute>
1622
1655
  <xsl:attribute name="start-indent">0</xsl:attribute>
@@ -2730,6 +2763,20 @@
2730
2763
  </xsl:for-each>
2731
2764
  </xsl:template>
2732
2765
 
2766
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
2767
+
2768
+ <xsl:template match="*[local-name()='table']" priority="2">
2769
+ <xsl:choose>
2770
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
2771
+ <xsl:call-template name="table"/>
2772
+ </xsl:when>
2773
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
2774
+ <xsl:otherwise>
2775
+ <xsl:call-template name="table"/>
2776
+ </xsl:otherwise>
2777
+ </xsl:choose>
2778
+ </xsl:template>
2779
+
2733
2780
  <xsl:template match="*[local-name()='table']" name="table">
2734
2781
 
2735
2782
  <xsl:variable name="table-preamble">
@@ -2739,9 +2786,11 @@
2739
2786
  <xsl:variable name="table">
2740
2787
 
2741
2788
  <xsl:variable name="simple-table">
2742
- <xsl:call-template name="getSimpleTable">
2743
- <xsl:with-param name="id" select="@id"/>
2744
- </xsl:call-template>
2789
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
2790
+ <xsl:call-template name="getSimpleTable">
2791
+ <xsl:with-param name="id" select="@id"/>
2792
+ </xsl:call-template>
2793
+ </xsl:if>
2745
2794
  </xsl:variable>
2746
2795
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2747
2796
 
@@ -2843,9 +2892,9 @@
2843
2892
  </xsl:attribute>
2844
2893
  </xsl:for-each>
2845
2894
 
2846
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2895
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'][not(@type = 'units')] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2847
2896
  <xsl:if test="$isNoteOrFnExist = 'true'">
2848
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2897
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2849
2898
  </xsl:if>
2850
2899
 
2851
2900
  <xsl:choose>
@@ -2994,9 +3043,28 @@
2994
3043
 
2995
3044
  </fo:block>
2996
3045
 
3046
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
3047
+ <xsl:if test="$continued = 'true'">
3048
+ <fo:block text-align="right">
3049
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
3050
+ </fo:block>
3051
+ </xsl:if>
3052
+ <!-- </xsl:if> -->
3053
+
2997
3054
  </xsl:if>
2998
3055
  </xsl:template> <!-- table/name -->
2999
3056
 
3057
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
3058
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
3059
+ <xsl:choose>
3060
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
3061
+ <!-- remove CR or LF at start -->
3062
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
3063
+ </xsl:when>
3064
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
3065
+ </xsl:choose>
3066
+ </xsl:template>
3067
+
3000
3068
  <!-- SOURCE: ... -->
3001
3069
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
3002
3070
  <xsl:call-template name="termsource"/>
@@ -3407,7 +3475,7 @@
3407
3475
  <xsl:param name="colwidths"/>
3408
3476
  <xsl:param name="colgroup"/>
3409
3477
 
3410
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
3478
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
3411
3479
 
3412
3480
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3413
3481
 
@@ -3479,7 +3547,7 @@
3479
3547
 
3480
3548
  <xsl:apply-templates select="../*[local-name()='p']"/>
3481
3549
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3482
- <xsl:apply-templates select="../*[local-name()='note']"/>
3550
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
3483
3551
  <xsl:apply-templates select="../*[local-name()='example']"/>
3484
3552
  <xsl:apply-templates select="../*[local-name()='source']"/>
3485
3553
 
@@ -3489,7 +3557,7 @@
3489
3557
 
3490
3558
  <!-- horizontal row separator -->
3491
3559
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3492
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3560
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3493
3561
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3494
3562
 
3495
3563
  <xsl:call-template name="setBordersTableArray"/>
@@ -3968,8 +4036,9 @@
3968
4036
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
3969
4037
 
3970
4038
  <fo:block xsl:use-attribute-sets="table-fn-style">
3971
-
4039
+ <xsl:call-template name="refine_table-fn-style"/>
3972
4040
  <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
4041
+ <xsl:call-template name="refine_table-fn-number-style"/>
3973
4042
 
3974
4043
  <xsl:value-of select="@reference"/>
3975
4044
 
@@ -4153,7 +4222,20 @@
4153
4222
  <!-- Definition List -->
4154
4223
  <!-- ===================== -->
4155
4224
 
4156
- <xsl:template match="*[local-name()='dl']">
4225
+ <!-- for table auto-layout algorithm -->
4226
+ <xsl:template match="*[local-name()='dl']" priority="2">
4227
+ <xsl:choose>
4228
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
4229
+ <xsl:call-template name="dl"/>
4230
+ </xsl:when>
4231
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
4232
+ <xsl:otherwise>
4233
+ <xsl:call-template name="dl"/>
4234
+ </xsl:otherwise>
4235
+ </xsl:choose>
4236
+ </xsl:template>
4237
+
4238
+ <xsl:template match="*[local-name()='dl']" name="dl">
4157
4239
  <xsl:variable name="isAdded" select="@added"/>
4158
4240
  <xsl:variable name="isDeleted" select="@deleted"/>
4159
4241
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -5107,11 +5189,16 @@
5107
5189
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5108
5190
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5109
5191
  <xsl:variable name="text" select="."/>
5110
- <fo:inline font-size="75%" role="SKIP">
5192
+ <xsl:variable name="ratio_">
5193
+ 0.75
5194
+ </xsl:variable>
5195
+ <xsl:variable name="ratio" select="number(normalize-space($ratio_))"/>
5196
+ <fo:inline font-size="{$ratio * 100}%" role="SKIP">
5111
5197
  <xsl:if test="string-length($text) &gt; 0">
5112
5198
  <xsl:variable name="smallCapsText">
5113
5199
  <xsl:call-template name="recursiveSmallCaps">
5114
5200
  <xsl:with-param name="text" select="$text"/>
5201
+ <xsl:with-param name="ratio" select="$ratio"/>
5115
5202
  </xsl:call-template>
5116
5203
  </xsl:variable>
5117
5204
  <!-- merge neighboring fo:inline -->
@@ -5148,12 +5235,13 @@
5148
5235
 
5149
5236
  <xsl:template name="recursiveSmallCaps">
5150
5237
  <xsl:param name="text"/>
5238
+ <xsl:param name="ratio"/>
5151
5239
  <xsl:variable name="char" select="substring($text,1,1)"/>
5152
5240
  <!-- <xsl:variable name="upperCase" select="translate($char, $lower, $upper)"/> -->
5153
5241
  <xsl:variable name="upperCase" select="java:toUpperCase(java:java.lang.String.new($char))"/>
5154
5242
  <xsl:choose>
5155
5243
  <xsl:when test="$char=$upperCase">
5156
- <fo:inline font-size="{100 div 0.75}%" role="SKIP">
5244
+ <fo:inline font-size="{100 div $ratio}%" role="SKIP">
5157
5245
  <xsl:value-of select="$upperCase"/>
5158
5246
  </fo:inline>
5159
5247
  </xsl:when>
@@ -5164,6 +5252,7 @@
5164
5252
  <xsl:if test="string-length($text) &gt; 1">
5165
5253
  <xsl:call-template name="recursiveSmallCaps">
5166
5254
  <xsl:with-param name="text" select="substring($text,2)"/>
5255
+ <xsl:with-param name="ratio" select="$ratio"/>
5167
5256
  </xsl:call-template>
5168
5257
  </xsl:if>
5169
5258
  </xsl:template>
@@ -5200,6 +5289,9 @@
5200
5289
  <xsl:if test="$key = 'font-family' or $key = 'font-size' or $key = 'color'">
5201
5290
  <style name="{$key}"><xsl:value-of select="$value"/></style>
5202
5291
  </xsl:if>
5292
+ <xsl:if test="$key = 'text-indent'">
5293
+ <style name="padding-left"><xsl:value-of select="$value"/></style>
5294
+ </xsl:if>
5203
5295
  </xsl:for-each>
5204
5296
  </xsl:variable>
5205
5297
  <xsl:variable name="styles" select="xalan:nodeset($styles_)"/>
@@ -6072,7 +6164,13 @@
6072
6164
  <xsl:value-of select="$language_current_2"/>
6073
6165
  </xsl:when>
6074
6166
  <xsl:otherwise>
6075
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
6167
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
6168
+ <xsl:choose>
6169
+ <xsl:when test="$language_current_3 != ''">
6170
+ <xsl:value-of select="$language_current_3"/>
6171
+ </xsl:when>
6172
+ <xsl:otherwise>en</xsl:otherwise>
6173
+ </xsl:choose>
6076
6174
  </xsl:otherwise>
6077
6175
  </xsl:choose>
6078
6176
  </xsl:otherwise>
@@ -6602,6 +6700,11 @@
6602
6700
  </xsl:call-template>
6603
6701
  </xsl:template>
6604
6702
 
6703
+ <!-- command between two xref points to non-standard bibitem -->
6704
+ <xsl:template match="text()[. = ','][preceding-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']] and following-sibling::node()[1][local-name() = 'sup'][*[local-name() = 'xref'][@type = 'footnote']]]">
6705
+ <xsl:value-of select="."/>
6706
+ </xsl:template>
6707
+
6605
6708
  <!-- ====== -->
6606
6709
  <!-- formula -->
6607
6710
  <!-- ====== -->
@@ -6981,7 +7084,7 @@
6981
7084
  </xsl:when>
6982
7085
  <xsl:otherwise>
6983
7086
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
6984
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7087
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and (../*[local-name() = 'name'] or parent::*[local-name() = 'figure'][@unnumbered = 'true']) and not(ancestor::*[local-name() = 'table'])">
6985
7088
 
6986
7089
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
6987
7090
  <xsl:attribute name="width">
@@ -7316,6 +7419,8 @@
7316
7419
  </xsl:attribute>
7317
7420
  </xsl:template>
7318
7421
 
7422
+ <xsl:variable name="regex_starts_with_digit">^[0-9].*</xsl:variable>
7423
+
7319
7424
  <xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
7320
7425
  <xsl:copy>
7321
7426
  <xsl:apply-templates select="@*" mode="svg_update"/>
@@ -7334,7 +7439,8 @@
7334
7439
 
7335
7440
  <xsl:attribute name="width">
7336
7441
  <xsl:choose>
7337
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7442
+ <!-- width is non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7443
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7338
7444
  <xsl:when test="$width != ''">
7339
7445
  <xsl:value-of select="round($width)"/>
7340
7446
  </xsl:when>
@@ -7343,7 +7449,8 @@
7343
7449
  </xsl:attribute>
7344
7450
  <xsl:attribute name="height">
7345
7451
  <xsl:choose>
7346
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7452
+ <!-- height non 'auto', 'text-width', 'full-page-width' or 'narrow' -->
7453
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7347
7454
  <xsl:when test="$height != ''">
7348
7455
  <xsl:value-of select="round($height)"/>
7349
7456
  </xsl:when>
@@ -7360,7 +7467,7 @@
7360
7467
  <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7361
7468
  <xsl:attribute name="width">
7362
7469
  <xsl:choose>
7363
- <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7470
+ <xsl:when test="$parent_image_width != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_width), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7364
7471
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7365
7472
  </xsl:choose>
7366
7473
  </xsl:attribute>
@@ -7371,7 +7478,7 @@
7371
7478
  <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7372
7479
  <xsl:attribute name="height">
7373
7480
  <xsl:choose>
7374
- <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7481
+ <xsl:when test="$parent_image_height != '' and normalize-space(java:matches(java:java.lang.String.new($parent_image_height), $regex_starts_with_digit)) = 'true'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7375
7482
  <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7376
7483
  </xsl:choose>
7377
7484
  </xsl:attribute>
@@ -8833,6 +8940,7 @@
8833
8940
  <xsl:template match="*[local-name() = 'termexample']/*[local-name() = 'name']">
8834
8941
  <xsl:if test="normalize-space() != ''">
8835
8942
  <fo:inline xsl:use-attribute-sets="termexample-name-style">
8943
+ <xsl:call-template name="refine_termexample-name-style"/>
8836
8944
  <xsl:apply-templates/>
8837
8945
  </fo:inline>
8838
8946
  </xsl:if>
@@ -8983,6 +9091,7 @@
8983
9091
  </xsl:when>
8984
9092
  <xsl:otherwise>
8985
9093
  <fo:inline xsl:use-attribute-sets="example-name-style">
9094
+ <xsl:call-template name="refine_example-name-style"/>
8986
9095
  <xsl:apply-templates/>
8987
9096
  </fo:inline>
8988
9097
  </xsl:otherwise>
@@ -10194,6 +10303,7 @@
10194
10303
  <xsl:template match="*[local-name() = 'references'][@normative='true']/*[local-name() = 'bibitem']" name="bibitem" priority="2">
10195
10304
 
10196
10305
  <fo:block id="{@id}" xsl:use-attribute-sets="bibitem-normative-style">
10306
+
10197
10307
  <xsl:call-template name="processBibitem"/>
10198
10308
  </fo:block>
10199
10309
 
@@ -10214,6 +10324,7 @@
10214
10324
  <xsl:when test="@hidden = 'true'"><!-- skip --></xsl:when>
10215
10325
  <xsl:otherwise>
10216
10326
  <fo:list-item id="{@id}" xsl:use-attribute-sets="bibitem-non-normative-list-item-style">
10327
+
10217
10328
  <fo:list-item-label end-indent="label-end()">
10218
10329
  <fo:block role="SKIP">
10219
10330
  <fo:inline role="SKIP">
@@ -208,7 +208,9 @@
208
208
  </define>
209
209
  <define name="roledescription">
210
210
  <element name="description">
211
- <ref name="FormattedString"/>
211
+ <oneOrMore>
212
+ <ref name="TextElement"/>
213
+ </oneOrMore>
212
214
  </element>
213
215
  </define>
214
216
  <define name="person">
@@ -333,7 +335,9 @@
333
335
  </define>
334
336
  <define name="affiliationdescription">
335
337
  <element name="description">
336
- <ref name="FormattedString"/>
338
+ <oneOrMore>
339
+ <ref name="TextElement"/>
340
+ </oneOrMore>
337
341
  </element>
338
342
  </define>
339
343
  <define name="organization">
@@ -897,7 +901,9 @@
897
901
  </define>
898
902
  <define name="formattedref">
899
903
  <element name="formattedref">
900
- <ref name="FormattedString"/>
904
+ <oneOrMore>
905
+ <ref name="TextElement"/>
906
+ </oneOrMore>
901
907
  </element>
902
908
  </define>
903
909
  <define name="license">
@@ -942,7 +948,9 @@
942
948
  <optional>
943
949
  <attribute name="type"/>
944
950
  </optional>
945
- <ref name="FormattedString"/>
951
+ <zeroOrMore>
952
+ <ref name="TextElement"/>
953
+ </zeroOrMore>
946
954
  </define>
947
955
  <!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
948
956
  <define name="TypedUri">
@@ -1042,7 +1050,9 @@
1042
1050
  <optional>
1043
1051
  <attribute name="script"/>
1044
1052
  </optional>
1045
- <text/>
1053
+ <oneOrMore>
1054
+ <ref name="TextElement"/>
1055
+ </oneOrMore>
1046
1056
  </element>
1047
1057
  </define>
1048
1058
  <define name="docnumber">
@@ -1267,12 +1277,16 @@
1267
1277
  <optional>
1268
1278
  <attribute name="type"/>
1269
1279
  </optional>
1270
- <ref name="FormattedString"/>
1280
+ <oneOrMore>
1281
+ <ref name="TextElement"/>
1282
+ </oneOrMore>
1271
1283
  </element>
1272
1284
  </define>
1273
1285
  <define name="bibabstract">
1274
1286
  <element name="abstract">
1275
- <ref name="FormattedString"/>
1287
+ <oneOrMore>
1288
+ <ref name="TextElement"/>
1289
+ </oneOrMore>
1276
1290
  </element>
1277
1291
  </define>
1278
1292
  <define name="copyright">
@@ -1377,7 +1391,9 @@
1377
1391
  </attribute>
1378
1392
  <optional>
1379
1393
  <element name="description">
1380
- <ref name="FormattedString"/>
1394
+ <oneOrMore>
1395
+ <ref name="TextElement"/>
1396
+ </oneOrMore>
1381
1397
  </element>
1382
1398
  </optional>
1383
1399
  <element name="bibitem">
@@ -59,7 +59,9 @@ module Metanorma
59
59
  dn = "#{dn}(#{abbr})" unless abbr.empty?
60
60
  end
61
61
  id = node.attr("docidentifier") and dn = id
62
- xml.docidentifier { |i| i << dn }
62
+ xml.docidentifier primary: "true" do |i|
63
+ i << dn
64
+ end
63
65
  end
64
66
 
65
67
  def metadata_distribution(node, xml)
@@ -156,44 +156,7 @@
156
156
  </define>
157
157
  <define name="xref">
158
158
  <element name="xref">
159
- <attribute name="target">
160
- <data type="string">
161
- <param name="pattern">\i\c*|\c+#\c+</param>
162
- </data>
163
- </attribute>
164
- <optional>
165
- <attribute name="to">
166
- <data type="string">
167
- <param name="pattern">\i\c*|\c+#\c+</param>
168
- </data>
169
- </attribute>
170
- </optional>
171
- <optional>
172
- <attribute name="type">
173
- <ref name="ReferenceFormat"/>
174
- </attribute>
175
- </optional>
176
- <optional>
177
- <attribute name="alt"/>
178
- </optional>
179
- <optional>
180
- <attribute name="case">
181
- <choice>
182
- <value>capital</value>
183
- <value>lowercase</value>
184
- </choice>
185
- </attribute>
186
- </optional>
187
- <optional>
188
- <attribute name="droploc">
189
- <data type="boolean"/>
190
- </attribute>
191
- </optional>
192
- <optional>
193
- <attribute name="style">
194
- <ref name="XrefStyleType"/>
195
- </attribute>
196
- </optional>
159
+ <ref name="XrefAttributes"/>
197
160
  <ref name="XrefBody"/>
198
161
  </element>
199
162
  </define>
@@ -407,23 +370,7 @@
407
370
  </define>
408
371
  <define name="figure">
409
372
  <element name="figure">
410
- <attribute name="id">
411
- <data type="ID"/>
412
- </attribute>
413
- <optional>
414
- <attribute name="unnumbered">
415
- <data type="boolean"/>
416
- </attribute>
417
- </optional>
418
- <optional>
419
- <attribute name="number"/>
420
- </optional>
421
- <optional>
422
- <attribute name="subsequence"/>
423
- </optional>
424
- <optional>
425
- <attribute name="class"/>
426
- </optional>
373
+ <ref name="FigureAttributes"/>
427
374
  <ref name="BlockAttributes"/>
428
375
  <optional>
429
376
  <ref name="tname"/>
@@ -2450,6 +2397,49 @@
2450
2397
  </zeroOrMore>
2451
2398
  </element>
2452
2399
  </define>
2400
+ <define name="XrefAttributes">
2401
+ <attribute name="target">
2402
+ <data type="string">
2403
+ <param name="pattern">\i\c*|\c+#\c+</param>
2404
+ </data>
2405
+ </attribute>
2406
+ <optional>
2407
+ <attribute name="to">
2408
+ <data type="string">
2409
+ <param name="pattern">\i\c*|\c+#\c+</param>
2410
+ </data>
2411
+ </attribute>
2412
+ </optional>
2413
+ <optional>
2414
+ <attribute name="type">
2415
+ <ref name="ReferenceFormat"/>
2416
+ </attribute>
2417
+ </optional>
2418
+ <optional>
2419
+ <attribute name="alt"/>
2420
+ </optional>
2421
+ <optional>
2422
+ <attribute name="case">
2423
+ <choice>
2424
+ <value>capital</value>
2425
+ <value>lowercase</value>
2426
+ </choice>
2427
+ </attribute>
2428
+ </optional>
2429
+ <optional>
2430
+ <attribute name="droploc">
2431
+ <data type="boolean"/>
2432
+ </attribute>
2433
+ </optional>
2434
+ <optional>
2435
+ <attribute name="style">
2436
+ <ref name="XrefStyleType"/>
2437
+ </attribute>
2438
+ </optional>
2439
+ <optional>
2440
+ <attribute name="label"/>
2441
+ </optional>
2442
+ </define>
2453
2443
  <define name="XrefBody">
2454
2444
  <zeroOrMore>
2455
2445
  <ref name="XrefTarget"/>
@@ -2528,6 +2518,28 @@
2528
2518
  <attribute name="columns"/>
2529
2519
  </optional>
2530
2520
  </define>
2521
+ <define name="FigureAttributes">
2522
+ <attribute name="id">
2523
+ <data type="ID"/>
2524
+ </attribute>
2525
+ <optional>
2526
+ <attribute name="unnumbered">
2527
+ <data type="boolean"/>
2528
+ </attribute>
2529
+ </optional>
2530
+ <optional>
2531
+ <attribute name="number"/>
2532
+ </optional>
2533
+ <optional>
2534
+ <attribute name="subsequence"/>
2535
+ </optional>
2536
+ <optional>
2537
+ <attribute name="class"/>
2538
+ </optional>
2539
+ <optional>
2540
+ <attribute name="width"/>
2541
+ </optional>
2542
+ </define>
2531
2543
  <start>
2532
2544
  <ref name="standard-document"/>
2533
2545
  </start>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.12.5".freeze
3
+ VERSION = "0.12.7".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.5
4
+ version: 0.12.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-10 00:00:00.000000000 Z
11
+ date: 2024-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639