metanorma-ogc 2.5.5 → 2.5.7

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: 35eb5d112459eeed0144cd0540f405b6d0747de419d8480cde65847345378228
4
- data.tar.gz: c0fc6b930e03b9602a1608abb8341af9f9dc36fb0f59c45fe72341a441564a0c
3
+ metadata.gz: acd142168fdacf516fd55d11bc9da4ca95761aac478e1afd3c151fa78086e2d6
4
+ data.tar.gz: 2e48ec71cfae6823b126b189922180a5c2ec9133c3f73bdc85e95971d0b666d2
5
5
  SHA512:
6
- metadata.gz: fa414b2a8de42c48ec54c897536126b37f83f025fec56726692bce77a4a2699ec7510ef4c55876d885ec14bcc59af350e758d0dc1ab63b5a58b76c629937904c
7
- data.tar.gz: 370285842b061ab348ddc3b6d8316e57179e6c3107ca08229881f83e9f223c83b1c144a38749df6150236c182b7e4058d845f4c176580030b569ee21d97caff8
6
+ metadata.gz: 617759d4291fc25002162aaafa800736784ec8cad2c077328ff1fd02df82739021a2310bc13509159b4797976fe18bebb0c4ea94658b5045a94da5b4124e6599
7
+ data.tar.gz: af9a358d434af54bcb2af92ca6cc4811e03696833e08e12f7510bd3b5ec1e217c1fe9b8560e3ed1c04db359dff56878e829a75e4fe1cc9f17c9f78f79918f881
@@ -742,11 +742,15 @@
742
742
 
743
743
  <!-- Lato font doesn't contain 'thin space' glyph -->
744
744
  <xsl:template match="text()" priority="1">
745
- <xsl:value-of select="translate(., $thin_space, ' ')"/>
745
+ <xsl:call-template name="add_fo_character">
746
+ <xsl:with-param name="text" select="translate(., $thin_space, ' ')"/>
747
+ </xsl:call-template>
746
748
  </xsl:template>
747
749
 
748
750
  <xsl:template match="ogc:title//text() | ogc:name//text()" priority="3" mode="contents">
749
- <xsl:value-of select="translate(., $thin_space, ' ')"/>
751
+ <xsl:call-template name="add_fo_character">
752
+ <xsl:with-param name="text" select="translate(., $thin_space, ' ')"/>
753
+ </xsl:call-template>
750
754
  </xsl:template>
751
755
 
752
756
  <xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text()" priority="2">
@@ -762,7 +766,54 @@
762
766
  <!-- replace sequence #x200B to one &#x200B -->
763
767
  <xsl:variable name="content4" select="java:replaceAll(java:java.lang.String.new($content3), '\u200b{2,}', '​')"/>
764
768
 
765
- <xsl:value-of select="translate($content4, $thin_space, ' ')"/>
769
+ <xsl:call-template name="add_fo_character">
770
+ <xsl:with-param name="text" select="translate($content4, $thin_space, ' ')"/>
771
+ </xsl:call-template>
772
+ </xsl:template>
773
+
774
+ <xsl:template name="add_fo_character">
775
+ <xsl:param name="text"/>
776
+ <!-- https://github.com/metanorma/mn-native-pdf/issues/672, https://issues.apache.org/jira/browse/FOP-3175 -->
777
+ <!-- Miscellaneous Symbols https://www.compart.com/en/unicode/block/U+2600 U+2600 - U+26FF -->
778
+ <!-- Dingbats https://www.compart.com/en/unicode/block/U+2700 U+2700 - U+27BF -->
779
+ <!-- Miscellaneous Symbols and Arrows https://www.compart.com/en/unicode/block/U+2b55 U+2B00 - U+2BFF-->
780
+ <!-- enclose chars into <fo:character character="..."/> -->
781
+ <xsl:variable name="regex_dingbats_chars">([\u2100-\u2BFF])</xsl:variable> <!-- \u1F300;-\u1F5FF; not working in fo:character -->
782
+ <xsl:variable name="element_name_fo_character">fo:character</xsl:variable>
783
+ <xsl:variable name="tag_element_name_fo_character_open">###<xsl:value-of select="$element_name_fo_character"/>###</xsl:variable>
784
+ <xsl:variable name="tag_element_name_fo_character_close">###/<xsl:value-of select="$element_name_fo_character"/>###</xsl:variable>
785
+ <xsl:variable name="text_" select="java:replaceAll(java:java.lang.String.new($text), $regex_dingbats_chars, concat($tag_element_name_fo_character_open,'$1',$tag_element_name_fo_character_close))"/>
786
+ <xsl:call-template name="replace_text_tags_fo_character">
787
+ <xsl:with-param name="tag_open" select="$tag_element_name_fo_character_open"/>
788
+ <xsl:with-param name="tag_close" select="$tag_element_name_fo_character_close"/>
789
+ <xsl:with-param name="text" select="$text_"/>
790
+ </xsl:call-template>
791
+ </xsl:template>
792
+
793
+ <!-- ###fo:character###A###/fo:character### -->
794
+ <xsl:template name="replace_text_tags_fo_character">
795
+ <xsl:param name="tag_open"/>
796
+ <xsl:param name="tag_close"/>
797
+ <xsl:param name="text"/>
798
+ <xsl:choose>
799
+ <xsl:when test="contains($text, $tag_open)">
800
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
801
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
802
+
803
+ <xsl:element name="{substring-before(substring-after($tag_open, '###'),'###')}">
804
+ <xsl:attribute name="character">
805
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
806
+ </xsl:attribute>
807
+ </xsl:element>
808
+
809
+ <xsl:call-template name="replace_text_tags_fo_character">
810
+ <xsl:with-param name="tag_open" select="$tag_open"/>
811
+ <xsl:with-param name="tag_close" select="$tag_close"/>
812
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
813
+ </xsl:call-template>
814
+ </xsl:when>
815
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
816
+ </xsl:choose>
766
817
  </xsl:template>
