metanorma-ogc 2.0.6 → 2.0.8.1

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.
@@ -87,7 +87,13 @@
87
87
 
88
88
  <xsl:template match="/">
89
89
  <xsl:call-template name="namespaceCheck"/>
90
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
90
+ <fo:root xml:lang="{$lang}">
91
+ <xsl:variable name="root-style">
92
+ <root-style xsl:use-attribute-sets="root-style"/>
93
+ </xsl:variable>
94
+ <xsl:call-template name="insertRootStyle">
95
+ <xsl:with-param name="root-style" select="$root-style"/>
96
+ </xsl:call-template>
91
97
  <fo:layout-master-set>
92
98
 
93
99
  <!-- Document pages -->
@@ -632,7 +638,7 @@
632
638
  </xsl:choose>
633
639
  </xsl:template>
634
640
 
635
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
641
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:variable name="lang">
636
642
  <xsl:call-template name="getLang"/>
637
643
  </xsl:variable><xsl:variable name="pageWidth_">
638
644
  215.9
@@ -784,7 +790,30 @@
784
790
 
785
791
 
786
792
 
787
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
793
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
794
+ <xsl:param name="root-style"/>
795
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
796
+
797
+ <xsl:variable name="additional_fonts_">
798
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
799
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
800
+ </xsl:for-each>
801
+ </xsl:variable>
802
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
803
+
804
+ <xsl:for-each select="$root-style_/root-style/@*">
805
+ <xsl:choose>
806
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
807
+ <xsl:attribute name="{local-name()}">
808
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
809
+ </xsl:attribute>
810
+ </xsl:when>
811
+ <xsl:otherwise>
812
+ <xsl:copy-of select="."/>
813
+ </xsl:otherwise>
814
+ </xsl:choose>
815
+ </xsl:for-each>
816
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
788
817
 
789
818
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
790
819
 
@@ -1384,7 +1413,7 @@
1384
1413
 
1385
1414
 
1386
1415
 
1387
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1416
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1388
1417
 
1389
1418
 
1390
1419
 
@@ -2119,8 +2148,27 @@
2119
2148
  <xsl:sort select="@displayorder" data-type="number"/>
2120
2149
  <xsl:apply-templates select="."/>
2121
2150
  </xsl:for-each>
2122
- </xsl:template><xsl:template match="text()">
2123
- <xsl:value-of select="."/>
2151
+ </xsl:template><xsl:variable name="tag_open">###fo:inline###</xsl:variable><xsl:variable name="tag_close">###/fo:inline###</xsl:variable><xsl:template match="text()" name="text">
2152
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2153
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
2154
+ <xsl:call-template name="replace_fo_inline">
2155
+ <xsl:with-param name="text" select="$text"/>
2156
+ </xsl:call-template>
2157
+ </xsl:template><xsl:template name="replace_fo_inline">
2158
+ <xsl:param name="text"/>
2159
+ <xsl:choose>
2160
+ <xsl:when test="contains($text, $tag_open)">
2161
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
2162
+ <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
2163
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
2164
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
2165
+ <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
2166
+ <xsl:call-template name="replace_fo_inline">
2167
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
2168
+ </xsl:call-template>
2169
+ </xsl:when>
2170
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
2171
+ </xsl:choose>
2124
2172
  </xsl:template><xsl:template match="*[local-name()='br']">
2125
2173
  <xsl:value-of select="$linebreak"/>
2126
2174
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
@@ -2230,9 +2278,11 @@
2230
2278
  <xsl:with-param name="margin" select="$margin"/>
2231
2279
  </xsl:call-template>
2232
2280
 
2233
- </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2234
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
2235
- <xsl:call-template name="add-zero-spaces-java"/>
2281
+ </xsl:template><xsl:variable name="express_reference_separators">_.\</xsl:variable><xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
2282
+
2283
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
2284
+ <xsl:call-template name="add-zero-spaces-java"/>
2285
+
2236
2286
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
2237
2287
 
2238
2288
  <xsl:variable name="table-preamble">
@@ -2353,16 +2403,9 @@
2353
2403
  </xsl:for-each>
2354
2404
  </xsl:when>
2355
2405
  <xsl:otherwise>
2356
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2357
- <xsl:choose>
2358
- <xsl:when test=". = 1 or . = 0">
2359
- <fo:table-column column-width="proportional-column-width(2)"/>
2360
- </xsl:when>
2361
- <xsl:otherwise>
2362
- <fo:table-column column-width="proportional-column-width({.})"/>
2363
- </xsl:otherwise>
2364
- </xsl:choose>
2365
- </xsl:for-each>
2406
+ <xsl:call-template name="insertTableColumnWidth">
2407
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2408
+ </xsl:call-template>
2366
2409
  </xsl:otherwise>
