metanorma-itu 2.4.5 → 2.4.6

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: 0fd02439a7273b07f0c7797c761f1768a9428f2a80c4b7447d548a262e688eab
4
- data.tar.gz: 9fe9932561c17d4a2cb2073413d2375ef731a1e75f9e8517360859e2517b5cf5
3
+ metadata.gz: 91cd82cff5c818b51f7b3a257dd2533a1057d6faed4e1c2c591c7fb944e74cfc
4
+ data.tar.gz: 2f9db6fa8a8612aa83bd2d3bb2a3777db26283cf02c4e6ec41489cd0de421d1a
5
5
  SHA512:
6
- metadata.gz: 902af514ab03d5bc4cd9ee9b10f66240469c3808e5fb2cc6debaca0bdd2b1d91077cafb806a1a9557e9d77bad2d8077e052afa7d1308131a1e5bd2b95dfeb329
7
- data.tar.gz: 5e82257b4ae5b9ddcf67bb585978d401c0725a156ed89701c496a3da8e65bab725e7a3c4e50bc7c05e2f3f991e830c9c47e4b7a1d73ecced54236b27ed92512b
6
+ metadata.gz: d93267fcd68894e6dcd510d2dfcd33501fb9b8c8c9aad1dfa22288a5c29aecb6205587dbe884dc00265dafdbb3eafa79d1756e6cad2aacff4d098ed02cd347e7
7
+ data.tar.gz: 2c169c94d9fa26fad7dd1d632801bc0a5844a9f87ef5ac4ce0010247124b323539a61571fa76663c2e538e38960d09e04a499f0f3d71f5ff75f33b881f63fa9d
@@ -2747,17 +2747,30 @@
2747
2747
  <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 -->
2748
2748
 
2749
2749
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
2750
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
2750
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
2751
2751
  <!-- Example: <tables>
2752
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
2753
- <tbody>
2754
- <tr>
2755
- <td id="tab-symdu_1_1">
2756
- <p_len>6</p_len>
2757
- <p_len>100</p_len> for 2nd paragraph
2758
- <word_len>6</word_len>
2759
- <word_len>20</word_len>
2760
- ...
2752
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
2753
+ <column width_max="39354" width_min="39354"/>
2754
+ <column width_max="75394" width_min="75394"/>
2755
+ <column width_max="108813" width_min="108813"/>
2756
+ <tbody>
2757
+ <tr>
2758
+ <td width_max="39354" width_min="39354">
2759
+ <p_len>39354</p_len>
2760
+ <word_len>39354</word_len>
2761
+ </td>
2762
+
2763
+ OLD:
2764
+ <tables>
2765
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
2766
+ <tbody>
2767
+ <tr>
2768
+ <td id="tab-symdu_1_1">
2769
+ <p_len>6</p_len>
2770
+ <p_len>100</p_len> for 2nd paragraph
2771
+ <word_len>6</word_len>
2772
+ <word_len>20</word_len>
2773
+ ...
2761
2774
  -->
2762
2775
 
2763
2776
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -2977,6 +2990,9 @@
2977
2990
  <xsl:variable name="hair_space"> </xsl:variable>
2978
2991
  <xsl:variable name="en_dash">–</xsl:variable>
2979
2992
  <xsl:variable name="em_dash">—</xsl:variable>
2993
+ <xsl:variable name="cr">&#13;</xsl:variable>
2994
+ <xsl:variable name="lf">
2995
+ </xsl:variable>
2980
2996
 
2981
2997
  <xsl:template name="getTitle">
2982
2998
  <xsl:param name="name"/>
@@ -4670,6 +4686,20 @@
4670
4686
  </xsl:for-each>
4671
4687
  </xsl:template>
4672
4688
 
4689
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
4690
+
4691
+ <xsl:template match="*[local-name()='table']" priority="2">
4692
+ <xsl:choose>
4693
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
4694
+ <xsl:call-template name="table"/>
4695
+ </xsl:when>
4696
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
4697
+ <xsl:otherwise>
4698
+ <xsl:call-template name="table"/>
4699
+ </xsl:otherwise>
4700
+ </xsl:choose>
4701
+ </xsl:template>
4702
+
4673
4703
  <xsl:template match="*[local-name()='table']" name="table">