767
818
 
768
819
  <xsl:template match="node()" mode="sections">
@@ -1057,6 +1108,8 @@
1057
1108
  <xsl:template match="ogc:p" name="paragraph">
1058
1109
  <xsl:param name="inline" select="'false'"/>
1059
1110
  <xsl:param name="split_keep-within-line"/>
1111
+ <xsl:param name="indent">0</xsl:param>
1112
+ <!-- <fo:block>debug p indent=<xsl:value-of select="$indent"/></fo:block> -->
1060
1113
  <xsl:variable name="previous-element" select="local-name(preceding-sibling::*[1])"/>
1061
1114
  <xsl:variable name="element-name">
1062
1115
  <xsl:choose>
@@ -1092,6 +1145,7 @@
1092
1145
 
1093
1146
  <xsl:apply-templates>
1094
1147
  <xsl:with-param name="split_keep-within-line" select="$split_keep-within-line"/>
1148
+ <xsl:with-param name="indent" select="$indent"/>
1095
1149
  </xsl:apply-templates>
1096
1150
  </xsl:element>
1097
1151
  <xsl:if test="$element-name = 'fo:inline' and not($inline = 'true') and not(local-name(..) = 'admonition')">
@@ -1114,17 +1168,18 @@
1114
1168
  </xsl:template>
1115
1169
 
1116
1170
  <xsl:template match="ogc:ul | ogc:ol" mode="list" priority="2">
1117
- <xsl:variable name="ul_indent">6mm</xsl:variable>
1118
- <fo:block-container margin-left="13mm">
1119
- <xsl:if test="self::ogc:ul and not(ancestor::ogc:ul) and not(ancestor::ogc:ol)"> <!-- if first level -->
1120
- <xsl:attribute name="margin-left">4mm</xsl:attribute>
1121
- </xsl:if>
1122
- <xsl:if test="self::ogc:ul and ancestor::*[2][self::ogc:ul]"> <!-- ul/li/ul -->
1123
- <xsl:attribute name="margin-left"><xsl:value-of select="$ul_indent"/></xsl:attribute>
1124
- </xsl:if>
1125
- <xsl:if test="ancestor::ogc:table">
1126
- <xsl:attribute name="margin-left">4mm</xsl:attribute>
1127
- </xsl:if>
1171
+ <xsl:param name="indent">0</xsl:param>
1172
+ <!-- <fo:block>debug ul ol indent=<xsl:value-of select="$indent"/></fo:block> -->
1173
+ <xsl:variable name="ul_indent">6</xsl:variable>
1174
+ <xsl:variable name="margin_left">
1175
+ <xsl:choose>
1176
+ <xsl:when test="self::ogc:ul and not(ancestor::ogc:ul) and not(ancestor::ogc:ol)">4</xsl:when> <!-- if first level -->
1177
+ <xsl:when test="self::ogc:ul and ancestor::*[2][self::ogc:ul]"><xsl:value-of select="$ul_indent"/></xsl:when> <!-- ul/li/ul -->
1178
+ <xsl:when test="ancestor::ogc:table">4</xsl:when>
1179
+ <xsl:otherwise>13</xsl:otherwise>
1180
+ </xsl:choose>
1181
+ </xsl:variable>
1182
+ <fo:block-container margin-left="{$margin_left}mm">
1128
1183
  <xsl:if test="ancestor::ogc:ul or ancestor::ogc:ol">
