metanorma-un 0.9.9 → 0.9.11

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: f4134dee9f7b858f16da13effd1f60fcec62c1b81c7d1cb6fb00bf14851839fe
4
- data.tar.gz: 1ca85dfad1fa39a2d5094b62a74f0ed13ce5727368cc1536c3d702e610e1c752
3
+ metadata.gz: f4bd4167f68195cbec758318d3bea161298067b3a6427ffd7cff07c32089b927
4
+ data.tar.gz: 86719aba4467288e566504a9a4ec0fc424d2b94f98c934451b5aab404b8ef3e5
5
5
  SHA512:
6
- metadata.gz: 3164723cc1fd0cc5d20195f4d7d52582585dd0c030763554dc819407c3705bef35d93020d257c26d0c3e8ee65cf079af55768c7639c11a403f62139850ef87d5
7
- data.tar.gz: 2214521c8a53956cc2960db30b4fdf875358dff48a8db4179794b4bf828d32ef7f35f734dcadb602147431397788989f64f00615a0b6cad7d940bf8df03e93b7
6
+ metadata.gz: fa4a668dbe9603be670c3ee2d9a4d2c7e9fa9ae99fc2f8747b9a2eb756440025a868a449938ff1ecaa034bd4203967de150fca8f34e838d43a4d7b08d3e5d2ee
7
+ data.tar.gz: c4af28218a9eb52602ba1c6fe9f57a532cd5f0e94b7d0c0277564ed41a94dc2bb0ce9ef2e3b5a05d734f69883722f952bba1efa35019363f745d706c59ac63e0
@@ -0,0 +1,31 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ # source: https://github.com/marketplace/actions/merge-pull-requests#usage
4
+ name: automerge
5
+ on:
6
+ pull_request:
7
+ types:
8
+ - labeled
9
+ - unlabeled
10
+ - synchronize
11
+ - opened
12
+ - edited
13
+ - ready_for_review
14
+ - reopened
15
+ - unlocked
16
+ pull_request_review:
17
+ types:
18
+ - submitted
19
+ check_suite:
20
+ types:
21
+ - completed
22
+ status: {}
23
+ jobs:
24
+ automerge:
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - id: automerge
28
+ name: automerge
29
+ uses: "pascalgn/automerge-action@v0.15.3"
30
+ env:
31
+ GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
@@ -389,7 +389,7 @@ p {
389
389
  font-weight: 700;
390
390
  font-size: 1em;
391
391
  text-align: center; }
