metanorma-itu 2.1.8.1 → 2.1.10

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: cc3399686f48e214718550368bb135a0bd7610505b58dd718302e6b102f3481f
4
- data.tar.gz: ef00c2d8b32c81a5dff7b0e064dbfca1a39e5ce231349d58ed1dfff9b9260ec2
3
+ metadata.gz: ff80a10c49839631d4c76846f353bf8e180ce0ec482a126f63474ecbe091b3ad
4
+ data.tar.gz: e4d8301448368fbd4c9f01a512c8fd7372c88d2adfd34cec55a5e9f33d75c50d
5
5
  SHA512:
6
- metadata.gz: f0b46736932f751c01a8f81752eaec3a1369fef503364745467eb434df221a022697e83b9b5aa4218d66b81f539803fa17d0303331c4241a79591504f3ef6e5c
7
- data.tar.gz: 731eab3ba5a12e8fac1c0b1d84dcdb7810a92ea450151578c6acf089330b0256951763633c190a64301bbbaa483c993ab6565fc330718f4544f9f06318368f56
6
+ metadata.gz: cca3ddc45419d73b876c58cc13f1a3fd3328642bb815308125ceb58a5add436483645160f0975e4385567b7f294e59a2b78e306b5bff7be530092d933d05156d
7
+ data.tar.gz: bd00bfced817a40dce7e195d36638c15255bd8f76d5429ac5c105bb00852dbba0320d3b72326990be6f9b74cf91add3356069fc3fcf4e35dbffe24ac7ab00edb
@@ -6,8 +6,8 @@ require_relative "i18n"
6
6
  module IsoDoc
7
7
  module ITU
8
8
  module Init
9
- def metadata_init(lang, script, i18n)
10
- @meta = Metadata.new(lang, script, i18n)
9
+ def metadata_init(lang, script, locale, i18n)
10
+ @meta = Metadata.new(lang, script, locale, i18n)
11
11
  end
12
12
 
13
13
  def xref_init(lang, script, _klass, i18n, options)
@@ -16,8 +16,9 @@ module IsoDoc
16
16
  @xrefs = Xref.new(lang, script, html, i18n, options)
17
17
  end
18
18
 
19
- def i18n_init(lang, script, i18nyaml = nil)
20
- @i18n = I18n.new(lang, script, i18nyaml: i18nyaml || @i18nyaml)
19
+ def i18n_init(lang, script, locale, i18nyaml = nil)
20
+ @i18n = I18n.new(lang, script, locale: locale,
21
+ i18nyaml: i18nyaml || @i18nyaml)
21
22
  end
22
23
 
23
24
  def fileloc(loc)
@@ -7907,6 +7907,18 @@
7907
7907
  </xsl:copy>
7908
7908
  </xsl:template>
7909
7909
 
7910
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7911
+ <xsl:copy>
7912
+ <xsl:apply-templates mode="contents_item"/>
7913
+ </xsl:copy>
7914
+ </xsl:template>
7915
+
7916
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7917
+ <xsl:copy>
7918
+ <xsl:apply-templates mode="contents_item"/>
7919
+ </xsl:copy>
7920
+ </xsl:template>
7921
+
7910
7922
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7911
7923
  <xsl:copy-of select="."/>
7912
7924
  </xsl:template>
@@ -8853,7 +8865,7 @@
8853
8865
  <!-- ====== -->
8854
8866
  <!-- eref -->
8855
8867
  <!-- ====== -->
8856
- <xsl:template match="*[local-name() = 'eref']">
8868
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
8857
8869
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
8858
8870
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
8859
8871
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -9358,21 +9370,29 @@
9358
9370
  </xsl:variable>
9359
9371
 
9360
9372
  <xsl:template match="@*|node()" mode="index_add_id">
9373
+ <xsl:param name="docid"/>
9361
9374
  <xsl:copy>
9362
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
9375
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
9376
+ <xsl:with-param name="docid" select="$docid"/>
9377
+ </xsl:apply-templates>
9363
9378
  </xsl:copy>
9364
9379
  </xsl:template>
9365
9380
 
9366
9381
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
9382
+ <xsl:param name="docid"/>
9367
9383
  <xsl:variable name="id">
9368
- <xsl:call-template name="generateIndexXrefId"/>
9384
+ <xsl:call-template name="generateIndexXrefId">
9385
+ <xsl:with-param name="docid" select="$docid"/>
9386
+ </xsl:call-template>
9369
9387
  </xsl:variable>
9370
9388
  <xsl:copy> <!-- add id to xref -->
