metanorma-bipm 2.1.8.1 → 2.1.9

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: 8b23df94295951f1002e1675de50c1e53f915a6d5ec234d3d8675a5062689f23
4
- data.tar.gz: 7086b6fa90413673e86c84b9abf40638d03a738610d0933232c65863641021fe
3
+ metadata.gz: cfbdffcf73976366237efc63ba10a8d4f1abce69283275245e5cb6c0e1a227af
4
+ data.tar.gz: 19cf95cc971bee861e7027dbca0fe4708d81ab03bc34e603d0ef4d2af2cb5db1
5
5
  SHA512:
6
- metadata.gz: d7ea0fc8a9e3e6be89a3eb377baffaaaf2201e677ba01030ac10d2f2c6400daa1a1e33970a5acc9a1a7b6ecce60c3f40d0242a4925a8677d3d5183b002676afd
7
- data.tar.gz: cb8cee58c632312841f699fc4dd5419743714751ff3c4b935f01acd478882fbd335afc4e302d7002ba29d3999ca1fd13be71602fc46c60efc7db52eae7b976c0
6
+ metadata.gz: b35bb3852d18fed6f2977b2b020ff4c6032d7ae1b7785ce85443f43a7720143e7d9d820749cd0cd70ec93d0051c0b0e17f19cfef1bfbe1215fe2cae655a4cd12
7
+ data.tar.gz: aa02636559c9a13fcf1be5dab81e699cca967ec2e72104f8af72eed28a944c88c52a79737f8f029a19c3f80c0a0bb009d9f5b61fa8ba9f90c24d1837e829b7df
@@ -1065,16 +1065,18 @@
1065
1065
  <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and not(@type = 'annex') and not(@type = 'index') and not(@parent = 'annex')]">
1066
1066
  <xsl:call-template name="insertContentItem"/>
1067
1067
  </xsl:for-each>
1068
- <xsl:if test="$doctype ='brochure'">
1069
- <!-- insert page break between main sections and appendixes in ToC -->
1068
+ <!-- insert page break between main sections and appendixes in ToC -->
1069
+ <!-- <xsl:if test="$doctype ='brochure'">
1070
1070
  <fo:table-row>
1071
1071
  <fo:table-cell number-columns-spanned="2">
1072
1072
  <fo:block break-after="page"/>
1073
1073
  </fo:table-cell>
1074
1074
  </fo:table-row>
1075
- </xsl:if>
1075
+ </xsl:if> -->
1076
1076
  <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and (@type = 'annex')]"> <!-- or (@level = 2 and @parent = 'annex') -->
1077
- <xsl:call-template name="insertContentItem"/>
1077
+ <xsl:call-template name="insertContentItem">
1078
+ <xsl:with-param name="keep-with-next">true</xsl:with-param>
1079
+ </xsl:call-template>
1078
1080
  </xsl:for-each>
1079
1081
  <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and (@type = 'index')]">
1080
1082
  <xsl:call-template name="insertContentItem"/>
@@ -1733,7 +1735,11 @@
1733
1735
  </xsl:template>
1734
1736
 
1735
1737
  <xsl:template name="insertContentItem">
1738
+ <xsl:param name="keep-with-next"/>
1736
1739
  <fo:table-row>
1740
+ <xsl:if test="$keep-with-next = 'true'">
1741
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1742
+ </xsl:if>
1737
1743
  <xsl:variable name="space-before">
1738
1744
  <xsl:if test="@level = 1">
1739
1745
  <xsl:if test="@type = 'annex'">14pt</xsl:if>
@@ -2224,6 +2230,14 @@
2224
2230
  <xsl:text> </xsl:text>
2225
2231
  </xsl:template>
2226
2232
 
2233
+ <xsl:template match="*[local-name() = 'sub']" mode="header">
2234
+ <xsl:apply-templates select="."/>
2235
+ </xsl:template>
2236
+
2237
+ <xsl:template match="*[local-name() = 'sup']" mode="header">
2238
+ <xsl:apply-templates select="."/>
2239
+ </xsl:template>
2240
+
2227
2241
  <!-- ====== -->
2228
2242
  <!-- ====== -->
2229
2243
 
@@ -2747,6 +2761,10 @@
2747
2761
  <xsl:attribute name="role">BlockQuote</xsl:attribute>