4674
4704
 
4675
4705
  <xsl:variable name="table-preamble">
@@ -4683,9 +4713,11 @@
4683
4713
  <xsl:variable name="table">
4684
4714
 
4685
4715
  <xsl:variable name="simple-table">
4686
- <xsl:call-template name="getSimpleTable">
4687
- <xsl:with-param name="id" select="@id"/>
4688
- </xsl:call-template>
4716
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
4717
+ <xsl:call-template name="getSimpleTable">
4718
+ <xsl:with-param name="id" select="@id"/>
4719
+ </xsl:call-template>
4720
+ </xsl:if>
4689
4721
  </xsl:variable>
4690
4722
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
4691
4723
 
@@ -4781,9 +4813,9 @@
4781
4813
  </xsl:attribute>
4782
4814
  </xsl:for-each>
4783
4815
 
4784
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
4816
+ <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']"/>
4785
4817
  <xsl:if test="$isNoteOrFnExist = 'true'">
4786
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4818
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
4787
4819
  </xsl:if>
4788
4820
 
4789
4821
  <xsl:choose>
@@ -4936,9 +4968,28 @@
4936
4968
 
4937
4969
  </fo:block>
4938
4970
 
4971
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
4972
+ <xsl:if test="$continued = 'true'">
4973
+ <fo:block text-align="right">
4974
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
4975
+ </fo:block>
4976
+ </xsl:if>
4977
+ <!-- </xsl:if> -->
4978
+
4939
4979
  </xsl:if>
4940
4980
  </xsl:template> <!-- table/name -->
4941
4981
 
4982
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
4983
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
4984
+ <xsl:choose>
4985
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
4986
+ <!-- remove CR or LF at start -->
4987
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
4988
+ </xsl:when>
4989
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
4990
+ </xsl:choose>
4991
+ </xsl:template>
4992
+
4942
4993
  <!-- SOURCE: ... -->
4943
4994
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
4944
4995
  <xsl:call-template name="termsource"/>
@@ -5349,7 +5400,7 @@
5349
5400
  <xsl:param name="colwidths"/>
5350
5401
  <xsl:param name="colgroup"/>
5351
5402
 
5352
- <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']"/>
5403
+ <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']"/>
5353
5404
 
5354
5405
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
5355
5406
 
@@ -5431,7 +5482,7 @@
5431
5482
 
5432
5483
  <xsl:apply-templates select="../*[local-name()='p']"/>
5433
5484
  <xsl:apply-templates select="../*[local-name()='dl']"/>
5434
- <xsl:apply-templates select="../*[local-name()='note']"/>
5485
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
5435
5486
  <xsl:apply-templates select="../*[local-name()='example']"/>
5436
5487
  <xsl:apply-templates select="../*[local-name()='source']"/>
5437
5488
 
@@ -5441,7 +5492,7 @@
5441
5492
 
5442
5493
  <!-- horizontal row separator -->
5443
5494
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
5444
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
5495
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
5445
5496
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
5446
5497
 
5447
5498
  <xsl:call-template name="setBordersTableArray"/>
@@ -6150,7 +6201,20 @@
6150
6201
  </xsl:element>
6151
6202
  </xsl:template>
6152
6203
 
6153
- <xsl:template match="*[local-name()='dl']">
6204
+ <!-- for table auto-layout algorithm -->
6205
+ <xsl:template match="*[local-name()='dl']" priority="2">
6206
+ <xsl:choose>
6207
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
6208
+ <xsl:call-template name="dl"/>
6209
+ </xsl:when>
6210
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
6211
+ <xsl:otherwise>
6212
+ <xsl:call-template name="dl"/>
6213
+ </xsl:otherwise>
6214
+ </xsl:choose>
6215
+ </xsl:template>
6216
+
6217
+ <xsl:template match="*[local-name()='dl']" name="dl">
6154
6218
  <xsl:variable name="isAdded" select="@added"/>
6155
6219
  <xsl:variable name="isDeleted" select="@deleted"/>
6156
6220
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -8091,7 +8155,13 @@
8091
8155
  <xsl:value-of select="$language_current_2"/>
