metanorma-ogc 2.2.6 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -621,6 +621,8 @@
621
621
  </xsl:choose>
622
622
  </xsl:template>
623
623
 
624
+ <xsl:strip-space elements="ogc:xref"/>
625
+
624
626
  <!-- external parameters -->
625
627
 
626
628
  <xsl:param name="svg_images"/> <!-- svg images array -->
@@ -2115,17 +2117,22 @@
2115
2117
  </xsl:for-each>
2116
2118
  </xsl:template>
2117
2119
 
2120
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2118
2121
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
2119
2122
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
2120
2123
  <xsl:template match="text()" name="text">
2121
2124
 
2122
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2123
- <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
2124
- <xsl:call-template name="replace_fo_inline_tags">
2125
- <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2126
- <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2127
- <xsl:with-param name="text" select="$text"/>
2128
- </xsl:call-template>
2125
+ <xsl:choose>
2126
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when>
2127
+ <xsl:otherwise>
2128
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
2129
+ <xsl:call-template name="replace_fo_inline_tags">
2130
+ <xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
2131
+ <xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
2132
+ <xsl:with-param name="text" select="$text"/>
2133
+ </xsl:call-template>
2134
+ </xsl:otherwise>
2135
+ </xsl:choose>
2129
2136
 
2130
2137
  </xsl:template>
2131
2138
 
@@ -3179,7 +3186,7 @@
3179
3186
  <xsl:template match="*[local-name()='tr']">
3180
3187
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
3181
3188
 
3182
- <xsl:if test="*[local-name() = 'th']">
3189
+ <xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
3183
3190
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
3184
3191
  </xsl:if>
3185
3192
 
@@ -3341,6 +3348,10 @@
3341
3348
  <xsl:variable name="footnote_inline">
3342
3349
  <fo:inline xsl:use-attribute-sets="fn-num-style">
3343
3350
 
3351
+ <xsl:if test="following-sibling::*[1][local-name() = 'fn']">
3352
+ <xsl:attribute name="padding-right">0.5mm</xsl:attribute>
3353
+ </xsl:if>
3354
+
3344
3355
  <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
3345
3356
  <xsl:value-of select="$current_fn_number_text"/>
3346
3357
  </fo:basic-link>
@@ -4149,7 +4160,8 @@
4149
4160
  <xsl:copy-of select="node()"/>
4150
4161
  </td>
4151
4162
  <td>
4152
- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
4163
+ <!-- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> -->
4164
+ <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]" mode="dl_if"/>
4153
4165
  <!-- get paragraphs from nested 'dl' -->
4154
4166
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
4155
4167
  </td>
@@ -4157,6 +4169,53 @@
4157
4169
  </xsl:template>
4158
4170
  <xsl:template match="*[local-name()='dd']" mode="dl_if"/>
4159
4171
 
