metanorma-un 0.12.6 → 0.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4afd0f6a635e8ed3383d14ddd21737aafbb61f4d5b1e47eb683936f82d5fc37
4
- data.tar.gz: 4d11b23a6f99532384d12355db81fad52c020e1ab8495d0bb18313af8398e98b
3
+ metadata.gz: 9f97cc174e68fe01d91352126efebfeb9c2030b2a642b6551d806ad5dc0f346b
4
+ data.tar.gz: 96714bce764a880e0d47735c60038770c99f3bdc8f906e2b75306e29701d9086
5
5
  SHA512:
6
- metadata.gz: 7a5bdeb035b8f335eb6637d69664926ffa42d74c5d7aabddda3e403e418e996c6efe44c1945ea8d87f6cddcab52257585e540e9eaffedc371c726ea21312e457
7
- data.tar.gz: fbe220b5d596c020f3f16d03a67739bf9c5fed3b35617026a442ec52d0ccfb7afe1ef4d86a12c1d2c9d9f40b863b430f18d10ff1f6a4645a949e69f879cd5153
6
+ metadata.gz: 9d4cf529ec4a58d65533e056b4bc184230ac03d6c404211e729ee073d8061a2b1e81f866296dc2d4d42b1f495d95a197f2da8897a3d10984f0ca0b5cce06a602
7
+ data.tar.gz: 7c5cddf6314c362aa22493e9dae7e93d37dda6d63f01fbd638ca01de351328a2e95d08e816d284ff52619f8e951e137fdfe211baa51baf1c71fefc2041c5f426
@@ -745,17 +745,30 @@
745
745
  <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 -->
746
746
 
747
747
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
748
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
748
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
749
749
  <!-- Example: <tables>
750
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
751
- <tbody>
752
- <tr>
753
- <td id="tab-symdu_1_1">
754
- <p_len>6</p_len>
755
- <p_len>100</p_len> for 2nd paragraph
756
- <word_len>6</word_len>
757
- <word_len>20</word_len>
758
- ...
750
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
751
+ <column width_max="39354" width_min="39354"/>
752
+ <column width_max="75394" width_min="75394"/>
753
+ <column width_max="108813" width_min="108813"/>
754
+ <tbody>
755
+ <tr>
756
+ <td width_max="39354" width_min="39354">
757
+ <p_len>39354</p_len>
758
+ <word_len>39354</word_len>
759
+ </td>
760
+
761
+ OLD:
762
+ <tables>
763
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
764
+ <tbody>
765
+ <tr>
766
+ <td id="tab-symdu_1_1">
767
+ <p_len>6</p_len>
768
+ <p_len>100</p_len> for 2nd paragraph
769
+ <word_len>6</word_len>
770
+ <word_len>20</word_len>
771
+ ...
759
772
  -->
760
773
 
761
774
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -975,6 +988,9 @@
975
988
  <xsl:variable name="hair_space"> </xsl:variable>
976
989
  <xsl:variable name="en_dash">–</xsl:variable>
977
990
  <xsl:variable name="em_dash">—</xsl:variable>
991
+ <xsl:variable name="cr">&#13;</xsl:variable>
992
+ <xsl:variable name="lf">
993
+ </xsl:variable>
978
994
 
979
995
  <xsl:template name="getTitle">
980
996
  <xsl:param name="name"/>
@@ -2616,6 +2632,20 @@
2616
2632
  </xsl:for-each>
2617
2633
  </xsl:template>
2618
2634
 
2635
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
2636
+
2637
+ <xsl:template match="*[local-name()='table']" priority="2">
2638
+ <xsl:choose>
2639
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
2640
+ <xsl:call-template name="table"/>
2641
+ </xsl:when>
2642
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
2643
+ <xsl:otherwise>
2644
+ <xsl:call-template name="table"/>
2645
+ </xsl:otherwise>
2646
+ </xsl:choose>
2647
+ </xsl:template>
2648
+
2619
2649
  <xsl:template match="*[local-name()='table']" name="table">
2620
2650
 
2621
2651
  <xsl:variable name="table-preamble">