9371
9389
  <xsl:apply-templates select="@*" mode="index_add_id"/>
9372
9390
  <xsl:attribute name="id">
9373
9391
  <xsl:value-of select="$id"/>
9374
9392
  </xsl:attribute>
9375
- <xsl:apply-templates mode="index_add_id"/>
9393
+ <xsl:apply-templates mode="index_add_id">
9394
+ <xsl:with-param name="docid" select="$docid"/>
9395
+ </xsl:apply-templates>
9376
9396
  </xsl:copy>
9377
9397
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
9378
9398
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -9384,7 +9404,9 @@
9384
9404
  <xsl:attribute name="id">
9385
9405
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
9386
9406
  </xsl:attribute>
9387
- <xsl:apply-templates mode="index_add_id"/>
9407
+ <xsl:apply-templates mode="index_add_id">
9408
+ <xsl:with-param name="docid" select="$docid"/>
9409
+ </xsl:apply-templates>
9388
9410
  </xsl:copy>
9389
9411
  </xsl:if>
9390
9412
  </xsl:template>
@@ -9421,12 +9443,33 @@
9421
9443
  </xsl:when>
9422
9444
  <xsl:when test="self::* and local-name(.) = 'xref'">
9423
9445
  <xsl:variable name="id" select="@id"/>
9424
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
9425
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9426
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
9427
9446
 
9447
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9428
9448
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
9429
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
9449
+
9450
+ <xsl:variable name="pages_">
9451
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
9452
+ <xsl:choose>
9453
+ <xsl:when test="@id = $id">
9454
+ <page><xsl:value-of select="."/></page>
9455
+ </xsl:when>
9456
+ <xsl:when test="@id = $id_next">
9457
+ <page_next><xsl:value-of select="."/></page_next>
9458
+ </xsl:when>
9459
+ <xsl:when test="@id = $id_prev">
9460
+ <page_prev><xsl:value-of select="."/></page_prev>
9461
+ </xsl:when>
9462
+ </xsl:choose>
9463
+ </xsl:for-each>
9464
+ </xsl:variable>
9465
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
9466
+
9467
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
9468
+ <xsl:variable name="page" select="$pages/page"/>
9469
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
9470
+ <xsl:variable name="page_next" select="$pages/page_next"/>
9471
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
9472
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
9430
9473
 
9431
9474
  <xsl:choose>
9432
9475
  <!-- 2nd pass -->
@@ -9486,16 +9529,20 @@
9486
9529
  </xsl:template>
9487
9530
 
9488
9531
  <xsl:template name="generateIndexXrefId">
9532
+ <xsl:param name="docid"/>
9533
+
9489
9534
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9490
9535
 
9491
- <xsl:variable name="docid">
9492
- <xsl:call-template name="getDocumentId"/>
9536
+ <xsl:variable name="docid_curr">
9537
+ <xsl:value-of select="$docid"/>
9538
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9493
9539
  </xsl:variable>
9540
+
9494
9541
  <xsl:variable name="item_number">
9495
9542
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9496
9543
  </xsl:variable>
9497
9544
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9498
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9545
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9499
9546
  </xsl:template>
9500
9547
 
9501
9548
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -7907,6 +7907,18 @@
7907
7907
  </xsl:copy>
7908
7908
  </xsl:template>
7909
7909
 
7910
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7911
+ <xsl:copy>
7912
+ <xsl:apply-templates mode="contents_item"/>
7913
+ </xsl:copy>
7914
+ </xsl:template>
7915
+
7916
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7917
+ <xsl:copy>
7918
+ <xsl:apply-templates mode="contents_item"/>
7919
+ </xsl:copy>
7920
+ </xsl:template>
7921
+
7910
7922
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7911
7923
  <xsl:copy-of select="."/>
7912
7924
  </xsl:template>
@@ -8853,7 +8865,7 @@
8853
8865
  <!-- ====== -->
8854
8866
  <!-- eref -->
8855
8867
  <!-- ====== -->
8856
- <xsl:template match="*[local-name() = 'eref']">
8868
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
8857
8869
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
8858
8870
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
8859
8871
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -9358,21 +9370,29 @@
9358
9370
  </xsl:variable>
9359
9371
 
9360
9372
  <xsl:template match="@*|node()" mode="index_add_id">
9373
+ <xsl:param name="docid"/>
9361
9374
  <xsl:copy>
9362
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
9375
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
9376
+ <xsl:with-param name="docid" select="$docid"/>
9377
+ </xsl:apply-templates>
9363
9378
  </xsl:copy>
9364
9379
  </xsl:template>
9365
9380
 