4172
+ <xsl:template match="*" mode="dl_if">
4173
+ <xsl:copy-of select="."/>
4174
+ </xsl:template>
4175
+
4176
+ <xsl:template match="*[local-name() = 'p']" mode="dl_if">
4177
+ <xsl:param name="indent"/>
4178
+ <p>
4179
+ <xsl:copy-of select="@*"/>
4180
+ <xsl:value-of select="$indent"/>
4181
+ <xsl:copy-of select="node()"/>
4182
+ </p>
4183
+
4184
+ </xsl:template>
4185
+
4186
+ <xsl:template match="*[local-name() = 'ul' or local-name() = 'ol']" mode="dl_if">
4187
+ <xsl:variable name="list_rendered_">
4188
+ <xsl:apply-templates select="."/>
4189
+ </xsl:variable>
4190
+ <xsl:variable name="list_rendered" select="xalan:nodeset($list_rendered_)"/>
4191
+
4192
+ <xsl:variable name="indent">
4193
+ <xsl:for-each select="($list_rendered//fo:block[not(.//fo:block)])[1]">
4194
+ <xsl:apply-templates select="ancestor::*[@provisional-distance-between-starts]/@provisional-distance-between-starts" mode="dl_if"/>
4195
+ </xsl:for-each>
4196
+ </xsl:variable>
4197
+
4198
+ <xsl:apply-templates mode="dl_if">
4199
+ <xsl:with-param name="indent" select="$indent"/>
4200
+ </xsl:apply-templates>
4201
+ </xsl:template>
4202
+
4203
+ <xsl:template match="*[local-name() = 'li']" mode="dl_if">
4204
+ <xsl:param name="indent"/>
4205
+ <xsl:apply-templates mode="dl_if">
4206
+ <xsl:with-param name="indent" select="$indent"/>
4207
+ </xsl:apply-templates>
4208
+ </xsl:template>
4209
+
4210
+ <xsl:template match="@provisional-distance-between-starts" mode="dl_if">
4211
+ <xsl:variable name="value" select="round(substring-before(.,'mm'))"/>
4212
+ <!-- emulate left indent for list item -->
4213
+ <xsl:call-template name="repeat">
4214
+ <xsl:with-param name="char" select="'x'"/>
4215
+ <xsl:with-param name="count" select="$value"/>
4216
+ </xsl:call-template>
4217
+ </xsl:template>
4218
+
4160
4219
  <xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
4161
4220
  <xsl:for-each select="*[local-name() = 'dt']">
4162
4221
  <p>
@@ -4457,6 +4516,23 @@
4457
4516
  <xsl:apply-templates/>
4458
4517
  </xsl:template>
4459
4518
 
4519
+ <!-- Don't break standard's numbers -->
4520
+ <!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
4521
+ <xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
4522
+ <xsl:choose>
4523
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
4524
+ <xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
4525
+ <fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
4526
+ </xsl:when>
4527
+ <xsl:otherwise>
4528
+ <xsl:apply-templates/>
4529
+ </xsl:otherwise>
4530
+ </xsl:choose>
4531
+ </xsl:template>
4532
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
4533
+ <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
4534
+ </xsl:template>
4535
+
4460
4536
  <!-- ========================= -->
4461
4537
  <!-- END Rich text formatting -->
4462
4538
  <!-- ========================= -->
@@ -4555,6 +4631,7 @@
4555
4631
  </word>
4556
4632
  <xsl:call-template name="tokenize_with_tags">
4557
4633
  <xsl:with-param name="text" select="substring-after($text, $separator)"/>
4634
+ <xsl:with-param name="tags" select="$tags"/>
4558
4635
  </xsl:call-template>
4559
4636
  </xsl:otherwise>
4560
4637
  </xsl:choose>
@@ -4594,8 +4671,18 @@
4594
4671
 
4595
4672
  <xsl:template name="add-zero-spaces-java">
4596
4673
  <xsl:param name="text" select="."/>