@@ -2625,9 +2655,11 @@
2625
2655
  <xsl:variable name="table">
2626
2656
 
2627
2657
  <xsl:variable name="simple-table">
2628
- <xsl:call-template name="getSimpleTable">
2629
- <xsl:with-param name="id" select="@id"/>
2630
- </xsl:call-template>
2658
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
2659
+ <xsl:call-template name="getSimpleTable">
2660
+ <xsl:with-param name="id" select="@id"/>
2661
+ </xsl:call-template>
2662
+ </xsl:if>
2631
2663
  </xsl:variable>
2632
2664
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2633
2665
 
@@ -2729,9 +2761,9 @@
2729
2761
  </xsl:attribute>
2730
2762
  </xsl:for-each>
2731
2763
 
2732
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2764
+ <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']"/>
2733
2765
  <xsl:if test="$isNoteOrFnExist = 'true'">
2734
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2766
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2735
2767
  </xsl:if>
2736
2768
 
2737
2769
  <xsl:choose>
@@ -2880,9 +2912,28 @@
2880
2912
 
2881
2913
  </fo:block>
2882
2914
 
2915
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
2916
+ <xsl:if test="$continued = 'true'">
2917
+ <fo:block text-align="right">
2918
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
2919
+ </fo:block>
2920
+ </xsl:if>
2921
+ <!-- </xsl:if> -->
2922
+
2883
2923
  </xsl:if>
2884
2924
  </xsl:template> <!-- table/name -->
2885
2925
 
2926
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
2927
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
2928
+ <xsl:choose>
2929
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
2930
+ <!-- remove CR or LF at start -->
2931
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
2932
+ </xsl:when>
2933
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2934
+ </xsl:choose>
2935
+ </xsl:template>
2936
+
2886
2937
  <!-- SOURCE: ... -->
2887
2938
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2888
2939
  <xsl:call-template name="termsource"/>
@@ -3293,7 +3344,7 @@
3293
3344
  <xsl:param name="colwidths"/>
3294
3345
  <xsl:param name="colgroup"/>
3295
3346
 
3296
- <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']"/>
3347
+ <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']"/>
3297
3348
 
3298
3349
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3299
3350
 
@@ -3365,7 +3416,7 @@
3365
3416
 
3366
3417
  <xsl:apply-templates select="../*[local-name()='p']"/>
3367
3418
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3368
- <xsl:apply-templates select="../*[local-name()='note']"/>
3419
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
3369
3420
  <xsl:apply-templates select="../*[local-name()='example']"/>
3370
3421
  <xsl:apply-templates select="../*[local-name()='source']"/>
3371
3422
 
@@ -3375,7 +3426,7 @@
3375
3426
 
3376
3427
  <!-- horizontal row separator -->
3377
3428
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3378
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3429
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3379
3430
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3380
3431
 
3381
3432
  <xsl:call-template name="setBordersTableArray"/>
@@ -4044,7 +4095,20 @@
4044
4095
  <!-- Definition List -->
4045
4096
  <!-- ===================== -->
4046
4097
 
4047
- <xsl:template match="*[local-name()='dl']">
4098
+ <!-- for table auto-layout algorithm -->
4099
+ <xsl:template match="*[local-name()='dl']" priority="2">
4100
+ <xsl:choose>
4101
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
4102
+ <xsl:call-template name="dl"/>
4103
+ </xsl:when>
4104
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
4105
+ <xsl:otherwise>
4106
+ <xsl:call-template name="dl"/>
4107
+ </xsl:otherwise>
4108
+ </xsl:choose>
4109
+ </xsl:template>
4110
+
4111
+ <xsl:template match="*[local-name()='dl']" name="dl">
4048
4112
  <xsl:variable name="isAdded" select="@added"/>
4049
4113
  <xsl:variable name="isDeleted" select="@deleted"/>
4050
4114
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -5973,7 +6037,13 @@
5973
6037
  <xsl:value-of select="$language_current_2"/>
5974
6038
  </xsl:when>
5975
6039
  <xsl:otherwise>