9366
9381
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
9382
+ <xsl:param name="docid"/>
9367
9383
  <xsl:variable name="id">
9368
- <xsl:call-template name="generateIndexXrefId"/>
9384
+ <xsl:call-template name="generateIndexXrefId">
9385
+ <xsl:with-param name="docid" select="$docid"/>
9386
+ </xsl:call-template>
9369
9387
  </xsl:variable>
9370
9388
  <xsl:copy> <!-- add id to xref -->
9371
9389
  <xsl:apply-templates select="@*" mode="index_add_id"/>
9372
9390
  <xsl:attribute name="id">
9373
9391
  <xsl:value-of select="$id"/>
9374
9392
  </xsl:attribute>
9375
- <xsl:apply-templates mode="index_add_id"/>
9393
+ <xsl:apply-templates mode="index_add_id">
9394
+ <xsl:with-param name="docid" select="$docid"/>
9395
+ </xsl:apply-templates>
9376
9396
  </xsl:copy>
9377
9397
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
9378
9398
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -9384,7 +9404,9 @@
9384
9404
  <xsl:attribute name="id">
9385
9405
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
9386
9406
  </xsl:attribute>
9387
- <xsl:apply-templates mode="index_add_id"/>
9407
+ <xsl:apply-templates mode="index_add_id">
9408
+ <xsl:with-param name="docid" select="$docid"/>
9409
+ </xsl:apply-templates>
9388
9410
  </xsl:copy>
9389
9411
  </xsl:if>
9390
9412
  </xsl:template>
@@ -9421,12 +9443,33 @@
9421
9443
  </xsl:when>
9422
9444
  <xsl:when test="self::* and local-name(.) = 'xref'">
9423
9445
  <xsl:variable name="id" select="@id"/>
9424
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
9425
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9426
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
9427
9446
 
9447
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9428
9448
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
9429
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
9449
+
9450
+ <xsl:variable name="pages_">
9451
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
9452
+ <xsl:choose>
9453
+ <xsl:when test="@id = $id">
9454
+ <page><xsl:value-of select="."/></page>
9455
+ </xsl:when>
9456
+ <xsl:when test="@id = $id_next">
9457
+ <page_next><xsl:value-of select="."/></page_next>
9458
+ </xsl:when>
9459
+ <xsl:when test="@id = $id_prev">
9460
+ <page_prev><xsl:value-of select="."/></page_prev>
9461
+ </xsl:when>
9462
+ </xsl:choose>
9463
+ </xsl:for-each>
9464
+ </xsl:variable>
9465
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
9466
+
9467
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
9468
+ <xsl:variable name="page" select="$pages/page"/>
9469
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
9470
+ <xsl:variable name="page_next" select="$pages/page_next"/>
9471
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
9472
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
9430
9473
 
9431
9474
  <xsl:choose>
9432
9475
  <!-- 2nd pass -->
@@ -9486,16 +9529,20 @@
9486
9529
  </xsl:template>
9487
9530
 
9488
9531
  <xsl:template name="generateIndexXrefId">
9532
+ <xsl:param name="docid"/>
9533
+
9489
9534
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9490
9535
 
9491
- <xsl:variable name="docid">
9492
- <xsl:call-template name="getDocumentId"/>
9536
+ <xsl:variable name="docid_curr">
9537
+ <xsl:value-of select="$docid"/>
9538
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9493
9539
  </xsl:variable>
9540
+
9494
9541
  <xsl:variable name="item_number">
9495
9542
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9496
9543
  </xsl:variable>
9497
9544
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9498
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9545
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9499
9546
  </xsl:template>
9500
9547
 
9501
9548
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -7907,6 +7907,18 @@
7907
7907
  </xsl:copy>
7908
7908
  </xsl:template>
7909
7909
 
7910
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7911
+ <xsl:copy>
7912
+ <xsl:apply-templates mode="contents_item"/>
7913
+ </xsl:copy>
7914
+ </xsl:template>
7915
+
7916
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7917
+ <xsl:copy>
7918
+ <xsl:apply-templates mode="contents_item"/>
7919
+ </xsl:copy>
7920
+ </xsl:template>
7921
+
7910
7922
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7911
7923
  <xsl:copy-of select="."/>
7912
7924
  </xsl:template>
@@ -8853,7 +8865,7 @@
8853
8865
  <!-- ====== -->
8854
8866
  <!-- eref -->
8855
8867
  <!-- ====== -->
8856
- <xsl:template match="*[local-name() = 'eref']">
8868
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
8857
8869
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
8858
8870
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
8859
8871
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -9358,21 +9370,29 @@
9358
9370
  </xsl:variable>
