metanorma-ieee 1.0.5 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -4327,7 +4327,6 @@
4327
4327
 
4328
4328
  <xsl:attribute-set name="table-header-cell-style">
4329
4329
  <xsl:attribute name="font-weight">bold</xsl:attribute>
4330
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
4331
4330
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
4332
4331
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4333
4332
  <xsl:attribute name="display-align">center</xsl:attribute>
@@ -4339,7 +4338,6 @@
4339
4338
 
4340
4339
  <xsl:attribute-set name="table-cell-style">
4341
4340
  <xsl:attribute name="display-align">center</xsl:attribute>
4342
- <xsl:attribute name="border">solid black 1pt</xsl:attribute>
4343
4341
  <xsl:attribute name="padding-left">1mm</xsl:attribute>
4344
4342
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4345
4343
 
@@ -5084,7 +5082,7 @@
5084
5082
  <xsl:apply-templates select="." mode="contents"/>
5085
5083
  </xsl:for-each>
5086
5084
 
5087
- <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
5085
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true') and not(*[local-name()='references'][@normative='true'])][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]][count(.//*[local-name() = 'bibitem'][not(@hidden) = 'true']) &gt; 0]">
5088
5086
  <xsl:sort select="@displayorder" data-type="number"/>
5089
5087
  <xsl:apply-templates select="." mode="contents"/>
5090
5088
  </xsl:for-each>
@@ -5420,6 +5418,7 @@
5420
5418
 
5421
5419
  <xsl:choose>
5422
5420
  <xsl:when test="ancestor::*[local-name() = 'feedback-statement']">50%</xsl:when>
5421
+ <xsl:when test="@width = 'full-page-width' or @width = 'text-width'">100%</xsl:when>
5423
5422
  <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
5424
5423
  <xsl:otherwise><xsl:value-of select="$table_width_default"/></xsl:otherwise>
5425
5424
  </xsl:choose>
@@ -5543,7 +5542,7 @@
5543
5542
  <xsl:variable name="isDeleted" select="@deleted"/>
5544
5543
 
5545
5544
  <xsl:choose>
5546
- <xsl:when test="@width">
5545
+ <xsl:when test="@width and @width != 'full-page-width' and @width != 'text-width'">
5547
5546
 
5548
5547
  <!-- centered table when table name is centered (see table-name-style) -->
5549
5548
 
@@ -5845,6 +5844,7 @@
5845
5844
  This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. -->
5846
5845
  <xsl:when test="(@width_max &gt; $page_width and @width_min &lt; $page_width) or (@width_min &gt;= $page_width)">
5847
5846
  <!-- difference between the available space and the minimum table width -->
5847
+ <_width_min><xsl:value-of select="@width_min"/></_width_min>
5848
5848
  <xsl:variable name="W" select="$page_width - @width_min"/>
5849
5849
  <W><xsl:value-of select="$W"/></W>
5850
5850
  <!-- difference between maximum and minimum width of the table -->
@@ -6019,6 +6019,10 @@
6019
6019
  </xsl:choose>
6020
6020
  </xsl:variable>
6021
6021
 
6022
+ <xsl:variable name="table_fn_block">
6023
+ <xsl:call-template name="table_fn_display"/>
6024
+ </xsl:variable>
6025
+
6022
6026
  <xsl:variable name="tableWithNotesAndFootnotes">
6023
6027
 
6024
6028
  <fo:table keep-with-previous="always">
@@ -6066,7 +6070,20 @@
6066
6070
 
6067
6071
  <xsl:apply-templates select="../*[local-name()='note']"/>
6068
6072
 
6073
+ <xsl:variable name="isDisplayRowSeparator">
6074
+
6075
+ </xsl:variable>
6076
+
6069
6077
  <!-- horizontal row separator -->
6078
+ <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
6079
+ <xsl:if test="../*[local-name()='note'] and normalize-space($table_fn_block) != ''">
6080
+ <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
6081
+
6082
+ <xsl:call-template name="setBordersTableArray"/>
6083
+ <fo:block font-size="1pt"> </fo:block>
6084
+ </fo:block-container>
6085
+ </xsl:if>
6086
+ </xsl:if>
6070
6087
 
6071
6088
  <!-- fn processing -->
6072
6089
  <fo:block/><!-- display fn after table -->
@@ -6084,7 +6101,8 @@
6084
6101
  <xsl:copy-of select="$tableWithNotesAndFootnotes"/>
6085
6102
  </xsl:if>
6086
6103
 
6087
- <xsl:call-template name="table_fn_display"/>
6104
+ <!-- <xsl:call-template name="table_fn_display" /> -->
6105
+ <xsl:copy-of select="$table_fn_block"/>
6088
6106
 
6089
6107
  </xsl:if>
6090
6108
  </xsl:template> <!-- insertTableFooterInSeparateTable -->
@@ -6236,6 +6254,28 @@
6236
6254
  </fo:table-row>
6237
6255
  </xsl:template>
6238
6256
 