4597
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4598
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| )','$1​')"/>
4674
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
4675
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
4676
+ <!-- add zero-width space (#x200B) after characters: 'great than' -->
4677
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
4678
+ <!-- add zero-width space (#x200B) before characters: 'less than' -->
4679
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
4680
+ <!-- add zero-width space (#x200B) before character: { -->
4681
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
4682
+ <!-- add zero-width space (#x200B) after character: , -->
4683
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
4684
+
4685
+ <xsl:value-of select="$text5"/>
4599
4686
  </xsl:template>
4600
4687
 
4601
4688
  <xsl:template name="add-zero-spaces-link-java">
@@ -4741,7 +4828,7 @@
4741
4828
  </xsl:copy>
4742
4829
  </xsl:template>
4743
4830
 
4744
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
4831
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br">
4745
4832
  <xsl:copy>
4746
4833
  <xsl:copy-of select="@*"/>
4747
4834
  <p>
@@ -4789,6 +4876,28 @@
4789
4876
  </xsl:for-each>
4790
4877
  </xsl:template>
4791
4878
 
4879
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']" mode="table-without-br">
4880
+ <xsl:apply-templates mode="table-without-br"/>
4881
+ </xsl:template>
4882
+
4883
+ <xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']/text()[contains(., '&#13;') or contains(., '&#10;')]" mode="table-without-br">
4884
+
4885
+ <xsl:variable name="sep">###SOURCECODE_NEWLINE###</xsl:variable>
4886
+ <xsl:variable name="sourcecode_text" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', $sep)"/>
4887
+ <xsl:variable name="items">
4888
+ <xsl:call-template name="split">
4889
+ <xsl:with-param name="pText" select="$sourcecode_text"/>
4890
+ <xsl:with-param name="sep" select="$sep"/>
4891
+ <xsl:with-param name="normalize-space">false</xsl:with-param>
4892
+ </xsl:call-template>
4893
+ </xsl:variable>
4894
+ <xsl:for-each select="xalan:nodeset($items)/*">
4895
+ <p>
4896
+ <sourcecode><xsl:copy-of select="node()"/></sourcecode>
4897
+ </p>
4898
+ </xsl:for-each>
4899
+ </xsl:template>
4900
+
4792
4901
  <!-- remove redundant white spaces -->
4793
4902
  <xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
4794
4903
  <xsl:variable name="text" select="translate(.,'&#9;&#10;&#13;','')"/>
@@ -4819,7 +4928,7 @@
4819
4928
  <xsl:choose>
4820
4929
  <xsl:when test="@colspan">
4821
4930
  <xsl:variable name="td">
4822
- <xsl:element name="td">
4931
+ <xsl:element name="{local-name()}">
4823
4932
  <xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
4824
4933
  <xsl:if test="local-name()='th'">
4825
4934
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4834,7 +4943,7 @@
4834
4943
  </xsl:call-template>
4835
4944
  </xsl:when>
4836
4945
  <xsl:otherwise>
4837
- <xsl:element name="td">
4946
+ <xsl:element name="{local-name()}">
4838
4947
  <xsl:apply-templates select="@*" mode="simple-table-colspan"/>
4839
4948
  <xsl:if test="local-name()='th'">
4840
4949
  <xsl:attribute name="font-weight">bold</xsl:attribute>
@@ -4901,7 +5010,7 @@
4901
5010
  <xsl:variable name="currentRow" select="."/>
4902
5011
 
4903
5012
  <xsl:variable name="normalizedTDs">
4904
- <xsl:for-each select="xalan:nodeset($previousRow)//td">
5013
+ <xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
4905
5014
  <xsl:choose>
4906
5015
  <xsl:when test="@rowspan &gt; 1">
4907
5016
  <xsl:copy>
@@ -4913,7 +5022,7 @@
4913
5022
  </xsl:copy>
4914
5023
  </xsl:when>
4915
5024
  <xsl:otherwise>
4916
- <xsl:copy-of select="$currentRow/td[1 + count(current()/preceding-sibling::td[not(@rowspan) or (@rowspan = 1)])]"/>
5025
+ <xsl:copy-of select="$currentRow/*[self::td or self::th][1 + count(current()/preceding-sibling::*[self::td or self::th][not(@rowspan) or (@rowspan = 1)])]"/>
4917
5026
  </xsl:otherwise>
4918
5027
  </xsl:choose>
4919
5028
  </xsl:for-each>
@@ -5099,6 +5208,7 @@
5099
5208
  <xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
5100
5209
  <xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
5101
5210
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
5211
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
5102
5212
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
5103
5213
  </tags>
5104
5214
  </xsl:template>
@@ -6089,6 +6199,31 @@
6089
6199
  <xsl:apply-templates mode="svg_update"/>
6090
6200
  </xsl:copy>
6091
6201
  </xsl:template>
6202
+
6203
+ <!-- regex for 'display: inline-block;' -->
6204
+ <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
6205
+ <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
6206
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
6207
+ </xsl:template>
6208
+
6209
+ <!-- replace
6210
+ stroke="rgba(r, g, b, alpha)" to
6211
+ stroke="rgb(r,g,b)" stroke-opacity="alpha", and
6212
+ fill="rgba(r, g, b, alpha)" to
6213
+ fill="rgb(r,g,b)" fill-opacity="alpha" -->
6214
+ <xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
6215
+ <xsl:variable name="components_">
6216
+ <xsl:call-template name="split">
6217
+ <xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
6218
+ <xsl:with-param name="sep" select="','"/>
6219
+ </xsl:call-template>
6220
+ </xsl:variable>
6221
+ <xsl:variable name="components" select="xalan:nodeset($components_)"/>
6222
+ <xsl:variable name="att_name" select="local-name()"/>
6223
+ <xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
6224
+ <xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
6225
+ </xsl:template>
6226
+
6092
6227
  <!-- ============== -->
6093
6228
  <!-- END: svg_update -->
6094
6229
  <!-- ============== -->
@@ -6722,42 +6857,20 @@
6722
6857
  <!-- =============== -->
6723
6858
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
6724
6859
 
6725
- <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
6860
+ <xsl:variable name="sourcecode_attributes">
6861
+ <xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
6862
+ <xsl:variable name="_font-size">
6726
6863
 
6727
- <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
6728
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
6729
- </xsl:if>
6864
+ <!-- 9 -->
6730
6865
 
6731
- <xsl:if test="ancestor::*[local-name() = 'example']">
6732
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
6733
- </xsl:if>
6734
-
6735
- <xsl:copy-of select="@id"/>
6736
-
6737
- <xsl:if test="parent::*[local-name() = 'note']">
6738
- <xsl:attribute name="margin-left">
6739
- <xsl:choose>
6740
- <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
6741
- <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
6742
- </xsl:choose>
6743
- </xsl:attribute>
6744
-
6745
- </xsl:if>
6746
- <fo:block-container margin-left="0mm">
6747
-
6748
- <fo:block xsl:use-attribute-sets="sourcecode-style">
6749
- <xsl:variable name="_font-size">
6750
-
6751
- <!-- 9 -->
6752
-
6753
- <!-- <xsl:if test="$namespace = 'ieee'">
6754
- <xsl:if test="$current_template = 'standard'">8</xsl:if>
6755
- </xsl:if> -->
6866
+ <!-- <xsl:if test="$namespace = 'ieee'">
6867
+ <xsl:if test="$current_template = 'standard'">8</xsl:if>
6868
+ </xsl:if> -->
6756
6869
 
6757
- <xsl:choose>
6758
- <xsl:when test="ancestor::*[local-name() = 'table']">8.5</xsl:when>
6759
- <xsl:otherwise>9.5</xsl:otherwise>
6760
- </xsl:choose>
6870
+ <xsl:choose>
6871
+ <xsl:when test="ancestor::*[local-name() = 'table']">8.5</xsl:when>
6872
+ <xsl:otherwise>9.5</xsl:otherwise>
6873
+ </xsl:choose>
6761
6874
 
6762
6875
  </xsl:variable>
6763
6876
 
@@ -6772,14 +6885,60 @@
6772
6885
  </xsl:choose>
6773
6886
  </xsl:attribute>
6774
6887
  </xsl:if>
6888
+ </xsl:element>
6889
+ </xsl:variable>
6775
6890
 
6891
+ <xsl:choose>
6892
+ <xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
6893
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
6894
+ <xsl:attribute name="{local-name()}">
6895
+ <xsl:value-of select="."/>
6896
+ </xsl:attribute>
6897
+ </xsl:for-each>
6776
6898
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6777
- </fo:block>
6899
+ </xsl:when>
6900
+
6901
+ <xsl:otherwise>
6902
+ <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
6778
6903
 
6779
- <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
6904
+ <xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
6905
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
6906
+ </xsl:if>
6780
6907
 
6781
- </fo:block-container>
6782
- </fo:block-container>
6908
+ <xsl:if test="ancestor::*[local-name() = 'example']">
6909
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
6910
+ </xsl:if>
6911
+
6912
+ <xsl:copy-of select="@id"/>
6913
+
6914
+ <xsl:if test="parent::*[local-name() = 'note']">
6915
+ <xsl:attribute name="margin-left">
6916
+ <xsl:choose>
6917
+ <xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
6918
+ <xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
6919
+ </xsl:choose>
6920
+ </xsl:attribute>
6921
+
6922
+ </xsl:if>
6923
+ <fo:block-container margin-left="0mm">
6924
+
6925
+ <fo:block xsl:use-attribute-sets="sourcecode-style">
6926
+
6927
+ <xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
6928
+ <xsl:attribute name="{local-name()}">
6929
+ <xsl:value-of select="."/>
6930
+ </xsl:attribute>
6931
+ </xsl:for-each>
6932
+
6933
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
6934
+ </fo:block>
6935
+
6936
+ <xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
6937
+
6938
+ </fo:block-container>
6939
+ </fo:block-container>
6940
+ </xsl:otherwise>
6941
+ </xsl:choose>
6783
6942
  </xsl:template>
6784
6943
 
6785
6944
  <xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
@@ -9016,7 +9175,11 @@
9016
9175
  <!-- ===================================== -->
9017
9176
  <!-- Update xml -->
9018
9177
  <!-- ===================================== -->
9019
- <!-- STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9178
+ <!-- =========================================================================== -->
9179
+ <!-- STEP1: -->
9180
+ <!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
9181
+ <!-- - Ignore 'span' without style -->
9182
+ <!-- =========================================================================== -->
9020
9183
  <xsl:template match="@*|node()" mode="update_xml_step1">
9021
9184
  <xsl:copy>
9022
9185
  <xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
@@ -9098,7 +9261,8 @@
9098
9261
  </xsl:copy>
9099
9262
  </xsl:template>
9100
9263
 
9101
- <xsl:template match="*[local-name() = 'span'][@style]" mode="update_xml_step1" priority="2">
9264
+ <!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
9265
+ <xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" mode="update_xml_step1" priority="2">
9102
9266
  <xsl:copy>
9103
9267
  <xsl:copy-of select="@*"/>
9104
9268
  <xsl:apply-templates mode="update_xml_step1"/>
@@ -9108,10 +9272,15 @@
9108
9272
  <xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
9109
9273
  <xsl:apply-templates mode="update_xml_step1"/>
9110
9274
  </xsl:template>
9111
-
9275
+ <!-- =========================================================================== -->
9112
9276
  <!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
9277
+ <!-- =========================================================================== -->
9113
9278
 
9279
+ <!-- =========================================================================== -->
9114
9280
  <!-- XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9281
+ <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
9282
+ <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
9283
+ <!-- =========================================================================== -->
9115
9284
  <!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> -->
9116
9285
  <xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
9117
9286
  <xsl:copy>
@@ -9127,10 +9296,15 @@
9127
9296
  <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9128
9297
 
9129
9298
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
9130
- <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
9131
9299
  <xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
9132
9300
  <xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
9133
- <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
9301
+ <xsl:variable name="text__" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
9302
+ <xsl:variable name="text_">
9303
+ <xsl:choose>
9304
+ <xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
9305
+ <xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
9306
+ </xsl:choose>
9307
+ </xsl:variable>
9134
9308
  <xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
9135
9309
  <xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
9136
9310
  <xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
@@ -9146,7 +9320,11 @@
9146
9320
  </xsl:variable>
9147
9321
 
9148
9322
  <!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
9149
- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable>
9323
+ <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
9324
+ <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
9325
+ <!-- add &lt; and &gt; to \S -->
9326
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
9327
+ <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
9150
9328
  <xsl:variable name="text3">
9151
9329
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
9152
9330
  <xsl:choose>
@@ -9210,9 +9388,8 @@
9210
9388
  <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
9211
9389
  </xsl:choose>
9212
9390
  </xsl:template>
9213
-
9214
9391
  <!-- ===================================== -->
9215
- <!-- End Update xml -->
9392
+ <!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
9216
9393
  <!-- ===================================== -->
9217
9394
 
9218
9395
  <!-- for correct rendering combining chars -->
@@ -103,7 +103,7 @@ module IsoDoc
103
103
  def annex1(elem)
104
104
  lbl = @xrefs.anchor(elem["id"], :label)
105
105
  t = elem.at(ns("./title")) and
106
- t.children = "<strong>#{t.children.to_xml}</strong>"
106
+ t.children = "<strong>#{to_xml(t.children)}</strong>"
107
107
  prefix_name(elem, "<br/>", lbl, "title")
108
108
  end
109
109
 
@@ -168,10 +168,10 @@ module IsoDoc
168
168
 
169
169
  def termsource1(elem)
170
170
  while elem&.next_element&.name == "termsource"
171
- elem << "; #{elem.next_element.remove.children.to_xml}"
171
+ elem << "; #{to_xml(elem.next_element.remove.children)}"
172
172
  end
173
173
  elem.children = l10n("[<strong>#{@i18n.source}:</strong> " \
174
- "#{elem.children.to_xml.strip}]")
174
+ "#{to_xml(elem.children).strip}]")
175
175
  end
176
176
 
177
177
  def bibliography_bibitem_number_skip(bibitem)
@@ -683,6 +683,9 @@
683
683
  </define>
684
684
  <define name="underline">
685
685
  <element name="underline">
686
+ <optional>
687
+ <attribute name="style"/>
688
+ </optional>
686
689
  <zeroOrMore>
687
690
  <ref name="PureTextElement"/>
688
691
  </zeroOrMore>
@@ -47,7 +47,7 @@
47
47
  </element>
48
48
  </define>
49
49
  <define name="DocumentType">
50
- <value>document</value>
50
+ <text/>
51
51
  </define>
52
52
  <define name="docsubtype">
53
53
  <element name="subdoctype">
@@ -1152,7 +1152,7 @@
1152
1152
  <data type="boolean"/>
1153
1153
  </attribute>
1154
1154
  </optional>
1155
- <ref name="BibliographicItem"/>
1155
+ <ref name="ReducedBibliographicItem"/>
1156
1156
  </element>
1157
1157
  </define>
1158
1158
  <define name="image" combine="choice">
@@ -2653,6 +2653,7 @@
2653
2653
  <value>full</value>
2654
2654
  <value>short</value>
2655
2655
  <value>id</value>
2656
+ <value>modspec</value>
2656
2657
  </choice>
2657
2658
  </define>
2658
2659
  <define name="erefTypeWithConnective">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.2.6".freeze
3
+ VERSION = "2.3.0".freeze
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
27
27
 
28
28
  spec.add_dependency "iso-639"
29
- spec.add_dependency "metanorma-standoc", "~> 2.2.4"
29
+ spec.add_dependency "metanorma-standoc", "~> 2.3.0"
30
30
 
31
31
  spec.add_development_dependency "debug"
32
32
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ogc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.6
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-07 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.4
33
+ version: 2.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.2.4
40
+ version: 2.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -315,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  - !ruby/object:Gem::Version
316
316
  version: '0'
317
317
  requirements: []
318
- rubygems_version: 3.3.7
318
+ rubygems_version: 3.3.26
319
319
  signing_key:
320
320
  specification_version: 4
321
321
  summary: Metanorma for the Open Geospatial Consortium.