metanorma-ogc 2.0.8 → 2.0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef612784fe89a2f1a4a71dd5b4a21d76a867d91c04cb41c47d2c01f3ea42ebd2
4
- data.tar.gz: 724d7fa5be3843a86130b27a59f46221bd2d1abd0f8308132c2df4de67d7621b
3
+ metadata.gz: 4976045f5f9e91f8e3063916d3c83b19eeddce73f7e599a00b7f0117a172a329
4
+ data.tar.gz: 431db0941bdfeef065773432b51817e74f32fbdc179ab1315f994106445db6fe
5
5
  SHA512:
6
- metadata.gz: 55ee40296e95badf067ee1ff19add5204e3cd5ac1cc0c024f3932a40b37113630baedb1edd7469cb070f2bd30aa2d49b16d627aae3a5c5adf00864b1750e87ce
7
- data.tar.gz: 8578f3bd16e028683cd5769f9bdfeea9f581650bc3ddd56c895d0a621ca2409ed5e675291600ca5536e6cbdac8836021dcd8e859531c74bb65d3b5fe67e7748d
6
+ metadata.gz: 3ce12d5dcb3f4c4020a22e8210a31c39d43d02af6b76099588456b50ac46fbe93cfad0dbe714cdef49295e87b94848899086b21a3c8e82144e2275252ff3bb3f
7
+ data.tar.gz: 055d3c4851ea3d1745a7742e07922ad961e91ecd3067178b7778ac1b15434cf781f9b2f319dca6309cf5845fd720e7774ede7326c421f48846b9eb62e0a51f7b
@@ -1457,7 +1457,7 @@
1457
1457
  </fo:static-content>
1458
1458
  </xsl:template>
1459
1459
 
1460
- <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">
1460
+ <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">
1461
1461
  <xsl:call-template name="getLang"/>
1462
1462
  </xsl:variable><xsl:variable name="pageWidth_">
1463
1463
  215.9
@@ -3066,9 +3066,11 @@
3066
3066
  <xsl:apply-templates/>
3067
3067
  </fo:block>
3068
3068
 
3069
- </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3070
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3071
- <xsl:call-template name="add-zero-spaces-java"/>
3069
+ </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">
3070
+
3071
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3072
+ <xsl:call-template name="add-zero-spaces-java"/>
3073
+
3072
3074
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3073
3075
 
3074
3076
  <xsl:variable name="table-preamble">
@@ -3197,16 +3199,9 @@
3197
3199
  </xsl:for-each>
3198
3200
  </xsl:when>
3199
3201
  <xsl:otherwise>
3200
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3201
- <xsl:choose>
3202
- <xsl:when test=". = 1 or . = 0">
3203
- <fo:table-column column-width="proportional-column-width(2)"/>
3204
- </xsl:when>
3205
- <xsl:otherwise>
3206
- <fo:table-column column-width="proportional-column-width({.})"/>
3207
- </xsl:otherwise>
3208
- </xsl:choose>
3209
- </xsl:for-each>
3202
+ <xsl:call-template name="insertTableColumnWidth">
3203
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3204
+ </xsl:call-template>
3210
3205
  </xsl:otherwise>
3211
3206
  </xsl:choose>
3212
3207
 
@@ -3411,6 +3406,12 @@
3411
3406
  <xsl:with-param name="table" select="$table"/>
3412
3407
  </xsl:call-template>
3413
3408
  </xsl:if>
3409
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
3410
+ <xsl:apply-templates mode="td_text"/>
3411
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
3412
+
3413
+ <xsl:value-of select="."/>
3414
+
3414
3415
  </xsl:template><xsl:template match="text()" mode="td_text">
3415
3416
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3416
3417
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -3512,16 +3513,9 @@
3512
3513
  </xsl:for-each>
3513
3514
  </xsl:when>
3514
3515
  <xsl:otherwise>
3515
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3516
- <xsl:choose>
3517
- <xsl:when test=". = 1 or . = 0">
3518
- <fo:table-column column-width="proportional-column-width(2)"/>
3519
- </xsl:when>
3520
- <xsl:otherwise>
3521
- <fo:table-column column-width="proportional-column-width({.})"/>
3522
- </xsl:otherwise>
3523
- </xsl:choose>
3524
- </xsl:for-each>
3516
+ <xsl:call-template name="insertTableColumnWidth">
3517
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3518
+ </xsl:call-template>
3525
3519
  </xsl:otherwise>
