metanorma-bipm 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: 6592a6d50612ecdcad85206a712f990e3b7331000757d0ea1cfff641281a91b2
4
- data.tar.gz: 6daf81c91bf2ce643bc7bd488fc99c5cb1a68deed8ddfa2bcb51aec52558902b
3
+ metadata.gz: 79ddb94cee8f395735e1b4644c623b81e9522c33f4172b4372c0dfe9b19f0365
4
+ data.tar.gz: b064eeda4ff1cfbb355f11094d75e576add051310437e9e03ba60547422cac09
5
5
  SHA512:
6
- metadata.gz: d35169d2b8224ccf4efc95c155db2981714536db84a40a066ee5824cc92e8d06d27f8f24138e6211bbeccc8a7bf238689a79df41ca81e18217fd4a977919ccf1
7
- data.tar.gz: 8d2d87d8aa5caf10f3435cfc46005efafa598befeeb7937662d067e3c2a361535e70c6090754ae6f88799d3d2c8f1b80375ed294bfe26a88d6a89ac7c1b20fc9
6
+ metadata.gz: 6a17ed61270f09965d580af5e408aca95060f0683bd6d831691f3e05148d6ca7fc2a149ebf66e8794c8cc7dc0ba65060afb04edd900596289f77c6f4e6ac6a1c
7
+ data.tar.gz: 7a3ec186afaa3e10b76398e4a2d3f32e49709465929a8931b39add40c7e76b674ee141e35f9c8a8cc91ee11dc3ead4c7f7040bf157ceecb010b83b3c346316fc
@@ -3883,17 +3883,30 @@
3883
3883
  <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 -->
3884
3884
 
3885
3885
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
3886
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3886
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3887
3887
  <!-- Example: <tables>
3888
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3889
- <tbody>
3890
- <tr>
3891
- <td id="tab-symdu_1_1">
3892
- <p_len>6</p_len>
3893
- <p_len>100</p_len> for 2nd paragraph
3894
- <word_len>6</word_len>
3895
- <word_len>20</word_len>
3896
- ...
3888
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
3889
+ <column width_max="39354" width_min="39354"/>
3890
+ <column width_max="75394" width_min="75394"/>
3891
+ <column width_max="108813" width_min="108813"/>
3892
+ <tbody>
3893
+ <tr>
3894
+ <td width_max="39354" width_min="39354">
3895
+ <p_len>39354</p_len>
3896
+ <word_len>39354</word_len>
3897
+ </td>
3898
+
3899
+ OLD:
3900
+ <tables>
3901
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3902
+ <tbody>
3903
+ <tr>
3904
+ <td id="tab-symdu_1_1">
3905
+ <p_len>6</p_len>
3906
+ <p_len>100</p_len> for 2nd paragraph
3907
+ <word_len>6</word_len>
3908
+ <word_len>20</word_len>
3909
+ ...
3897
3910
  -->
3898
3911
 
3899
3912
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -4117,6 +4130,9 @@
4117
4130
  <xsl:variable name="hair_space"> </xsl:variable>
4118
4131
  <xsl:variable name="en_dash">–</xsl:variable>
4119
4132
  <xsl:variable name="em_dash">—</xsl:variable>
4133
+ <xsl:variable name="cr">&#13;</xsl:variable>
4134
+ <xsl:variable name="lf">
4135
+ </xsl:variable>
4120
4136
 
4121
4137
  <xsl:template name="getTitle">
4122
4138
  <xsl:param name="name"/>
@@ -5819,6 +5835,20 @@
5819
5835
  </xsl:for-each>
5820
5836
  </xsl:template>
5821
5837
 
5838
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
5839
+
5840
+ <xsl:template match="*[local-name()='table']" priority="2">
5841
+ <xsl:choose>
5842
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
5843
+ <xsl:call-template name="table"/>
5844
+ </xsl:when>
5845
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
5846
+ <xsl:otherwise>
5847
+ <xsl:call-template name="table"/>
5848
+ </xsl:otherwise>
5849
+ </xsl:choose>
5850
+ </xsl:template>
5851
+
5822
5852
  <xsl:template match="*[local-name()='table']" name="table">
5823
5853
 
5824
5854
  <xsl:variable name="table-preamble">
@@ -5828,9 +5858,11 @@
5828
5858
  <xsl:variable name="table">
5829
5859
 
5830
5860
  <xsl:variable name="simple-table">
5831
- <xsl:call-template name="getSimpleTable">
5832
- <xsl:with-param name="id" select="@id"/>
5833
- </xsl:call-template>
5861
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
5862
+ <xsl:call-template name="getSimpleTable">
5863
+ <xsl:with-param name="id" select="@id"/>
5864
+ </xsl:call-template>
5865
+ </xsl:if>
5834
5866
  </xsl:variable>
5835
5867
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
5836
5868
 
@@ -5932,9 +5964,9 @@
5932
5964
  </xsl:attribute>
5933
5965
  </xsl:for-each>
5934
5966
 
5935
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5967
+ <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']"/>
5936
5968
  <xsl:if test="$isNoteOrFnExist = 'true'">
5937
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5969
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
5938
5970
  </xsl:if>