6257
+ <xsl:template name="setBorderUnderRow">
6258
+ <xsl:variable name="border_under_row_" select="normalize-space(ancestor::*[local-name() = 'table'][1]/@border-under-row)"/>
6259
+ <xsl:choose>
6260
+ <xsl:when test="$border_under_row_ != ''">
6261
+ <xsl:variable name="table_id" select="ancestor::*[local-name() = 'table'][1]/@id"/>
6262
+ <xsl:variable name="row_num_"><xsl:number level="any" count="*[local-name() = 'table'][@id = $table_id]//*[local-name() = 'tr']"/></xsl:variable>
6263
+ <xsl:variable name="row_num" select="number($row_num_) - 1"/> <!-- because values in border-under-row start with 0 -->
6264
+ <xsl:variable name="border_under_row">
6265
+ <xsl:call-template name="split">
6266
+ <xsl:with-param name="pText" select="$border_under_row_"/>
6267
+ </xsl:call-template>
6268
+ </xsl:variable>
6269
+ <xsl:if test="xalan:nodeset($border_under_row)/item[. = normalize-space($row_num)]">
6270
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
6271
+ </xsl:if>
6272
+ </xsl:when>
6273
+ <xsl:otherwise>
6274
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
6275
+ </xsl:otherwise>
6276
+ </xsl:choose>
6277
+ </xsl:template>
6278
+
6239
6279
  <!-- row in table footer (tfoot) -->
6240
6280
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
6241
6281
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -6542,17 +6582,20 @@
6542
6582
  <xsl:for-each select="xalan:nodeset($references)//fn">
6543
6583
  <xsl:variable name="reference" select="@reference"/>
6544
6584
  <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6545
- <fo:block xsl:use-attribute-sets="table-fn-style">
6546
6585
 
6547
- <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
6586
+ <fo:block xsl:use-attribute-sets="table-fn-style">
6548
6587
 
6549
- <xsl:value-of select="@reference"/>
6588
+ <fo:inline id="{@id}" xsl:use-attribute-sets="table-fn-number-style">
6589
+
6590
+ <xsl:value-of select="@reference"/>
6591
+
6592
+ </fo:inline>
6593
+ <fo:inline xsl:use-attribute-sets="table-fn-body-style">
6594
+ <xsl:copy-of select="./node()"/>
6595
+ </fo:inline>
6596
+
6597
+ </fo:block>
6550
6598
 
6551
- </fo:inline>
6552
- <fo:inline xsl:use-attribute-sets="table-fn-body-style">
6553
- <xsl:copy-of select="./node()"/>
6554
- </fo:inline>
6555
- </fo:block>
6556
6599
  </xsl:if>
6557
6600
  </xsl:for-each>
6558
6601
  </xsl:template>
@@ -6581,8 +6624,16 @@
6581
6624
  <!-- figure's footnotes rendering -->
6582
6625
  <xsl:template name="fn_display_figure">
6583
6626
 
6627
+ <!-- current figure id -->
6628
+ <xsl:variable name="figure_id_">
6629
+ <xsl:value-of select="@id"/>
6630
+ <xsl:if test="not(@id)"><xsl:value-of select="generate-id()"/></xsl:if>
6631
+ </xsl:variable>
6632
+ <xsl:variable name="figure_id" select="normalize-space($figure_id_)"/>
6633
+
6634
+ <!-- all footnotes relates to the current figure -->
6584
6635
  <xsl:variable name="references">
6585
- <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])]">
6636
+ <xsl:for-each select=".//*[local-name()='fn'][not(parent::*[local-name()='name'])][ancestor::*[local-name() = 'figure'][1][@id = $figure_id]]">
6586
6637
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
6587
6638
  <xsl:apply-templates/>
6588
6639
  </fn>
@@ -6595,91 +6646,93 @@
6595
6646
 
6596
6647
  </xsl:variable>
6597
6648
 
6598
- <!-- current hierarchy is 'figure' element -->
6599
- <xsl:variable name="following_dl_colwidths">
6600
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
6601
- <xsl:variable name="simple-table">
6602
- <!-- <xsl:variable name="doc_ns">
6603
- <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
6649
+ <fo:block>
6650
+
6651
+ <!-- current hierarchy is 'figure' element -->
6652
+ <xsl:variable name="following_dl_colwidths">
6653
+ <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
6654
+ <xsl:variable name="simple-table">
6655
+ <!-- <xsl:variable name="doc_ns">
6656
+ <xsl:if test="$namespace = 'bipm'">bipm</xsl:if>
6657
+ </xsl:variable>
6658
+ <xsl:variable name="ns">
6659
+ <xsl:choose>
6660
+ <xsl:when test="normalize-space($doc_ns) != ''">
6661
+ <xsl:value-of select="normalize-space($doc_ns)"/>
6662
+ </xsl:when>
6663
+ <xsl:otherwise>
6664
+ <xsl:value-of select="substring-before(name(/*), '-')"/>
6665
+ </xsl:otherwise>
6666
+ </xsl:choose>
6667
+ </xsl:variable> -->
6668
+
6669
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
6670
+ <tbody>
6671
+ <xsl:apply-templates mode="dl"/>
6672
+ </tbody>
6673
+ </xsl:for-each>
6674
+ </xsl:variable>
6675
+
6676
+ <xsl:call-template name="calculate-column-widths">
6677
+ <xsl:with-param name="cols-count" select="2"/>
6678
+ <xsl:with-param name="table" select="$simple-table"/>
6679
+ </xsl:call-template>
6680
+
6681
+ </xsl:if>
6604
6682
  </xsl:variable>
