metanorma-itu 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: 0e30e3335fc27b626ca6cba25b687f537aac08babe91e60664b75cdf3d15b297
4
- data.tar.gz: 35647c71c2143a270867b3ac28df029132b57d7aa6f06775eb86f54ed2d2e4b4
3
+ metadata.gz: 8b72833fd8174442ae52fa5586d1153f1487ea255d8624976c06b3865483ddeb
4
+ data.tar.gz: 84f4c5e4ec5fa53caa2e5b6d2dc9868adfac469a5eb570bf8262ab08ae768639
5
5
  SHA512:
6
- metadata.gz: 4d5973cea39ad61788f98e1176eae971ab0e7cf680e6aac7fd823d8a240055d73a672f2fcf7484b293dcaf6e6c6bca58dc3732cfdc1a7d1a2ca1f14620dd1768
7
- data.tar.gz: de137661607d004bd80e2b119f2932abaae1ffc78b4cc57789ecde1c7b20c295ddf6369184c55c6b82774f1d42e2e0f3c54efe97c9a633e070bc7737c12021e5
6
+ metadata.gz: ebc8d6bf3d905a53717b86b91c2b9ad42b95b0fea78308ad7d2c76dd9bf8f35324c3931257f316f91f5996684fc3bfaaa07217ad0fb37f4653e60c20ca7c1aa8
7
+ data.tar.gz: 504a360980e1614092bb9ae5c9f900553646c7d7d72f8ed9293cfc7a5063e8c5fefce2a3af286aa35315f1ee2ca5d8bdf39445368f6804f3d9992edc65122886
@@ -2068,7 +2068,7 @@
2068
2068
  </xsl:if>
2069
2069
  </xsl:template>
2070
2070
 
2071
- <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">
2071
+ <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">
2072
2072
  <xsl:call-template name="getLang"/>
2073
2073
  </xsl:variable><xsl:variable name="pageWidth_">
2074
2074
  210
@@ -3550,9 +3550,11 @@
3550
3550
  <xsl:with-param name="margin" select="$margin"/>
3551
3551
  </xsl:call-template>
3552
3552
 
3553
- </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3554
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3555
- <xsl:call-template name="add-zero-spaces-java"/>
3553
+ </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">
3554
+
3555
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3556
+ <xsl:call-template name="add-zero-spaces-java"/>
3557
+
3556
3558
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3557
3559
 
3558
3560
  <xsl:variable name="table-preamble">
@@ -3682,16 +3684,9 @@
3682
3684
  </xsl:for-each>
3683
3685
  </xsl:when>
3684
3686
  <xsl:otherwise>
3685
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3686
- <xsl:choose>
3687
- <xsl:when test=". = 1 or . = 0">
3688
- <fo:table-column column-width="proportional-column-width(2)"/>
3689
- </xsl:when>
3690
- <xsl:otherwise>
3691
- <fo:table-column column-width="proportional-column-width({.})"/>
3692
- </xsl:otherwise>
3693
- </xsl:choose>
3694
- </xsl:for-each>
3687
+ <xsl:call-template name="insertTableColumnWidth">
3688
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3689
+ </xsl:call-template>
3695
3690
  </xsl:otherwise>
3696
3691
  </xsl:choose>
3697
3692
 
@@ -3899,6 +3894,12 @@
3899
3894
  <xsl:with-param name="table" select="$table"/>
3900
3895
  </xsl:call-template>
3901
3896
  </xsl:if>
3897
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
3898
+ <xsl:apply-templates mode="td_text"/>
3899
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
3900
+
3901
+ <xsl:value-of select="."/>
3902
+
3902
3903
  </xsl:template><xsl:template match="text()" mode="td_text">
3903
3904
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3904
3905
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -4006,16 +4007,9 @@
4006
4007
  </xsl:for-each>
4007
4008
  </xsl:when>
4008
4009
  <xsl:otherwise>
4009
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4010
- <xsl:choose>
4011
- <xsl:when test=". = 1 or . = 0">
4012
- <fo:table-column column-width="proportional-column-width(2)"/>
4013
- </xsl:when>
4014
- <xsl:otherwise>
4015
- <fo:table-column column-width="proportional-column-width({.})"/>
4016
- </xsl:otherwise>
4017
- </xsl:choose>
4018
- </xsl:for-each>
4010
+ <xsl:call-template name="insertTableColumnWidth">
4011
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4012
+ </xsl:call-template>
4019
4013
  </xsl:otherwise>