2748
2762
  </xsl:if>
2749
2763
 
2764
+ <xsl:if test="ancestor::bipm:preface">
2765
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
2766
+ </xsl:if>
2767
+
2750
2768
  <!-- last item -->
2751
2769
  <xsl:if test="not(following-sibling::*[1][local-name() = 'li'])">
2752
2770
  <xsl:attribute name="space-after">6pt</xsl:attribute>
@@ -2913,8 +2931,8 @@
2913
2931
  <xsl:choose>
2914
2932
  <xsl:when test="$curr_lang = 'fr'">
2915
2933
  <xsl:choose>
2916
- <xsl:when test="ancestor::bipm:li">Remarque: </xsl:when>
2917
- <xsl:otherwise>Note: </xsl:otherwise>
2934
+ <xsl:when test="ancestor::bipm:li">Remarque : </xsl:when>
2935
+ <xsl:otherwise>Note : </xsl:otherwise>
2918
2936
  </xsl:choose>
2919
2937
  </xsl:when>
2920
2938
  <xsl:otherwise>Note: </xsl:otherwise>
@@ -2928,11 +2946,26 @@
2928
2946
  </xsl:template>
2929
2947
 
2930
2948
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']" priority="3">
2931
- <fo:inline xsl:use-attribute-sets="note-p-style">
2932
- <xsl:apply-templates/>
2933
- </fo:inline>
2934
- <fo:inline><xsl:value-of select="$linebreak"/></fo:inline>
2935
-
2949
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
2950
+ <xsl:choose>
2951
+ <xsl:when test="$num = 1"> <!-- display first NOTE's paragraph in the same line with label NOTE -->
2952
+ <fo:inline xsl:use-attribute-sets="note-p-style">
2953
+ <xsl:apply-templates/>
2954
+ </fo:inline>
2955
+ </xsl:when>
2956
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
2957
+ <fo:block xsl:use-attribute-sets="note-p-style">
2958
+ <xsl:attribute name="space-before">6pt</xsl:attribute>
2959
+ <xsl:apply-templates/>
2960
+ </fo:block>
2961
+ </xsl:when>
2962
+ <xsl:otherwise>
2963
+ <fo:inline xsl:use-attribute-sets="note-p-style">
2964
+ <xsl:apply-templates/>
2965
+ </fo:inline>
2966
+ <fo:inline><xsl:value-of select="$linebreak"/></fo:inline>
2967
+ </xsl:otherwise>
2968
+ </xsl:choose>
2936
2969
  </xsl:template>
2937
2970
 
2938
2971
  <xsl:template match="*[local-name() = 'sup_fn']">
@@ -4462,6 +4495,7 @@
4462
4495
  <xsl:attribute-set name="note-style">
4463
4496
 
4464
4497
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4498
+ <xsl:attribute name="text-align">justify</xsl:attribute>
4465
4499
 
4466
4500
  </xsl:attribute-set>
4467
4501
 
@@ -8680,7 +8714,11 @@
8680
8714
  </xsl:when>
8681
8715
  <xsl:otherwise>
8682
8716
 
8683
- <xsl:text>:</xsl:text>
8717
+ <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
8718
+ <xsl:choose>
8719
+ <xsl:when test="$curr_lang = 'fr'"><xsl:text> : </xsl:text></xsl:when>
8720
+ <xsl:otherwise><xsl:text>: </xsl:text></xsl:otherwise>
8721
+ </xsl:choose>
8684
8722
 
8685
8723
  </xsl:otherwise>
8686
8724
  </xsl:choose>
@@ -8700,7 +8738,11 @@
8700
8738
  </xsl:when>
8701
8739
  <xsl:otherwise>
8702
8740
 
8703
- <xsl:text>:</xsl:text>
8741
+ <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
8742
+ <xsl:choose>
8743
+ <xsl:when test="$curr_lang = 'fr'"><xsl:text> : </xsl:text></xsl:when>
8744
+ <xsl:otherwise><xsl:text>: </xsl:text></xsl:otherwise>
8745
+ </xsl:choose>
8704
8746
 
8705
8747
  </xsl:otherwise>
8706
8748
  </xsl:choose>