5976
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
6040
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
6041
+ <xsl:choose>
6042
+ <xsl:when test="$language_current_3 != ''">
6043
+ <xsl:value-of select="$language_current_3"/>
6044
+ </xsl:when>
6045
+ <xsl:otherwise>en</xsl:otherwise>
6046
+ </xsl:choose>
5977
6047
  </xsl:otherwise>
5978
6048
  </xsl:choose>
5979
6049
  </xsl:otherwise>
@@ -6887,7 +6957,7 @@
6887
6957
  </xsl:when>
6888
6958
  <xsl:otherwise>
6889
6959
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
6890
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
6960
+ <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'])">
6891
6961
 
6892
6962
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
6893
6963
  <xsl:attribute name="width">
@@ -11899,6 +11969,4 @@
11899
11969
  </xsl:if>
11900
11970
  </xsl:template>
11901
11971
 
11902
- <!-- update -->
11903
-
11904
11972
  </xsl:stylesheet>
@@ -745,17 +745,30 @@
745
745
  <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 -->
746
746
 
747
747
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
748
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
748
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
749
749
  <!-- Example: <tables>
750
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
751
- <tbody>
752
- <tr>
753
- <td id="tab-symdu_1_1">
754
- <p_len>6</p_len>
755
- <p_len>100</p_len> for 2nd paragraph
756
- <word_len>6</word_len>
757
- <word_len>20</word_len>
758
- ...
750
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
751
+ <column width_max="39354" width_min="39354"/>
752
+ <column width_max="75394" width_min="75394"/>
753
+ <column width_max="108813" width_min="108813"/>
754
+ <tbody>
755
+ <tr>
756
+ <td width_max="39354" width_min="39354">
757
+ <p_len>39354</p_len>
758
+ <word_len>39354</word_len>
759
+ </td>
760
+
761
+ OLD:
762
+ <tables>
763
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
764
+ <tbody>
765
+ <tr>
766
+ <td id="tab-symdu_1_1">
767
+ <p_len>6</p_len>
768
+ <p_len>100</p_len> for 2nd paragraph
769
+ <word_len>6</word_len>
770
+ <word_len>20</word_len>
771
+ ...
759
772
  -->
760
773
 
761
774
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -975,6 +988,9 @@
975
988
  <xsl:variable name="hair_space"> </xsl:variable>
976
989
  <xsl:variable name="en_dash">–</xsl:variable>
977
990
  <xsl:variable name="em_dash">—</xsl:variable>
991
+ <xsl:variable name="cr">&#13;</xsl:variable>
992
+ <xsl:variable name="lf">
993
+ </xsl:variable>
978
994
 
979
995
  <xsl:template name="getTitle">
980
996
  <xsl:param name="name"/>
@@ -2616,6 +2632,20 @@
2616
2632
  </xsl:for-each>
2617
2633
  </xsl:template>
2618
2634
 
2635
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
2636
+
2637
+ <xsl:template match="*[local-name()='table']" priority="2">
2638
+ <xsl:choose>
2639
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
2640
+ <xsl:call-template name="table"/>
2641
+ </xsl:when>
2642
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
2643
+ <xsl:otherwise>
2644
+ <xsl:call-template name="table"/>
2645
+ </xsl:otherwise>
2646
+ </xsl:choose>
2647
+ </xsl:template>
2648
+
2619
2649
  <xsl:template match="*[local-name()='table']" name="table">
2620
2650
 
2621
2651
  <xsl:variable name="table-preamble">
@@ -2625,9 +2655,11 @@
2625
2655
  <xsl:variable name="table">
2626
2656
 
2627
2657
  <xsl:variable name="simple-table">
2628
- <xsl:call-template name="getSimpleTable">
2629
- <xsl:with-param name="id" select="@id"/>
2630
- </xsl:call-template>
2658
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
2659
+ <xsl:call-template name="getSimpleTable">
2660
+ <xsl:with-param name="id" select="@id"/>
2661
+ </xsl:call-template>
2662
+ </xsl:if>
2631
2663
  </xsl:variable>