4020
4014
  </xsl:choose>
4021
4015
 
@@ -4710,9 +4704,15 @@
4710
4704
  <xsl:variable name="maxlength_dt">
4711
4705
  <xsl:call-template name="getMaxLength_dt"/>
4712
4706
  </xsl:variable>
4707
+ <xsl:variable name="isContainsExpressReference_">
4708
+ false
4709
+ </xsl:variable>
4710
+ <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
4711
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4713
4712
  <xsl:call-template name="setColumnWidth_dl">
4714
4713
  <xsl:with-param name="colwidths" select="$colwidths"/>
4715
4714
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4715
+ <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
4716
4716
  </xsl:call-template>
4717
4717
  <fo:table-body>
4718
4718
  <xsl:apply-templates>
@@ -4728,6 +4728,7 @@
4728
4728
  </xsl:template><xsl:template name="setColumnWidth_dl">
4729
4729
  <xsl:param name="colwidths"/>
4730
4730
  <xsl:param name="maxlength_dt"/>
4731
+ <xsl:param name="isContainsExpressReference"/>
4731
4732
  <xsl:choose>
4732
4733
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4733
4734
  <fo:table-column column-width="50%"/>
@@ -4735,6 +4736,11 @@
4735
4736
  </xsl:when>
4736
4737
  <xsl:otherwise>
4737
4738
  <xsl:choose>
4739
+ <xsl:when test="$isContainsExpressReference">
4740
+ <xsl:call-template name="insertTableColumnWidth">
4741
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4742
+ </xsl:call-template>
4743
+ </xsl:when>
4738
4744
  <!-- to set width check most wide chars like `W` -->
4739
4745
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4740
4746
  <fo:table-column column-width="7%"/>
@@ -4765,20 +4771,25 @@
4765
4771
  <fo:table-column column-width="60%"/>
4766
4772
  </xsl:when>
4767
4773
  <xsl:otherwise>
4768
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4769
- <xsl:choose>
4770
- <xsl:when test=". = 1 or . = 0">
4771
- <fo:table-column column-width="proportional-column-width(2)"/>
4772
- </xsl:when>
4773
- <xsl:otherwise>
4774
- <fo:table-column column-width="proportional-column-width({.})"/>
4775
- </xsl:otherwise>
4776
- </xsl:choose>
4777
- </xsl:for-each>
4774
+ <xsl:call-template name="insertTableColumnWidth">
4775
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4776
+ </xsl:call-template>
4778
4777
  </xsl:otherwise>
4779
4778
  </xsl:choose>
4780
4779
  </xsl:otherwise>
4781
4780
  </xsl:choose>
4781
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4782
+ <xsl:param name="colwidths"/>
4783
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4784
+ <xsl:choose>
4785
+ <xsl:when test=". = 1 or . = 0">
4786
+ <fo:table-column column-width="proportional-column-width(2)"/>
4787
+ </xsl:when>
4788
+ <xsl:otherwise>
4789
+ <fo:table-column column-width="proportional-column-width({.})"/>
4790
+ </xsl:otherwise>
4791
+ </xsl:choose>
4792
+ </xsl:for-each>
4782
4793
  </xsl:template><xsl:template name="getMaxLength_dt">
4783
4794
  <xsl:variable name="lengths">
4784
4795
  <xsl:for-each select="*[local-name()='dt']">
@@ -5396,6 +5407,9 @@
5396
5407
  <xsl:variable name="isDeleted" select="@deleted"/>
5397
5408
 
5398
5409
  <fo:inline xsl:use-attribute-sets="mathml-style">
5410
+
5411
+
5412
+
5399
5413
 
5400
5414
 
5401
5415
  <xsl:call-template name="setTrackChangesStyles">
@@ -5403,48 +5417,80 @@
5403
5417
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5404
5418
  </xsl:call-template>
5405
5419
 
5420
+ <xsl:if test="$add_math_as_text = 'true'">
5421
+ <!-- insert helper tag -->
5422
+ <!-- set unique font-size (fiction) -->
5423
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
5424
+ <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 -->
5425
+ </xsl:if>
5406
5426
 