3526
3520
  </xsl:choose>
3527
3521
 
@@ -4176,9 +4170,15 @@
4176
4170
  <xsl:variable name="maxlength_dt">
4177
4171
  <xsl:call-template name="getMaxLength_dt"/>
4178
4172
  </xsl:variable>
4173
+ <xsl:variable name="isContainsExpressReference_">
4174
+ false
4175
+ </xsl:variable>
4176
+ <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
4177
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4179
4178
  <xsl:call-template name="setColumnWidth_dl">
4180
4179
  <xsl:with-param name="colwidths" select="$colwidths"/>
4181
4180
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4181
+ <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
4182
4182
  </xsl:call-template>
4183
4183
  <fo:table-body>
4184
4184
  <xsl:apply-templates>
@@ -4194,6 +4194,7 @@
4194
4194
  </xsl:template><xsl:template name="setColumnWidth_dl">
4195
4195
  <xsl:param name="colwidths"/>
4196
4196
  <xsl:param name="maxlength_dt"/>
4197
+ <xsl:param name="isContainsExpressReference"/>
4197
4198
  <xsl:choose>
4198
4199
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4199
4200
  <fo:table-column column-width="50%"/>
@@ -4201,6 +4202,11 @@
4201
4202
  </xsl:when>
4202
4203
  <xsl:otherwise>
4203
4204
  <xsl:choose>
4205
+ <xsl:when test="$isContainsExpressReference">
4206
+ <xsl:call-template name="insertTableColumnWidth">
4207
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4208
+ </xsl:call-template>
4209
+ </xsl:when>
4204
4210
  <!-- to set width check most wide chars like `W` -->
4205
4211
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4206
4212
  <fo:table-column column-width="7%"/>
@@ -4231,20 +4237,25 @@
4231
4237
  <fo:table-column column-width="60%"/>
4232
4238
  </xsl:when>
4233
4239
  <xsl:otherwise>
4234
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4235
- <xsl:choose>
4236
- <xsl:when test=". = 1 or . = 0">
4237
- <fo:table-column column-width="proportional-column-width(2)"/>
4238
- </xsl:when>
4239
- <xsl:otherwise>
4240
- <fo:table-column column-width="proportional-column-width({.})"/>
4241
- </xsl:otherwise>
4242
- </xsl:choose>
4243
- </xsl:for-each>
4240
+ <xsl:call-template name="insertTableColumnWidth">
4241
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4242
+ </xsl:call-template>
4244
4243
  </xsl:otherwise>
4245
4244
  </xsl:choose>
4246
4245
  </xsl:otherwise>
4247
4246
  </xsl:choose>
4247
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4248
+ <xsl:param name="colwidths"/>
4249
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4250
+ <xsl:choose>
4251
+ <xsl:when test=". = 1 or . = 0">
4252
+ <fo:table-column column-width="proportional-column-width(2)"/>
4253
+ </xsl:when>
4254
+ <xsl:otherwise>
4255
+ <fo:table-column column-width="proportional-column-width({.})"/>
4256
+ </xsl:otherwise>
4257
+ </xsl:choose>
4258
+ </xsl:for-each>
4248
4259
  </xsl:template><xsl:template name="getMaxLength_dt">
4249
4260
  <xsl:variable name="lengths">
4250
4261
  <xsl:for-each select="*[local-name()='dt']">
@@ -4852,6 +4863,9 @@
4852
4863
  <xsl:variable name="isDeleted" select="@deleted"/>
4853
4864
 
4854
4865
  <fo:inline xsl:use-attribute-sets="mathml-style">
4866
+
4867
+
4868
+
4855
4869
 
4856
4870
 
4857
4871
  <xsl:call-template name="setTrackChangesStyles">
@@ -4859,48 +4873,80 @@
4859
4873
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4860
4874
  </xsl:call-template>
4861
4875
 
4876
+ <xsl:if test="$add_math_as_text = 'true'">
4877
+ <!-- insert helper tag -->
4878
+ <!-- set unique font-size (fiction) -->
4879
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4880
+ <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 -->
4881
+ </xsl:if>
4862
4882
 