@@ -9709,6 +9751,18 @@
9709
9751
  </xsl:copy>
9710
9752
  </xsl:template>
9711
9753
 
9754
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
9755
+ <xsl:copy>
9756
+ <xsl:apply-templates mode="contents_item"/>
9757
+ </xsl:copy>
9758
+ </xsl:template>
9759
+
9760
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
9761
+ <xsl:copy>
9762
+ <xsl:apply-templates mode="contents_item"/>
9763
+ </xsl:copy>
9764
+ </xsl:template>
9765
+
9712
9766
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
9713
9767
  <xsl:copy-of select="."/>
9714
9768
  </xsl:template>
@@ -11157,21 +11211,29 @@
11157
11211
  </xsl:variable>
11158
11212
 
11159
11213
  <xsl:template match="@*|node()" mode="index_add_id">
11214
+ <xsl:param name="docid"/>
11160
11215
  <xsl:copy>
11161
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
11216
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
11217
+ <xsl:with-param name="docid" select="$docid"/>
11218
+ </xsl:apply-templates>
11162
11219
  </xsl:copy>
11163
11220
  </xsl:template>
11164
11221
 
11165
11222
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
11223
+ <xsl:param name="docid"/>
11166
11224
  <xsl:variable name="id">
11167
- <xsl:call-template name="generateIndexXrefId"/>
11225
+ <xsl:call-template name="generateIndexXrefId">
11226
+ <xsl:with-param name="docid" select="$docid"/>
11227
+ </xsl:call-template>
11168
11228
  </xsl:variable>
11169
11229
  <xsl:copy> <!-- add id to xref -->
11170
11230
  <xsl:apply-templates select="@*" mode="index_add_id"/>
11171
11231
  <xsl:attribute name="id">
11172
11232
  <xsl:value-of select="$id"/>
11173
11233
  </xsl:attribute>
11174
- <xsl:apply-templates mode="index_add_id"/>
11234
+ <xsl:apply-templates mode="index_add_id">
11235
+ <xsl:with-param name="docid" select="$docid"/>
11236
+ </xsl:apply-templates>
11175
11237
  </xsl:copy>
11176
11238
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
11177
11239
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -11183,7 +11245,9 @@
11183
11245
  <xsl:attribute name="id">
11184
11246
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
11185
11247
  </xsl:attribute>
11186
- <xsl:apply-templates mode="index_add_id"/>
11248
+ <xsl:apply-templates mode="index_add_id">
11249
+ <xsl:with-param name="docid" select="$docid"/>
11250
+ </xsl:apply-templates>
11187
11251
  </xsl:copy>
11188
11252
  </xsl:if>
11189
11253
  </xsl:template>
@@ -11220,12 +11284,33 @@
11220
11284
  </xsl:when>
11221
11285
  <xsl:when test="self::* and local-name(.) = 'xref'">
11222
11286
  <xsl:variable name="id" select="@id"/>
11223
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
11224
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
11225
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
11226
11287
 
11288
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
11227
11289
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
11228
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
11290
+
11291
+ <xsl:variable name="pages_">
11292
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
11293
+ <xsl:choose>
11294
+ <xsl:when test="@id = $id">
11295
+ <page><xsl:value-of select="."/></page>
11296
+ </xsl:when>
11297
+ <xsl:when test="@id = $id_next">
11298
+ <page_next><xsl:value-of select="."/></page_next>
11299
+ </xsl:when>
11300
+ <xsl:when test="@id = $id_prev">
11301
+ <page_prev><xsl:value-of select="."/></page_prev>
11302
+ </xsl:when>
11303
+ </xsl:choose>
11304
+ </xsl:for-each>
11305
+ </xsl:variable>
11306
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
11307
+
11308
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
11309
+ <xsl:variable name="page" select="$pages/page"/>
11310
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
11311
+ <xsl:variable name="page_next" select="$pages/page_next"/>
11312
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
11313
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
11229
11314
 
11230
11315
  <xsl:choose>
11231
11316
  <!-- 2nd pass -->
@@ -11285,16 +11370,20 @@
11285
11370
  </xsl:template>
11286
11371
 
11287
11372
  <xsl:template name="generateIndexXrefId">
11373
+ <xsl:param name="docid"/>
11374
+
11288
11375
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
11289
11376
 