6605
- <xsl:variable name="ns">
6683
+
6684
+ <xsl:variable name="maxlength_dt">
6685
+ <xsl:for-each select="*[local-name() = 'dl'][1]">
6686
+ <xsl:call-template name="getMaxLength_dt"/>
6687
+ </xsl:for-each>
6688
+ </xsl:variable>
6689
+
6690
+ <fo:table width="95%" table-layout="fixed">
6691
+ <xsl:if test="normalize-space($key_iso) = 'true'">
6692
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
6693
+
6694
+ </xsl:if>
6606
6695
  <xsl:choose>
6607
- <xsl:when test="normalize-space($doc_ns) != ''">
6608
- <xsl:value-of select="normalize-space($doc_ns)"/>
6696
+ <!-- if there 'dl', then set same columns width -->
6697
+ <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
6698
+ <xsl:call-template name="setColumnWidth_dl">
6699
+ <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
6700
+ <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6701
+ </xsl:call-template>
6609
6702
  </xsl:when>
6610
6703
  <xsl:otherwise>
6611
- <xsl:value-of select="substring-before(name(/*), '-')"/>
6704
+ <fo:table-column column-width="5%"/>
6705
+ <fo:table-column column-width="95%"/>
6612
6706
  </xsl:otherwise>
6613
6707
  </xsl:choose>
6614
- </xsl:variable> -->
6615
-
6616
- <xsl:for-each select="*[local-name() = 'dl'][1]">
6617
- <tbody>
6618
- <xsl:apply-templates mode="dl"/>
6619
- </tbody>
6620
- </xsl:for-each>
6621
- </xsl:variable>
6622
-
6623
- <xsl:call-template name="calculate-column-widths">
6624
- <xsl:with-param name="cols-count" select="2"/>
6625
- <xsl:with-param name="table" select="$simple-table"/>
6626
- </xsl:call-template>
6627
-
6628
- </xsl:if>
6629
- </xsl:variable>
6630
-
6631
- <xsl:variable name="maxlength_dt">
6632
- <xsl:for-each select="*[local-name() = 'dl'][1]">
6633
- <xsl:call-template name="getMaxLength_dt"/>
6634
- </xsl:for-each>
6635
- </xsl:variable>
6708
+ <fo:table-body>
6709
+ <xsl:for-each select="xalan:nodeset($references)//fn">
6710
+ <xsl:variable name="reference" select="@reference"/>
6711
+ <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6712
+ <fo:table-row>
6713
+ <fo:table-cell>
6714
+ <fo:block>
6715
+ <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
6716
+ <xsl:value-of select="@reference"/>
6717
+ </fo:inline>
6718
+ </fo:block>
6719
+ </fo:table-cell>
6720
+ <fo:table-cell>
6721
+ <fo:block xsl:use-attribute-sets="figure-fn-body-style">
6722
+ <xsl:if test="normalize-space($key_iso) = 'true'">
6636
6723
 
6637
- <fo:block>
6638
- <fo:table width="95%" table-layout="fixed">
6639
- <xsl:if test="normalize-space($key_iso) = 'true'">
6640
- <xsl:attribute name="font-size">10pt</xsl:attribute>
6724
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
6641
6725
 
6642
- </xsl:if>
6643
- <xsl:choose>
6644
- <!-- if there 'dl', then set same columns width -->
6645
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
6646
- <xsl:call-template name="setColumnWidth_dl">
6647
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
6648
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6649
- </xsl:call-template>
6650
- </xsl:when>
6651
- <xsl:otherwise>
6652
- <fo:table-column column-width="15%"/>
6653
- <fo:table-column column-width="85%"/>
6654
- </xsl:otherwise>
6655
- </xsl:choose>
6656
- <fo:table-body>
6657
- <xsl:for-each select="xalan:nodeset($references)//fn">
6658
- <xsl:variable name="reference" select="@reference"/>
6659
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6660
- <fo:table-row>
6661
- <fo:table-cell>
6662
- <fo:block>
6663
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
6664
- <xsl:value-of select="@reference"/>
6665
- </fo:inline>
6666
- </fo:block>
6667
- </fo:table-cell>
6668
- <fo:table-cell>
6669
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
6670
- <xsl:if test="normalize-space($key_iso) = 'true'">
6671
-
6672
- <xsl:attribute name="margin-bottom">0</xsl:attribute>
6726
+ </xsl:if>
6727
+ <xsl:copy-of select="./node()"/>
6728
+ </fo:block>
6729
+ </fo:table-cell>
6730
+ </fo:table-row>
6731
+ </xsl:if>
6732
+ </xsl:for-each>
6733
+ </fo:table-body>
6734
+ </fo:table>
6673
6735
 
6674
- </xsl:if>
6675
- <xsl:copy-of select="./node()"/>
6676
- </fo:block>
6677
- </fo:table-cell>
6678
- </fo:table-row>
6679
- </xsl:if>
6680
- </xsl:for-each>
6681
- </fo:table-body>
6682
- </fo:table>
6683
6736
  </fo:block>
6684
6737
  </xsl:if>
6685
6738
 
@@ -6755,12 +6808,14 @@
6755
6808
 
6756
6809
  <fo:block margin-bottom="12pt" text-align="left">
6757
6810
 
6758
- <xsl:variable name="title-where">
6811
+ <!-- <xsl:variable name="title-where">
6759
6812
  <xsl:call-template name="getLocalizedString">
6760
6813
  <xsl:with-param name="key">where</xsl:with-param>
6761
6814
  </xsl:call-template>