8092
8156
  </xsl:when>
8093
8157
  <xsl:otherwise>
8094
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
8158
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
8159
+ <xsl:choose>
8160
+ <xsl:when test="$language_current_3 != ''">
8161
+ <xsl:value-of select="$language_current_3"/>
8162
+ </xsl:when>
8163
+ <xsl:otherwise>en</xsl:otherwise>
8164
+ </xsl:choose>
8095
8165
  </xsl:otherwise>
8096
8166
  </xsl:choose>
8097
8167
  </xsl:otherwise>
@@ -9000,7 +9070,7 @@
9000
9070
  </xsl:when>
9001
9071
  <xsl:otherwise>
9002
9072
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
9003
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
9073
+ <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'])">
9004
9074
 
9005
9075
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
9006
9076
  <xsl:attribute name="width">
@@ -14058,6 +14128,4 @@
14058
14128
  </xsl:if>
14059
14129
  </xsl:template>
14060
14130
 
14061
- <!-- update -->
14062
-
14063
14131
  </xsl:stylesheet>
@@ -2747,17 +2747,30 @@
2747
2747
  <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 -->
2748
2748
 
2749
2749
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
2750
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
2750
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
2751
2751
  <!-- Example: <tables>
2752
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
2753
- <tbody>
2754
- <tr>
2755
- <td id="tab-symdu_1_1">
2756
- <p_len>6</p_len>
2757
- <p_len>100</p_len> for 2nd paragraph
2758
- <word_len>6</word_len>
2759
- <word_len>20</word_len>
2760
- ...
2752
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
2753
+ <column width_max="39354" width_min="39354"/>
2754
+ <column width_max="75394" width_min="75394"/>
2755
+ <column width_max="108813" width_min="108813"/>
2756
+ <tbody>
2757
+ <tr>
2758
+ <td width_max="39354" width_min="39354">
2759
+ <p_len>39354</p_len>
2760
+ <word_len>39354</word_len>
2761
+ </td>
2762
+
2763
+ OLD:
2764
+ <tables>
2765
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
2766
+ <tbody>
2767
+ <tr>
2768
+ <td id="tab-symdu_1_1">
2769
+ <p_len>6</p_len>
2770
+ <p_len>100</p_len> for 2nd paragraph
2771
+ <word_len>6</word_len>
2772
+ <word_len>20</word_len>
2773
+ ...
2761
2774
  -->
2762
2775
 
2763
2776
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -2977,6 +2990,9 @@
2977
2990
  <xsl:variable name="hair_space"> </xsl:variable>
2978
2991
  <xsl:variable name="en_dash">–</xsl:variable>
2979
2992
  <xsl:variable name="em_dash">—</xsl:variable>
2993
+ <xsl:variable name="cr">&#13;</xsl:variable>
2994
+ <xsl:variable name="lf">
2995
+ </xsl:variable>
2980
2996
 
2981
2997
  <xsl:template name="getTitle">
2982
2998
  <xsl:param name="name"/>
@@ -4670,6 +4686,20 @@
4670
4686
  </xsl:for-each>
4671
4687
  </xsl:template>
4672
4688
 
4689
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
4690
+
4691
+ <xsl:template match="*[local-name()='table']" priority="2">
4692
+ <xsl:choose>
4693
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
4694
+ <xsl:call-template name="table"/>
4695
+ </xsl:when>
4696
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
4697
+ <xsl:otherwise>
4698
+ <xsl:call-template name="table"/>
4699
+ </xsl:otherwise>
4700
+ </xsl:choose>
4701
+ </xsl:template>
4702
+
4673
4703
  <xsl:template match="*[local-name()='table']" name="table">
4674
4704
 
4675
4705
  <xsl:variable name="table-preamble">
@@ -4683,9 +4713,11 @@
4683
4713
  <xsl:variable name="table">
4684
4714
 
4685
4715
  <xsl:variable name="simple-table">
4686
- <xsl:call-template name="getSimpleTable">
4687
- <xsl:with-param name="id" select="@id"/>
4688
- </xsl:call-template>
4716
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
4717
+ <xsl:call-template name="getSimpleTable">
4718
+ <xsl:with-param name="id" select="@id"/>
4719
+ </xsl:call-template>
4720
+ </xsl:if>
4689
4721
  </xsl:variable>