5939
5971
 
5940
5972
  <xsl:choose>
@@ -6102,6 +6134,17 @@
6102
6134
  </xsl:if>
6103
6135
  </xsl:template> <!-- table/name -->
6104
6136
 
6137
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
6138
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
6139
+ <xsl:choose>
6140
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
6141
+ <!-- remove CR or LF at start -->
6142
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
6143
+ </xsl:when>
6144
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6145
+ </xsl:choose>
6146
+ </xsl:template>
6147
+
6105
6148
  <!-- SOURCE: ... -->
6106
6149
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
6107
6150
  <xsl:call-template name="termsource"/>
@@ -6512,7 +6555,7 @@
6512
6555
  <xsl:param name="colwidths"/>
6513
6556
  <xsl:param name="colgroup"/>
6514
6557
 
6515
- <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']"/>
6558
+ <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']"/>
6516
6559
 
6517
6560
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6518
6561
 
@@ -6578,7 +6621,7 @@
6578
6621
 
6579
6622
  <!-- fn will be processed inside 'note' processing -->
6580
6623
 
6581
- <xsl:if test="count(ancestor::bipm:table//*[local-name()='note']) &gt; 1">
6624
+ <xsl:if test="count(ancestor::bipm:table//*[local-name()='note'][not(@type = 'units')]) &gt; 1">
6582
6625
  <fo:block font-weight="bold" role="SKIP">
6583
6626
  <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language"/>
6584
6627
  <xsl:choose>
@@ -6594,7 +6637,7 @@
6594
6637
 
6595
6638
  <xsl:apply-templates select="../*[local-name()='p']"/>
6596
6639
  <xsl:apply-templates select="../*[local-name()='dl']"/>
6597
- <xsl:apply-templates select="../*[local-name()='note']"/>
6640
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
6598
6641
  <xsl:apply-templates select="../*[local-name()='example']"/>
6599
6642
  <xsl:apply-templates select="../*[local-name()='source']"/>
6600
6643
 
@@ -6604,7 +6647,7 @@
6604
6647
 
6605
6648
  <!-- horizontal row separator -->
6606
6649
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
6607
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6650
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6608
6651
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
6609
6652
 
6610
6653
  <xsl:call-template name="setBordersTableArray"/>
@@ -7297,7 +7340,20 @@
7297
7340
  <!-- Definition List -->
7298
7341
  <!-- ===================== -->
7299
7342
 
7300
- <xsl:template match="*[local-name()='dl']">
7343
+ <!-- for table auto-layout algorithm -->
7344
+ <xsl:template match="*[local-name()='dl']" priority="2">
7345
+ <xsl:choose>
7346
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
7347
+ <xsl:call-template name="dl"/>
7348
+ </xsl:when>
7349
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
7350
+ <xsl:otherwise>
7351
+ <xsl:call-template name="dl"/>
7352
+ </xsl:otherwise>
7353
+ </xsl:choose>
7354
+ </xsl:template>
7355
+
7356
+ <xsl:template match="*[local-name()='dl']" name="dl">
7301
7357
  <xsl:variable name="isAdded" select="@added"/>
7302
7358
  <xsl:variable name="isDeleted" select="@deleted"/>
7303
7359
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -9227,7 +9283,13 @@
9227
9283
  <xsl:value-of select="$language_current_2"/>
9228
9284
  </xsl:when>
9229
9285
  <xsl:otherwise>
9230
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
9286
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
9287
+ <xsl:choose>
9288
+ <xsl:when test="$language_current_3 != ''">
9289
+ <xsl:value-of select="$language_current_3"/>
9290
+ </xsl:when>
9291
+ <xsl:otherwise>en</xsl:otherwise>
9292
+ </xsl:choose>
9231
9293
  </xsl:otherwise>
9232
9294
  </xsl:choose>
9233
9295
  </xsl:otherwise>
@@ -10181,7 +10243,7 @@
10181
10243
  </xsl:when>
10182
10244
  <xsl:otherwise>
10183
10245
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
10184
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
10246
+ <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'])">
10185
10247
 
10186
10248
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
10187
10249
  <xsl:attribute name="width">
@@ -15220,6 +15282,4 @@
15220
15282
  </xsl:if>
15221
15283
  </xsl:template>
15222
15284
 
15223
- <!-- update -->
15224
-
15225
15285
  </xsl:stylesheet>
@@ -3883,17 +3883,30 @@
3883
3883
  <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 -->
3884
3884
 
3885
3885
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
3886
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3886
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3887
3887
  <!-- Example: <tables>
3888
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3889
- <tbody>
3890
- <tr>
3891
- <td id="tab-symdu_1_1">
3892
- <p_len>6</p_len>
3893
- <p_len>100</p_len> for 2nd paragraph
3894
- <word_len>6</word_len>
3895
- <word_len>20</word_len>
3896
- ...
3888
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
3889
+ <column width_max="39354" width_min="39354"/>
3890
+ <column width_max="75394" width_min="75394"/>
3891
+ <column width_max="108813" width_min="108813"/>
3892
+ <tbody>
3893
+ <tr>
3894
+ <td width_max="39354" width_min="39354">
3895
+ <p_len>39354</p_len>
3896
+ <word_len>39354</word_len>
3897
+ </td>
3898
+
3899
+ OLD:
3900
+ <tables>
3901
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3902
+ <tbody>
3903
+ <tr>
3904
+ <td id="tab-symdu_1_1">
3905
+ <p_len>6</p_len>
3906
+ <p_len>100</p_len> for 2nd paragraph
3907
+ <word_len>6</word_len>
3908
+ <word_len>20</word_len>
3909
+ ...
3897
3910
  -->