5407
-
5408
- <xsl:variable name="mathml">
5409
- <xsl:apply-templates select="." mode="mathml"/>
5427
+ <xsl:variable name="mathml_content">
5428
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
5410
5429
  </xsl:variable>
5411
- <fo:instream-foreign-object fox:alt-text="Math">
5412
5430
 
5431
+
5432
+ <xsl:call-template name="mathml_instream_object">
5433
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
5434
+ </xsl:call-template>
5413
5435
 
5414
-
5415
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5416
- <xsl:variable name="comment_text_">
5417
- <xsl:choose>
5418
- <xsl:when test="normalize-space($comment_text_following) != ''">
5419
- <xsl:value-of select="$comment_text_following"/>
5420
- </xsl:when>
5421
- <xsl:otherwise>
5422
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5423
- </xsl:otherwise>
5424
- </xsl:choose>
5425
- </xsl:variable>
5426
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5427
-
5428
- <xsl:if test="normalize-space($comment_text) != ''">
5429
- <!-- put Mathin Alternate Text -->
5430
- <xsl:attribute name="fox:alt-text">
5431
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
5432
- </xsl:attribute>
5433
- </xsl:if>
5434
-
5435
- <xsl:variable name="mathml_content">
5436
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
5437
- </xsl:variable>
5438
- <!-- put MathML in Actual Text -->
5439
- <xsl:attribute name="fox:actual-text">
5440
- <xsl:value-of select="$mathml_content"/>
5441
- </xsl:attribute>
5442
-
5443
-
5444
-
5445
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
5446
- </fo:instream-foreign-object>
5436
+
5447
5437
  </fo:inline>
5438
+ </xsl:template><xsl:template name="getMathml_comment_text">
5439
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5440
+ <xsl:variable name="comment_text_">
5441
+ <xsl:choose>
5442
+ <xsl:when test="normalize-space($comment_text_following) != ''">
5443
+ <xsl:value-of select="$comment_text_following"/>
5444
+ </xsl:when>
5445
+ <xsl:otherwise>
5446
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5447
+ </xsl:otherwise>
5448
+ </xsl:choose>
5449
+ </xsl:variable>
5450
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5451
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
5452
+ <xsl:value-of select="$comment_text"/>
5453
+ </xsl:template><xsl:template name="mathml_instream_object">
5454
+ <xsl:param name="comment_text"/>
5455
+ <xsl:param name="mathml_content"/>
5456
+
5457
+ <xsl:variable name="comment_text_">
5458
+ <xsl:choose>
5459
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5460
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5461
+ </xsl:choose>
5462
+ </xsl:variable>
5463
+
5464
+ <xsl:variable name="mathml">
5465
+ <xsl:apply-templates select="." mode="mathml"/>
5466
+ </xsl:variable>
5467
+
5468
+ <fo:instream-foreign-object fox:alt-text="Math">
5469
+
5470
+
5471
+
5472
+
5473
+
5474
+
5475
+
5476
+ <!-- put MathML in Actual Text -->
5477
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5478
+ <xsl:attribute name="fox:actual-text">
5479
+ <xsl:value-of select="$mathml_content"/>
5480
+ </xsl:attribute>
5481
+
5482
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5483
+ <xsl:if test="normalize-space($comment_text_) != ''">
5484
+ <!-- put Mathin Alternate Text -->
5485
+ <xsl:attribute name="fox:alt-text">
5486
+ <xsl:value-of select="$comment_text_"/>
5487
+ </xsl:attribute>
5488
+ </xsl:if>
5489
+ <!-- </xsl:if> -->
5490
+
5491
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
5492
+
5493
+ </fo:instream-foreign-object>
5448
5494
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
5449
5495
  <!-- <xsl:text>a+b</xsl:text> -->
5450
5496
  <xsl:text>&lt;</xsl:text>
@@ -6074,18 +6120,33 @@
6074
6120
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
6075
6121
  <xsl:copy>
6076
6122
  <xsl:apply-templates select="@*" mode="svg_update"/>
6077
- <xsl:variable name="viewbox">
6123
+ <xsl:variable name="viewbox_">
6078
6124
  <xsl:call-template name="split">
6079
6125
  <xsl:with-param name="pText" select="@viewBox"/>
6080
6126
  <xsl:with-param name="sep" select="' '"/>
6081
6127
  </xsl:call-template>
6082
6128
  </xsl:variable>
6129
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
6130
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
6131
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
6132
+
6083
6133
  <xsl:attribute name="width">