11290
- <xsl:variable name="docid">
11291
- <xsl:call-template name="getDocumentId"/>
11377
+ <xsl:variable name="docid_curr">
11378
+ <xsl:value-of select="$docid"/>
11379
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
11292
11380
  </xsl:variable>
11381
+
11293
11382
  <xsl:variable name="item_number">
11294
11383
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
11295
11384
  </xsl:variable>
11296
11385
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
11297
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
11386
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
11298
11387
  </xsl:template>
11299
11388
 
11300
11389
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -1065,16 +1065,18 @@
1065
1065
  <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and not(@type = 'annex') and not(@type = 'index') and not(@parent = 'annex')]">
1066
1066
  <xsl:call-template name="insertContentItem"/>
1067
1067
  </xsl:for-each>
1068
- <xsl:if test="$doctype ='brochure'">
1069
- <!-- insert page break between main sections and appendixes in ToC -->
1068
+ <!-- insert page break between main sections and appendixes in ToC -->
1069
+ <!-- <xsl:if test="$doctype ='brochure'">
1070
1070
  <fo:table-row>
1071
1071
  <fo:table-cell number-columns-spanned="2">
1072
1072
  <fo:block break-after="page"/>
1073
1073
  </fo:table-cell>
1074
1074
  </fo:table-row>
1075
- </xsl:if>
1075
+ </xsl:if> -->
1076
1076
  <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and (@type = 'annex')]"> <!-- or (@level = 2 and @parent = 'annex') -->
1077
- <xsl:call-template name="insertContentItem"/>
1077
+ <xsl:call-template name="insertContentItem">
1078
+ <xsl:with-param name="keep-with-next">true</xsl:with-param>
1079
+ </xsl:call-template>
1078
1080
  </xsl:for-each>
1079
1081
  <xsl:for-each select="$contents/doc[@id = $docid]//item[@display='true' and (@type = 'index')]">
1080
1082
  <xsl:call-template name="insertContentItem"/>
@@ -1733,7 +1735,11 @@
1733
1735
  </xsl:template>
1734
1736
 
1735
1737
  <xsl:template name="insertContentItem">
1738
+ <xsl:param name="keep-with-next"/>
1736
1739
  <fo:table-row>
1740
+ <xsl:if test="$keep-with-next = 'true'">
1741
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1742
+ </xsl:if>
1737
1743
  <xsl:variable name="space-before">
1738
1744
  <xsl:if test="@level = 1">
1739
1745
  <xsl:if test="@type = 'annex'">14pt</xsl:if>
@@ -2224,6 +2230,14 @@
2224
2230
  <xsl:text> </xsl:text>
2225
2231
  </xsl:template>
2226
2232
 
2233
+ <xsl:template match="*[local-name() = 'sub']" mode="header">
2234
+ <xsl:apply-templates select="."/>
2235
+ </xsl:template>
2236
+
2237
+ <xsl:template match="*[local-name() = 'sup']" mode="header">
2238
+ <xsl:apply-templates select="."/>
2239
+ </xsl:template>
2240
+
2227
2241
  <!-- ====== -->
2228
2242
  <!-- ====== -->
2229
2243
 
@@ -2747,6 +2761,10 @@
2747
2761
  <xsl:attribute name="role">BlockQuote</xsl:attribute>
2748
2762
  </xsl:if>
2749
2763
 
2764
+ <xsl:if test="ancestor::bipm:preface">
2765
+ <xsl:attribute name="space-after">6pt</xsl:attribute>
2766
+ </xsl:if>
2767
+
2750
2768
  <!-- last item -->
2751
2769
  <xsl:if test="not(following-sibling::*[1][local-name() = 'li'])">
2752
2770
  <xsl:attribute name="space-after">6pt</xsl:attribute>
@@ -2913,8 +2931,8 @@
2913
2931
  <xsl:choose>
2914
2932
  <xsl:when test="$curr_lang = 'fr'">
2915
2933
  <xsl:choose>
2916
- <xsl:when test="ancestor::bipm:li">Remarque: </xsl:when>
2917
- <xsl:otherwise>Note: </xsl:otherwise>
2934
+ <xsl:when test="ancestor::bipm:li">Remarque : </xsl:when>
2935
+ <xsl:otherwise>Note : </xsl:otherwise>
2918
2936
  </xsl:choose>