2367
2410
  </xsl:choose>
2368
2411
 
@@ -2569,6 +2612,12 @@
2569
2612
  <xsl:with-param name="table" select="$table"/>
2570
2613
  </xsl:call-template>
2571
2614
  </xsl:if>
2615
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
2616
+ <xsl:apply-templates mode="td_text"/>
2617
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
2618
+
2619
+ <xsl:value-of select="."/>
2620
+
2572
2621
  </xsl:template><xsl:template match="text()" mode="td_text">
2573
2622
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
2574
2623
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -2670,16 +2719,9 @@
2670
2719
  </xsl:for-each>
2671
2720
  </xsl:when>
2672
2721
  <xsl:otherwise>
2673
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
2674
- <xsl:choose>
2675
- <xsl:when test=". = 1 or . = 0">
2676
- <fo:table-column column-width="proportional-column-width(2)"/>
2677
- </xsl:when>
2678
- <xsl:otherwise>
2679
- <fo:table-column column-width="proportional-column-width({.})"/>
2680
- </xsl:otherwise>
2681
- </xsl:choose>
2682
- </xsl:for-each>
2722
+ <xsl:call-template name="insertTableColumnWidth">
2723
+ <xsl:with-param name="colwidths" select="$colwidths"/>
2724
+ </xsl:call-template>
2683
2725
  </xsl:otherwise>
2684
2726
  </xsl:choose>
2685
2727
 
@@ -3329,9 +3371,15 @@
3329
3371
  <xsl:variable name="maxlength_dt">
3330
3372
  <xsl:call-template name="getMaxLength_dt"/>
3331
3373
  </xsl:variable>
3374
+ <xsl:variable name="isContainsExpressReference_">
3375
+ false
3376
+ </xsl:variable>
3377
+ <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
3378
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
3332
3379
  <xsl:call-template name="setColumnWidth_dl">
3333
3380
  <xsl:with-param name="colwidths" select="$colwidths"/>
3334
3381
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
3382
+ <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
3335
3383
  </xsl:call-template>
3336
3384
  <fo:table-body>
3337
3385
  <xsl:apply-templates>
@@ -3347,6 +3395,7 @@
3347
3395
  </xsl:template><xsl:template name="setColumnWidth_dl">
3348
3396
  <xsl:param name="colwidths"/>
3349
3397
  <xsl:param name="maxlength_dt"/>
3398
+ <xsl:param name="isContainsExpressReference"/>
3350
3399
  <xsl:choose>
3351
3400
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
3352
3401
  <fo:table-column column-width="50%"/>
@@ -3354,6 +3403,11 @@
3354
3403
  </xsl:when>
3355
3404
  <xsl:otherwise>
3356
3405
  <xsl:choose>
3406
+ <xsl:when test="$isContainsExpressReference">
3407
+ <xsl:call-template name="insertTableColumnWidth">
3408
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3409
+ </xsl:call-template>
3410
+ </xsl:when>
3357
3411
  <!-- to set width check most wide chars like `W` -->
3358
3412
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
3359
3413
  <fo:table-column column-width="7%"/>
@@ -3384,20 +3438,25 @@
3384
3438
  <fo:table-column column-width="60%"/>
3385
3439
  </xsl:when>
3386
3440
  <xsl:otherwise>
3387
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3388
- <xsl:choose>
3389
- <xsl:when test=". = 1 or . = 0">
3390
- <fo:table-column column-width="proportional-column-width(2)"/>
3391
- </xsl:when>
3392
- <xsl:otherwise>
3393
- <fo:table-column column-width="proportional-column-width({.})"/>
3394
- </xsl:otherwise>
3395
- </xsl:choose>
3396
- </xsl:for-each>
3441
+ <xsl:call-template name="insertTableColumnWidth">
3442
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3443
+ </xsl:call-template>
3397
3444
  </xsl:otherwise>
3398
3445
  </xsl:choose>
3399
3446
  </xsl:otherwise>
3400
3447
  </xsl:choose>