6084
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
6134
+ <xsl:choose>
6135
+ <xsl:when test="$width != ''">
6136
+ <xsl:value-of select="round($width)"/>
6137
+ </xsl:when>
6138
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
6139
+ </xsl:choose>
6085
6140
  </xsl:attribute>
6086
6141
  <xsl:attribute name="height">
6087
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
6142
+ <xsl:choose>
6143
+ <xsl:when test="$height != ''">
6144
+ <xsl:value-of select="round($height)"/>
6145
+ </xsl:when>
6146
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
6147
+ </xsl:choose>
6088
6148
  </xsl:attribute>
6149
+
6089
6150
  <xsl:apply-templates mode="svg_update"/>
6090
6151
  </xsl:copy>
6091
6152
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -2068,7 +2068,7 @@
2068
2068
  </xsl:if>
2069
2069
  </xsl:template>
2070
2070
 
2071
- <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">
2071
+ <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">
2072
2072
  <xsl:call-template name="getLang"/>
2073
2073
  </xsl:variable><xsl:variable name="pageWidth_">
2074
2074
  210
@@ -3550,9 +3550,11 @@
3550
3550
  <xsl:with-param name="margin" select="$margin"/>
3551
3551
  </xsl:call-template>
3552
3552
 
3553
- </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3554
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3555
- <xsl:call-template name="add-zero-spaces-java"/>
3553
+ </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">
3554
+
3555
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3556
+ <xsl:call-template name="add-zero-spaces-java"/>
3557
+
3556
3558
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3557
3559
 
3558
3560
  <xsl:variable name="table-preamble">
@@ -3682,16 +3684,9 @@
3682
3684
  </xsl:for-each>
3683
3685
  </xsl:when>
3684
3686
  <xsl:otherwise>
3685
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3686
- <xsl:choose>
3687
- <xsl:when test=". = 1 or . = 0">
3688
- <fo:table-column column-width="proportional-column-width(2)"/>
3689
- </xsl:when>
3690
- <xsl:otherwise>
3691
- <fo:table-column column-width="proportional-column-width({.})"/>
3692
- </xsl:otherwise>
3693
- </xsl:choose>
3694
- </xsl:for-each>
3687
+ <xsl:call-template name="insertTableColumnWidth">
3688
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3689
+ </xsl:call-template>
3695
3690
  </xsl:otherwise>
3696
3691
  </xsl:choose>
3697
3692
 
@@ -3899,6 +3894,12 @@
3899
3894
  <xsl:with-param name="table" select="$table"/>
3900
3895
  </xsl:call-template>
3901
3896
  </xsl:if>
3897
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
3898
+ <xsl:apply-templates mode="td_text"/>
3899
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
3900
+
3901
+ <xsl:value-of select="."/>
3902
+
3902
3903
  </xsl:template><xsl:template match="text()" mode="td_text">
3903
3904
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3904
3905
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -4006,16 +4007,9 @@
4006
4007
  </xsl:for-each>
4007
4008
  </xsl:when>
4008
4009
  <xsl:otherwise>
4009
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4010
- <xsl:choose>
4011
- <xsl:when test=". = 1 or . = 0">
4012
- <fo:table-column column-width="proportional-column-width(2)"/>
4013
- </xsl:when>
4014
- <xsl:otherwise>
4015
- <fo:table-column column-width="proportional-column-width({.})"/>
4016
- </xsl:otherwise>
4017
- </xsl:choose>
4018
- </xsl:for-each>
4010
+ <xsl:call-template name="insertTableColumnWidth">
4011
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4012
+ </xsl:call-template>
4019
4013
  </xsl:otherwise>
4020
4014
  </xsl:choose>
4021
4015
 
@@ -4710,9 +4704,15 @@
4710
4704
  <xsl:variable name="maxlength_dt">
4711
4705
  <xsl:call-template name="getMaxLength_dt"/>
4712
4706
  </xsl:variable>
4707
+ <xsl:variable name="isContainsExpressReference_">
4708
+ false
4709
+ </xsl:variable>
4710
+ <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
4711
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4713
4712
  <xsl:call-template name="setColumnWidth_dl">
4714
4713
  <xsl:with-param name="colwidths" select="$colwidths"/>
4715
4714
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4715
+ <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
4716
4716
  </xsl:call-template>