6762
6815
  </xsl:variable>
6763
- <xsl:value-of select="$title-where"/><xsl:text> </xsl:text>
6816
+ <xsl:value-of select="$title-where"/> -->
6817
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
6818
+ <xsl:text> </xsl:text>
6764
6819
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
6765
6820
  <xsl:text/>
6766
6821
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -6770,12 +6825,14 @@
6770
6825
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
6771
6826
  <fo:block margin-bottom="12pt" text-align="left">
6772
6827
 
6773
- <xsl:variable name="title-where">
6828
+ <!-- <xsl:variable name="title-where">
6774
6829
  <xsl:call-template name="getLocalizedString">
6775
6830
  <xsl:with-param name="key">where</xsl:with-param>
6776
6831
  </xsl:call-template>
6777
6832
  </xsl:variable>
6778
- <xsl:value-of select="$title-where"/>
6833
+ <xsl:value-of select="$title-where"/><xsl:if test="$namespace = 'bsi' or $namespace = 'itu'">:</xsl:if> -->
6834
+ <!-- preceding 'p' with word 'where' -->
6835
+ <xsl:apply-templates select="preceding-sibling::*[1][local-name() = 'p' and @keep-with-next = 'true']/node()"/>
6779
6836
  </fo:block>
6780
6837
  </xsl:when> <!-- END: a few components -->
6781
6838
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -6958,6 +7015,9 @@
6958
7015
 
6959
7016
  </xsl:template> <!-- END: dl -->
6960
7017
 
7018
+ <!-- ignore 'p' with 'where' in formula, before 'dl' -->
7019
+ <xsl:template match="*[local-name() = 'formula']/*[local-name() = 'p' and @keep-with-next = 'true' and following-sibling::*[1][local-name() = 'dl']]"/>
7020
+
6961
7021
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
6962
7022
  <xsl:param name="process">false</xsl:param>
6963
7023
  <xsl:if test="$process = 'true'">
@@ -7488,12 +7548,12 @@
7488
7548
  <xsl:param name="value"/>
7489
7549
  <xsl:variable name="add_width" select="string-length($value) * 20"/>
7490
7550
  <xsl:variable name="maxwidth" select="60 + $add_width"/>
7491
- <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-20%"><!-- alignment-baseline="middle" -->
7492
- <xsl:attribute name="height">5mm</xsl:attribute>
7551
+ <fo:instream-foreign-object fox:alt-text="OpeningTag" baseline-shift="-10%"><!-- alignment-baseline="middle" -->
7552
+ <xsl:attribute name="height">3.5mm</xsl:attribute> <!-- 5mm -->
7493
7553
  <xsl:attribute name="content-width">100%</xsl:attribute>
7494
7554
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7495
7555
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7496
- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
7556
+ <!-- <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
7497
7557
  <g>
7498
7558
  <xsl:if test="$type = 'closing' or $type = 'end'">
7499
7559
  <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
@@ -7507,6 +7567,27 @@
7507
7567
  </xsl:if>
7508
7568
  <xsl:value-of select="$kind"/><tspan dy="10" font-size="30pt"><xsl:value-of select="$value"/></tspan>
7509
7569
  </text>
7570
+ </svg> -->
7571
+ <svg xmlns="http://www.w3.org/2000/svg" width="{$maxwidth + 32}" height="80">
7572
+ <g>
7573
+ <xsl:if test="$type = 'closing' or $type = 'end'">
7574
+ <xsl:attribute name="transform">scale(-1 1) translate(-<xsl:value-of select="$maxwidth + 32"/>,0)</xsl:attribute>
7575
+ </xsl:if>
7576
+ <polyline points="0,2.5 {$maxwidth},2.5 {$maxwidth + 20},40 {$maxwidth},77.5 0,77.5" stroke="black" stroke-width="5" fill="white"/>
7577
+ <line x1="9.5" y1="0" x2="9.5" y2="80" stroke="black" stroke-width="19"/>
7578
+ </g>
7579
+ <xsl:variable name="text_x">
7580
+ <xsl:choose>
7581
+ <xsl:when test="$type = 'closing' or $type = 'end'">28</xsl:when>
7582
+ <xsl:otherwise>22</xsl:otherwise>
7583
+ </xsl:choose>
7584
+ </xsl:variable>
7585
+ <text font-family="Arial" x="{$text_x}" y="50" font-size="40pt">
7586
+ <xsl:value-of select="$kind"/>
7587
+ </text>
7588
+ <text font-family="Arial" x="{$text_x + 33}" y="65" font-size="38pt">
7589
+ <xsl:value-of select="$value"/>
7590
+ </text>
7510
7591
  </svg>
7511
7592
  </fo:instream-foreign-object>
7512
7593
  </xsl:template>
@@ -7761,18 +7842,34 @@
7761
7842
 
7762
7843
  <xsl:template name="add-zero-spaces-java">
7763
7844
  <xsl:param name="text" select="."/>