4863
-
4864
- <xsl:variable name="mathml">
4865
- <xsl:apply-templates select="." mode="mathml"/>
4883
+ <xsl:variable name="mathml_content">
4884
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4866
4885
  </xsl:variable>
4867
- <fo:instream-foreign-object fox:alt-text="Math">
4868
4886
 
4887
+
4888
+ <xsl:call-template name="mathml_instream_object">
4889
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4890
+ </xsl:call-template>
4869
4891
 
4870
-
4871
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4872
- <xsl:variable name="comment_text_">
4873
- <xsl:choose>
4874
- <xsl:when test="normalize-space($comment_text_following) != ''">
4875
- <xsl:value-of select="$comment_text_following"/>
4876
- </xsl:when>
4877
- <xsl:otherwise>
4878
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4879
- </xsl:otherwise>
4880
- </xsl:choose>
4881
- </xsl:variable>
4882
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4883
-
4884
- <xsl:if test="normalize-space($comment_text) != ''">
4885
- <!-- put Mathin Alternate Text -->
4886
- <xsl:attribute name="fox:alt-text">
4887
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4888
- </xsl:attribute>
4889
- </xsl:if>
4890
-
4891
- <xsl:variable name="mathml_content">
4892
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
4893
- </xsl:variable>
4894
- <!-- put MathML in Actual Text -->
4895
- <xsl:attribute name="fox:actual-text">
4896
- <xsl:value-of select="$mathml_content"/>
4897
- </xsl:attribute>
4898
-
4899
-
4900
-
4901
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
4902
- </fo:instream-foreign-object>
4892
+
4903
4893
  </fo:inline>
4894
+ </xsl:template><xsl:template name="getMathml_comment_text">
4895
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4896
+ <xsl:variable name="comment_text_">
4897
+ <xsl:choose>
4898
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4899
+ <xsl:value-of select="$comment_text_following"/>
4900
+ </xsl:when>
4901
+ <xsl:otherwise>
4902
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4903
+ </xsl:otherwise>
4904
+ </xsl:choose>
4905
+ </xsl:variable>
4906
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4907
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
4908
+ <xsl:value-of select="$comment_text"/>
4909
+ </xsl:template><xsl:template name="mathml_instream_object">
4910
+ <xsl:param name="comment_text"/>
4911
+ <xsl:param name="mathml_content"/>
4912
+
4913
+ <xsl:variable name="comment_text_">
4914
+ <xsl:choose>
4915
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
4916
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
4917
+ </xsl:choose>
4918
+ </xsl:variable>
4919
+
4920
+ <xsl:variable name="mathml">
4921
+ <xsl:apply-templates select="." mode="mathml"/>
4922
+ </xsl:variable>
4923
+
4924
+ <fo:instream-foreign-object fox:alt-text="Math">
4925
+
4926
+
4927
+
4928
+
4929
+
4930
+
4931
+
4932
+ <!-- put MathML in Actual Text -->
4933
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
4934
+ <xsl:attribute name="fox:actual-text">
4935
+ <xsl:value-of select="$mathml_content"/>
4936
+ </xsl:attribute>
4937
+
4938
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
4939
+ <xsl:if test="normalize-space($comment_text_) != ''">
4940
+ <!-- put Mathin Alternate Text -->
4941
+ <xsl:attribute name="fox:alt-text">
4942
+ <xsl:value-of select="$comment_text_"/>
4943
+ </xsl:attribute>
4944
+ </xsl:if>
4945
+ <!-- </xsl:if> -->
4946
+
4947
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
4948
+
4949
+ </fo:instream-foreign-object>
4904
4950
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4905
4951
  <!-- <xsl:text>a+b</xsl:text> -->
4906
4952
  <xsl:text>&lt;</xsl:text>
@@ -5532,18 +5578,33 @@
5532
5578
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
5533
5579
  <xsl:copy>
5534
5580
  <xsl:apply-templates select="@*" mode="svg_update"/>
5535
- <xsl:variable name="viewbox">
5581
+ <xsl:variable name="viewbox_">
5536
5582
  <xsl:call-template name="split">
5537
5583
  <xsl:with-param name="pText" select="@viewBox"/>
5538
5584
  <xsl:with-param name="sep" select="' '"/>
5539
5585
  </xsl:call-template>
5540
5586
  </xsl:variable>
5587
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
5588
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
5589
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
5590
+
5541
5591
  <xsl:attribute name="width">
