metanorma-ieee 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0e77b3ab3de3ca673830115226fbcb513099163dc9eda80e99690e52b6d9769
4
- data.tar.gz: 90c72649f406b2e1ee198a01de3f27a90283ddabee9ffd83f4757e83e2fd2244
3
+ metadata.gz: cdf013ad5b7bad27f48282dfb166c87e0bce9d41f8a94621b56ce3f648ae7657
4
+ data.tar.gz: 01ddb4d056454b112307855255b9ee2e67ae32bea8247510fc12f7bcc21a80e9
5
5
  SHA512:
6
- metadata.gz: 780a030d7c17d733585f58998322a0c0cddf9d3874205f312c487078787eb4f78db508f524cb247183f682365cbd0198726698dedc9b6aa4bb3f5a77191d0784
7
- data.tar.gz: 806b01577fd868581ce8555a155060a7b3b673120393c187be9b22b214d7fe362c3288bb74dfb9c3483b0155b6f38649057083b2bfdfe36b80e995b39e584bb1
6
+ metadata.gz: 482b633f5f6b44b41c271dc5e1b28d41952ac89e9eaf5cbf581544349999550154f40d89a13f8a805ea87db39428f6719154945a73db0d747c1f597017e79193
7
+ data.tar.gz: 70156591d2d36841d14de1198d8676c475618fcafac4f71693e71f7cfaa3d7400c851715f9ee3f4717b28f54b84f36915f5b9968734f071abc594a753153b412
@@ -12,7 +12,7 @@ module IsoDoc
12
12
  f = isoxml.at(ns("//clause[@type = 'overview']")) or return num
13
13
  out.div **attr_code(id: f["id"]) do |div|
14
14
  num = num + 1
15
- clause_name(num, f&.at(ns("./title")), div, nil)
15
+ clause_name(f, f&.at(ns("./title")), div, nil)
16
16
  f.elements.each do |e|
17
17
  parse(e, div) unless e.name == "title"
18
18
  end
@@ -21,7 +21,7 @@ module IsoDoc
21
21
  end
22
22
 
23
23
  def middle_clause(_docxml = nil)
24
- "//clause[parent::sections][not(@type = 'overview')]"\
24
+ "//clause[parent::sections][not(@type = 'overview')]" \
25
25
  "[not(descendant::terms)]"
26
26
  end
27
27
 
@@ -36,7 +36,7 @@ module IsoDoc
36
36
  def note_p_parse(node, div)
37
37
  name = node&.at(ns("./name"))&.remove
38
38
  div.p do |p|
39
- name and p.span **{ class: "note_label" } do |s|
39
+ name and p.span class: "note_label" do |s|
40
40
  name.children.each { |n| parse(n, s) }
41
41
  s << note_delim
42
42
  end
@@ -48,7 +48,7 @@ module IsoDoc
48
48
  def note_parse1(node, div)
49
49
  name = node&.at(ns("./name"))&.remove
50
50
  name and div.p do |p|
51
- p.span **{ class: "note_label" } do |s|
51
+ p.span class: "note_label" do |s|
52
52
  name.children.each { |n| parse(n, s) }
53
53
  s << note_delim
54
54
  end
@@ -60,13 +60,6 @@ module IsoDoc
60
60
  "&#x2014;"
61
61
  end
62
62
 
63
- def formula_where(dlist, out)
64
- return unless dlist
65
-
66
- parse(dlist, out)
67
- out.parent.at("./dl")["class"] = "formula_dl"
68
- end
69
-
70
63
  def bracket_if_num(num)
71
64
  return nil if num.nil?
72
65
 
@@ -80,7 +73,7 @@ module IsoDoc
80
73
  return if name.nil?
81
74
 
82
75
  name << ":"
83
- div.p **{ class: "example-title" } do |p|
76
+ div.p class: "example-title" do |p|
84
77
  name.children.each { |n| parse(n, p) }
85
78
  end
86
79
  end
@@ -124,6 +124,10 @@ a.FootnoteRef + a.FootnoteRef:before {
124
124
  content: ", ";
125
125
  vertical-align: super; }
126
126
 
127
+ a.TableFootnoteRef + a.TableFootnoteRef:before {
128
+ content: ", ";
129
+ vertical-align: super; }
130
+
127
131
  .addition {
128
132
  color: blue; }
129
133
 
@@ -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>
@@ -6021,6 +6019,10 @@
6021
6019
  </xsl:choose>
6022
6020
  </xsl:variable>
6023
6021
 
6022
+ <xsl:variable name="table_fn_block">
6023
+ <xsl:call-template name="table_fn_display"/>
6024
+ </xsl:variable>
6025
+
6024
6026
  <xsl:variable name="tableWithNotesAndFootnotes">