7764
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
7765
- <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1​')"/>
7845
+
7846
+ <!-- add zero-width space (#x200B) after dot with next non-digit -->
7847
+ <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
7848
+ <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right, ; -->
7849
+ <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→|;)','$1​')"/>
7850
+ <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
7851
+ <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
7766
7852
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
7767
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
7853
+ <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(\u003e)(?!\u003e)', '$1​')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
7768
7854
  <!-- add zero-width space (#x200B) before characters: 'less than' -->
7769
- <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
7855
+ <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(?&lt;!\u003c)(\u003c)', '​$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
7770
7856
  <!-- add zero-width space (#x200B) before character: { -->
7771
- <xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
7857
+ <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
7772
7858
  <!-- add zero-width space (#x200B) after character: , -->
7773
- <xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
7859
+ <xsl:variable name="text7" select="java:replaceAll(java:java.lang.String.new($text6), '(\,)(?!\d)', '$1​')"/> <!-- negative lookahead: ',' not followed by digit -->
7860
+ <!-- add zero-width space (#x200B) after character: '/' -->
7861
+ <xsl:variable name="text8" select="java:replaceAll(java:java.lang.String.new($text7), '(\u002f)(?!\u002f)', '$1​')"/><!-- negative lookahead: '/' not followed by '/' -->
7862
+
7863
+ <xsl:variable name="text9">
7864
+ <xsl:choose>
7865
+ <xsl:when test="$isGenerateTableIF = 'true'">
7866
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text8), '([\u3000-\u9FFF])', '$1​')"/> <!-- 3000 - CJK Symbols and Punctuation ... 9FFF CJK Unified Ideographs-->
7867
+ </xsl:when>
7868
+ <xsl:otherwise><xsl:value-of select="$text8"/></xsl:otherwise>
7869
+ </xsl:choose>
7870
+ </xsl:variable>
7774
7871
 
7775
- <xsl:value-of select="$text5"/>
7872
+ <xsl:value-of select="$text9"/>
7776
7873
  </xsl:template>
7777
7874
 
7778
7875
  <xsl:template name="add-zero-spaces-link-java">
@@ -7780,8 +7877,10 @@
7780
7877
 
7781
7878
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
7782
7879
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7783
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7784
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
7880
+ <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, comma, slash, @ -->
7881
+ <xsl:variable name="url" select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/|@)','$1​')"/>
7882
+ <!-- remove zero-width space at the end -->
7883
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
7785
7884
  </xsl:template>
7786
7885
 
7787
7886
  <!-- add zero space after dash character (for table's entries) -->
@@ -7918,7 +8017,7 @@
7918
8017
  </xsl:copy>
7919
8018
  </xsl:template>
7920
8019
 
7921
- <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br">
8020
+ <xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode']) and not(*[local-name()='ul']) and not(*[local-name()='ol'])]" mode="table-without-br">
7922
8021
  <xsl:copy>
7923
8022
  <xsl:copy-of select="@*"/>
7924
8023
  <p>
@@ -7994,6 +8093,14 @@
7994
8093
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),' {2,}',' ')"/>
7995
8094
  </xsl:template>
7996
8095
 
8096
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'ol' or local-name() = 'ul']" mode="table-without-br">
8097
+ <xsl:apply-templates mode="table-without-br"/>
8098
+ </xsl:template>
8099
+
8100
+ <xsl:template match="*[local-name()='th' or local-name()='td']//*[local-name() = 'li']" mode="table-without-br">
8101
+ <xsl:apply-templates mode="table-without-br"/>
8102
+ </xsl:template>
8103
+
7997
8104
  <!-- mode="table-without-br" -->
7998
8105
  <!-- ================================== -->
7999
8106
  <!-- END: Step 0. replace <br/> to <p>...</p> -->
@@ -8126,9 +8233,28 @@
8126
8233
  </xsl:variable>
8127
8234
  <xsl:copy-of select="$newRow"/>
8128
8235
 
8129
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
8130
- <xsl:with-param name="previousRow" select="$newRow"/>
8131
- </xsl:apply-templates>
8236
+ <!-- optimize to prevent StackOverflowError, just copy next 'tr' -->
8237
+ <xsl:variable name="currrow_num" select="count(preceding-sibling::tr) + 1"/>
8238
+ <xsl:variable name="nextrow_without_rowspan_" select="count(following-sibling::tr[*[@rowspan and @rowspan != 1]][1]/preceding-sibling::tr) + 1"/>
8239
+ <xsl:variable name="nextrow_without_rowspan" select="$nextrow_without_rowspan_ - $currrow_num"/>
8240
+ <xsl:choose>
8241
+ <xsl:when test="not(xalan:nodeset($newRow)/*/*[@rowspan and @rowspan != 1]) and $nextrow_without_rowspan &lt;= 0">
8242
+ <xsl:copy-of select="following-sibling::tr"/>
8243
+ </xsl:when>
8244
+ <!-- <xsl:when test="xalan:nodeset($newRow)/*[not(@rowspan) or (@rowspan = 1)] and $nextrow_without_rowspan &gt; 0">
8245
+ <xsl:copy-of select="following-sibling::tr[position() &lt;= $nextrow_without_rowspan]"/>
8246
+
8247
+ <xsl:copy-of select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
8248
+ <xsl:apply-templates select="following-sibling::tr[$nextrow_without_rowspan + 2]" mode="simple-table-rowspan">
8249
+ <xsl:with-param name="previousRow" select="following-sibling::tr[$nextrow_without_rowspan + 1]"/>
8250
+ </xsl:apply-templates>
8251
+ </xsl:when> -->
8252
+ <xsl:otherwise>
8253
+ <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
8254
+ <xsl:with-param name="previousRow" select="$newRow"/>
8255
+ </xsl:apply-templates>
8256
+ </xsl:otherwise>
8257
+ </xsl:choose>
8132
8258
  </xsl:template>