3898
3911
 
3899
3912
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -4117,6 +4130,9 @@
4117
4130
  <xsl:variable name="hair_space"> </xsl:variable>
4118
4131
  <xsl:variable name="en_dash">–</xsl:variable>
4119
4132
  <xsl:variable name="em_dash">—</xsl:variable>
4133
+ <xsl:variable name="cr">&#13;</xsl:variable>
4134
+ <xsl:variable name="lf">
4135
+ </xsl:variable>
4120
4136
 
4121
4137
  <xsl:template name="getTitle">
4122
4138
  <xsl:param name="name"/>
@@ -5819,6 +5835,20 @@
5819
5835
  </xsl:for-each>
5820
5836
  </xsl:template>
5821
5837
 
5838
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
5839
+
5840
+ <xsl:template match="*[local-name()='table']" priority="2">
5841
+ <xsl:choose>
5842
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
5843
+ <xsl:call-template name="table"/>
5844
+ </xsl:when>
5845
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
5846
+ <xsl:otherwise>
5847
+ <xsl:call-template name="table"/>
5848
+ </xsl:otherwise>
5849
+ </xsl:choose>
5850
+ </xsl:template>
5851
+
5822
5852
  <xsl:template match="*[local-name()='table']" name="table">
5823
5853
 
5824
5854
  <xsl:variable name="table-preamble">
@@ -5828,9 +5858,11 @@
5828
5858
  <xsl:variable name="table">
5829
5859
 
5830
5860
  <xsl:variable name="simple-table">
5831
- <xsl:call-template name="getSimpleTable">
5832
- <xsl:with-param name="id" select="@id"/>
5833
- </xsl:call-template>
5861
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
5862
+ <xsl:call-template name="getSimpleTable">
5863
+ <xsl:with-param name="id" select="@id"/>
5864
+ </xsl:call-template>
5865
+ </xsl:if>
5834
5866
  </xsl:variable>
5835
5867
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
5836
5868
 
@@ -5932,9 +5964,9 @@
5932
5964
  </xsl:attribute>
5933
5965
  </xsl:for-each>
5934
5966
 
5935
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5967
+ <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']"/>
5936
5968
  <xsl:if test="$isNoteOrFnExist = 'true'">
5937
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5969
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
5938
5970
  </xsl:if>
5939
5971
 
5940
5972
  <xsl:choose>
@@ -6102,6 +6134,17 @@
6102
6134
  </xsl:if>
6103
6135
  </xsl:template> <!-- table/name -->
6104
6136
 
6137
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
6138
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
6139
+ <xsl:choose>
6140
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
6141
+ <!-- remove CR or LF at start -->
6142
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
6143
+ </xsl:when>
6144
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6145
+ </xsl:choose>
6146
+ </xsl:template>
6147
+
6105
6148
  <!-- SOURCE: ... -->
6106
6149
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
6107
6150
  <xsl:call-template name="termsource"/>
@@ -6512,7 +6555,7 @@
6512
6555
  <xsl:param name="colwidths"/>
6513
6556
  <xsl:param name="colgroup"/>
6514
6557
 
6515
- <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']"/>
6558
+ <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']"/>
6516
6559
 
6517
6560
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6518
6561
 
@@ -6578,7 +6621,7 @@
6578
6621
 
6579
6622
  <!-- fn will be processed inside 'note' processing -->
6580
6623
 
6581
- <xsl:if test="count(ancestor::bipm:table//*[local-name()='note']) &gt; 1">
6624
+ <xsl:if test="count(ancestor::bipm:table//*[local-name()='note'][not(@type = 'units')]) &gt; 1">
6582
6625
  <fo:block font-weight="bold" role="SKIP">
6583
6626
  <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language"/>
6584
6627
  <xsl:choose>
@@ -6594,7 +6637,7 @@
6594
6637
 
6595
6638
  <xsl:apply-templates select="../*[local-name()='p']"/>
6596
6639
  <xsl:apply-templates select="../*[local-name()='dl']"/>
6597
- <xsl:apply-templates select="../*[local-name()='note']"/>
6640
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
6598
6641
  <xsl:apply-templates select="../*[local-name()='example']"/>
6599
6642
  <xsl:apply-templates select="../*[local-name()='source']"/>
6600
6643
 
@@ -6604,7 +6647,7 @@
6604
6647
 
6605
6648
  <!-- horizontal row separator -->
6606
6649
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
6607
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6650
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6608
6651
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
6609
6652
 
6610
6653
  <xsl:call-template name="setBordersTableArray"/>
@@ -7297,7 +7340,20 @@
7297
7340
  <!-- Definition List -->