4717
4717
  <fo:table-body>
4718
4718
  <xsl:apply-templates>
@@ -4728,6 +4728,7 @@
4728
4728
  </xsl:template><xsl:template name="setColumnWidth_dl">
4729
4729
  <xsl:param name="colwidths"/>
4730
4730
  <xsl:param name="maxlength_dt"/>
4731
+ <xsl:param name="isContainsExpressReference"/>
4731
4732
  <xsl:choose>
4732
4733
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4733
4734
  <fo:table-column column-width="50%"/>
@@ -4735,6 +4736,11 @@
4735
4736
  </xsl:when>
4736
4737
  <xsl:otherwise>
4737
4738
  <xsl:choose>
4739
+ <xsl:when test="$isContainsExpressReference">
4740
+ <xsl:call-template name="insertTableColumnWidth">
4741
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4742
+ </xsl:call-template>
4743
+ </xsl:when>
4738
4744
  <!-- to set width check most wide chars like `W` -->
4739
4745
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4740
4746
  <fo:table-column column-width="7%"/>
@@ -4765,20 +4771,25 @@
4765
4771
  <fo:table-column column-width="60%"/>
4766
4772
  </xsl:when>
4767
4773
  <xsl:otherwise>
4768
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4769
- <xsl:choose>
4770
- <xsl:when test=". = 1 or . = 0">
4771
- <fo:table-column column-width="proportional-column-width(2)"/>
4772
- </xsl:when>
4773
- <xsl:otherwise>
4774
- <fo:table-column column-width="proportional-column-width({.})"/>
4775
- </xsl:otherwise>
4776
- </xsl:choose>
4777
- </xsl:for-each>
4774
+ <xsl:call-template name="insertTableColumnWidth">
4775
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4776
+ </xsl:call-template>
4778
4777
  </xsl:otherwise>
4779
4778
  </xsl:choose>
4780
4779
  </xsl:otherwise>
4781
4780
  </xsl:choose>
4781
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4782
+ <xsl:param name="colwidths"/>
4783
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4784
+ <xsl:choose>
4785
+ <xsl:when test=". = 1 or . = 0">
4786
+ <fo:table-column column-width="proportional-column-width(2)"/>
4787
+ </xsl:when>
4788
+ <xsl:otherwise>
4789
+ <fo:table-column column-width="proportional-column-width({.})"/>
4790
+ </xsl:otherwise>
4791
+ </xsl:choose>
4792
+ </xsl:for-each>
4782
4793
  </xsl:template><xsl:template name="getMaxLength_dt">
4783
4794
  <xsl:variable name="lengths">
4784
4795
  <xsl:for-each select="*[local-name()='dt']">
@@ -5396,6 +5407,9 @@
5396
5407
  <xsl:variable name="isDeleted" select="@deleted"/>
5397
5408
 
5398
5409
  <fo:inline xsl:use-attribute-sets="mathml-style">
5410
+
5411
+
5412
+
5399
5413
 
5400
5414
 
5401
5415
  <xsl:call-template name="setTrackChangesStyles">
@@ -5403,48 +5417,80 @@
5403
5417
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5404
5418
  </xsl:call-template>
5405
5419
 
5420
+ <xsl:if test="$add_math_as_text = 'true'">
5421
+ <!-- insert helper tag -->
5422
+ <!-- set unique font-size (fiction) -->
5423
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
5424
+ <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 -->
5425
+ </xsl:if>
5406
5426
 
5407
-
5408
- <xsl:variable name="mathml">
5409
- <xsl:apply-templates select="." mode="mathml"/>
5427
+ <xsl:variable name="mathml_content">
5428
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
5410
5429
  </xsl:variable>
5411
- <fo:instream-foreign-object fox:alt-text="Math">
5412
5430
 
5431
+
5432
+ <xsl:call-template name="mathml_instream_object">
5433
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
5434
+ </xsl:call-template>
5413
5435
 