8133
8259
  <!-- End mode simple-table-rowspan -->
8134
8260
 
@@ -8291,6 +8417,27 @@
8291
8417
  </xsl:call-template>
8292
8418
  </xsl:template>
8293
8419
 
8420
+ <xsl:template match="*[local-name() = 'link'][normalize-space() = '']" mode="td_text_with_formatting">
8421
+ <xsl:variable name="link">
8422
+ <link_updated>
8423
+ <xsl:variable name="target_text">
8424
+ <xsl:choose>
8425
+ <xsl:when test="starts-with(normalize-space(@target), 'mailto:')">
8426
+ <xsl:value-of select="normalize-space(substring-after(@target, 'mailto:'))"/>
8427
+ </xsl:when>
8428
+ <xsl:otherwise>
8429
+ <xsl:value-of select="normalize-space(@target)"/>
8430
+ </xsl:otherwise>
8431
+ </xsl:choose>
8432
+ </xsl:variable>
8433
+ <xsl:value-of select="$target_text"/>
8434
+ </link_updated>
8435
+ </xsl:variable>
8436
+ <xsl:for-each select="xalan:nodeset($link)/*">
8437
+ <xsl:apply-templates mode="td_text_with_formatting"/>
8438
+ </xsl:for-each>
8439
+ </xsl:template>
8440
+
8294
8441
  <xsl:template name="getFormattingTags">
8295
8442
  <tags>
8296
8443
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -8634,7 +8781,7 @@
8634
8781
  </xsl:variable>
8635
8782
  <fo:inline xsl:use-attribute-sets="link-style">
8636
8783
 
8637
- <xsl:if test="starts-with(normalize-space(@target), 'mailto:')">
8784
+ <xsl:if test="starts-with(normalize-space(@target), 'mailto:') and not(ancestor::*[local-name() = 'td'])">
8638
8785
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8639
8786
  </xsl:if>
8640
8787
 
@@ -8821,7 +8968,7 @@
8821
8968
 
8822
8969
  <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style">
8823
8970
 
8824
- <fo:block-container margin-left="0mm">
8971
+ <fo:block-container margin-left="0mm" margin-right="0mm">
8825
8972
 
8826
8973
  <fo:block>
8827
8974
 
@@ -9001,13 +9148,16 @@
9001
9148
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
9002
9149
  </xsl:call-template>
9003
9150
 
9151
+ <!-- Example: Dimensions in millimeters -->
9152
+ <xsl:apply-templates select="*[local-name() = 'note'][@type = 'units']"/>
9153
+
9004
9154
  <fo:block xsl:use-attribute-sets="figure-style">
9005
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
9155
+ <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
9006
9156
  </fo:block>
9007
- <xsl:call-template name="fn_display_figure"/>
9008
- <xsl:for-each select="*[local-name() = 'note']">
9157
+ <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9009
9158
  <xsl:call-template name="note"/>
9010
9159
  </xsl:for-each>
9160
+ <xsl:call-template name="fn_display_figure"/>
9011
9161
 
9012
9162
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
9013
9163
 
@@ -9070,7 +9220,13 @@
9070
9220
  </xsl:choose>
9071
9221
  </xsl:variable>
9072
9222
 
9073
- <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
9223
+ <xsl:variable name="image_width_effective">
9224
+
9225
+ <xsl:value-of select="$width_effective"/>
9226
+
9227
+ </xsl:variable>
9228
+
9229
+ <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $image_width_effective, $height_effective)"/>
9074
9230
  <xsl:if test="number($scale) &lt; 100">
9075
9231
 
9076
9232
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -9262,24 +9418,47 @@
9262
9418
 
9263
9419
  </xsl:when>
9264
9420
  <xsl:otherwise>
9265
- <fo:block xsl:use-attribute-sets="image-style">
9266
- <fo:instream-foreign-object fox:alt-text="{$alt-text}">
9267
- <xsl:attribute name="width">100%</xsl:attribute>
9268
- <xsl:attribute name="content-height">100%</xsl:attribute>
9269
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9270
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9271
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9272
- <!-- effective height 297 - 27.4 - 13 = 256.6 -->
9273
- <!-- effective width 210 - 12.5 - 25 = 172.5 -->
9274
- <!-- effective height / width = 1.48, 1.4 - with title -->
9275
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9276
- <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
9277
- <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9278
- </xsl:if>
9279
- <xsl:attribute name="scaling">uniform</xsl:attribute>
9280
- <xsl:copy-of select="$svg_content"/>
9281
- </fo:instream-foreign-object>
9282
- </fo:block>
9421
+
9422
+ <xsl:variable name="element">
9423
+ <xsl:choose>
9424
+ <xsl:when test="ancestor::*[local-name() = 'tr'] and $isGenerateTableIF = 'true'">
9425
+ <fo:inline xsl:use-attribute-sets="image-style" text-align="left"/>
9426
+ </xsl:when>
9427
+ <xsl:otherwise>
9428
+ <fo:block xsl:use-attribute-sets="image-style">
9429
+ <xsl:if test="ancestor::*[local-name() = 'dt']">
9430
+ <xsl:attribute name="text-align">left</xsl:attribute>
9431
+ </xsl:if>
9432
+ </fo:block>
9433
+ </xsl:otherwise>
9434
+ </xsl:choose>
9435
+ </xsl:variable>
9436
+
9437
+ <xsl:for-each select="xalan:nodeset($element)/*">
9438
+ <xsl:copy>
9439
+ <xsl:copy-of select="@*"/>
9440
+ <!-- <fo:block xsl:use-attribute-sets="image-style"> -->
9441
+ <fo:instream-foreign-object fox:alt-text="{$alt-text}">
9442
+ <xsl:if test="$isGenerateTableIF = 'false'">
9443
+ <xsl:attribute name="width">100%</xsl:attribute>
9444
+ </xsl:if>
9445
+ <xsl:attribute name="content-height">100%</xsl:attribute>
9446
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
9447
+ <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
9448
+ <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
9449
+ <!-- effective height 297 - 27.4 - 13 = 256.6 -->
9450
+ <!-- effective width 210 - 12.5 - 25 = 172.5 -->
9451
+ <!-- effective height / width = 1.48, 1.4 - with title -->
9452
+ <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
9453
+ <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
9454
+ <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
9455
+ </xsl:if>
9456
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
9457
+ <xsl:copy-of select="$svg_content"/>
9458
+ </fo:instream-foreign-object>
9459
+ <!-- </fo:block> -->
9460
+ </xsl:copy>
9461
+ </xsl:for-each>
9283
9462
  </xsl:otherwise>