2919
2937
  </xsl:when>
2920
2938
  <xsl:otherwise>Note: </xsl:otherwise>
@@ -2928,11 +2946,26 @@
2928
2946
  </xsl:template>
2929
2947
 
2930
2948
  <xsl:template match="*[local-name() = 'note']/*[local-name() = 'p']" priority="3">
2931
- <fo:inline xsl:use-attribute-sets="note-p-style">
2932
- <xsl:apply-templates/>
2933
- </fo:inline>
2934
- <fo:inline><xsl:value-of select="$linebreak"/></fo:inline>
2935
-
2949
+ <xsl:variable name="num"><xsl:number/></xsl:variable>
2950
+ <xsl:choose>
2951
+ <xsl:when test="$num = 1"> <!-- display first NOTE's paragraph in the same line with label NOTE -->
2952
+ <fo:inline xsl:use-attribute-sets="note-p-style">
2953
+ <xsl:apply-templates/>
2954
+ </fo:inline>
2955
+ </xsl:when>
2956
+ <xsl:when test="ancestor::*[local-name() = 'preface']">
2957
+ <fo:block xsl:use-attribute-sets="note-p-style">
2958
+ <xsl:attribute name="space-before">6pt</xsl:attribute>
2959
+ <xsl:apply-templates/>
2960
+ </fo:block>
2961
+ </xsl:when>
2962
+ <xsl:otherwise>
2963
+ <fo:inline xsl:use-attribute-sets="note-p-style">
2964
+ <xsl:apply-templates/>
2965
+ </fo:inline>
2966
+ <fo:inline><xsl:value-of select="$linebreak"/></fo:inline>
2967
+ </xsl:otherwise>
2968
+ </xsl:choose>
2936
2969
  </xsl:template>
2937
2970
 
2938
2971
  <xsl:template match="*[local-name() = 'sup_fn']">
@@ -4462,6 +4495,7 @@
4462
4495
  <xsl:attribute-set name="note-style">
4463
4496
 
4464
4497
  <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
4498
+ <xsl:attribute name="text-align">justify</xsl:attribute>
4465
4499
 
4466
4500
  </xsl:attribute-set>
4467
4501
 
@@ -8680,7 +8714,11 @@
8680
8714
  </xsl:when>
8681
8715
  <xsl:otherwise>
8682
8716
 
8683
- <xsl:text>:</xsl:text>
8717
+ <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
8718
+ <xsl:choose>
8719
+ <xsl:when test="$curr_lang = 'fr'"><xsl:text> : </xsl:text></xsl:when>
8720
+ <xsl:otherwise><xsl:text>: </xsl:text></xsl:otherwise>
8721
+ </xsl:choose>
8684
8722
 
8685
8723
  </xsl:otherwise>
8686
8724
  </xsl:choose>
@@ -8700,7 +8738,11 @@
8700
8738
  </xsl:when>
8701
8739
  <xsl:otherwise>
8702
8740
 
8703
- <xsl:text>:</xsl:text>
8741
+ <xsl:variable name="curr_lang" select="ancestor::bipm:bipm-standard/bipm:bibdata/bipm:language[@current = 'true']"/>
8742
+ <xsl:choose>
8743
+ <xsl:when test="$curr_lang = 'fr'"><xsl:text> : </xsl:text></xsl:when>
8744
+ <xsl:otherwise><xsl:text>: </xsl:text></xsl:otherwise>
8745
+ </xsl:choose>
8704
8746
 
8705
8747
  </xsl:otherwise>
8706
8748
  </xsl:choose>
@@ -9709,6 +9751,18 @@
9709
9751
  </xsl:copy>
9710
9752
  </xsl:template>
9711
9753
 
9754
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
9755
+ <xsl:copy>
9756
+ <xsl:apply-templates mode="contents_item"/>
9757
+ </xsl:copy>
9758
+ </xsl:template>
9759
+
9760
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
9761
+ <xsl:copy>
9762
+ <xsl:apply-templates mode="contents_item"/>
9763
+ </xsl:copy>
9764
+ </xsl:template>
9765
+
9712
9766
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
9713
9767
  <xsl:copy-of select="."/>