4690
4722
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
4691
4723
 
@@ -4781,9 +4813,9 @@
4781
4813
  </xsl:attribute>
4782
4814
  </xsl:for-each>
4783
4815
 
4784
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
4816
+ <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']"/>
4785
4817
  <xsl:if test="$isNoteOrFnExist = 'true'">
4786
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4818
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
4787
4819
  </xsl:if>
4788
4820
 
4789
4821
  <xsl:choose>
@@ -4936,9 +4968,28 @@
4936
4968
 
4937
4969
  </fo:block>
4938
4970
 
4971
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
4972
+ <xsl:if test="$continued = 'true'">
4973
+ <fo:block text-align="right">
4974
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
4975
+ </fo:block>
4976
+ </xsl:if>
4977
+ <!-- </xsl:if> -->
4978
+
4939
4979
  </xsl:if>
4940
4980
  </xsl:template> <!-- table/name -->
4941
4981
 
4982
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
4983
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
4984
+ <xsl:choose>
4985
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
4986
+ <!-- remove CR or LF at start -->
4987
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
4988
+ </xsl:when>
4989
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
4990
+ </xsl:choose>
4991
+ </xsl:template>
4992
+
4942
4993
  <!-- SOURCE: ... -->
4943
4994
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
4944
4995
  <xsl:call-template name="termsource"/>
@@ -5349,7 +5400,7 @@
5349
5400
  <xsl:param name="colwidths"/>
5350
5401
  <xsl:param name="colgroup"/>
5351
5402
 
5352
- <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']"/>
5403
+ <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']"/>
5353
5404
 
5354
5405
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
5355
5406
 
@@ -5431,7 +5482,7 @@
5431
5482
 
5432
5483
  <xsl:apply-templates select="../*[local-name()='p']"/>
5433
5484
  <xsl:apply-templates select="../*[local-name()='dl']"/>
5434
- <xsl:apply-templates select="../*[local-name()='note']"/>
5485
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
5435
5486
  <xsl:apply-templates select="../*[local-name()='example']"/>
5436
5487
  <xsl:apply-templates select="../*[local-name()='source']"/>
5437
5488
 
@@ -5441,7 +5492,7 @@
5441
5492
 
5442
5493
  <!-- horizontal row separator -->
5443
5494
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
5444
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
5495
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
5445
5496
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
5446
5497
 
5447
5498
  <xsl:call-template name="setBordersTableArray"/>
@@ -6150,7 +6201,20 @@
6150
6201
  </xsl:element>
6151
6202
  </xsl:template>
6152
6203
 
6153
- <xsl:template match="*[local-name()='dl']">
6204
+ <!-- for table auto-layout algorithm -->
6205
+ <xsl:template match="*[local-name()='dl']" priority="2">
6206
+ <xsl:choose>
6207
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
6208
+ <xsl:call-template name="dl"/>
6209
+ </xsl:when>
6210
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
6211
+ <xsl:otherwise>
6212
+ <xsl:call-template name="dl"/>
6213
+ </xsl:otherwise>
6214
+ </xsl:choose>
6215
+ </xsl:template>
6216
+
6217
+ <xsl:template match="*[local-name()='dl']" name="dl">
6154
6218
  <xsl:variable name="isAdded" select="@added"/>
6155
6219
  <xsl:variable name="isDeleted" select="@deleted"/>
6156
6220
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -8091,7 +8155,13 @@
8091
8155
  <xsl:value-of select="$language_current_2"/>
8092
8156
  </xsl:when>
8093
8157
  <xsl:otherwise>
8094
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
8158
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
8159
+ <xsl:choose>
8160
+ <xsl:when test="$language_current_3 != ''">
8161
+ <xsl:value-of select="$language_current_3"/>
8162
+ </xsl:when>
8163
+ <xsl:otherwise>en</xsl:otherwise>
8164
+ </xsl:choose>
8095
8165
  </xsl:otherwise>
8096
8166
  </xsl:choose>