2632
2664
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2633
2665
 
@@ -2729,9 +2761,9 @@
2729
2761
  </xsl:attribute>
2730
2762
  </xsl:for-each>
2731
2763
 
2732
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2764
+ <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']"/>
2733
2765
  <xsl:if test="$isNoteOrFnExist = 'true'">
2734
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2766
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2735
2767
  </xsl:if>
2736
2768
 
2737
2769
  <xsl:choose>
@@ -2880,9 +2912,28 @@
2880
2912
 
2881
2913
  </fo:block>
2882
2914
 
2915
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
2916
+ <xsl:if test="$continued = 'true'">
2917
+ <fo:block text-align="right">
2918
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
2919
+ </fo:block>
2920
+ </xsl:if>
2921
+ <!-- </xsl:if> -->
2922
+
2883
2923
  </xsl:if>
2884
2924
  </xsl:template> <!-- table/name -->
2885
2925
 
2926
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
2927
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
2928
+ <xsl:choose>
2929
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
2930
+ <!-- remove CR or LF at start -->
2931
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
2932
+ </xsl:when>
2933
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2934
+ </xsl:choose>
2935
+ </xsl:template>
2936
+
2886
2937
  <!-- SOURCE: ... -->
2887
2938
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2888
2939
  <xsl:call-template name="termsource"/>
@@ -3293,7 +3344,7 @@
3293
3344
  <xsl:param name="colwidths"/>
3294
3345
  <xsl:param name="colgroup"/>
3295
3346
 
3296
- <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']"/>
3347
+ <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']"/>
3297
3348
 
3298
3349
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3299
3350
 
@@ -3365,7 +3416,7 @@
3365
3416
 
3366
3417
  <xsl:apply-templates select="../*[local-name()='p']"/>
3367
3418
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3368
- <xsl:apply-templates select="../*[local-name()='note']"/>
3419
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
3369
3420
  <xsl:apply-templates select="../*[local-name()='example']"/>
3370
3421
  <xsl:apply-templates select="../*[local-name()='source']"/>
3371
3422
 
@@ -3375,7 +3426,7 @@
3375
3426
 
3376
3427
  <!-- horizontal row separator -->
3377
3428
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3378
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3429
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3379
3430
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3380
3431
 
3381
3432
  <xsl:call-template name="setBordersTableArray"/>
@@ -4044,7 +4095,20 @@
4044
4095
  <!-- Definition List -->
4045
4096
  <!-- ===================== -->
4046
4097
 
4047
- <xsl:template match="*[local-name()='dl']">
4098
+ <!-- for table auto-layout algorithm -->
4099
+ <xsl:template match="*[local-name()='dl']" priority="2">
4100
+ <xsl:choose>
4101
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
4102
+ <xsl:call-template name="dl"/>
4103
+ </xsl:when>
4104
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
4105
+ <xsl:otherwise>
4106
+ <xsl:call-template name="dl"/>
4107
+ </xsl:otherwise>
4108
+ </xsl:choose>
4109
+ </xsl:template>
4110
+
4111
+ <xsl:template match="*[local-name()='dl']" name="dl">
4048
4112
  <xsl:variable name="isAdded" select="@added"/>
4049
4113
  <xsl:variable name="isDeleted" select="@deleted"/>
4050
4114
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -5973,7 +6037,13 @@
5973
6037
  <xsl:value-of select="$language_current_2"/>
5974
6038
  </xsl:when>
5975
6039
  <xsl:otherwise>
5976
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
6040
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
6041
+ <xsl:choose>
6042
+ <xsl:when test="$language_current_3 != ''">
6043
+ <xsl:value-of select="$language_current_3"/>
6044
+ </xsl:when>
6045
+ <xsl:otherwise>en</xsl:otherwise>
6046
+ </xsl:choose>
5977
6047
  </xsl:otherwise>
5978
6048
  </xsl:choose>
5979
6049
  </xsl:otherwise>
@@ -6887,7 +6957,7 @@
6887
6957
  </xsl:when>
6888
6958
  <xsl:otherwise>