7298
7341
  <!-- ===================== -->
7299
7342
 
7300
- <xsl:template match="*[local-name()='dl']">
7343
+ <!-- for table auto-layout algorithm -->
7344
+ <xsl:template match="*[local-name()='dl']" priority="2">
7345
+ <xsl:choose>
7346
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
7347
+ <xsl:call-template name="dl"/>
7348
+ </xsl:when>
7349
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
7350
+ <xsl:otherwise>
7351
+ <xsl:call-template name="dl"/>
7352
+ </xsl:otherwise>
7353
+ </xsl:choose>
7354
+ </xsl:template>
7355
+
7356
+ <xsl:template match="*[local-name()='dl']" name="dl">
7301
7357
  <xsl:variable name="isAdded" select="@added"/>
7302
7358
  <xsl:variable name="isDeleted" select="@deleted"/>
7303
7359
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -9227,7 +9283,13 @@
9227
9283
  <xsl:value-of select="$language_current_2"/>
9228
9284
  </xsl:when>
9229
9285
  <xsl:otherwise>
9230
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
9286
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
9287
+ <xsl:choose>
9288
+ <xsl:when test="$language_current_3 != ''">
9289
+ <xsl:value-of select="$language_current_3"/>
9290
+ </xsl:when>
9291
+ <xsl:otherwise>en</xsl:otherwise>
9292
+ </xsl:choose>
9231
9293
  </xsl:otherwise>
9232
9294
  </xsl:choose>
9233
9295
  </xsl:otherwise>
@@ -10181,7 +10243,7 @@
10181
10243
  </xsl:when>
10182
10244
  <xsl:otherwise>
10183
10245
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
10184
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
10246
+ <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'])">
10185
10247
 
10186
10248
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
10187
10249
  <xsl:attribute name="width">
@@ -15220,6 +15282,4 @@
15220
15282
  </xsl:if>
15221
15283
  </xsl:template>
15222
15284
 
15223
- <!-- update -->
15224
-
15225
15285
  </xsl:stylesheet>
@@ -3883,17 +3883,30 @@
3883
3883
  <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 -->
3884
3884
 
3885
3885
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
3886
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3886
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3887
3887
  <!-- Example: <tables>
3888
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3889
- <tbody>
3890
- <tr>
3891
- <td id="tab-symdu_1_1">
3892
- <p_len>6</p_len>
3893
- <p_len>100</p_len> for 2nd paragraph
3894
- <word_len>6</word_len>
3895
- <word_len>20</word_len>
3896
- ...
3888
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
3889
+ <column width_max="39354" width_min="39354"/>
3890
+ <column width_max="75394" width_min="75394"/>
3891
+ <column width_max="108813" width_min="108813"/>
3892
+ <tbody>
3893
+ <tr>
3894
+ <td width_max="39354" width_min="39354">
3895
+ <p_len>39354</p_len>
3896
+ <word_len>39354</word_len>
3897
+ </td>
3898
+
3899
+ OLD:
3900
+ <tables>
3901
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3902
+ <tbody>
3903
+ <tr>
3904
+ <td id="tab-symdu_1_1">
3905
+ <p_len>6</p_len>
3906
+ <p_len>100</p_len> for 2nd paragraph
3907
+ <word_len>6</word_len>
3908
+ <word_len>20</word_len>
3909
+ ...
3897
3910
  -->
3898
3911
 
3899
3912
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -4117,6 +4130,9 @@
4117
4130
  <xsl:variable name="hair_space"> </xsl:variable>
4118
4131
  <xsl:variable name="en_dash">–</xsl:variable>
4119
4132
  <xsl:variable name="em_dash">—</xsl:variable>
4133
+ <xsl:variable name="cr">&#13;</xsl:variable>
4134
+ <xsl:variable name="lf">
4135
+ </xsl:variable>
4120
4136
 
4121
4137
  <xsl:template name="getTitle">
4122
4138
  <xsl:param name="name"/>
@@ -5819,6 +5835,20 @@
5819
5835
  </xsl:for-each>
5820
5836
  </xsl:template>
5821
5837
 
5838
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
5839
+
5840
+ <xsl:template match="*[local-name()='table']" priority="2">
5841
+ <xsl:choose>
5842
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
5843
+ <xsl:call-template name="table"/>
5844
+ </xsl:when>
5845
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
5846
+ <xsl:otherwise>
5847
+ <xsl:call-template name="table"/>
5848
+ </xsl:otherwise>
5849
+ </xsl:choose>
5850
+ </xsl:template>
5851
+
5822
5852
  <xsl:template match="*[local-name()='table']" name="table">
5823
5853
 
5824
5854
  <xsl:variable name="table-preamble">
@@ -5828,9 +5858,11 @@
5828
5858
  <xsl:variable name="table">
5829
5859
 
5830
5860
  <xsl:variable name="simple-table">
5831
- <xsl:call-template name="getSimpleTable">
5832
- <xsl:with-param name="id" select="@id"/>
5833
- </xsl:call-template>
5861
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
5862
+ <xsl:call-template name="getSimpleTable">
5863
+ <xsl:with-param name="id" select="@id"/>
5864
+ </xsl:call-template>
5865
+ </xsl:if>
5834
5866
  </xsl:variable>