6025
6027
 
6026
6028
  <fo:table keep-with-previous="always">
@@ -6068,7 +6070,20 @@
6068
6070
 
6069
6071
  <xsl:apply-templates select="../*[local-name()='note']"/>
6070
6072
 
6073
+ <xsl:variable name="isDisplayRowSeparator">
6074
+
6075
+ </xsl:variable>
6076
+
6071
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>
6072
6087
 
6073
6088
  <!-- fn processing -->
6074
6089
  <fo:block/><!-- display fn after table -->
@@ -6086,7 +6101,8 @@
6086
6101
  <xsl:copy-of select="$tableWithNotesAndFootnotes"/>
6087
6102
  </xsl:if>
6088
6103
 
6089
- <xsl:call-template name="table_fn_display"/>
6104
+ <!-- <xsl:call-template name="table_fn_display" /> -->
6105
+ <xsl:copy-of select="$table_fn_block"/>
6090
6106
 
6091
6107
  </xsl:if>
6092
6108
  </xsl:template> <!-- insertTableFooterInSeparateTable -->
@@ -6238,6 +6254,28 @@
6238
6254
  </fo:table-row>
6239
6255
  </xsl:template>
6240
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
+
6241
6279
  <!-- row in table footer (tfoot) -->
6242
6280
  <xsl:template match="*[local-name()='tfoot']/*[local-name()='tr']" priority="2">
6243
6281
  <fo:table-row xsl:use-attribute-sets="table-footer-row-style">
@@ -6586,8 +6624,16 @@
6586
6624
  <!-- figure's footnotes rendering -->
6587
6625
  <xsl:template name="fn_display_figure">
6588
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 -->
6589
6635
  <xsl:variable name="references">
6590
- <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]]">
6591
6637
  <fn reference="{@reference}" id="{@reference}_{ancestor::*[@id][1]/@id}">
6592
6638
  <xsl:apply-templates/>
6593
6639
  </fn>
@@ -6600,91 +6646,93 @@
6600
6646
 
6601
6647
  </xsl:variable>
6602
6648
 
6603
- <!-- current hierarchy is 'figure' element -->
6604
- <xsl:variable name="following_dl_colwidths">
6605
- <xsl:if test="*[local-name() = 'dl']"><!-- if there is a 'dl', then set the same columns width as for 'dl' -->
6606
- <xsl:variable name="simple-table">
6607
- <!-- <xsl:variable name="doc_ns">
6608
- <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>
6682
+ </xsl:variable>
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>
6609
6688
  </xsl:variable>
6610
- <xsl:variable name="ns">
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>
6611
6695
  <xsl:choose>
6612
- <xsl:when test="normalize-space($doc_ns) != ''">
6613
- <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>
6614
6702
  </xsl:when>
6615
6703
  <xsl:otherwise>
6616
- <xsl:value-of select="substring-before(name(/*), '-')"/>
6704
+ <fo:table-column column-width="5%"/>
6705
+ <fo:table-column column-width="95%"/>
6617
6706
  </xsl:otherwise>
6618
6707
  </xsl:choose>
6619
- </xsl:variable> -->
6620
-
6621
- <xsl:for-each select="*[local-name() = 'dl'][1]">
6622
- <tbody>
6623
- <xsl:apply-templates mode="dl"/>
6624
- </tbody>
6625
- </xsl:for-each>
6626
- </xsl:variable>
6627
-
6628
- <xsl:call-template name="calculate-column-widths">
6629
- <xsl:with-param name="cols-count" select="2"/>
6630
- <xsl:with-param name="table" select="$simple-table"/>
6631
- </xsl:call-template>
6632
-
6633
- </xsl:if>
6634
- </xsl:variable>
6635
-
6636
- <xsl:variable name="maxlength_dt">
6637
- <xsl:for-each select="*[local-name() = 'dl'][1]">
6638
- <xsl:call-template name="getMaxLength_dt"/>
6639
- </xsl:for-each>
6640
- </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'">
6641
6723
 
6642
- <fo:block>
6643
- <fo:table width="95%" table-layout="fixed">
6644
- <xsl:if test="normalize-space($key_iso) = 'true'">
6645
- <xsl:attribute name="font-size">10pt</xsl:attribute>
6724
+ <xsl:attribute name="margin-bottom">0</xsl:attribute>
6646
6725
 