9284
9463
  </xsl:choose>
9285
9464
  </xsl:template>
@@ -9371,6 +9550,13 @@
9371
9550
  </xsl:for-each>
9372
9551
  </xsl:template>
9373
9552
 
9553
+ <!-- For the structures like: <dt><image src="" mimetype="image/svg+xml" height="" width=""><svg xmlns="http://www.w3.org/2000/svg" ... -->
9554
+ <xsl:template match="*[local-name() != 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
9555
+ <xsl:for-each select="*[local-name() = 'svg']">
9556
+ <xsl:call-template name="image_svg"/>
9557
+ </xsl:for-each>
9558
+ </xsl:template>
9559
+
9374
9560
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][@mimetype = 'image/svg+xml' and @src[not(starts-with(., 'data:image/'))]]" priority="2">
9375
9561
  <xsl:variable name="svg_content" select="document(@src)"/>
9376
9562
  <xsl:variable name="name" select="ancestor::*[local-name() = 'figure']/*[local-name() = 'name']"/>
@@ -9509,6 +9695,8 @@
9509
9695
  <xsl:value-of select="."/>
9510
9696
  </xsl:template>
9511
9697
 
9698
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="bookmarks" priority="3"/>
9699
+
9512
9700
  <xsl:template match="node()" mode="contents">
9513
9701
  <xsl:apply-templates mode="contents"/>
9514
9702
  </xsl:template>
@@ -9625,6 +9813,13 @@
9625
9813
  <xsl:when test="$contents_nodes/doc">
9626
9814
  <xsl:choose>
9627
9815
  <xsl:when test="count($contents_nodes/doc) &gt; 1">
9816
+
9817
+ <xsl:if test="$contents_nodes/collection">
9818
+ <fo:bookmark internal-destination="{$contents/collection/@firstpage_id}">
9819
+ <fo:bookmark-title>collection.pdf</fo:bookmark-title>
9820
+ </fo:bookmark>
9821
+ </xsl:if>
9822
+
9628
9823
  <xsl:for-each select="$contents_nodes/doc">
9629
9824
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
9630
9825
  <xsl:if test="@bundle = 'true'">
@@ -9816,7 +10011,15 @@
9816
10011
  <xsl:value-of select="@section"/>
9817
10012
  <xsl:text> </xsl:text>
9818
10013
  </xsl:if>
9819
- <xsl:value-of select="normalize-space(title)"/>
10014
+ <xsl:variable name="title">
10015
+ <xsl:for-each select="title/node()">
10016
+ <xsl:choose>
10017
+ <xsl:when test="local-name() = 'add' and starts-with(., $ace_tag)"><!-- skip --></xsl:when>
10018
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
10019
+ </xsl:choose>
10020
+ </xsl:for-each>
10021
+ </xsl:variable>
10022
+ <xsl:value-of select="normalize-space($title)"/>
9820
10023
  </fo:bookmark-title>
9821
10024
  <xsl:apply-templates mode="bookmark"/>
9822
10025
  </fo:bookmark>
@@ -9847,6 +10050,12 @@
9847
10050
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'fn']" priority="2"/>
9848
10051
  <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note']"/>
9849
10052
 
10053
+ <xsl:template match="*[local-name() = 'figure']/*[local-name() = 'note'][@type = 'units'] | *[local-name() = 'image']/*[local-name() = 'note'][@type = 'units']" priority="2">
10054
+ <fo:block text-align="right" keep-with-next="always">
10055
+ <xsl:apply-templates/>
10056
+ </fo:block>
10057
+ </xsl:template>
10058
+
9850
10059
  <!-- ====== -->
9851
10060
  <!-- ====== -->
9852
10061
  <xsl:template match="*[local-name() = 'title']" mode="contents_item">
@@ -9996,6 +10205,10 @@
9996
10205
  </xsl:for-each>
9997
10206
  </xsl:template>
9998
10207
 