5542
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5592
+ <xsl:choose>
5593
+ <xsl:when test="$width != ''">
5594
+ <xsl:value-of select="round($width)"/>
5595
+ </xsl:when>
5596
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
5597
+ </xsl:choose>
5543
5598
  </xsl:attribute>
5544
5599
  <xsl:attribute name="height">
5545
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5600
+ <xsl:choose>
5601
+ <xsl:when test="$height != ''">
5602
+ <xsl:value-of select="round($height)"/>
5603
+ </xsl:when>
5604
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
5605
+ </xsl:choose>
5546
5606
  </xsl:attribute>
5607
+
5547
5608
  <xsl:apply-templates mode="svg_update"/>
5548
5609
  </xsl:copy>
5549
5610
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -1457,7 +1457,7 @@
1457
1457
  </fo:static-content>
1458
1458
  </xsl:template>
1459
1459
 
1460
- <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">
1460
+ <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">
1461
1461
  <xsl:call-template name="getLang"/>
1462
1462
  </xsl:variable><xsl:variable name="pageWidth_">
1463
1463
  215.9
@@ -3066,9 +3066,11 @@
3066
3066
  <xsl:apply-templates/>
3067
3067
  </fo:block>
3068
3068
 
3069
- </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3070
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3071
- <xsl:call-template name="add-zero-spaces-java"/>
3069
+ </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">
3070
+
3071
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3072
+ <xsl:call-template name="add-zero-spaces-java"/>
3073
+
3072
3074
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3073
3075
 
3074
3076
  <xsl:variable name="table-preamble">
@@ -3197,16 +3199,9 @@
3197
3199
  </xsl:for-each>
3198
3200
  </xsl:when>
3199
3201
  <xsl:otherwise>
3200
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3201
- <xsl:choose>
3202
- <xsl:when test=". = 1 or . = 0">
3203
- <fo:table-column column-width="proportional-column-width(2)"/>
3204
- </xsl:when>
3205
- <xsl:otherwise>
3206
- <fo:table-column column-width="proportional-column-width({.})"/>
3207
- </xsl:otherwise>
3208
- </xsl:choose>
3209
- </xsl:for-each>
3202
+ <xsl:call-template name="insertTableColumnWidth">
3203
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3204
+ </xsl:call-template>
3210
3205
  </xsl:otherwise>
3211
3206
  </xsl:choose>
3212
3207
 
@@ -3411,6 +3406,12 @@
3411
3406
  <xsl:with-param name="table" select="$table"/>
3412
3407
  </xsl:call-template>
3413
3408
  </xsl:if>
3409
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
3410
+ <xsl:apply-templates mode="td_text"/>
3411
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
3412
+
3413
+ <xsl:value-of select="."/>
3414
+
3414
3415
  </xsl:template><xsl:template match="text()" mode="td_text">
3415
3416
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3416
3417
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -3512,16 +3513,9 @@
3512
3513
  </xsl:for-each>
3513
3514
  </xsl:when>
3514
3515
  <xsl:otherwise>
3515
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3516
- <xsl:choose>
3517
- <xsl:when test=". = 1 or . = 0">
3518
- <fo:table-column column-width="proportional-column-width(2)"/>
3519
- </xsl:when>
3520
- <xsl:otherwise>
3521
- <fo:table-column column-width="proportional-column-width({.})"/>
3522
- </xsl:otherwise>
3523
- </xsl:choose>
3524
- </xsl:for-each>
3516
+ <xsl:call-template name="insertTableColumnWidth">
3517
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3518
+ </xsl:call-template>
3525
3519
  </xsl:otherwise>
3526
3520
  </xsl:choose>
3527
3521
 
@@ -4176,9 +4170,15 @@
4176
4170
  <xsl:variable name="maxlength_dt">
4177
4171
  <xsl:call-template name="getMaxLength_dt"/>
4178
4172
  </xsl:variable>
4173
+ <xsl:variable name="isContainsExpressReference_">
4174
+ false
4175
+ </xsl:variable>
4176
+ <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
4177
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4179
4178
  <xsl:call-template name="setColumnWidth_dl">
4180
4179
  <xsl:with-param name="colwidths" select="$colwidths"/>
4181
4180
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4181
+ <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
4182
4182
  </xsl:call-template>
4183
4183
  <fo:table-body>