6647
- </xsl:if>
6648
- <xsl:choose>
6649
- <!-- if there 'dl', then set same columns width -->
6650
- <xsl:when test="xalan:nodeset($following_dl_colwidths)//column">
6651
- <xsl:call-template name="setColumnWidth_dl">
6652
- <xsl:with-param name="colwidths" select="$following_dl_colwidths"/>
6653
- <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
6654
- </xsl:call-template>
6655
- </xsl:when>
6656
- <xsl:otherwise>
6657
- <fo:table-column column-width="15%"/>
6658
- <fo:table-column column-width="85%"/>
6659
- </xsl:otherwise>
6660
- </xsl:choose>
6661
- <fo:table-body>
6662
- <xsl:for-each select="xalan:nodeset($references)//fn">
6663
- <xsl:variable name="reference" select="@reference"/>
6664
- <xsl:if test="not(preceding-sibling::*[@reference = $reference])"> <!-- only unique reference puts in note-->
6665
- <fo:table-row>
6666
- <fo:table-cell>
6667
- <fo:block>
6668
- <fo:inline id="{@id}" xsl:use-attribute-sets="figure-fn-number-style">
6669
- <xsl:value-of select="@reference"/>
6670
- </fo:inline>
6671
- </fo:block>
6672
- </fo:table-cell>
6673
- <fo:table-cell>
6674
- <fo:block xsl:use-attribute-sets="figure-fn-body-style">
6675
- <xsl:if test="normalize-space($key_iso) = 'true'">
6676
-
6677
- <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>
6678
6735
 
6679
- </xsl:if>
6680
- <xsl:copy-of select="./node()"/>
6681
- </fo:block>
6682
- </fo:table-cell>
6683
- </fo:table-row>
6684
- </xsl:if>
6685
- </xsl:for-each>
6686
- </fo:table-body>
6687
- </fo:table>
6688
6736
  </fo:block>
6689
6737
  </xsl:if>
6690
6738
 
@@ -6760,12 +6808,14 @@
6760
6808
 
6761
6809
  <fo:block margin-bottom="12pt" text-align="left">
6762
6810
 
6763
- <xsl:variable name="title-where">
6811
+ <!-- <xsl:variable name="title-where">
6764
6812
  <xsl:call-template name="getLocalizedString">
6765
6813
  <xsl:with-param name="key">where</xsl:with-param>
6766
6814
  </xsl:call-template>
6767
6815
  </xsl:variable>
6768
- <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>
6769
6819
  <xsl:apply-templates select="*[local-name()='dt']/*"/>
6770
6820
  <xsl:text/>
6771
6821
  <xsl:apply-templates select="*[local-name()='dd']/*" mode="inline"/>
@@ -6775,12 +6825,14 @@
6775
6825
  <xsl:when test="$parent = 'formula'"> <!-- a few components -->
6776
6826
  <fo:block margin-bottom="12pt" text-align="left">
6777
6827
 
6778
- <xsl:variable name="title-where">
6828
+ <!-- <xsl:variable name="title-where">
6779
6829
  <xsl:call-template name="getLocalizedString">
6780
6830
  <xsl:with-param name="key">where</xsl:with-param>
6781
6831
  </xsl:call-template>
6782
6832
  </xsl:variable>
6783
- <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()"/>
6784
6836
  </fo:block>
6785
6837
  </xsl:when> <!-- END: a few components -->
6786
6838
  <xsl:when test="$parent = 'figure' and (not(../@class) or ../@class !='pseudocode')"> <!-- definition list in a figure -->
@@ -6963,6 +7015,9 @@
6963
7015
 
6964
7016
  </xsl:template> <!-- END: dl -->
6965
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
+
6966
7021
  <xsl:template match="*[local-name() = 'dl']/*[local-name() = 'name']">
6967
7022
  <xsl:param name="process">false</xsl:param>
6968
7023
  <xsl:if test="$process = 'true'">
@@ -7790,8 +7845,8 @@
7790
7845
 
7791
7846
  <!-- add zero-width space (#x200B) after dot with next non-digit -->
7792
7847
  <xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(\.)([^\d\s])','$1​$2')"/>
7793
- <!-- add zero-width space (#x200B) after characters: dash, equal, underscore, em dash, thin space, arrow right -->
7794
- <xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1),'(-|=|_|—| |→)','$1​')"/>
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​')"/>
7795
7850
  <!-- add zero-width space (#x200B) after characters: colon, if there aren't digits after -->
7796
7851
  <xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2),'(:)(\D)','$1​$2')"/>