5835
5867
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
5836
5868
 
@@ -5932,9 +5964,9 @@
5932
5964
  </xsl:attribute>
5933
5965
  </xsl:for-each>
5934
5966
 
5935
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5967
+ <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']"/>
5936
5968
  <xsl:if test="$isNoteOrFnExist = 'true'">
5937
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5969
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
5938
5970
  </xsl:if>
5939
5971
 
5940
5972
  <xsl:choose>
@@ -6102,6 +6134,17 @@
6102
6134
  </xsl:if>
6103
6135
  </xsl:template> <!-- table/name -->
6104
6136
 
6137
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
6138
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
6139
+ <xsl:choose>
6140
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
6141
+ <!-- remove CR or LF at start -->
6142
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
6143
+ </xsl:when>
6144
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6145
+ </xsl:choose>
6146
+ </xsl:template>
6147
+
6105
6148
  <!-- SOURCE: ... -->
6106
6149
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
6107
6150
  <xsl:call-template name="termsource"/>
@@ -6512,7 +6555,7 @@
6512
6555
  <xsl:param name="colwidths"/>
6513
6556
  <xsl:param name="colgroup"/>
6514
6557
 
6515
- <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']"/>
6558
+ <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']"/>
6516
6559
 
6517
6560
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6518
6561
 
@@ -6578,7 +6621,7 @@
6578
6621
 
6579
6622
  <!-- fn will be processed inside 'note' processing -->
6580
6623
 
6581
- <xsl:if test="count(ancestor::bipm:table//*[local-name()='note']) &gt; 1">
6624
+ <xsl:if test="count(ancestor::bipm:table//*[local-name()='note'][not(@type = 'units')]) &gt; 1">
6582
6625
  <fo:block font-weight="bold" role="SKIP">
6583
6626
  <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language"/>
6584
6627
  <xsl:choose>
@@ -6594,7 +6637,7 @@
6594
6637
 
6595
6638
  <xsl:apply-templates select="../*[local-name()='p']"/>
6596
6639
  <xsl:apply-templates select="../*[local-name()='dl']"/>
6597
- <xsl:apply-templates select="../*[local-name()='note']"/>
6640
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
6598
6641
  <xsl:apply-templates select="../*[local-name()='example']"/>
6599
6642
  <xsl:apply-templates select="../*[local-name()='source']"/>
6600
6643
 
@@ -6604,7 +6647,7 @@
6604
6647
 
6605
6648
  <!-- horizontal row separator -->
6606
6649
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
6607
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6650
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6608
6651
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
6609
6652
 
6610
6653
  <xsl:call-template name="setBordersTableArray"/>
@@ -7297,7 +7340,20 @@
7297
7340
  <!-- Definition List -->
7298
7341
  <!-- ===================== -->
7299
7342
 
7300
- <xsl:template match="*[local-name()='dl']">
7343
+ <!-- for table auto-layout algorithm -->
7344
+ <xsl:template match="*[local-name()='dl']" priority="2">
7345
+ <xsl:choose>
7346
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
7347
+ <xsl:call-template name="dl"/>
7348
+ </xsl:when>
7349
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
7350
+ <xsl:otherwise>
7351
+ <xsl:call-template name="dl"/>
7352
+ </xsl:otherwise>
7353
+ </xsl:choose>
7354
+ </xsl:template>
7355
+
7356
+ <xsl:template match="*[local-name()='dl']" name="dl">
7301
7357
  <xsl:variable name="isAdded" select="@added"/>
7302
7358
  <xsl:variable name="isDeleted" select="@deleted"/>
7303
7359
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -9227,7 +9283,13 @@
9227
9283
  <xsl:value-of select="$language_current_2"/>
9228
9284
  </xsl:when>
9229
9285
  <xsl:otherwise>
9230
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
9286
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
9287
+ <xsl:choose>
9288
+ <xsl:when test="$language_current_3 != ''">
9289
+ <xsl:value-of select="$language_current_3"/>
9290
+ </xsl:when>
9291
+ <xsl:otherwise>en</xsl:otherwise>
9292
+ </xsl:choose>
9231
9293
  </xsl:otherwise>
9232
9294
  </xsl:choose>
9233
9295
  </xsl:otherwise>
@@ -10181,7 +10243,7 @@
10181
10243
  </xsl:when>
10182
10244
  <xsl:otherwise>
10183
10245
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
10184
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
10246
+ <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'])">
10185
10247
 
10186
10248
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
10187
10249
  <xsl:attribute name="width">
@@ -15220,6 +15282,4 @@
15220
15282
  </xsl:if>
15221
15283
  </xsl:template>
15222
15284
 
15223
- <!-- update -->
15224
-
15225
15285
  </xsl:stylesheet>
@@ -3883,17 +3883,30 @@
3883
3883
  <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 -->
3884
3884
 
3885
3885
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
3886
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3886
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
3887
3887
  <!-- Example: <tables>