392
- .figure > img {
392
+ .figure > img, .figure > svg {
393
393
  margin-left: auto;
394
394
  margin-right: auto;
395
395
  display: block;
@@ -4173,8 +4173,17 @@
4173
4173
  </fo:inline>
4174
4174
  </xsl:template> <!-- tt -->
4175
4175
 
4176
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
4176
4177
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
4177
- <xsl:call-template name="add_spaces_to_sourcecode"/>
4178
+ <xsl:choose>
4179
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
4180
+ <!-- url -->
4181
+ <xsl:call-template name="add-zero-spaces-link-java"/>
4182
+ </xsl:when>
4183
+ <xsl:otherwise>
4184
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4185
+ </xsl:otherwise>
4186
+ </xsl:choose>
4178
4187
  </xsl:template>
4179
4188
 
4180
4189
  <xsl:template match="*[local-name()='underline']">
@@ -4530,8 +4539,11 @@
4530
4539
 
4531
4540
  <xsl:template name="add-zero-spaces-link-java">
4532
4541
  <xsl:param name="text" select="."/>
4542
+
4543
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4544
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4533
4545
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4534
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4546
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4535
4547
  </xsl:template>
4536
4548
 
4537
4549
  <!-- add zero space after dash character (for table's entries) -->
@@ -7503,7 +7515,7 @@
7503
7515
  <!-- ====== -->
7504
7516
  <!-- eref -->
7505
7517
  <!-- ====== -->
7506
- <xsl:template match="*[local-name() = 'eref']">
7518
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
7507
7519
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7508
7520
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
7509
7521
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -8004,21 +8016,29 @@
8004
8016
  </xsl:variable>
8005
8017
 
8006
8018
  <xsl:template match="@*|node()" mode="index_add_id">
8019
+ <xsl:param name="docid"/>
8007
8020
  <xsl:copy>
8008
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
8021
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
8022
+ <xsl:with-param name="docid" select="$docid"/>
8023
+ </xsl:apply-templates>
8009
8024
  </xsl:copy>
8010
8025
  </xsl:template>
8011
8026
 
8012
8027
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
8028
+ <xsl:param name="docid"/>
8013
8029
  <xsl:variable name="id">
8014
- <xsl:call-template name="generateIndexXrefId"/>
8030
+ <xsl:call-template name="generateIndexXrefId">
8031
+ <xsl:with-param name="docid" select="$docid"/>
8032
+ </xsl:call-template>
8015
8033
  </xsl:variable>
8016
8034
  <xsl:copy> <!-- add id to xref -->
8017
8035
  <xsl:apply-templates select="@*" mode="index_add_id"/>
8018
8036
  <xsl:attribute name="id">
8019
8037
  <xsl:value-of select="$id"/>
8020
8038
  </xsl:attribute>
8021
- <xsl:apply-templates mode="index_add_id"/>
8039
+ <xsl:apply-templates mode="index_add_id">
8040
+ <xsl:with-param name="docid" select="$docid"/>
8041
+ </xsl:apply-templates>
8022
8042
  </xsl:copy>
8023
8043
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
8024
8044
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -8030,7 +8050,9 @@
8030
8050
  <xsl:attribute name="id">
8031
8051
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
8032
8052
  </xsl:attribute>
8033
- <xsl:apply-templates mode="index_add_id"/>
8053
+ <xsl:apply-templates mode="index_add_id">
8054
+ <xsl:with-param name="docid" select="$docid"/>
8055
+ </xsl:apply-templates>
8034
8056
  </xsl:copy>
8035
8057
  </xsl:if>
8036
8058
  </xsl:template>
@@ -8067,12 +8089,33 @@
8067
8089
  </xsl:when>
8068
8090
  <xsl:when test="self::* and local-name(.) = 'xref'">
8069
8091
  <xsl:variable name="id" select="@id"/>
8070
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
8071
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8072
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
8073
8092
 
8093
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8074
8094
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
8075
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
8095
+
8096
+ <xsl:variable name="pages_">
8097
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
8098
+ <xsl:choose>
8099
+ <xsl:when test="@id = $id">
8100
+ <page><xsl:value-of select="."/></page>
8101
+ </xsl:when>
8102
+ <xsl:when test="@id = $id_next">
8103
+ <page_next><xsl:value-of select="."/></page_next>
8104
+ </xsl:when>
8105
+ <xsl:when test="@id = $id_prev">
8106
+ <page_prev><xsl:value-of select="."/></page_prev>
8107
+ </xsl:when>
8108
+ </xsl:choose>
8109
+ </xsl:for-each>
8110
+ </xsl:variable>
8111
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
8112
+
8113
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
8114
+ <xsl:variable name="page" select="$pages/page"/>
8115
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
8116
+ <xsl:variable name="page_next" select="$pages/page_next"/>
8117
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
8118
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
8076
8119
 
8077
8120
  <xsl:choose>
8078
8121
  <!-- 2nd pass -->
@@ -8132,16 +8175,20 @@
8132
8175
  </xsl:template>
8133
8176
 
8134
8177
  <xsl:template name="generateIndexXrefId">
8178
+ <xsl:param name="docid"/>
8179
+
8135
8180
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
8136
8181
 
8137
- <xsl:variable name="docid">
8138
- <xsl:call-template name="getDocumentId"/>
8182
+ <xsl:variable name="docid_curr">
8183
+ <xsl:value-of select="$docid"/>
8184
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
8139
8185
  </xsl:variable>
8186
+
8140
8187
  <xsl:variable name="item_number">
8141
8188
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
8142
8189
  </xsl:variable>
8143
8190
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
8144
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
8191
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
8145
8192
  </xsl:template>
8146
8193
 
8147
8194
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -8898,7 +8945,7 @@
8898
8945
 
8899
8946
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
8900
8947
 
8901
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
8948
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
8902
8949
 
8903
8950
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
8904
8951
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -4173,8 +4173,17 @@
4173
4173
  </fo:inline>
4174
4174
  </xsl:template> <!-- tt -->
4175
4175
 
4176
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
4176
4177
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
4177
- <xsl:call-template name="add_spaces_to_sourcecode"/>
4178
+ <xsl:choose>
4179
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
4180
+ <!-- url -->
4181
+ <xsl:call-template name="add-zero-spaces-link-java"/>
4182
+ </xsl:when>
4183
+ <xsl:otherwise>
4184
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4185
+ </xsl:otherwise>
4186
+ </xsl:choose>
4178
4187
  </xsl:template>
4179
4188
 
4180
4189
  <xsl:template match="*[local-name()='underline']">
@@ -4530,8 +4539,11 @@
4530
4539
 
4531
4540
  <xsl:template name="add-zero-spaces-link-java">
4532
4541
  <xsl:param name="text" select="."/>
4542
+
4543
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4544
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4533
4545
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4534
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4546
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4535
4547
  </xsl:template>
4536
4548
 
4537
4549
  <!-- add zero space after dash character (for table's entries) -->
@@ -7503,7 +7515,7 @@
7503
7515
  <!-- ====== -->
7504
7516
  <!-- eref -->
7505
7517
  <!-- ====== -->
7506
- <xsl:template match="*[local-name() = 'eref']">
7518
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
7507
7519
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7508
7520
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
7509
7521
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -8004,21 +8016,29 @@
8004
8016
  </xsl:variable>
8005
8017
 
8006
8018
  <xsl:template match="@*|node()" mode="index_add_id">
8019
+ <xsl:param name="docid"/>
8007
8020
  <xsl:copy>
8008
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
8021
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
8022
+ <xsl:with-param name="docid" select="$docid"/>
8023
+ </xsl:apply-templates>
8009
8024
  </xsl:copy>
8010
8025
  </xsl:template>
8011
8026
 
8012
8027
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
8028
+ <xsl:param name="docid"/>
8013
8029
  <xsl:variable name="id">
8014
- <xsl:call-template name="generateIndexXrefId"/>
8030
+ <xsl:call-template name="generateIndexXrefId">
8031
+ <xsl:with-param name="docid" select="$docid"/>
8032
+ </xsl:call-template>
8015
8033
  </xsl:variable>
8016
8034
  <xsl:copy> <!-- add id to xref -->
8017
8035
  <xsl:apply-templates select="@*" mode="index_add_id"/>
8018
8036
  <xsl:attribute name="id">
8019
8037
  <xsl:value-of select="$id"/>
8020
8038
  </xsl:attribute>
8021
- <xsl:apply-templates mode="index_add_id"/>
8039
+ <xsl:apply-templates mode="index_add_id">
8040
+ <xsl:with-param name="docid" select="$docid"/>
8041
+ </xsl:apply-templates>
8022
8042
  </xsl:copy>
8023
8043
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
8024
8044
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -8030,7 +8050,9 @@
8030
8050
  <xsl:attribute name="id">
8031
8051
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
8032
8052
  </xsl:attribute>
8033
- <xsl:apply-templates mode="index_add_id"/>
8053
+ <xsl:apply-templates mode="index_add_id">
8054
+ <xsl:with-param name="docid" select="$docid"/>
8055
+ </xsl:apply-templates>
8034
8056
  </xsl:copy>
8035
8057
  </xsl:if>
8036
8058
  </xsl:template>
@@ -8067,12 +8089,33 @@
8067
8089
  </xsl:when>
8068
8090
  <xsl:when test="self::* and local-name(.) = 'xref'">
8069
8091
  <xsl:variable name="id" select="@id"/>
8070
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
8071
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8072
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
8073
8092
 
8093
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8074
8094
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
8075
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
8095
+
8096
+ <xsl:variable name="pages_">
8097
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
8098
+ <xsl:choose>
8099
+ <xsl:when test="@id = $id">
8100
+ <page><xsl:value-of select="."/></page>
8101
+ </xsl:when>
8102
+ <xsl:when test="@id = $id_next">
8103
+ <page_next><xsl:value-of select="."/></page_next>
8104
+ </xsl:when>
8105
+ <xsl:when test="@id = $id_prev">
8106
+ <page_prev><xsl:value-of select="."/></page_prev>
8107
+ </xsl:when>
8108
+ </xsl:choose>
8109
+ </xsl:for-each>
8110
+ </xsl:variable>
8111
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
8112
+
8113
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
8114
+ <xsl:variable name="page" select="$pages/page"/>
8115
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
8116
+ <xsl:variable name="page_next" select="$pages/page_next"/>
8117
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
8118
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
8076
8119
 
8077
8120
  <xsl:choose>
8078
8121
  <!-- 2nd pass -->
@@ -8132,16 +8175,20 @@
8132
8175
  </xsl:template>
8133
8176
 
8134
8177
  <xsl:template name="generateIndexXrefId">
8178
+ <xsl:param name="docid"/>
8179
+
8135
8180
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
8136
8181
 
8137
- <xsl:variable name="docid">
8138
- <xsl:call-template name="getDocumentId"/>
8182
+ <xsl:variable name="docid_curr">
8183
+ <xsl:value-of select="$docid"/>
8184
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
8139
8185
  </xsl:variable>
8186
+
8140
8187
  <xsl:variable name="item_number">
8141
8188
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
8142
8189
  </xsl:variable>
8143
8190
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
8144
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
8191
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
8145
8192
  </xsl:template>
8146
8193
 
8147
8194
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -8898,7 +8945,7 @@
8898
8945
 
8899
8946
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
8900
8947
 
8901
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
8948
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
8902
8949
 
8903
8950
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
8904
8951
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -4244,8 +4244,17 @@
4244
4244
  </fo:inline>
4245
4245
  </xsl:template> <!-- tt -->
4246
4246
 
4247
+ <xsl:variable name="regex_url_start">^(http://|https://|www\.)?(.*)</xsl:variable>
4247
4248
  <xsl:template match="*[local-name()='tt']/text()" priority="2">
4248
- <xsl:call-template name="add_spaces_to_sourcecode"/>
4249
+ <xsl:choose>
4250
+ <xsl:when test="java:replaceAll(java:java.lang.String.new(.), '$2', '') != ''">
4251
+ <!-- url -->
4252
+ <xsl:call-template name="add-zero-spaces-link-java"/>
4253
+ </xsl:when>
4254
+ <xsl:otherwise>
4255
+ <xsl:call-template name="add_spaces_to_sourcecode"/>
4256
+ </xsl:otherwise>
4257
+ </xsl:choose>
4249
4258
  </xsl:template>
4250
4259
 
4251
4260
  <xsl:template match="*[local-name()='underline']">
@@ -4601,8 +4610,11 @@
4601
4610
 
4602
4611
  <xsl:template name="add-zero-spaces-link-java">
4603
4612
  <xsl:param name="text" select="."/>
4613
+
4614
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$1')"/> <!-- http://. https:// or www. -->
4615
+ <xsl:variable name="url_continue" select="java:replaceAll(java:java.lang.String.new($text), $regex_url_start, '$2')"/>
4604
4616
  <!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space -->
4605
- <xsl:value-of select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |,)','$1​')"/>
4617
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new($url_continue),'(-|\.|:|=|_|—| |,|/)','$1​')"/>
4606
4618
  </xsl:template>
4607
4619
 
4608
4620
  <!-- add zero space after dash character (for table's entries) -->
@@ -7583,7 +7595,7 @@
7583
7595
  <!-- ====== -->
7584
7596
  <!-- eref -->
7585
7597
  <!-- ====== -->
7586
- <xsl:template match="*[local-name() = 'eref']">
7598
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
7587
7599
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
7588
7600
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
7589
7601
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -8084,21 +8096,29 @@
8084
8096
  </xsl:variable>
8085
8097
 
8086
8098
  <xsl:template match="@*|node()" mode="index_add_id">
8099
+ <xsl:param name="docid"/>
8087
8100
  <xsl:copy>
8088
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
8101
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
8102
+ <xsl:with-param name="docid" select="$docid"/>
8103
+ </xsl:apply-templates>
8089
8104
  </xsl:copy>
8090
8105
  </xsl:template>
8091
8106
 
8092
8107
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
8108
+ <xsl:param name="docid"/>
8093
8109
  <xsl:variable name="id">
8094
- <xsl:call-template name="generateIndexXrefId"/>
8110
+ <xsl:call-template name="generateIndexXrefId">
8111
+ <xsl:with-param name="docid" select="$docid"/>
8112
+ </xsl:call-template>
8095
8113
  </xsl:variable>
8096
8114
  <xsl:copy> <!-- add id to xref -->
8097
8115
  <xsl:apply-templates select="@*" mode="index_add_id"/>
8098
8116
  <xsl:attribute name="id">
8099
8117
  <xsl:value-of select="$id"/>
8100
8118
  </xsl:attribute>
8101
- <xsl:apply-templates mode="index_add_id"/>
8119
+ <xsl:apply-templates mode="index_add_id">
8120
+ <xsl:with-param name="docid" select="$docid"/>
8121
+ </xsl:apply-templates>
8102
8122
  </xsl:copy>
8103
8123
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
8104
8124
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -8110,7 +8130,9 @@
8110
8130
  <xsl:attribute name="id">
8111
8131
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
8112
8132
  </xsl:attribute>
8113
- <xsl:apply-templates mode="index_add_id"/>
8133
+ <xsl:apply-templates mode="index_add_id">
8134
+ <xsl:with-param name="docid" select="$docid"/>
8135
+ </xsl:apply-templates>
8114
8136
  </xsl:copy>
8115
8137
  </xsl:if>
8116
8138
  </xsl:template>
@@ -8147,12 +8169,33 @@
8147
8169
  </xsl:when>
8148
8170
  <xsl:when test="self::* and local-name(.) = 'xref'">
8149
8171
  <xsl:variable name="id" select="@id"/>
8150
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
8151
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8152
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
8153
8172
 
8173
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8154
8174
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
8155
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
8175
+
8176
+ <xsl:variable name="pages_">
8177
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
8178
+ <xsl:choose>
8179
+ <xsl:when test="@id = $id">
8180
+ <page><xsl:value-of select="."/></page>
8181
+ </xsl:when>
8182
+ <xsl:when test="@id = $id_next">
8183
+ <page_next><xsl:value-of select="."/></page_next>
8184
+ </xsl:when>
8185
+ <xsl:when test="@id = $id_prev">
8186
+ <page_prev><xsl:value-of select="."/></page_prev>
8187
+ </xsl:when>
8188
+ </xsl:choose>
8189
+ </xsl:for-each>
8190
+ </xsl:variable>
8191
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
8192
+
8193
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
8194
+ <xsl:variable name="page" select="$pages/page"/>
8195
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
8196
+ <xsl:variable name="page_next" select="$pages/page_next"/>
8197
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
8198
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
8156
8199
 
8157
8200
  <xsl:choose>
8158
8201
  <!-- 2nd pass -->
@@ -8212,16 +8255,20 @@
8212
8255
  </xsl:template>
8213
8256
 
8214
8257
  <xsl:template name="generateIndexXrefId">
8258
+ <xsl:param name="docid"/>
8259
+
8215
8260
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
8216
8261
 
8217
- <xsl:variable name="docid">
8218
- <xsl:call-template name="getDocumentId"/>
8262
+ <xsl:variable name="docid_curr">
8263
+ <xsl:value-of select="$docid"/>
8264
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
8219
8265
  </xsl:variable>
8266
+
8220
8267
  <xsl:variable name="item_number">
8221
8268
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
8222
8269
  </xsl:variable>
8223
8270
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
8224
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
8271
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
8225
8272
  </xsl:template>
8226
8273
 
8227
8274
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -8979,7 +9026,7 @@
8979
9026
 
8980
9027
  <xsl:variable name="element_name_keep-together_within-line">keep-together_within-line</xsl:variable>
8981
9028
 
8982
- <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'])]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
9029
+ <xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
8983
9030
 
8984
9031
  <!-- enclose standard's number into tag 'keep-together_within-line' -->
8985
9032
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
@@ -1,10 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <include href="biblio.rng">
4
- <start>
5
- <ref name="document"/>
6
- </start>
7
- </include>
8
3
  <define name="document">
9
4
  <element name="document">
10
5
  <optional>
@@ -1125,26 +1120,4 @@
1125
1120
  </zeroOrMore>
1126
1121
  </element>
1127
1122
  </define>
1128
- <define name="ext">
1129
- <element name="ext">
1130
- <ref name="BibDataExtensionType"/>
1131
- </element>
1132
- </define>
1133
- <define name="BibDataExtensionType">
1134
- <ref name="doctype"/>
1135
- </define>
1136
- <define name="doctype">
1137
- <element name="doctype">
1138
- <ref name="DocumentType"/>
1139
- </element>
1140
- </define>
1141
- <define name="DocumentType">
1142
- <value>document</value>
1143
- </define>
1144
- <define name="BibData">
1145
- <ref name="BibliographicItem"/>
1146
- <optional>
1147
- <ref name="ext"/>
1148
- </optional>
1149
- </define>
1150
1123
  </grammar>