4184
4184
  <xsl:apply-templates>
@@ -4194,6 +4194,7 @@
4194
4194
  </xsl:template><xsl:template name="setColumnWidth_dl">
4195
4195
  <xsl:param name="colwidths"/>
4196
4196
  <xsl:param name="maxlength_dt"/>
4197
+ <xsl:param name="isContainsExpressReference"/>
4197
4198
  <xsl:choose>
4198
4199
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4199
4200
  <fo:table-column column-width="50%"/>
@@ -4201,6 +4202,11 @@
4201
4202
  </xsl:when>
4202
4203
  <xsl:otherwise>
4203
4204
  <xsl:choose>
4205
+ <xsl:when test="$isContainsExpressReference">
4206
+ <xsl:call-template name="insertTableColumnWidth">
4207
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4208
+ </xsl:call-template>
4209
+ </xsl:when>
4204
4210
  <!-- to set width check most wide chars like `W` -->
4205
4211
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4206
4212
  <fo:table-column column-width="7%"/>
@@ -4231,20 +4237,25 @@
4231
4237
  <fo:table-column column-width="60%"/>
4232
4238
  </xsl:when>
4233
4239
  <xsl:otherwise>
4234
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4235
- <xsl:choose>
4236
- <xsl:when test=". = 1 or . = 0">
4237
- <fo:table-column column-width="proportional-column-width(2)"/>
4238
- </xsl:when>
4239
- <xsl:otherwise>
4240
- <fo:table-column column-width="proportional-column-width({.})"/>
4241
- </xsl:otherwise>
4242
- </xsl:choose>
4243
- </xsl:for-each>
4240
+ <xsl:call-template name="insertTableColumnWidth">
4241
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4242
+ </xsl:call-template>
4244
4243
  </xsl:otherwise>
4245
4244
  </xsl:choose>
4246
4245
  </xsl:otherwise>
4247
4246
  </xsl:choose>
4247
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4248
+ <xsl:param name="colwidths"/>
4249
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4250
+ <xsl:choose>
4251
+ <xsl:when test=". = 1 or . = 0">
4252
+ <fo:table-column column-width="proportional-column-width(2)"/>
4253
+ </xsl:when>
4254
+ <xsl:otherwise>
4255
+ <fo:table-column column-width="proportional-column-width({.})"/>
4256
+ </xsl:otherwise>
4257
+ </xsl:choose>
4258
+ </xsl:for-each>
4248
4259
  </xsl:template><xsl:template name="getMaxLength_dt">
4249
4260
  <xsl:variable name="lengths">
4250
4261
  <xsl:for-each select="*[local-name()='dt']">
@@ -4852,6 +4863,9 @@
4852
4863
  <xsl:variable name="isDeleted" select="@deleted"/>
4853
4864
 
4854
4865
  <fo:inline xsl:use-attribute-sets="mathml-style">
4866
+
4867
+
4868
+
4855
4869
 
4856
4870
 
4857
4871
  <xsl:call-template name="setTrackChangesStyles">
@@ -4859,48 +4873,80 @@
4859
4873
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
4860
4874
  </xsl:call-template>
4861
4875
 
4876
+ <xsl:if test="$add_math_as_text = 'true'">
4877
+ <!-- insert helper tag -->
4878
+ <!-- set unique font-size (fiction) -->
4879
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
4880
+ <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 -->
4881
+ </xsl:if>
4862
4882
 
4863
-
4864
- <xsl:variable name="mathml">
4865
- <xsl:apply-templates select="." mode="mathml"/>
4883
+ <xsl:variable name="mathml_content">
4884
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
4866
4885
  </xsl:variable>
4867
- <fo:instream-foreign-object fox:alt-text="Math">
4868
4886
 
4887
+
4888
+ <xsl:call-template name="mathml_instream_object">
4889
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
4890
+ </xsl:call-template>
4869
4891
 