3448
+ </xsl:template><xsl:template name="insertTableColumnWidth">
3449
+ <xsl:param name="colwidths"/>
3450
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
3451
+ <xsl:choose>
3452
+ <xsl:when test=". = 1 or . = 0">
3453
+ <fo:table-column column-width="proportional-column-width(2)"/>
3454
+ </xsl:when>
3455
+ <xsl:otherwise>
3456
+ <fo:table-column column-width="proportional-column-width({.})"/>
3457
+ </xsl:otherwise>
3458
+ </xsl:choose>
3459
+ </xsl:for-each>
3401
3460
  </xsl:template><xsl:template name="getMaxLength_dt">
3402
3461
  <xsl:variable name="lengths">
3403
3462
  <xsl:for-each select="*[local-name()='dt']">
@@ -3816,24 +3875,28 @@
3816
3875
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3817
3876
  <xsl:param name="text" select="."/>
3818
3877
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3878
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3819
3879
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3880
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3820
3881
  <xsl:variable name="zero-space">​</xsl:variable>
3821
3882
  <xsl:choose>
3822
3883
  <xsl:when test="contains($text, $zero-space-after-equals)">
3823
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3884
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3824
3885
  <xsl:value-of select="$zero-space-after-equals"/>
3825
3886
  <xsl:value-of select="$zero-space"/>
3826
3887
  <xsl:call-template name="add-zero-spaces-equal">
3827
3888
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3828
- </xsl:call-template>
3889
+ </xsl:call-template> -->
3890
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3829
3891
  </xsl:when>
3830
3892
  <xsl:when test="contains($text, $zero-space-after-equal)">
3831
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3893
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3832
3894
  <xsl:value-of select="$zero-space-after-equal"/>
3833
3895
  <xsl:value-of select="$zero-space"/>
3834
3896
  <xsl:call-template name="add-zero-spaces-equal">
3835
3897
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3836
- </xsl:call-template>
3898
+ </xsl:call-template> -->
3899
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3837
3900
  </xsl:when>
3838
3901
  <xsl:otherwise>
3839
3902
  <xsl:value-of select="$text"/>
@@ -4001,6 +4064,9 @@
4001
4064
  <xsl:variable name="isDeleted" select="@deleted"/>
4002
4065
 
4003
4066
  <fo:inline xsl:use-attribute-sets="mathml-style">
4067
+
4068
+
4069
+
4004
4070
 
4005
4071
 
4006
4072
  <xsl:call-template name="setTrackChangesStyles">
@@ -4008,48 +4074,80 @@
4008
4074
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4009
4075
  </xsl:call-template>
4010
4076
 
4077
+ <xsl:if test="$add_math_as_text = 'true'">
4078
+ <!-- insert helper tag -->
4079
+ <!-- set unique font-size (fiction) -->
4080
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4081
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
4082
+ </xsl:if>
4011
4083
 
4012
-
4013
- <xsl:variable name="mathml">
4014
- <xsl:apply-templates select="." mode="mathml"/>
4084
+ <xsl:variable name="mathml_content">
4085
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4015
4086
  </xsl:variable>
4016
- <fo:instream-foreign-object fox:alt-text="Math">
4017
4087
 
4088
+
4089
+ <xsl:call-template name="mathml_instream_object">
4090
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4091
+ </xsl:call-template>
4018
4092
 
4019
-
4020
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4021
- <xsl:variable name="comment_text_">
4022
- <xsl:choose>
4023
- <xsl:when test="normalize-space($comment_text_following) != ''">
4024
- <xsl:value-of select="$comment_text_following"/>
4025
- </xsl:when>
4026
- <xsl:otherwise>
4027
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4028
- </xsl:otherwise>
4029
- </xsl:choose>
4030
- </xsl:variable>
4031
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4032
-
4033
- <xsl:if test="normalize-space($comment_text) != ''">
4034
- <!-- put Mathin Alternate Text -->
4035
- <xsl:attribute name="fox:alt-text">
4036
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4037
- </xsl:attribute>
4038
- </xsl:if>
4039
-
4040
- <xsl:variable name="mathml_content">
4041
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
4042
- </xsl:variable>
4043
- <!-- put MathML in Actual Text -->
4044
- <xsl:attribute name="fox:actual-text">
4045
- <xsl:value-of select="$mathml_content"/>
4046
- </xsl:attribute>
4047
-
4048
-
4049
-
4050
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
4051
- </fo:instream-foreign-object>
4093
+
4052
4094
  </fo:inline>