1129
1184
  <xsl:attribute name="margin-top">10pt</xsl:attribute>
1130
1185
  <xsl:if test="ancestor::ogc:table">
@@ -1134,7 +1189,7 @@
1134
1189
  <fo:block-container margin-left="0mm">
1135
1190
  <fo:list-block xsl:use-attribute-sets="list-style">
1136
1191
  <xsl:if test="self::ogc:ul">
1137
- <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$ul_indent"/></xsl:attribute>
1192
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$ul_indent"/>mm</xsl:attribute>
1138
1193
  </xsl:if>
1139
1194
  <xsl:if test="ancestor::ogc:table">
1140
1195
  <xsl:attribute name="provisional-distance-between-starts">5mm</xsl:attribute>
@@ -1148,7 +1203,9 @@
1148
1203
  <xsl:if test="following-sibling::*[1][local-name() = 'ul' or local-name() = 'ol']">
1149
1204
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1150
1205
  </xsl:if>
1151
- <xsl:apply-templates/>
1206
+ <xsl:apply-templates>
1207
+ <xsl:with-param name="indent" select="$indent + $ul_indent"/>
1208
+ </xsl:apply-templates>
1152
1209
  </fo:list-block>
1153
1210
  </fo:block-container>
1154
1211
  </fo:block-container>
@@ -1256,9 +1313,13 @@
1256
1313
  </xsl:template>
1257
1314
 
1258
1315
  <xsl:template match="ogc:figure" priority="2">
1316
+ <xsl:param name="indent"/>
1317
+ <!-- <fo:block>debug figure indent=<xsl:value-of select="$indent"/></fo:block> -->
1259
1318
  <fo:block-container id="{@id}" margin-top="12pt" margin-bottom="12pt">
1260
1319
  <fo:block>
1261
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
1320
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]">
1321
+ <xsl:with-param name="indent" select="$indent"/>
1322
+ </xsl:apply-templates>
1262
1323
  </fo:block>
1263
1324
  <xsl:call-template name="fn_display_figure"/>
1264
1325
  <xsl:for-each select="ogc:note">
@@ -1584,17 +1645,30 @@
1584
1645
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
1585
1646
 
1586
1647
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
1587
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
1648
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
1588
1649
  <!-- Example: <tables>
1589
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
1590
- <tbody>
1591
- <tr>
1592
- <td id="tab-symdu_1_1">
1593
- <p_len>6</p_len>
1594
- <p_len>100</p_len> for 2nd paragraph
1595
- <word_len>6</word_len>
1596
- <word_len>20</word_len>
1597
- ...
1650
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
1651
+ <column width_max="39354" width_min="39354"/>
1652
+ <column width_max="75394" width_min="75394"/>
1653
+ <column width_max="108813" width_min="108813"/>
1654
+ <tbody>
1655
+ <tr>
1656
+ <td width_max="39354" width_min="39354">
1657
+ <p_len>39354</p_len>
1658
+ <word_len>39354</word_len>
1659
+ </td>
1660
+
1661
+ OLD:
1662
+ <tables>
1663
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
1664
+ <tbody>
1665
+ <tr>
1666
+ <td id="tab-symdu_1_1">
1667
+ <p_len>6</p_len>
1668
+ <p_len>100</p_len> for 2nd paragraph
1669
+ <word_len>6</word_len>
1670
+ <word_len>20</word_len>
1671
+ ...
1598
1672
  -->
1599
1673
 
1600
1674
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -1814,6 +1888,9 @@
1814
1888
  <xsl:variable name="hair_space"> </xsl:variable>
1815
1889
  <xsl:variable name="en_dash">–</xsl:variable>
1816
1890
  <xsl:variable name="em_dash">—</xsl:variable>
1891
+ <xsl:variable name="cr">&#13;</xsl:variable>
1892
+ <xsl:variable name="lf">
1893
+ </xsl:variable>
1817
1894
 