5414
-
5415
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5416
- <xsl:variable name="comment_text_">
5417
- <xsl:choose>
5418
- <xsl:when test="normalize-space($comment_text_following) != ''">
5419
- <xsl:value-of select="$comment_text_following"/>
5420
- </xsl:when>
5421
- <xsl:otherwise>
5422
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5423
- </xsl:otherwise>
5424
- </xsl:choose>
5425
- </xsl:variable>
5426
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5427
-
5428
- <xsl:if test="normalize-space($comment_text) != ''">
5429
- <!-- put Mathin Alternate Text -->
5430
- <xsl:attribute name="fox:alt-text">
5431
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
5432
- </xsl:attribute>
5433
- </xsl:if>
5434
-
5435
- <xsl:variable name="mathml_content">
5436
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
5437
- </xsl:variable>
5438
- <!-- put MathML in Actual Text -->
5439
- <xsl:attribute name="fox:actual-text">
5440
- <xsl:value-of select="$mathml_content"/>
5441
- </xsl:attribute>
5442
-
5443
-
5444
-
5445
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
5446
- </fo:instream-foreign-object>
5436
+
5447
5437
  </fo:inline>
5438
+ </xsl:template><xsl:template name="getMathml_comment_text">
5439
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5440
+ <xsl:variable name="comment_text_">
5441
+ <xsl:choose>
5442
+ <xsl:when test="normalize-space($comment_text_following) != ''">
5443
+ <xsl:value-of select="$comment_text_following"/>
5444
+ </xsl:when>
5445
+ <xsl:otherwise>
5446
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5447
+ </xsl:otherwise>
5448
+ </xsl:choose>
5449
+ </xsl:variable>
5450
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5451
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
5452
+ <xsl:value-of select="$comment_text"/>
5453
+ </xsl:template><xsl:template name="mathml_instream_object">
5454
+ <xsl:param name="comment_text"/>
5455
+ <xsl:param name="mathml_content"/>
5456
+
5457
+ <xsl:variable name="comment_text_">
5458
+ <xsl:choose>
5459
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5460
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5461
+ </xsl:choose>
5462
+ </xsl:variable>
5463
+
5464
+ <xsl:variable name="mathml">
5465
+ <xsl:apply-templates select="." mode="mathml"/>
5466
+ </xsl:variable>
5467
+
5468
+ <fo:instream-foreign-object fox:alt-text="Math">
5469
+
5470
+
5471
+
5472
+
5473
+
5474
+
5475
+
5476
+ <!-- put MathML in Actual Text -->
5477
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5478
+ <xsl:attribute name="fox:actual-text">
5479
+ <xsl:value-of select="$mathml_content"/>
5480
+ </xsl:attribute>
5481
+
5482
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5483
+ <xsl:if test="normalize-space($comment_text_) != ''">
5484
+ <!-- put Mathin Alternate Text -->
5485
+ <xsl:attribute name="fox:alt-text">
5486
+ <xsl:value-of select="$comment_text_"/>
5487
+ </xsl:attribute>
5488
+ </xsl:if>
5489
+ <!-- </xsl:if> -->
5490
+
5491
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
5492
+
5493
+ </fo:instream-foreign-object>
5448
5494
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
5449
5495
  <!-- <xsl:text>a+b</xsl:text> -->
5450
5496
  <xsl:text>&lt;</xsl:text>
@@ -6074,18 +6120,33 @@
6074
6120
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
6075
6121
  <xsl:copy>
6076
6122
  <xsl:apply-templates select="@*" mode="svg_update"/>
6077
- <xsl:variable name="viewbox">
6123
+ <xsl:variable name="viewbox_">
6078
6124
  <xsl:call-template name="split">
6079
6125
  <xsl:with-param name="pText" select="@viewBox"/>
6080
6126
  <xsl:with-param name="sep" select="' '"/>
6081
6127
  </xsl:call-template>
6082
6128
  </xsl:variable>
6129
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
6130
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
6131
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
6132
+
6083
6133
  <xsl:attribute name="width">
6084
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
6134
+ <xsl:choose>
6135
+ <xsl:when test="$width != ''">
6136
+ <xsl:value-of select="round($width)"/>
6137
+ </xsl:when>
6138
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
6139
+ </xsl:choose>
6085
6140
  </xsl:attribute>
6086
6141
  <xsl:attribute name="height">
6087
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
6142
+ <xsl:choose>
6143
+ <xsl:when test="$height != ''">
6144
+ <xsl:value-of select="round($height)"/>
6145
+ </xsl:when>
6146
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
6147
+ </xsl:choose>
6088
6148
  </xsl:attribute>
6149
+
6089
6150
  <xsl:apply-templates mode="svg_update"/>
6090
6151
  </xsl:copy>
6091
6152
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">