10208
+ <xsl:template match="*[local-name() = 'add'][starts-with(., $ace_tag)]/text()" mode="contents_item" priority="2">
10209
+ <xsl:value-of select="."/>
10210
+ </xsl:template>
10211
+
9999
10212
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10000
10213
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10001
10214
  <xsl:apply-templates mode="contents_item"/>
@@ -11498,6 +11711,44 @@
11498
11711
 
11499
11712
  <fo:list-block xsl:use-attribute-sets="list-style">
11500
11713
 
11714
+ <xsl:variable name="provisional_distance_between_starts_">
11715
+ <attributes xsl:use-attribute-sets="list-style">
11716
+
11717
+ </attributes>
11718
+ </xsl:variable>
11719
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space(xalan:nodeset($provisional_distance_between_starts_)/attributes/@provisional-distance-between-starts)"/>
11720
+ <xsl:if test="$provisional_distance_between_starts != ''">
11721
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts"/></xsl:attribute>
11722
+ </xsl:if>
11723
+ <xsl:variable name="provisional_distance_between_starts_value" select="substring-before($provisional_distance_between_starts, 'mm')"/>
11724
+
11725
+ <!-- increase provisional-distance-between-starts for long lists -->
11726
+ <xsl:if test="local-name() = 'ol'">
11727
+ <!-- Examples: xiii), xviii), xxviii) -->
11728
+ <xsl:variable name="item_numbers">
11729
+ <xsl:for-each select="*[local-name() = 'li']">
11730
+ <item><xsl:call-template name="getListItemFormat"/></item>
11731
+ </xsl:for-each>
11732
+ </xsl:variable>
11733
+
11734
+ <xsl:variable name="max_length">
11735
+ <xsl:for-each select="xalan:nodeset($item_numbers)/item">
11736
+ <xsl:sort select="string-length(.)" data-type="number" order="descending"/>
11737
+ <xsl:if test="position() = 1"><xsl:value-of select="string-length(.)"/></xsl:if>
11738
+ </xsl:for-each>
11739
+ </xsl:variable>
11740
+
11741
+ <!-- base width (provisional-distance-between-starts) for 4 chars -->
11742
+ <xsl:variable name="addon" select="$max_length - 4"/>
11743
+ <xsl:if test="$addon &gt; 0">
11744
+ <xsl:attribute name="provisional-distance-between-starts"><xsl:value-of select="$provisional_distance_between_starts_value + $addon * 2"/>mm</xsl:attribute>
11745
+ </xsl:if>
11746
+ <!-- DEBUG -->
11747
+ <!-- <xsl:copy-of select="$item_numbers"/>
11748
+ <max_length><xsl:value-of select="$max_length"/></max_length>
11749
+ <addon><xsl:value-of select="$addon"/></addon> -->
11750
+ </xsl:if>
11751
+
11501
11752
  <xsl:if test="*[local-name() = 'name']">
11502
11753
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
11503
11754
  </xsl:if>
@@ -12600,7 +12851,7 @@
12600
12851
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
12601
12852
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
12602
12853
  <!-- add &lt; and &gt; to \S -->
12603
- <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;]</xsl:variable>
12854
+ <xsl:variable name="regex_S">[^\r\n\t\f\v \&lt;&gt;\u3000-\u9FFF]</xsl:variable>
12604
12855
  <xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
12605
12856
  <xsl:variable name="text3">
12606
12857
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -12622,7 +12873,8 @@
12622
12873
  <xsl:choose>
12623
12874
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
12624
12875
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
12625
- <xsl:variable name="regex_dots_units">((\b((\S{1,3}\.\S+)|(\S+\.\S{1,3}))\b)|(\.\S{1,3})\b)</xsl:variable>
12876
+ <xsl:variable name="non_white_space">[^\s\u3000-\u9FFF]</xsl:variable>
12877
+ <xsl:variable name="regex_dots_units">((\b((<xsl:value-of select="$non_white_space"/>{1,3}\.<xsl:value-of select="$non_white_space"/>+)|(<xsl:value-of select="$non_white_space"/>+\.<xsl:value-of select="$non_white_space"/>{1,3}))\b)|(\.<xsl:value-of select="$non_white_space"/>{1,3})\b)</xsl:variable>
12626
12878
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
12627
12879
  <xsl:choose>
12628
12880
  <xsl:when test="self::text()">
@@ -13223,6 +13475,23 @@
13223
13475
  </xsl:if>
13224
13476
  </xsl:template>
13225
13477
 
13478
+ <xsl:template name="setBlockAttributes">
13479
+ <xsl:param name="text_align_default">left</xsl:param>
13480
+ <xsl:call-template name="setTextAlignment">
13481
+ <xsl:with-param name="default" select="$text_align_default"/>
13482
+ </xsl:call-template>
13483
+
13484
+ <!-- https://www.metanorma.org/author/topics/document-format/text/#avoiding-page-breaks -->
13485
+ <!-- Example: keep-lines-together="true" -->
13486
+ <xsl:if test="@keep-lines-together = 'true'">
13487
+ <xsl:attribute name="keep-together.within-column">always</xsl:attribute>
13488
+ </xsl:if>
13489
+ <!-- Example: keep-with-next="true" -->
13490
+ <xsl:if test="@keep-with-next = 'true'">
13491
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
13492
+ </xsl:if>
13493
+ </xsl:template>
13494
+
13226
13495
  <xsl:template name="number-to-words">
13227
13496
  <xsl:param name="number"/>
13228
13497
  <xsl:param name="first"/>