3888
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3889
- <tbody>
3890
- <tr>
3891
- <td id="tab-symdu_1_1">
3892
- <p_len>6</p_len>
3893
- <p_len>100</p_len> for 2nd paragraph
3894
- <word_len>6</word_len>
3895
- <word_len>20</word_len>
3896
- ...
3888
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
3889
+ <column width_max="39354" width_min="39354"/>
3890
+ <column width_max="75394" width_min="75394"/>
3891
+ <column width_max="108813" width_min="108813"/>
3892
+ <tbody>
3893
+ <tr>
3894
+ <td width_max="39354" width_min="39354">
3895
+ <p_len>39354</p_len>
3896
+ <word_len>39354</word_len>
3897
+ </td>
3898
+
3899
+ OLD:
3900
+ <tables>
3901
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
3902
+ <tbody>
3903
+ <tr>
3904
+ <td id="tab-symdu_1_1">
3905
+ <p_len>6</p_len>
3906
+ <p_len>100</p_len> for 2nd paragraph
3907
+ <word_len>6</word_len>
3908
+ <word_len>20</word_len>
3909
+ ...
3897
3910
  -->
3898
3911
 
3899
3912
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -4117,6 +4130,9 @@
4117
4130
  <xsl:variable name="hair_space"> </xsl:variable>
4118
4131
  <xsl:variable name="en_dash">–</xsl:variable>
4119
4132
  <xsl:variable name="em_dash">—</xsl:variable>
4133
+ <xsl:variable name="cr">&#13;</xsl:variable>
4134
+ <xsl:variable name="lf">
4135
+ </xsl:variable>
4120
4136
 
4121
4137
  <xsl:template name="getTitle">
4122
4138
  <xsl:param name="name"/>
@@ -5819,6 +5835,20 @@
5819
5835
  </xsl:for-each>
5820
5836
  </xsl:template>
5821
5837
 
5838
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
5839
+
5840
+ <xsl:template match="*[local-name()='table']" priority="2">
5841
+ <xsl:choose>
5842
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
5843
+ <xsl:call-template name="table"/>
5844
+ </xsl:when>
5845
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
5846
+ <xsl:otherwise>
5847
+ <xsl:call-template name="table"/>
5848
+ </xsl:otherwise>
5849
+ </xsl:choose>
5850
+ </xsl:template>
5851
+
5822
5852
  <xsl:template match="*[local-name()='table']" name="table">
5823
5853
 
5824
5854
  <xsl:variable name="table-preamble">
@@ -5828,9 +5858,11 @@
5828
5858
  <xsl:variable name="table">
5829
5859
 
5830
5860
  <xsl:variable name="simple-table">
5831
- <xsl:call-template name="getSimpleTable">
5832
- <xsl:with-param name="id" select="@id"/>
5833
- </xsl:call-template>
5861
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
5862
+ <xsl:call-template name="getSimpleTable">
5863
+ <xsl:with-param name="id" select="@id"/>
5864
+ </xsl:call-template>
5865
+ </xsl:if>
5834
5866
  </xsl:variable>
5835
5867
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
5836
5868
 
@@ -5932,9 +5964,9 @@
5932
5964
  </xsl:attribute>
5933
5965
  </xsl:for-each>
5934
5966
 
5935
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
5967
+ <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']"/>
5936
5968
  <xsl:if test="$isNoteOrFnExist = 'true'">
5937
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
5969
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
5938
5970
  </xsl:if>
5939
5971
 
5940
5972
  <xsl:choose>
@@ -6102,6 +6134,17 @@
6102
6134
  </xsl:if>
6103
6135
  </xsl:template> <!-- table/name -->
6104
6136
 
6137
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
6138
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
6139
+ <xsl:choose>
6140
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
6141
+ <!-- remove CR or LF at start -->
6142
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
6143
+ </xsl:when>
6144
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
6145
+ </xsl:choose>
6146
+ </xsl:template>
6147
+
6105
6148
  <!-- SOURCE: ... -->
6106
6149
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
6107
6150
  <xsl:call-template name="termsource"/>
@@ -6512,7 +6555,7 @@
6512
6555
  <xsl:param name="colwidths"/>
6513
6556
  <xsl:param name="colgroup"/>
6514
6557
 
6515
- <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']"/>
6558
+ <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']"/>
6516
6559
 
6517
6560
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
6518
6561
 
@@ -6578,7 +6621,7 @@
6578
6621
 
6579
6622
  <!-- fn will be processed inside 'note' processing -->
6580
6623
 
6581
- <xsl:if test="count(ancestor::bipm:table//*[local-name()='note']) &gt; 1">
6624
+ <xsl:if test="count(ancestor::bipm:table//*[local-name()='note'][not(@type = 'units')]) &gt; 1">
6582
6625
  <fo:block font-weight="bold" role="SKIP">
6583
6626
  <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language"/>
6584
6627
  <xsl:choose>
@@ -6594,7 +6637,7 @@
6594
6637
 
6595
6638
  <xsl:apply-templates select="../*[local-name()='p']"/>
6596
6639
  <xsl:apply-templates select="../*[local-name()='dl']"/>
6597
- <xsl:apply-templates select="../*[local-name()='note']"/>
6640
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
6598
6641
  <xsl:apply-templates select="../*[local-name()='example']"/>