6889
6959
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
6890
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
6960
+ <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'])">
6891
6961
 
6892
6962
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
6893
6963
  <xsl:attribute name="width">
@@ -11899,6 +11969,4 @@
11899
11969
  </xsl:if>
11900
11970
  </xsl:template>
11901
11971
 
11902
- <!-- update -->
11903
-
11904
11972
  </xsl:stylesheet>
@@ -851,17 +851,30 @@
851
851
  <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 -->
852
852
 
853
853
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
854
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
854
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
855
855
  <!-- Example: <tables>
856
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
857
- <tbody>
858
- <tr>
859
- <td id="tab-symdu_1_1">
860
- <p_len>6</p_len>
861
- <p_len>100</p_len> for 2nd paragraph
862
- <word_len>6</word_len>
863
- <word_len>20</word_len>
864
- ...
856
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
857
+ <column width_max="39354" width_min="39354"/>
858
+ <column width_max="75394" width_min="75394"/>
859
+ <column width_max="108813" width_min="108813"/>
860
+ <tbody>
861
+ <tr>
862
+ <td width_max="39354" width_min="39354">
863
+ <p_len>39354</p_len>
864
+ <word_len>39354</word_len>
865
+ </td>
866
+
867
+ OLD:
868
+ <tables>
869
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
870
+ <tbody>
871
+ <tr>
872
+ <td id="tab-symdu_1_1">
873
+ <p_len>6</p_len>
874
+ <p_len>100</p_len> for 2nd paragraph
875
+ <word_len>6</word_len>
876
+ <word_len>20</word_len>
877
+ ...
865
878
  -->
866
879
 
867
880
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -1081,6 +1094,9 @@
1081
1094
  <xsl:variable name="hair_space"> </xsl:variable>
1082
1095
  <xsl:variable name="en_dash">–</xsl:variable>
1083
1096
  <xsl:variable name="em_dash">—</xsl:variable>
1097
+ <xsl:variable name="cr">&#13;</xsl:variable>
1098
+ <xsl:variable name="lf">
1099
+ </xsl:variable>
1084
1100
 
1085
1101
  <xsl:template name="getTitle">
1086
1102
  <xsl:param name="name"/>
@@ -2747,6 +2763,20 @@
2747
2763
  </xsl:for-each>
2748
2764
  </xsl:template>
2749
2765
 
2766
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
2767
+
2768
+ <xsl:template match="*[local-name()='table']" priority="2">
2769
+ <xsl:choose>
2770
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
2771
+ <xsl:call-template name="table"/>
2772
+ </xsl:when>
2773
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
2774
+ <xsl:otherwise>
2775
+ <xsl:call-template name="table"/>
2776
+ </xsl:otherwise>
2777
+ </xsl:choose>
2778
+ </xsl:template>
2779
+
2750
2780
  <xsl:template match="*[local-name()='table']" name="table">
2751
2781
 
2752
2782
  <xsl:variable name="table-preamble">
@@ -2756,9 +2786,11 @@
2756
2786
  <xsl:variable name="table">
2757
2787
 
2758
2788
  <xsl:variable name="simple-table">
2759
- <xsl:call-template name="getSimpleTable">
2760
- <xsl:with-param name="id" select="@id"/>
2761
- </xsl:call-template>
2789
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
2790
+ <xsl:call-template name="getSimpleTable">
2791
+ <xsl:with-param name="id" select="@id"/>
2792
+ </xsl:call-template>
2793
+ </xsl:if>
2762
2794
  </xsl:variable>
2763
2795
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2764
2796
 
@@ -2860,9 +2892,9 @@
2860
2892
  </xsl:attribute>
2861
2893
  </xsl:for-each>
2862
2894
 
2863
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2895
+ <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']"/>
2864
2896
  <xsl:if test="$isNoteOrFnExist = 'true'">
2865
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2897
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2866
2898
  </xsl:if>
2867
2899
 
2868
2900
  <xsl:choose>
@@ -3011,9 +3043,28 @@
3011
3043
 
3012
3044
  </fo:block>