1818
1895
  <xsl:template name="getTitle">
1819
1896
  <xsl:param name="name"/>
@@ -3617,6 +3694,20 @@
3617
3694
  </xsl:for-each>
3618
3695
  </xsl:template>
3619
3696
 
3697
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
3698
+
3699
+ <xsl:template match="*[local-name()='table']" priority="2">
3700
+ <xsl:choose>
3701
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
3702
+ <xsl:call-template name="table"/>
3703
+ </xsl:when>
3704
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
3705
+ <xsl:otherwise>
3706
+ <xsl:call-template name="table"/>
3707
+ </xsl:otherwise>
3708
+ </xsl:choose>
3709
+ </xsl:template>
3710
+
3620
3711
  <xsl:template match="*[local-name()='table']" name="table">
3621
3712
 
3622
3713
  <xsl:variable name="table-preamble">
@@ -3628,9 +3719,11 @@
3628
3719
  <xsl:variable name="table">
3629
3720
 
3630
3721
  <xsl:variable name="simple-table">
3631
- <xsl:call-template name="getSimpleTable">
3632
- <xsl:with-param name="id" select="@id"/>
3633
- </xsl:call-template>
3722
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
3723
+ <xsl:call-template name="getSimpleTable">
3724
+ <xsl:with-param name="id" select="@id"/>
3725
+ </xsl:call-template>
3726
+ </xsl:if>
3634
3727
  </xsl:variable>
3635
3728
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
3636
3729
 
@@ -3732,9 +3825,9 @@
3732
3825
  </xsl:attribute>
3733
3826
  </xsl:for-each>
3734
3827
 
3735
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3828
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'][not(@type = 'units')] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3736
3829
  <xsl:if test="$isNoteOrFnExist = 'true'">
3737
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3830
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3738
3831
  </xsl:if>
3739
3832
 
3740
3833
  <xsl:choose>
@@ -3883,9 +3976,28 @@
3883
3976
 
3884
3977
  </fo:block>
3885
3978
 
3979
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
3980
+ <xsl:if test="$continued = 'true'">
3981
+ <fo:block text-align="right">
3982
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
3983
+ </fo:block>
3984
+ </xsl:if>
3985
+ <!-- </xsl:if> -->
3986
+
3886
3987
  </xsl:if>
3887
3988
  </xsl:template> <!-- table/name -->
3888
3989
 
3990
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
3991
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
3992
+ <xsl:choose>
3993
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
3994
+ <!-- remove CR or LF at start -->
3995
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
3996
+ </xsl:when>
3997
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
3998
+ </xsl:choose>
3999
+ </xsl:template>
4000
+
3889
4001
  <!-- SOURCE: ... -->
3890
4002
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
3891
4003
  <xsl:call-template name="termsource"/>
@@ -4296,7 +4408,7 @@
4296
4408
  <xsl:param name="colwidths"/>
4297
4409
  <xsl:param name="colgroup"/>
4298
4410
 
4299
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
4411
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
4300
4412
 
4301
4413
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4302
4414
 
@@ -4368,7 +4480,7 @@
4368
4480
 
4369
4481
  <xsl:apply-templates select="../*[local-name()='p']"/>
4370
4482
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4371
- <xsl:apply-templates select="../*[local-name()='note']"/>
4483
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
4372
4484
  <xsl:apply-templates select="../*[local-name()='example']"/>
4373
4485
  <xsl:apply-templates select="../*[local-name()='source']"/>
4374
4486
 
@@ -4378,7 +4490,7 @@
4378
4490
 
4379
4491
  <!-- horizontal row separator -->
4380
4492
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
4381
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
4493
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
4382
4494
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
4383
4495
 
4384
4496
  <xsl:call-template name="setBordersTableArray"/>
@@ -5054,7 +5166,20 @@
5054
5166
  <!-- Definition List -->
5055
5167
  <!-- ===================== -->
5056
5168
 
5057
- <xsl:template match="*[local-name()='dl']">
5169
+ <!-- for table auto-layout algorithm -->
5170
+ <xsl:template match="*[local-name()='dl']" priority="2">
5171
+ <xsl:choose>
5172
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
5173
+ <xsl:call-template name="dl"/>
5174
+ </xsl:when>
5175
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
5176
+ <xsl:otherwise>
5177
+ <xsl:call-template name="dl"/>
5178
+ </xsl:otherwise>
5179
+ </xsl:choose>
5180
+ </xsl:template>
5181
+
5182
+ <xsl:template match="*[local-name()='dl']" name="dl">
5058
5183
  <xsl:variable name="isAdded" select="@added"/>