9359
9371
 
9360
9372
  <xsl:template match="@*|node()" mode="index_add_id">
9373
+ <xsl:param name="docid"/>
9361
9374
  <xsl:copy>
9362
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
9375
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
9376
+ <xsl:with-param name="docid" select="$docid"/>
9377
+ </xsl:apply-templates>
9363
9378
  </xsl:copy>
9364
9379
  </xsl:template>
9365
9380
 
9366
9381
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
9382
+ <xsl:param name="docid"/>
9367
9383
  <xsl:variable name="id">
9368
- <xsl:call-template name="generateIndexXrefId"/>
9384
+ <xsl:call-template name="generateIndexXrefId">
9385
+ <xsl:with-param name="docid" select="$docid"/>
9386
+ </xsl:call-template>
9369
9387
  </xsl:variable>
9370
9388
  <xsl:copy> <!-- add id to xref -->
9371
9389
  <xsl:apply-templates select="@*" mode="index_add_id"/>
9372
9390
  <xsl:attribute name="id">
9373
9391
  <xsl:value-of select="$id"/>
9374
9392
  </xsl:attribute>
9375
- <xsl:apply-templates mode="index_add_id"/>
9393
+ <xsl:apply-templates mode="index_add_id">
9394
+ <xsl:with-param name="docid" select="$docid"/>
9395
+ </xsl:apply-templates>
9376
9396
  </xsl:copy>
9377
9397
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
9378
9398
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -9384,7 +9404,9 @@
9384
9404
  <xsl:attribute name="id">
9385
9405
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
9386
9406
  </xsl:attribute>
9387
- <xsl:apply-templates mode="index_add_id"/>
9407
+ <xsl:apply-templates mode="index_add_id">
9408
+ <xsl:with-param name="docid" select="$docid"/>
9409
+ </xsl:apply-templates>
9388
9410
  </xsl:copy>
9389
9411
  </xsl:if>
9390
9412
  </xsl:template>
@@ -9421,12 +9443,33 @@
9421
9443
  </xsl:when>
9422
9444
  <xsl:when test="self::* and local-name(.) = 'xref'">
9423
9445
  <xsl:variable name="id" select="@id"/>
9424
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
9425
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9426
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
9427
9446
 
9447
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9428
9448
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
9429
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
9449
+
9450
+ <xsl:variable name="pages_">
9451
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
9452
+ <xsl:choose>
9453
+ <xsl:when test="@id = $id">
9454
+ <page><xsl:value-of select="."/></page>
9455
+ </xsl:when>
9456
+ <xsl:when test="@id = $id_next">
9457
+ <page_next><xsl:value-of select="."/></page_next>
9458
+ </xsl:when>
9459
+ <xsl:when test="@id = $id_prev">
9460
+ <page_prev><xsl:value-of select="."/></page_prev>
9461
+ </xsl:when>
9462
+ </xsl:choose>
9463
+ </xsl:for-each>
9464
+ </xsl:variable>
9465
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
9466
+
9467
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
9468
+ <xsl:variable name="page" select="$pages/page"/>
9469
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
9470
+ <xsl:variable name="page_next" select="$pages/page_next"/>
9471
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
9472
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
9430
9473
 
9431
9474
  <xsl:choose>
9432
9475
  <!-- 2nd pass -->
@@ -9486,16 +9529,20 @@
9486
9529
  </xsl:template>
9487
9530
 
9488
9531
  <xsl:template name="generateIndexXrefId">
9532
+ <xsl:param name="docid"/>
9533
+
9489
9534
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9490
9535
 
9491
- <xsl:variable name="docid">
9492
- <xsl:call-template name="getDocumentId"/>
9536
+ <xsl:variable name="docid_curr">
9537
+ <xsl:value-of select="$docid"/>
9538
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9493
9539
  </xsl:variable>
9540
+
9494
9541
  <xsl:variable name="item_number">
9495
9542
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9496
9543
  </xsl:variable>
9497
9544
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9498
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9545
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9499
9546
  </xsl:template>
9500
9547
 
9501
9548
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -7907,6 +7907,18 @@
7907
7907
  </xsl:copy>
7908
7908
  </xsl:template>
7909
7909
 
7910
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7911
+ <xsl:copy>
7912
+ <xsl:apply-templates mode="contents_item"/>
7913
+ </xsl:copy>
7914
+ </xsl:template>
7915
+
7916
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7917
+ <xsl:copy>
7918
+ <xsl:apply-templates mode="contents_item"/>
7919
+ </xsl:copy>
7920
+ </xsl:template>
7921
+
7910
7922
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7911
7923
  <xsl:copy-of select="."/>