6599
6642
  <xsl:apply-templates select="../*[local-name()='source']"/>
6600
6643
 
@@ -6604,7 +6647,7 @@
6604
6647
 
6605
6648
  <!-- horizontal row separator -->
6606
6649
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
6607
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6650
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
6608
6651
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
6609
6652
 
6610
6653
  <xsl:call-template name="setBordersTableArray"/>
@@ -7297,7 +7340,20 @@
7297
7340
  <!-- Definition List -->
7298
7341
  <!-- ===================== -->
7299
7342
 
7300
- <xsl:template match="*[local-name()='dl']">
7343
+ <!-- for table auto-layout algorithm -->
7344
+ <xsl:template match="*[local-name()='dl']" priority="2">
7345
+ <xsl:choose>
7346
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
7347
+ <xsl:call-template name="dl"/>
7348
+ </xsl:when>
7349
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
7350
+ <xsl:otherwise>
7351
+ <xsl:call-template name="dl"/>
7352
+ </xsl:otherwise>
7353
+ </xsl:choose>
7354
+ </xsl:template>
7355
+
7356
+ <xsl:template match="*[local-name()='dl']" name="dl">
7301
7357
  <xsl:variable name="isAdded" select="@added"/>
7302
7358
  <xsl:variable name="isDeleted" select="@deleted"/>
7303
7359
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -9227,7 +9283,13 @@
9227
9283
  <xsl:value-of select="$language_current_2"/>
9228
9284
  </xsl:when>
9229
9285
  <xsl:otherwise>
9230
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
9286
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
9287
+ <xsl:choose>
9288
+ <xsl:when test="$language_current_3 != ''">
9289
+ <xsl:value-of select="$language_current_3"/>
9290
+ </xsl:when>
9291
+ <xsl:otherwise>en</xsl:otherwise>
9292
+ </xsl:choose>
9231
9293
  </xsl:otherwise>
9232
9294
  </xsl:choose>
9233
9295
  </xsl:otherwise>
@@ -10181,7 +10243,7 @@
10181
10243
  </xsl:when>
10182
10244
  <xsl:otherwise>
10183
10245
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
10184
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
10246
+ <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'])">
10185
10247
 
10186
10248
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
10187
10249
  <xsl:attribute name="width">
@@ -15220,6 +15282,4 @@
15220
15282
  </xsl:if>
15221
15283
  </xsl:template>
15222
15284
 
15223
- <!-- update -->
15224
-
15225
15285
  </xsl:stylesheet>
@@ -1744,17 +1744,30 @@
1744
1744
  <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 -->
1745
1745
 
1746
1746
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
1747
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
1747
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
1748
1748
  <!-- Example: <tables>
1749
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
1750
- <tbody>
1751
- <tr>
1752
- <td id="tab-symdu_1_1">
1753
- <p_len>6</p_len>
1754
- <p_len>100</p_len> for 2nd paragraph
1755
- <word_len>6</word_len>
1756
- <word_len>20</word_len>
1757
- ...
1749
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
1750
+ <column width_max="39354" width_min="39354"/>
1751
+ <column width_max="75394" width_min="75394"/>
1752
+ <column width_max="108813" width_min="108813"/>
1753
+ <tbody>
1754
+ <tr>
1755
+ <td width_max="39354" width_min="39354">
1756
+ <p_len>39354</p_len>
1757
+ <word_len>39354</word_len>
1758
+ </td>
1759
+
1760
+ OLD:
1761
+ <tables>
1762
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
1763
+ <tbody>
1764
+ <tr>
1765
+ <td id="tab-symdu_1_1">
1766
+ <p_len>6</p_len>
1767
+ <p_len>100</p_len> for 2nd paragraph
1768
+ <word_len>6</word_len>
1769
+ <word_len>20</word_len>
1770
+ ...
1758
1771
  -->
1759
1772
 
1760
1773
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -1974,6 +1987,9 @@
1974
1987
  <xsl:variable name="hair_space"> </xsl:variable>
1975
1988
  <xsl:variable name="en_dash">–</xsl:variable>
1976
1989
  <xsl:variable name="em_dash">—</xsl:variable>
1990
+ <xsl:variable name="cr">&#13;</xsl:variable>
1991
+ <xsl:variable name="lf">
1992
+ </xsl:variable>
1977
1993
 
1978
1994
  <xsl:template name="getTitle">
1979
1995
  <xsl:param name="name"/>
@@ -3668,6 +3684,20 @@
3668
3684
  </xsl:for-each>
3669
3685
  </xsl:template>
3670
3686
 
3687
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
3688
+
3689
+ <xsl:template match="*[local-name()='table']" priority="2">
3690
+ <xsl:choose>
3691
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
3692
+ <xsl:call-template name="table"/>
3693
+ </xsl:when>
3694
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
3695
+ <xsl:otherwise>
3696
+ <xsl:call-template name="table"/>
3697
+ </xsl:otherwise>
3698
+ </xsl:choose>
3699
+ </xsl:template>
3700
+
3671
3701
  <xsl:template match="*[local-name()='table']" name="table">
3672
3702
 
3673
3703
  <xsl:variable name="table-preamble">