5059
5184
  <xsl:variable name="isDeleted" select="@deleted"/>
5060
5185
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -6995,7 +7120,13 @@
6995
7120
  <xsl:value-of select="$language_current_2"/>
6996
7121
  </xsl:when>
6997
7122
  <xsl:otherwise>
6998
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
7123
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
7124
+ <xsl:choose>
7125
+ <xsl:when test="$language_current_3 != ''">
7126
+ <xsl:value-of select="$language_current_3"/>
7127
+ </xsl:when>
7128
+ <xsl:otherwise>en</xsl:otherwise>
7129
+ </xsl:choose>
6999
7130
  </xsl:otherwise>
7000
7131
  </xsl:choose>
7001
7132
  </xsl:otherwise>
@@ -7865,10 +7996,11 @@
7865
7996
  </xsl:template>
7866
7997
 
7867
7998
  <xsl:template match="*[local-name() = 'image']">
7999
+ <xsl:param name="indent">0</xsl:param>
7868
8000
  <xsl:variable name="isAdded" select="../@added"/>
7869
8001
  <xsl:variable name="isDeleted" select="../@deleted"/>
7870
8002
  <xsl:choose>
7871
- <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
8003
+ <xsl:when test="ancestor::*[local-name() = 'title'] or not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']"> <!-- inline image ( 'image:path' in adoc, with one colon after image) -->
7872
8004
  <fo:inline padding-left="1mm" padding-right="1mm">
7873
8005
  <xsl:if test="not(parent::*[local-name() = 'figure']) or parent::*[local-name() = 'p']">
7874
8006
  <xsl:attribute name="padding-left">0mm</xsl:attribute>
@@ -7877,7 +8009,43 @@
7877
8009
  <xsl:variable name="src">
7878
8010
  <xsl:call-template name="image_src"/>
7879
8011
  </xsl:variable>
7880
- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/>
8012
+
8013
+ <xsl:variable name="scale">
8014
+ <xsl:call-template name="getImageScale">
8015
+ <xsl:with-param name="indent" select="$indent"/>
8016
+ </xsl:call-template>
8017
+ </xsl:variable>
8018
+
8019
+ <!-- debug scale='<xsl:value-of select="$scale"/>', indent='<xsl:value-of select="$indent"/>' -->
8020
+
8021
+ <!-- <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle"/> -->
8022
+ <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" vertical-align="middle">
8023
+
8024
+ <xsl:variable name="width">
8025
+ <xsl:call-template name="setImageWidth"/>
8026
+ </xsl:variable>
8027
+ <xsl:if test="$width != ''">
8028
+ <xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute>
8029
+ </xsl:if>
8030
+ <xsl:variable name="height">
8031
+ <xsl:call-template name="setImageHeight"/>
8032
+ </xsl:variable>
8033
+ <xsl:if test="$height != ''">
8034
+ <xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute>
8035
+ </xsl:if>
8036
+
8037
+ <xsl:if test="$width = '' and $height = ''">
8038
+ <xsl:if test="number($scale) &lt; 100">
8039
+ <xsl:attribute name="content-width"><xsl:value-of select="number($scale)"/>%</xsl:attribute>
8040
+ <!-- <xsl:attribute name="content-width">scale-to-fit</xsl:attribute>
8041
+ <xsl:attribute name="content-height">100%</xsl:attribute>
8042
+ <xsl:attribute name="width">100%</xsl:attribute>
8043
+ <xsl:attribute name="scaling">uniform</xsl:attribute> -->
8044
+ </xsl:if>
8045
+ </xsl:if>
8046
+
8047
+ </fo:external-graphic>
8048
+
7881
8049
  </fo:inline>
7882
8050
  </xsl:when>
7883
8051
  <xsl:otherwise>
@@ -7898,25 +8066,23 @@
7898
8066
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7899
8067
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7900
8068
 
7901
- <xsl:apply-templates select="." mode="cross_image"/>
8069
+ <xsl:apply-templates select="." mode="cross_image"/>
7902
8070
 
7903
8071
  </fo:instream-foreign-object>
7904
8072
  </xsl:when>
7905
8073
  <xsl:otherwise>