7797
7852
  <!-- add zero-width space (#x200B) after characters: 'great than' -->
@@ -7802,8 +7857,19 @@
7802
7857
  <xsl:variable name="text6" select="java:replaceAll(java:java.lang.String.new($text5), '(?&lt;!\W)(\{)', '​$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
7803
7858
  <!-- add zero-width space (#x200B) after character: , -->
7804
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>
7805
7871
 
7806
- <xsl:value-of select="$text7"/>
7872
+ <xsl:value-of select="$text9"/>
7807
7873
  </xsl:template>
7808
7874
 
7809
7875
  <xsl:template name="add-zero-spaces-link-java">
@@ -7811,8 +7877,8 @@
7811
7877
 
7812
7878
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
7813
7879
  <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
7814
- <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
7815
- <xsl:variable name="url" 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​')"/>
7816
7882
  <!-- remove zero-width space at the end -->
7817
7883
  <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url), '​$', '')"/>
7818
7884
  </xsl:template>
@@ -8167,9 +8233,28 @@
8167
8233
  </xsl:variable>
8168
8234
  <xsl:copy-of select="$newRow"/>
8169
8235
 
8170
- <xsl:apply-templates select="following-sibling::tr[1]" mode="simple-table-rowspan">
8171
- <xsl:with-param name="previousRow" select="$newRow"/>
8172
- </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>
8173
8258
  </xsl:template>
8174
8259
  <!-- End mode simple-table-rowspan -->
8175
8260
 
@@ -8332,6 +8417,27 @@
8332
8417
  </xsl:call-template>
8333
8418
  </xsl:template>
8334
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
+
8335
8441
  <xsl:template name="getFormattingTags">
8336
8442
  <tags>
8337
8443
  <xsl:if test="ancestor::*[local-name() = 'strong']"><tag>strong</tag></xsl:if>
@@ -8675,7 +8781,7 @@
8675
8781
  </xsl:variable>
8676
8782
  <fo:inline xsl:use-attribute-sets="link-style">
8677
8783
 
8678
- <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'])">
8679
8785
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8680
8786
  </xsl:if>
8681
8787
 
@@ -9048,10 +9154,10 @@
9048
9154
  <fo:block xsl:use-attribute-sets="figure-style">
9049
9155
  <xsl:apply-templates select="node()[not(local-name() = 'name') and not(local-name() = 'note' and @type = 'units')]"/>
9050
9156
  </fo:block>
9051
- <xsl:call-template name="fn_display_figure"/>
9052
9157
  <xsl:for-each select="*[local-name() = 'note'][not(@type = 'units')]">
9053
9158
  <xsl:call-template name="note"/>
9054
9159
  </xsl:for-each>
9160
+ <xsl:call-template name="fn_display_figure"/>
9055
9161
 
9056
9162
  <xsl:apply-templates select="*[local-name() = 'name']"/> <!-- show figure's name AFTER image -->
9057
9163
 
@@ -9114,7 +9220,13 @@
9114
9220
  </xsl:choose>
9115
9221
  </xsl:variable>
9116
9222
 
9117
- <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)"/>
9118
9230
  <xsl:if test="number($scale) &lt; 100">
9119
9231
 
9120
9232
  <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
@@ -9701,6 +9813,13 @@
9701
9813
  <xsl:when test="$contents_nodes/doc">
9702
9814
  <xsl:choose>
9703
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
+
9704
9823
  <xsl:for-each select="$contents_nodes/doc">
9705
9824
  <fo:bookmark internal-destination="{contents/item[1]/@id}" starting-state="hide">
9706
9825
  <xsl:if test="@bundle = 'true'">
@@ -11592,6 +11711,44 @@
11592
11711
 
11593
11712
  <fo:list-block xsl:use-attribute-sets="list-style">
11594
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
+
11595
11752
  <xsl:if test="*[local-name() = 'name']">
11596
11753
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
11597
11754
  </xsl:if>
@@ -12694,7 +12851,7 @@
12694
12851
  <!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
12695
12852
  <!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
12696
12853
  <!-- add &lt; and &gt; to \S -->
12697
- <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>
12698
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>
12699
12856
  <xsl:variable name="text3">
12700
12857
  <text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
@@ -12716,7 +12873,8 @@
12716
12873
  <xsl:choose>
12717
12874
  <xsl:when test="ancestor::*[local-name() = 'td' or local-name() = 'th']">
12718
12875
  <!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
12719
- <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>
12720
12878
  <xsl:for-each select="xalan:nodeset($text3)/text/node()">
12721
12879
  <xsl:choose>
12722
12880
  <xsl:when test="self::text()">
@@ -13317,6 +13475,23 @@
13317
13475
  </xsl:if>
13318
13476
  </xsl:template>
13319
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
+
13320
13495
  <xsl:template name="number-to-words">
13321
13496
  <xsl:param name="number"/>
13322
13497
  <xsl:param name="first"/>