4095
+ </xsl:template><xsl:template name="getMathml_comment_text">
4096
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4097
+ <xsl:variable name="comment_text_">
4098
+ <xsl:choose>
4099
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4100
+ <xsl:value-of select="$comment_text_following"/>
4101
+ </xsl:when>
4102
+ <xsl:otherwise>
4103
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4104
+ </xsl:otherwise>
4105
+ </xsl:choose>
4106
+ </xsl:variable>
4107
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4108
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
4109
+ <xsl:value-of select="$comment_text"/>
4110
+ </xsl:template><xsl:template name="mathml_instream_object">
4111
+ <xsl:param name="comment_text"/>
4112
+ <xsl:param name="mathml_content"/>
4113
+
4114
+ <xsl:variable name="comment_text_">
4115
+ <xsl:choose>
4116
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
4117
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
4118
+ </xsl:choose>
4119
+ </xsl:variable>
4120
+
4121
+ <xsl:variable name="mathml">
4122
+ <xsl:apply-templates select="." mode="mathml"/>
4123
+ </xsl:variable>
4124
+
4125
+ <fo:instream-foreign-object fox:alt-text="Math">
4126
+
4127
+
4128
+
4129
+
4130
+
4131
+
4132
+
4133
+ <!-- put MathML in Actual Text -->
4134
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
4135
+ <xsl:attribute name="fox:actual-text">
4136
+ <xsl:value-of select="$mathml_content"/>
4137
+ </xsl:attribute>
4138
+
4139
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
4140
+ <xsl:if test="normalize-space($comment_text_) != ''">
4141
+ <!-- put Mathin Alternate Text -->
4142
+ <xsl:attribute name="fox:alt-text">
4143
+ <xsl:value-of select="$comment_text_"/>
4144
+ </xsl:attribute>
4145
+ </xsl:if>
4146
+ <!-- </xsl:if> -->
4147
+
4148
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
4149
+
4150
+ </fo:instream-foreign-object>
4053
4151
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4054
4152
  <!-- <xsl:text>a+b</xsl:text> -->
4055
4153
  <xsl:text>&lt;</xsl:text>
@@ -4313,7 +4411,12 @@
4313
4411
 
4314
4412
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4315
4413
 
4414
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
4415
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4416
+ </xsl:if>
4417
+
4316
4418
 
4419
+
4317
4420
 
4318
4421
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4319
4422
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -4672,18 +4775,33 @@
4672
4775
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
4673
4776
  <xsl:copy>
4674
4777
  <xsl:apply-templates select="@*" mode="svg_update"/>
4675
- <xsl:variable name="viewbox">
4778
+ <xsl:variable name="viewbox_">
4676
4779
  <xsl:call-template name="split">
4677
4780
  <xsl:with-param name="pText" select="@viewBox"/>
4678
4781
  <xsl:with-param name="sep" select="' '"/>
4679
4782
  </xsl:call-template>
4680
4783
  </xsl:variable>
4784
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
4785
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
4786
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
4787
+
4681
4788
  <xsl:attribute name="width">
4682
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
4789
+ <xsl:choose>
4790
+ <xsl:when test="$width != ''">
4791
+ <xsl:value-of select="round($width)"/>
4792
+ </xsl:when>
4793
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
4794
+ </xsl:choose>
4683
4795
  </xsl:attribute>
4684
4796
  <xsl:attribute name="height">
4685
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
4797
+ <xsl:choose>
4798
+ <xsl:when test="$height != ''">
4799
+ <xsl:value-of select="round($height)"/>
4800
+ </xsl:when>
4801
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
4802
+ </xsl:choose>
4686
4803
  </xsl:attribute>
4804
+
4687
4805
  <xsl:apply-templates mode="svg_update"/>
4688
4806
  </xsl:copy>
4689
4807
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -5282,17 +5400,15 @@
5282
5400
 
5283
5401
  <!-- split text by zero-width space -->
5284
5402
  <xsl:variable name="text_step4">
5285
- <xsl:call-template name="split">
5403
+ <xsl:call-template name="split_for_interspers">
5286
5404
  <xsl:with-param name="pText" select="$text_step3"/>
5287
5405
  <xsl:with-param name="sep" select="$zero_width_space"/>
5288
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5289
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5290
5406
  </xsl:call-template>
5291
5407
  </xsl:variable>
5292
5408
 
5293
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
5409
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5294
5410
  <xsl:choose>
5295
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5411
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5296
5412
  <xsl:call-template name="interspers">
5297
5413
  <xsl:with-param name="str" select="."/>
5298
5414
  </xsl:call-template>
@@ -5303,6 +5419,30 @@
5303
5419
  </xsl:choose>
5304
5420
  </xsl:for-each>
5305
5421
 
