metanorma-itu 2.1.8.1 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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">
@@ -4,7 +4,7 @@ require "twitter_cldr"
4
4
  module IsoDoc
5
5
  module ITU
6
6
  class Metadata < IsoDoc::Metadata
7
- def initialize(lang, script, labels)
7
+ def initialize(lang, script, locale, labels)
8
8
  super
9
9
  n = "International_Telecommunication_Union_Logo.svg"
10
10
  set(:logo_html, fileloc(n))