9714
9768
  </xsl:template>
@@ -11157,21 +11211,29 @@
11157
11211
  </xsl:variable>
11158
11212
 
11159
11213
  <xsl:template match="@*|node()" mode="index_add_id">
11214
+ <xsl:param name="docid"/>
11160
11215
  <xsl:copy>
11161
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
11216
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
11217
+ <xsl:with-param name="docid" select="$docid"/>
11218
+ </xsl:apply-templates>
11162
11219
  </xsl:copy>
11163
11220
  </xsl:template>
11164
11221
 
11165
11222
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
11223
+ <xsl:param name="docid"/>
11166
11224
  <xsl:variable name="id">
11167
- <xsl:call-template name="generateIndexXrefId"/>
11225
+ <xsl:call-template name="generateIndexXrefId">
11226
+ <xsl:with-param name="docid" select="$docid"/>
11227
+ </xsl:call-template>
11168
11228
  </xsl:variable>
11169
11229
  <xsl:copy> <!-- add id to xref -->
11170
11230
  <xsl:apply-templates select="@*" mode="index_add_id"/>
11171
11231
  <xsl:attribute name="id">
11172
11232
  <xsl:value-of select="$id"/>
11173
11233
  </xsl:attribute>
11174
- <xsl:apply-templates mode="index_add_id"/>
11234
+ <xsl:apply-templates mode="index_add_id">
11235
+ <xsl:with-param name="docid" select="$docid"/>
11236
+ </xsl:apply-templates>
11175
11237
  </xsl:copy>
11176
11238
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
11177
11239
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -11183,7 +11245,9 @@
11183
11245
  <xsl:attribute name="id">
11184
11246
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
11185
11247
  </xsl:attribute>
11186
- <xsl:apply-templates mode="index_add_id"/>
11248
+ <xsl:apply-templates mode="index_add_id">
11249
+ <xsl:with-param name="docid" select="$docid"/>
11250
+ </xsl:apply-templates>
11187
11251
  </xsl:copy>
11188
11252
  </xsl:if>
11189
11253
  </xsl:template>
@@ -11220,12 +11284,33 @@
11220
11284
  </xsl:when>
11221
11285
  <xsl:when test="self::* and local-name(.) = 'xref'">
11222
11286
  <xsl:variable name="id" select="@id"/>
11223
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
11224
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
11225
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
11226
11287
 
11288
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
11227
11289
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
11228
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
11290
+
11291
+ <xsl:variable name="pages_">
11292
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
11293
+ <xsl:choose>
11294
+ <xsl:when test="@id = $id">
11295
+ <page><xsl:value-of select="."/></page>
11296
+ </xsl:when>
11297
+ <xsl:when test="@id = $id_next">
11298
+ <page_next><xsl:value-of select="."/></page_next>
11299
+ </xsl:when>
11300
+ <xsl:when test="@id = $id_prev">
11301
+ <page_prev><xsl:value-of select="."/></page_prev>
11302
+ </xsl:when>
11303
+ </xsl:choose>
11304
+ </xsl:for-each>
11305
+ </xsl:variable>
11306
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
11307
+
11308
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
11309
+ <xsl:variable name="page" select="$pages/page"/>
11310
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
11311
+ <xsl:variable name="page_next" select="$pages/page_next"/>
11312
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
11313
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
11229
11314
 
11230
11315
  <xsl:choose>
11231
11316
  <!-- 2nd pass -->
@@ -11285,16 +11370,20 @@
11285
11370
  </xsl:template>
11286
11371
 
11287
11372
  <xsl:template name="generateIndexXrefId">
11373
+ <xsl:param name="docid"/>
11374
+
11288
11375
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
11289
11376
 
11290
- <xsl:variable name="docid">
11291
- <xsl:call-template name="getDocumentId"/>
11377
+ <xsl:variable name="docid_curr">
11378
+ <xsl:value-of select="$docid"/>
11379
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
11292
11380
  </xsl:variable>
11381
+
11293
11382
  <xsl:variable name="item_number">
11294
11383
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
11295
11384
  </xsl:variable>
11296
11385
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
11297
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
11386
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
11298
11387
  </xsl:template>
11299
11388
 
11300
11389
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">