8074
+ <!-- <fo:block>debug block image:
8075
+ <xsl:variable name="scale">
8076
+ <xsl:call-template name="getImageScale">
8077
+ <xsl:with-param name="indent" select="$indent"/>
8078
+ </xsl:call-template>
8079
+ </xsl:variable>
8080
+ <xsl:value-of select="concat('scale=', $scale,', indent=', $indent)"/>
8081
+ </fo:block> -->
7906
8082
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7907
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
8083
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and (../*[local-name() = 'name'] or parent::*[local-name() = 'figure'][@unnumbered = 'true']) and not(ancestor::*[local-name() = 'table'])">
7908
8084
 
7909
- <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
7910
- <xsl:attribute name="width">
7911
- <xsl:value-of select="@width"/>
7912
- </xsl:attribute>
7913
- </xsl:if>
7914
-
7915
- <xsl:if test="@height != '' and @height != 'auto'">
7916
- <xsl:attribute name="height">
7917
- <xsl:value-of select="@height"/>
7918
- </xsl:attribute>
7919
- </xsl:if>
8085
+ <xsl:call-template name="setImageWidthHeight"/>
7920
8086
 
7921
8087
  <xsl:choose>
7922
8088
  <xsl:when test="@width != '' and @width != 'auto' and @height != '' and @height != 'auto'">
@@ -7924,24 +8090,18 @@
7924
8090
  </xsl:when>
7925
8091
  <xsl:otherwise>
7926
8092
 
7927
- <xsl:variable name="img_src">
7928
- <xsl:choose>
7929
- <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
7930
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7931
- </xsl:choose>
8093
+ <xsl:variable name="scale">
8094
+ <xsl:call-template name="getImageScale">
8095
+ <xsl:with-param name="indent" select="$indent"/>
8096
+ </xsl:call-template>
7932
8097
  </xsl:variable>
7933
8098
 
7934
- <xsl:variable name="image_width_effective">
7935
-
7936
- <xsl:value-of select="$width_effective"/>
7937
-
8099
+ <xsl:variable name="scaleRatio">
8100
+ 1
7938
8101
  </xsl:variable>
7939
8102
 
7940
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
7941
8103
  <xsl:if test="number($scale) &lt; 100">
7942
-
7943
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7944
-
8104
+ <xsl:attribute name="content-width"><xsl:value-of select="number($scale) * number($scaleRatio)"/>%</xsl:attribute>
7945
8105
  </xsl:if>
7946
8106
  </xsl:otherwise>
7947
8107
  </xsl:choose>
@@ -7957,6 +8117,62 @@
7957
8117
  </xsl:choose>
7958
8118
  </xsl:template>
7959
8119
 
8120
+ <xsl:template name="setImageWidth">
8121
+ <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
8122
+ <xsl:value-of select="@width"/>
8123
+ </xsl:if>
8124
+ </xsl:template>
8125
+ <xsl:template name="setImageHeight">
8126
+ <xsl:if test="@height != '' and @height != 'auto'">
8127
+ <xsl:value-of select="@height"/>
8128
+ </xsl:if>
8129
+ </xsl:template>
8130
+ <xsl:template name="setImageWidthHeight">
8131
+ <xsl:variable name="width">
8132
+ <xsl:call-template name="setImageWidth"/>
8133
+ </xsl:variable>
8134
+ <xsl:if test="$width != ''">
8135
+ <xsl:attribute name="width">
8136
+ <xsl:value-of select="$width"/>
8137
+ </xsl:attribute>
8138
+ </xsl:if>
8139
+ <xsl:variable name="height">
8140
+ <xsl:call-template name="setImageHeight"/>
8141
+ </xsl:variable>
8142
+ <xsl:if test="$height != ''">
8143
+ <xsl:attribute name="height">
8144
+ <xsl:value-of select="$height"/>
8145
+ </xsl:attribute>
8146
+ </xsl:if>
8147
+ </xsl:template>
8148
+
8149
+ <xsl:template name="getImageScale">
8150
+ <xsl:param name="indent"/>
8151
+ <xsl:variable name="indent_left">
8152
+ <xsl:choose>
8153
+ <xsl:when test="$indent != ''"><xsl:value-of select="$indent"/></xsl:when>
8154
+ <xsl:otherwise>0</xsl:otherwise>
8155
+ </xsl:choose>
8156
+ </xsl:variable>
8157
+ <xsl:variable name="img_src">
8158
+ <xsl:choose>
8159
+ <xsl:when test="not(starts-with(@src, 'data:'))"><xsl:value-of select="concat($basepath, @src)"/></xsl:when>
8160
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8161
+ </xsl:choose>
8162
+ </xsl:variable>
8163
+
8164
+ <xsl:variable name="image_width_effective">
8165
+
8166
+ <xsl:value-of select="$width_effective - number($indent_left)"/>
8167
+
8168
+ </xsl:variable>
8169
+ <!-- <xsl:message>width_effective=<xsl:value-of select="$width_effective"/></xsl:message>
8170
+ <xsl:message>indent_left=<xsl:value-of select="$indent_left"/></xsl:message>
8171
+ <xsl:message>image_width_effective=<xsl:value-of select="$image_width_effective"/> for <xsl:value-of select="ancestor::ogc:p[1]/@id"/></xsl:message> -->
8172
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
8173
+ <xsl:value-of select="$scale"/>
8174
+ </xsl:template>
8175
+
7960
8176
  <xsl:template name="image_src">
7961
8177
  <xsl:choose>
7962
8178
  <xsl:when test="@mimetype = 'image/svg+xml' and $images/images/image[@id = current()/@id]">
@@ -10683,6 +10899,7 @@
10683
10899
  </xsl:template>
10684
10900
 
10685
10901
  <xsl:template match="*[local-name() = 'ul'] | *[local-name() = 'ol']">
10902
+ <xsl:param name="indent">0</xsl:param>
10686
10903
  <xsl:choose>
10687
10904
  <xsl:when test="parent::*[local-name() = 'note'] or parent::*[local-name() = 'termnote']">
10688
10905
  <fo:block-container role="SKIP">
@@ -10697,7 +10914,9 @@
10697
10914
 
10698
10915
  <fo:block-container margin-left="0mm" role="SKIP">
10699
10916
  <fo:block>
10700
- <xsl:apply-templates select="." mode="list"/>
10917
+ <xsl:apply-templates select="." mode="list">
10918
+ <xsl:with-param name="indent" select="$indent"/>
10919
+ </xsl:apply-templates>
10701
10920
  </fo:block>
10702
10921
  </fo:block-container>
10703
10922
  </fo:block-container>
@@ -10705,7 +10924,9 @@
10705
10924
  <xsl:otherwise>
10706
10925
 
10707
10926
  <fo:block role="SKIP">
10708
- <xsl:apply-templates select="." mode="list"/>
10927
+ <xsl:apply-templates select="." mode="list">
10928
+ <xsl:with-param name="indent" select="$indent"/>
10929
+ </xsl:apply-templates>
10709
10930
  </fo:block>
10710
10931
 
10711
10932
  </xsl:otherwise>
@@ -10790,6 +11011,13 @@
10790
11011
  </xsl:template>
10791
11012
 
10792
11013
  <xsl:template match="*[local-name()='li']">
11014
+ <xsl:param name="indent">0</xsl:param>
11015
+ <!-- <fo:list-item xsl:use-attribute-sets="list-item-style">
11016
+ <fo:list-item-label end-indent="label-end()"><fo:block>x</fo:block></fo:list-item-label>
11017
+ <fo:list-item-body start-indent="body-start()" xsl:use-attribute-sets="list-item-body-style">
11018
+ <fo:block>debug li indent=<xsl:value-of select="$indent"/></fo:block>
11019
+ </fo:list-item-body>
11020
+ </fo:list-item> -->
10793
11021
  <fo:list-item xsl:use-attribute-sets="list-item-style">
10794
11022
  <xsl:copy-of select="@id"/>
10795
11023
 
@@ -10814,7 +11042,9 @@
10814
11042
 
10815
11043
  <xsl:call-template name="refine_list-item-body-style"/>
10816
11044
 
10817
- <xsl:apply-templates/>
11045
+ <xsl:apply-templates>
11046
+ <xsl:with-param name="indent" select="$indent"/>
11047
+ </xsl:apply-templates>
10818
11048
 
10819
11049
  <!-- <xsl:apply-templates select="node()[not(local-name() = 'note')]" />
10820
11050
 
@@ -12975,6 +13205,4 @@
12975
13205
  </xsl:if>
12976
13206
  </xsl:template>
12977
13207
 
12978
- <!-- update -->
12979
-
12980
13208
  </xsl:stylesheet>