7912
7924
  </xsl:template>
@@ -8853,7 +8865,7 @@
8853
8865
  <!-- ====== -->
8854
8866
  <!-- eref -->
8855
8867
  <!-- ====== -->
8856
- <xsl:template match="*[local-name() = 'eref']">
8868
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
8857
8869
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
8858
8870
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
8859
8871
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -9358,21 +9370,29 @@
9358
9370
  </xsl:variable>
9359
9371
 
9360
9372
  <xsl:template match="@*|node()" mode="index_add_id">
9373
+ <xsl:param name="docid"/>
9361
9374
  <xsl:copy>
9362
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
9375
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
9376
+ <xsl:with-param name="docid" select="$docid"/>
9377
+ </xsl:apply-templates>
9363
9378
  </xsl:copy>
9364
9379
  </xsl:template>
9365
9380
 
9366
9381
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
9382
+ <xsl:param name="docid"/>
9367
9383
  <xsl:variable name="id">
9368
- <xsl:call-template name="generateIndexXrefId"/>
9384
+ <xsl:call-template name="generateIndexXrefId">
9385
+ <xsl:with-param name="docid" select="$docid"/>
9386
+ </xsl:call-template>
9369
9387
  </xsl:variable>
9370
9388
  <xsl:copy> <!-- add id to xref -->
9371
9389
  <xsl:apply-templates select="@*" mode="index_add_id"/>
9372
9390
  <xsl:attribute name="id">
9373
9391
  <xsl:value-of select="$id"/>
9374
9392
  </xsl:attribute>
9375
- <xsl:apply-templates mode="index_add_id"/>
9393
+ <xsl:apply-templates mode="index_add_id">
9394
+ <xsl:with-param name="docid" select="$docid"/>
9395
+ </xsl:apply-templates>
9376
9396
  </xsl:copy>
9377
9397
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
9378
9398
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -9384,7 +9404,9 @@
9384
9404
  <xsl:attribute name="id">
9385
9405
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
9386
9406
  </xsl:attribute>
9387
- <xsl:apply-templates mode="index_add_id"/>
9407
+ <xsl:apply-templates mode="index_add_id">
9408
+ <xsl:with-param name="docid" select="$docid"/>
9409
+ </xsl:apply-templates>
9388
9410
  </xsl:copy>
9389
9411
  </xsl:if>
9390
9412
  </xsl:template>
@@ -9421,12 +9443,33 @@
9421
9443
  </xsl:when>
9422
9444
  <xsl:when test="self::* and local-name(.) = 'xref'">
9423
9445
  <xsl:variable name="id" select="@id"/>
9424
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
9425
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9426
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
9427
9446
 
9447
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9428
9448
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
9429
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
9449
+
9450
+ <xsl:variable name="pages_">
9451
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
9452
+ <xsl:choose>
9453
+ <xsl:when test="@id = $id">
9454
+ <page><xsl:value-of select="."/></page>
9455
+ </xsl:when>
9456
+ <xsl:when test="@id = $id_next">
9457
+ <page_next><xsl:value-of select="."/></page_next>
9458
+ </xsl:when>
9459
+ <xsl:when test="@id = $id_prev">
9460
+ <page_prev><xsl:value-of select="."/></page_prev>
9461
+ </xsl:when>
9462
+ </xsl:choose>
9463
+ </xsl:for-each>
9464
+ </xsl:variable>
9465
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
9466
+
9467
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
9468
+ <xsl:variable name="page" select="$pages/page"/>
9469
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
9470
+ <xsl:variable name="page_next" select="$pages/page_next"/>
9471
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
9472
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
9430
9473
 
9431
9474
  <xsl:choose>
9432
9475
  <!-- 2nd pass -->
@@ -9486,16 +9529,20 @@
9486
9529
  </xsl:template>
9487
9530
 
9488
9531
  <xsl:template name="generateIndexXrefId">
9532
+ <xsl:param name="docid"/>
9533
+
9489
9534
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9490
9535
 
9491
- <xsl:variable name="docid">
9492
- <xsl:call-template name="getDocumentId"/>
9536
+ <xsl:variable name="docid_curr">
9537
+ <xsl:value-of select="$docid"/>
9538
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9493
9539
  </xsl:variable>
9540
+
9494
9541
  <xsl:variable name="item_number">
9495
9542
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9496
9543
  </xsl:variable>
9497
9544
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9498
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9545
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9499
9546
  </xsl:template>
9500
9547
 
9501
9548
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">