5422
+ </xsl:template><xsl:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers">
5423
+ <xsl:param name="pText" select="."/>
5424
+ <xsl:param name="sep" select="','"/>
5425
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
5426
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
5427
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
5428
+ <xsl:call-template name="replace_tag_interspers">
5429
+ <xsl:with-param name="text" select="$text"/>
5430
+ </xsl:call-template>
5431
+ </xsl:template><xsl:template name="replace_tag_interspers">
5432
+ <xsl:param name="text"/>
5433
+ <xsl:choose>
5434
+ <xsl:when test="contains($text, $interspers_tag_open)">
5435
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
5436
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
5437
+ <interspers>
5438
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
5439
+ </interspers>
5440
+ <xsl:call-template name="replace_tag_interspers">
5441
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
5442
+ </xsl:call-template>
5443
+ </xsl:when>
5444
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
5445
+ </xsl:choose>
5306
5446
  </xsl:template><xsl:template name="interspers">
5307
5447
  <xsl:param name="str"/>
5308
5448
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5760,7 +5900,7 @@
5760
5900
  </xsl:otherwise>
5761
5901
  </xsl:choose> -->
5762
5902
  </fo:block>
5763
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5903
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2">
5764
5904
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5765
5905
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5766
5906
  <xsl:if test="normalize-space() != ''">
@@ -5796,7 +5936,8 @@
5796
5936
  <fo:inline><xsl:apply-templates/></fo:inline>
5797
5937
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
5798
5938
  <xsl:if test="normalize-space() != ''">
5799
- <xsl:value-of select="."/>
5939
+ <!-- <xsl:value-of select="."/> -->
5940
+ <xsl:call-template name="text"/>
5800
5941
  </xsl:if>
5801
5942
  </xsl:template><xsl:template match="*[local-name() = 'quote']">
5802
5943
  <fo:block-container margin-left="0mm">
@@ -226,7 +226,8 @@ module IsoDoc
226
226
 
227
227
  def bibliography_bibitem_number_skip(bibitem)
228
228
  @xrefs.klass.implicit_reference(bibitem) ||
229
- bibitem.at(ns(".//docidentifier[@type = 'metanorma-ordinal']"))
229
+ bibitem.at(ns(".//docidentifier[@type = 'metanorma-ordinal']")) ||
230
+ bibitem["hidden"] == "true" || bibitem.parent["hidden"] == "true"
230
231
  end
231
232
 
232
233
  include Init
@@ -157,6 +157,7 @@ module IsoDoc
157
157
 
158
158
  def toWord(result, filename, dir, header)
159
159
  result = from_xhtml(word_cleanup(to_xhtml(result)))
160
+ .gsub(/-DOUBLE_HYPHEN_ESCAPE-/, "--")
160
161
  @wordstylesheet = wordstylesheet_update
161
162
  Html2Doc.process(
162
163
  result,
@@ -527,7 +527,7 @@
527
527
  </define>
528
528
  <define name="LocalityType">
529
529
  <data type="string">
530
- <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
530
+ <param name="pattern">section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
531
531
  </data>
532
532
  </define>
533
533
  <define name="referenceFrom">
@@ -677,6 +677,9 @@
677
677
  <zeroOrMore>
678
678
  <ref name="extent"/>
679
679
  </zeroOrMore>
680
+ <optional>
681
+ <ref name="bibliographic_size"/>
682
+ </optional>
680
683
  <zeroOrMore>
681
684
  <ref name="accesslocation"/>
682
685
  </zeroOrMore>
@@ -922,9 +925,29 @@
922
925
  <text/>
923
926
  </element>
924
927
  </define>
928
+ <define name="sizevalue">
929
+ <element name="value">
930
+ <attribute name="type"/>
931
+ <text/>
932
+ </element>
933
+ </define>
934
+ <define name="bibliographic_size">
935
+ <element name="size">
936
+ <oneOrMore>
937
+ <ref name="sizevalue"/>
938
+ </oneOrMore>
939
+ </element>
940
+ </define>
925
941
  <define name="extent">
926
942
  <element name="extent">
927
- <ref name="BibItemLocality"/>
943
+ <choice>
944
+ <zeroOrMore>
945
+ <ref name="locality"/>
946
+ </zeroOrMore>
947
+ <zeroOrMore>
948
+ <ref name="localityStack"/>
949
+ </zeroOrMore>
950
+ </choice>
928
951
  </element>
929
952
  </define>
930
953
  <define name="series">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.0.6".freeze
3
+ VERSION = "2.0.8.1".freeze
4
4
  end
5
5
  end
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.0.6
4
+ version: 2.0.8.1
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-03-21 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639