@@ -3677,9 +3707,11 @@
3677
3707
  <xsl:variable name="table">
3678
3708
 
3679
3709
  <xsl:variable name="simple-table">
3680
- <xsl:call-template name="getSimpleTable">
3681
- <xsl:with-param name="id" select="@id"/>
3682
- </xsl:call-template>
3710
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
3711
+ <xsl:call-template name="getSimpleTable">
3712
+ <xsl:with-param name="id" select="@id"/>
3713
+ </xsl:call-template>
3714
+ </xsl:if>
3683
3715
  </xsl:variable>
3684
3716
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
3685
3717
 
@@ -3771,9 +3803,9 @@
3771
3803
  </xsl:attribute>
3772
3804
  </xsl:for-each>
3773
3805
 
3774
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
3806
+ <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']"/>
3775
3807
  <xsl:if test="$isNoteOrFnExist = 'true'">
3776
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
3808
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
3777
3809
  </xsl:if>
3778
3810
 
3779
3811
  <xsl:choose>
@@ -3928,9 +3960,28 @@
3928
3960
 
3929
3961
  </fo:block>
3930
3962
 
3963
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
3964
+ <xsl:if test="$continued = 'true'">
3965
+ <fo:block text-align="right">
3966
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
3967
+ </fo:block>
3968
+ </xsl:if>
3969
+ <!-- </xsl:if> -->
3970
+
3931
3971
  </xsl:if>
3932
3972
  </xsl:template> <!-- table/name -->
3933
3973
 
3974
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
3975
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
3976
+ <xsl:choose>
3977
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
3978
+ <!-- remove CR or LF at start -->
3979
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
3980
+ </xsl:when>
3981
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
3982
+ </xsl:choose>
3983
+ </xsl:template>
3984
+
3934
3985
  <!-- SOURCE: ... -->
3935
3986
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
3936
3987
  <xsl:call-template name="termsource"/>
@@ -4354,7 +4405,7 @@
4354
4405
  <xsl:param name="colwidths"/>
4355
4406
  <xsl:param name="colgroup"/>
4356
4407
 
4357
- <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']"/>
4408
+ <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']"/>
4358
4409
 
4359
4410
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4360
4411
 
@@ -4426,7 +4477,7 @@
4426
4477
 
4427
4478
  <xsl:apply-templates select="../*[local-name()='p']"/>
4428
4479
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4429
- <xsl:apply-templates select="../*[local-name()='note']"/>
4480
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
4430
4481
  <xsl:apply-templates select="../*[local-name()='example']"/>
4431
4482
  <xsl:apply-templates select="../*[local-name()='source']"/>
4432
4483
 
@@ -4436,7 +4487,7 @@
4436
4487
 
4437
4488
  <!-- horizontal row separator -->
4438
4489
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
4439
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
4490
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
4440
4491
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
4441
4492
 
4442
4493
  <xsl:call-template name="setBordersTableArray"/>
@@ -5142,7 +5193,20 @@
5142
5193
  <!-- Definition List -->
5143
5194
  <!-- ===================== -->
5144
5195
 
5145
- <xsl:template match="*[local-name()='dl']">
5196
+ <!-- for table auto-layout algorithm -->
5197
+ <xsl:template match="*[local-name()='dl']" priority="2">
5198
+ <xsl:choose>
5199
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
5200
+ <xsl:call-template name="dl"/>
5201
+ </xsl:when>
5202
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
5203
+ <xsl:otherwise>
5204
+ <xsl:call-template name="dl"/>
5205
+ </xsl:otherwise>
5206
+ </xsl:choose>
5207
+ </xsl:template>
5208
+
5209
+ <xsl:template match="*[local-name()='dl']" name="dl">
5146
5210
  <xsl:variable name="isAdded" select="@added"/>
5147
5211
  <xsl:variable name="isDeleted" select="@deleted"/>
5148
5212
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -7088,7 +7152,13 @@
7088
7152
  <xsl:value-of select="$language_current_2"/>
7089
7153
  </xsl:when>
7090
7154
  <xsl:otherwise>
7091
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
7155
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
7156
+ <xsl:choose>
7157
+ <xsl:when test="$language_current_3 != ''">
7158
+ <xsl:value-of select="$language_current_3"/>
7159
+ </xsl:when>
7160
+ <xsl:otherwise>en</xsl:otherwise>
7161
+ </xsl:choose>
7092
7162
  </xsl:otherwise>
7093
7163
  </xsl:choose>
7094
7164
  </xsl:otherwise>
@@ -7998,7 +8068,7 @@
7998
8068
  </xsl:when>
7999
8069
  <xsl:otherwise>
8000
8070
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
8001
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
8071
+ <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'])">
8002
8072
 
8003
8073
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
8004
8074
  <xsl:attribute name="width">
@@ -13038,6 +13108,4 @@
13038
13108
  </xsl:if>
13039
13109
  </xsl:template>
13040
13110
 
13041
- <!-- update -->
13042
-
13043
13111
  </xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "2.4.5".freeze
3
+ VERSION = "2.4.6".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.5
4
+ version: 2.4.6
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: metanorma-generic