8097
8167
  </xsl:otherwise>
@@ -9000,7 +9070,7 @@
9000
9070
  </xsl:when>
9001
9071
  <xsl:otherwise>
9002
9072
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
9003
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
9073
+ <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'])">
9004
9074
 
9005
9075
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
9006
9076
  <xsl:attribute name="width">
@@ -14058,6 +14128,4 @@
14058
14128
  </xsl:if>
14059
14129
  </xsl:template>
14060
14130
 
14061
- <!-- update -->
14062
-
14063
14131
  </xsl:stylesheet>
@@ -2747,17 +2747,30 @@
2747
2747
  <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 -->
2748
2748
 
2749
2749
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
2750
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
2750
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
2751
2751
  <!-- Example: <tables>
2752
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
2753
- <tbody>
2754
- <tr>
2755
- <td id="tab-symdu_1_1">
2756
- <p_len>6</p_len>
2757
- <p_len>100</p_len> for 2nd paragraph
2758
- <word_len>6</word_len>
2759
- <word_len>20</word_len>
2760
- ...
2752
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
2753
+ <column width_max="39354" width_min="39354"/>
2754
+ <column width_max="75394" width_min="75394"/>
2755
+ <column width_max="108813" width_min="108813"/>
2756
+ <tbody>
2757
+ <tr>
2758
+ <td width_max="39354" width_min="39354">
2759
+ <p_len>39354</p_len>
2760
+ <word_len>39354</word_len>
2761
+ </td>
2762
+
2763
+ OLD:
2764
+ <tables>
2765
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
2766
+ <tbody>
2767
+ <tr>
2768
+ <td id="tab-symdu_1_1">
2769
+ <p_len>6</p_len>
2770
+ <p_len>100</p_len> for 2nd paragraph
2771
+ <word_len>6</word_len>
2772
+ <word_len>20</word_len>
2773
+ ...
2761
2774
  -->
2762
2775
 
2763
2776
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -2977,6 +2990,9 @@
2977
2990
  <xsl:variable name="hair_space"> </xsl:variable>
2978
2991
  <xsl:variable name="en_dash">–</xsl:variable>
2979
2992
  <xsl:variable name="em_dash">—</xsl:variable>
2993
+ <xsl:variable name="cr">&#13;</xsl:variable>
2994
+ <xsl:variable name="lf">
2995
+ </xsl:variable>
2980
2996
 
2981
2997
  <xsl:template name="getTitle">
2982
2998
  <xsl:param name="name"/>
@@ -4670,6 +4686,20 @@
4670
4686
  </xsl:for-each>
4671
4687
  </xsl:template>
4672
4688
 
4689
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
4690
+
4691
+ <xsl:template match="*[local-name()='table']" priority="2">
4692
+ <xsl:choose>
4693
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
4694
+ <xsl:call-template name="table"/>
4695
+ </xsl:when>
4696
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
4697
+ <xsl:otherwise>
4698
+ <xsl:call-template name="table"/>
4699
+ </xsl:otherwise>
4700
+ </xsl:choose>
4701
+ </xsl:template>
4702
+
4673
4703
  <xsl:template match="*[local-name()='table']" name="table">
4674
4704
 
4675
4705
  <xsl:variable name="table-preamble">
@@ -4683,9 +4713,11 @@
4683
4713
  <xsl:variable name="table">
4684
4714
 
4685
4715
  <xsl:variable name="simple-table">
4686
- <xsl:call-template name="getSimpleTable">
4687
- <xsl:with-param name="id" select="@id"/>
4688
- </xsl:call-template>
4716
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
4717
+ <xsl:call-template name="getSimpleTable">
4718
+ <xsl:with-param name="id" select="@id"/>
4719
+ </xsl:call-template>
4720
+ </xsl:if>
4689
4721
  </xsl:variable>
4690
4722
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
4691
4723
 
@@ -4781,9 +4813,9 @@
4781
4813
  </xsl:attribute>
4782
4814
  </xsl:for-each>
4783
4815
 
4784
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
4816
+ <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']"/>
4785
4817
  <xsl:if test="$isNoteOrFnExist = 'true'">
4786
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4818
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
4787
4819
  </xsl:if>