3013
3045
 
3046
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
3047
+ <xsl:if test="$continued = 'true'">
3048
+ <fo:block text-align="right">
3049
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
3050
+ </fo:block>
3051
+ </xsl:if>
3052
+ <!-- </xsl:if> -->
3053
+
3014
3054
  </xsl:if>
3015
3055
  </xsl:template> <!-- table/name -->
3016
3056
 
3057
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
3058
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
3059
+ <xsl:choose>
3060
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
3061
+ <!-- remove CR or LF at start -->
3062
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
3063
+ </xsl:when>
3064
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
3065
+ </xsl:choose>
3066
+ </xsl:template>
3067
+
3017
3068
  <!-- SOURCE: ... -->
3018
3069
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
3019
3070
  <xsl:call-template name="termsource"/>
@@ -3424,7 +3475,7 @@
3424
3475
  <xsl:param name="colwidths"/>
3425
3476
  <xsl:param name="colgroup"/>
3426
3477
 
3427
- <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']"/>
3478
+ <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']"/>
3428
3479
 
3429
3480
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3430
3481
 
@@ -3496,7 +3547,7 @@
3496
3547
 
3497
3548
  <xsl:apply-templates select="../*[local-name()='p']"/>
3498
3549
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3499
- <xsl:apply-templates select="../*[local-name()='note']"/>
3550
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
3500
3551
  <xsl:apply-templates select="../*[local-name()='example']"/>
3501
3552
  <xsl:apply-templates select="../*[local-name()='source']"/>
3502
3553
 
@@ -3506,7 +3557,7 @@
3506
3557
 
3507
3558
  <!-- horizontal row separator -->
3508
3559
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3509
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3560
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3510
3561
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3511
3562
 
3512
3563
  <xsl:call-template name="setBordersTableArray"/>
@@ -4171,7 +4222,20 @@
4171
4222
  <!-- Definition List -->
4172
4223
  <!-- ===================== -->
4173
4224
 
4174
- <xsl:template match="*[local-name()='dl']">
4225
+ <!-- for table auto-layout algorithm -->
4226
+ <xsl:template match="*[local-name()='dl']" priority="2">
4227
+ <xsl:choose>
4228
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
4229
+ <xsl:call-template name="dl"/>
4230
+ </xsl:when>
4231
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
4232
+ <xsl:otherwise>
4233
+ <xsl:call-template name="dl"/>
4234
+ </xsl:otherwise>
4235
+ </xsl:choose>
4236
+ </xsl:template>
4237
+
4238
+ <xsl:template match="*[local-name()='dl']" name="dl">
4175
4239
  <xsl:variable name="isAdded" select="@added"/>
4176
4240
  <xsl:variable name="isDeleted" select="@deleted"/>
4177
4241
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -6100,7 +6164,13 @@
6100
6164
  <xsl:value-of select="$language_current_2"/>
6101
6165
  </xsl:when>
6102
6166
  <xsl:otherwise>
6103
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
6167
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
6168
+ <xsl:choose>
6169
+ <xsl:when test="$language_current_3 != ''">
6170
+ <xsl:value-of select="$language_current_3"/>
6171
+ </xsl:when>
6172
+ <xsl:otherwise>en</xsl:otherwise>
6173
+ </xsl:choose>
6104
6174
  </xsl:otherwise>
6105
6175
  </xsl:choose>
6106
6176
  </xsl:otherwise>
@@ -7014,7 +7084,7 @@
7014
7084
  </xsl:when>
7015
7085
  <xsl:otherwise>
7016
7086
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
7017
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7087
+ <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'])">
7018
7088
 
7019
7089
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
7020
7090
  <xsl:attribute name="width">
@@ -12027,6 +12097,4 @@
12027
12097
  </xsl:if>
12028
12098
  </xsl:template>
12029
12099
 
12030
- <!-- update -->
12031
-
12032
12100
  </xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.12.6".freeze
3
+ VERSION = "0.12.7".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.6
4
+ version: 0.12.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-25 00:00:00.000000000 Z
11
+ date: 2024-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639