4870
-
4871
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4872
- <xsl:variable name="comment_text_">
4873
- <xsl:choose>
4874
- <xsl:when test="normalize-space($comment_text_following) != ''">
4875
- <xsl:value-of select="$comment_text_following"/>
4876
- </xsl:when>
4877
- <xsl:otherwise>
4878
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4879
- </xsl:otherwise>
4880
- </xsl:choose>
4881
- </xsl:variable>
4882
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4883
-
4884
- <xsl:if test="normalize-space($comment_text) != ''">
4885
- <!-- put Mathin Alternate Text -->
4886
- <xsl:attribute name="fox:alt-text">
4887
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
4888
- </xsl:attribute>
4889
- </xsl:if>
4890
-
4891
- <xsl:variable name="mathml_content">
4892
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
4893
- </xsl:variable>
4894
- <!-- put MathML in Actual Text -->
4895
- <xsl:attribute name="fox:actual-text">
4896
- <xsl:value-of select="$mathml_content"/>
4897
- </xsl:attribute>
4898
-
4899
-
4900
-
4901
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
4902
- </fo:instream-foreign-object>
4892
+
4903
4893
  </fo:inline>
4894
+ </xsl:template><xsl:template name="getMathml_comment_text">
4895
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
4896
+ <xsl:variable name="comment_text_">
4897
+ <xsl:choose>
4898
+ <xsl:when test="normalize-space($comment_text_following) != ''">
4899
+ <xsl:value-of select="$comment_text_following"/>
4900
+ </xsl:when>
4901
+ <xsl:otherwise>
4902
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
4903
+ </xsl:otherwise>
4904
+ </xsl:choose>
4905
+ </xsl:variable>
4906
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
4907
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
4908
+ <xsl:value-of select="$comment_text"/>
4909
+ </xsl:template><xsl:template name="mathml_instream_object">
4910
+ <xsl:param name="comment_text"/>
4911
+ <xsl:param name="mathml_content"/>
4912
+
4913
+ <xsl:variable name="comment_text_">
4914
+ <xsl:choose>
4915
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
4916
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
4917
+ </xsl:choose>
4918
+ </xsl:variable>
4919
+
4920
+ <xsl:variable name="mathml">
4921
+ <xsl:apply-templates select="." mode="mathml"/>
4922
+ </xsl:variable>
4923
+
4924
+ <fo:instream-foreign-object fox:alt-text="Math">
4925
+
4926
+
4927
+
4928
+
4929
+
4930
+
4931
+
4932
+ <!-- put MathML in Actual Text -->
4933
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
4934
+ <xsl:attribute name="fox:actual-text">
4935
+ <xsl:value-of select="$mathml_content"/>
4936
+ </xsl:attribute>
4937
+
4938
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
4939
+ <xsl:if test="normalize-space($comment_text_) != ''">
4940
+ <!-- put Mathin Alternate Text -->
4941
+ <xsl:attribute name="fox:alt-text">
4942
+ <xsl:value-of select="$comment_text_"/>
4943
+ </xsl:attribute>
4944
+ </xsl:if>
4945
+ <!-- </xsl:if> -->
4946
+
4947
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
4948
+
4949
+ </fo:instream-foreign-object>
4904
4950
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
4905
4951
  <!-- <xsl:text>a+b</xsl:text> -->
4906
4952
  <xsl:text>&lt;</xsl:text>
@@ -5532,18 +5578,33 @@
5532
5578
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
5533
5579
  <xsl:copy>
5534
5580
  <xsl:apply-templates select="@*" mode="svg_update"/>
5535
- <xsl:variable name="viewbox">
5581
+ <xsl:variable name="viewbox_">
5536
5582
  <xsl:call-template name="split">
5537
5583
  <xsl:with-param name="pText" select="@viewBox"/>
5538
5584
  <xsl:with-param name="sep" select="' '"/>
5539
5585
  </xsl:call-template>
5540
5586
  </xsl:variable>
5587
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
5588
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
5589
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
5590
+
5541
5591
  <xsl:attribute name="width">
5542
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
5592
+ <xsl:choose>
5593
+ <xsl:when test="$width != ''">
5594
+ <xsl:value-of select="round($width)"/>
5595
+ </xsl:when>
5596
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
5597
+ </xsl:choose>
5543
5598
  </xsl:attribute>
5544
5599
  <xsl:attribute name="height">
5545
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
5600
+ <xsl:choose>
5601
+ <xsl:when test="$height != ''">
5602
+ <xsl:value-of select="round($height)"/>
5603
+ </xsl:when>
5604
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
5605
+ </xsl:choose>
5546
5606
  </xsl:attribute>
5607
+
5547
5608
  <xsl:apply-templates mode="svg_update"/>
5548
5609
  </xsl:copy>
5549
5610
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">