4788
4820
 
4789
4821
  <xsl:choose>
@@ -4936,9 +4968,28 @@
4936
4968
 
4937
4969
  </fo:block>
4938
4970
 
4971
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
4972
+ <xsl:if test="$continued = 'true'">
4973
+ <fo:block text-align="right">
4974
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
4975
+ </fo:block>
4976
+ </xsl:if>
4977
+ <!-- </xsl:if> -->
4978
+
4939
4979
  </xsl:if>
4940
4980
  </xsl:template> <!-- table/name -->
4941
4981
 
4982
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
4983
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
4984
+ <xsl:choose>
4985
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
4986
+ <!-- remove CR or LF at start -->
4987
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
4988
+ </xsl:when>
4989
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
4990
+ </xsl:choose>
4991
+ </xsl:template>
4992
+
4942
4993
  <!-- SOURCE: ... -->
4943
4994
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
4944
4995
  <xsl:call-template name="termsource"/>
@@ -5349,7 +5400,7 @@
5349
5400
  <xsl:param name="colwidths"/>
5350
5401
  <xsl:param name="colgroup"/>
5351
5402
 
5352
- <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']"/>
5403
+ <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']"/>
5353
5404
 
5354
5405
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
5355
5406
 
@@ -5431,7 +5482,7 @@
5431
5482
 
5432
5483
  <xsl:apply-templates select="../*[local-name()='p']"/>
5433
5484
  <xsl:apply-templates select="../*[local-name()='dl']"/>
5434
- <xsl:apply-templates select="../*[local-name()='note']"/>
5485
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
5435
5486
  <xsl:apply-templates select="../*[local-name()='example']"/>
5436
5487
  <xsl:apply-templates select="../*[local-name()='source']"/>
5437
5488
 
@@ -5441,7 +5492,7 @@
5441
5492
 
5442
5493
  <!-- horizontal row separator -->
5443
5494
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
5444
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
5495
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
5445
5496
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
5446
5497
 
5447
5498
  <xsl:call-template name="setBordersTableArray"/>
@@ -6150,7 +6201,20 @@
6150
6201
  </xsl:element>
6151
6202
  </xsl:template>
6152
6203
 
6153
- <xsl:template match="*[local-name()='dl']">
6204
+ <!-- for table auto-layout algorithm -->
6205
+ <xsl:template match="*[local-name()='dl']" priority="2">
6206
+ <xsl:choose>
6207
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
6208
+ <xsl:call-template name="dl"/>
6209
+ </xsl:when>
6210
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
6211
+ <xsl:otherwise>
6212
+ <xsl:call-template name="dl"/>
6213
+ </xsl:otherwise>
6214
+ </xsl:choose>
6215
+ </xsl:template>
6216
+
6217
+ <xsl:template match="*[local-name()='dl']" name="dl">
6154
6218
  <xsl:variable name="isAdded" select="@added"/>
6155
6219
  <xsl:variable name="isDeleted" select="@deleted"/>
6156
6220
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -8091,7 +8155,13 @@
8091
8155
  <xsl:value-of select="$language_current_2"/>
8092
8156
  </xsl:when>
8093
8157
  <xsl:otherwise>
8094
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
8158
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
8159
+ <xsl:choose>
8160
+ <xsl:when test="$language_current_3 != ''">
8161
+ <xsl:value-of select="$language_current_3"/>
8162
+ </xsl:when>
8163
+ <xsl:otherwise>en</xsl:otherwise>
8164
+ </xsl:choose>
8095
8165
  </xsl:otherwise>
8096
8166
  </xsl:choose>
8097
8167
  </xsl:otherwise>
@@ -9000,7 +9070,7 @@
9000
9070
  </xsl:when>
9001
9071
  <xsl:otherwise>
9002
9072
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
9003
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
9073
+ <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'])">
9004
9074
 
9005
9075
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
9006
9076
  <xsl:attribute name="width">
@@ -14058,6 +14128,4 @@
14058
14128
  </xsl:if>
14059
14129
  </xsl:template>
14060
14130
 
14061
- <!-- update -->
14062
-
14063
14131
  </xsl:stylesheet>