metanorma-ogc 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7392,6 +7392,18 @@
7392
7392
  </xsl:copy>
7393
7393
  </xsl:template>
7394
7394
 
7395
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7396
+ <xsl:copy>
7397
+ <xsl:apply-templates mode="contents_item"/>
7398
+ </xsl:copy>
7399
+ </xsl:template>
7400
+
7401
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7402
+ <xsl:copy>
7403
+ <xsl:apply-templates mode="contents_item"/>
7404
+ </xsl:copy>
7405
+ </xsl:template>
7406
+
7395
7407
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7396
7408
  <xsl:copy-of select="."/>
7397
7409
  </xsl:template>
@@ -8874,21 +8886,29 @@
8874
8886
  </xsl:variable>
8875
8887
 
8876
8888
  <xsl:template match="@*|node()" mode="index_add_id">
8889
+ <xsl:param name="docid"/>
8877
8890
  <xsl:copy>
8878
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
8891
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
8892
+ <xsl:with-param name="docid" select="$docid"/>
8893
+ </xsl:apply-templates>
8879
8894
  </xsl:copy>
8880
8895
  </xsl:template>
8881
8896
 
8882
8897
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
8898
+ <xsl:param name="docid"/>
8883
8899
  <xsl:variable name="id">
8884
- <xsl:call-template name="generateIndexXrefId"/>
8900
+ <xsl:call-template name="generateIndexXrefId">
8901
+ <xsl:with-param name="docid" select="$docid"/>
8902
+ </xsl:call-template>
8885
8903
  </xsl:variable>
8886
8904
  <xsl:copy> <!-- add id to xref -->
8887
8905
  <xsl:apply-templates select="@*" mode="index_add_id"/>
8888
8906
  <xsl:attribute name="id">
8889
8907
  <xsl:value-of select="$id"/>
8890
8908
  </xsl:attribute>
8891
- <xsl:apply-templates mode="index_add_id"/>
8909
+ <xsl:apply-templates mode="index_add_id">
8910
+ <xsl:with-param name="docid" select="$docid"/>
8911
+ </xsl:apply-templates>
8892
8912
  </xsl:copy>
8893
8913
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
8894
8914
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -8900,7 +8920,9 @@
8900
8920
  <xsl:attribute name="id">
8901
8921
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
8902
8922
  </xsl:attribute>
8903
- <xsl:apply-templates mode="index_add_id"/>
8923
+ <xsl:apply-templates mode="index_add_id">
8924
+ <xsl:with-param name="docid" select="$docid"/>
8925
+ </xsl:apply-templates>
8904
8926
  </xsl:copy>
8905
8927
  </xsl:if>
8906
8928
  </xsl:template>
@@ -8937,12 +8959,33 @@
8937
8959
  </xsl:when>
8938
8960
  <xsl:when test="self::* and local-name(.) = 'xref'">
8939
8961
  <xsl:variable name="id" select="@id"/>
8940
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
8941
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8942
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
8943
8962
 
8963
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8944
8964
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
8945
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
8965
+
8966
+ <xsl:variable name="pages_">
8967
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
8968
+ <xsl:choose>
8969
+ <xsl:when test="@id = $id">
8970
+ <page><xsl:value-of select="."/></page>
8971
+ </xsl:when>
8972
+ <xsl:when test="@id = $id_next">
8973
+ <page_next><xsl:value-of select="."/></page_next>
8974
+ </xsl:when>
8975
+ <xsl:when test="@id = $id_prev">
8976
+ <page_prev><xsl:value-of select="."/></page_prev>
8977
+ </xsl:when>
8978
+ </xsl:choose>
8979
+ </xsl:for-each>
8980
+ </xsl:variable>
8981
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
8982
+
8983
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
8984
+ <xsl:variable name="page" select="$pages/page"/>
8985
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
8986
+ <xsl:variable name="page_next" select="$pages/page_next"/>
8987
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
8988
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
8946
8989
 
8947
8990
  <xsl:choose>
8948
8991
  <!-- 2nd pass -->
@@ -9002,16 +9045,20 @@
9002
9045
  </xsl:template>
9003
9046
 
9004
9047
  <xsl:template name="generateIndexXrefId">
9048
+ <xsl:param name="docid"/>
9049
+
9005
9050
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9006
9051
 
9007
- <xsl:variable name="docid">
9008
- <xsl:call-template name="getDocumentId"/>
9052
+ <xsl:variable name="docid_curr">
9053
+ <xsl:value-of select="$docid"/>
9054
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9009
9055
  </xsl:variable>
9056
+
9010
9057
  <xsl:variable name="item_number">
9011
9058
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9012
9059
  </xsl:variable>
9013
9060
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9014
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9061
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9015
9062
  </xsl:template>
9016
9063
 
9017
9064
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -7392,6 +7392,18 @@
7392
7392
  </xsl:copy>
7393
7393
  </xsl:template>
7394
7394
 
7395
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7396
+ <xsl:copy>
7397
+ <xsl:apply-templates mode="contents_item"/>
7398
+ </xsl:copy>
7399
+ </xsl:template>
7400
+
7401
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7402
+ <xsl:copy>
7403
+ <xsl:apply-templates mode="contents_item"/>
7404
+ </xsl:copy>
7405
+ </xsl:template>
7406
+
7395
7407
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7396
7408
  <xsl:copy-of select="."/>
7397
7409
  </xsl:template>
@@ -8874,21 +8886,29 @@
8874
8886
  </xsl:variable>
8875
8887
 
8876
8888
  <xsl:template match="@*|node()" mode="index_add_id">
8889
+ <xsl:param name="docid"/>
8877
8890
  <xsl:copy>
8878
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
8891
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
8892
+ <xsl:with-param name="docid" select="$docid"/>
8893
+ </xsl:apply-templates>
8879
8894
  </xsl:copy>
8880
8895
  </xsl:template>
8881
8896
 
8882
8897
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
8898
+ <xsl:param name="docid"/>
8883
8899
  <xsl:variable name="id">
8884
- <xsl:call-template name="generateIndexXrefId"/>
8900
+ <xsl:call-template name="generateIndexXrefId">
8901
+ <xsl:with-param name="docid" select="$docid"/>
8902
+ </xsl:call-template>
8885
8903
  </xsl:variable>
8886
8904
  <xsl:copy> <!-- add id to xref -->
8887
8905
  <xsl:apply-templates select="@*" mode="index_add_id"/>
8888
8906
  <xsl:attribute name="id">
8889
8907
  <xsl:value-of select="$id"/>
8890
8908
  </xsl:attribute>
8891
- <xsl:apply-templates mode="index_add_id"/>
8909
+ <xsl:apply-templates mode="index_add_id">
8910
+ <xsl:with-param name="docid" select="$docid"/>
8911
+ </xsl:apply-templates>
8892
8912
  </xsl:copy>
8893
8913
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
8894
8914
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -8900,7 +8920,9 @@
8900
8920
  <xsl:attribute name="id">
8901
8921
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
8902
8922
  </xsl:attribute>
8903
- <xsl:apply-templates mode="index_add_id"/>
8923
+ <xsl:apply-templates mode="index_add_id">
8924
+ <xsl:with-param name="docid" select="$docid"/>
8925
+ </xsl:apply-templates>
8904
8926
  </xsl:copy>
8905
8927
  </xsl:if>
8906
8928
  </xsl:template>
@@ -8937,12 +8959,33 @@
8937
8959
  </xsl:when>
8938
8960
  <xsl:when test="self::* and local-name(.) = 'xref'">
8939
8961
  <xsl:variable name="id" select="@id"/>
8940
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
8941
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8942
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
8943
8962
 
8963
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8944
8964
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
8945
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
8965
+
8966
+ <xsl:variable name="pages_">
8967
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
8968
+ <xsl:choose>
8969
+ <xsl:when test="@id = $id">
8970
+ <page><xsl:value-of select="."/></page>
8971
+ </xsl:when>
8972
+ <xsl:when test="@id = $id_next">
8973
+ <page_next><xsl:value-of select="."/></page_next>
8974
+ </xsl:when>
8975
+ <xsl:when test="@id = $id_prev">
8976
+ <page_prev><xsl:value-of select="."/></page_prev>
8977
+ </xsl:when>
8978
+ </xsl:choose>
8979
+ </xsl:for-each>
8980
+ </xsl:variable>
8981
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
8982
+
8983
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
8984
+ <xsl:variable name="page" select="$pages/page"/>
8985
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
8986
+ <xsl:variable name="page_next" select="$pages/page_next"/>
8987
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
8988
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
8946
8989
 
8947
8990
  <xsl:choose>
8948
8991
  <!-- 2nd pass -->
@@ -9002,16 +9045,20 @@
9002
9045
  </xsl:template>
9003
9046
 
9004
9047
  <xsl:template name="generateIndexXrefId">
9048
+ <xsl:param name="docid"/>
9049
+
9005
9050
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9006
9051
 
9007
- <xsl:variable name="docid">
9008
- <xsl:call-template name="getDocumentId"/>
9052
+ <xsl:variable name="docid_curr">
9053
+ <xsl:value-of select="$docid"/>
9054
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9009
9055
  </xsl:variable>
9056
+
9010
9057
  <xsl:variable name="item_number">
9011
9058
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9012
9059
  </xsl:variable>
9013
9060
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9014
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9061
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9015
9062
  </xsl:template>
9016
9063
 
9017
9064
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -7392,6 +7392,18 @@
7392
7392
  </xsl:copy>
7393
7393
  </xsl:template>
7394
7394
 
7395
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7396
+ <xsl:copy>
7397
+ <xsl:apply-templates mode="contents_item"/>
7398
+ </xsl:copy>
7399
+ </xsl:template>
7400
+
7401
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7402
+ <xsl:copy>
7403
+ <xsl:apply-templates mode="contents_item"/>
7404
+ </xsl:copy>
7405
+ </xsl:template>
7406
+
7395
7407
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7396
7408
  <xsl:copy-of select="."/>
7397
7409
  </xsl:template>
@@ -8874,21 +8886,29 @@
8874
8886
  </xsl:variable>
8875
8887
 
8876
8888
  <xsl:template match="@*|node()" mode="index_add_id">
8889
+ <xsl:param name="docid"/>
8877
8890
  <xsl:copy>
8878
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
8891
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
8892
+ <xsl:with-param name="docid" select="$docid"/>
8893
+ </xsl:apply-templates>
8879
8894
  </xsl:copy>
8880
8895
  </xsl:template>
8881
8896
 
8882
8897
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
8898
+ <xsl:param name="docid"/>
8883
8899
  <xsl:variable name="id">
8884
- <xsl:call-template name="generateIndexXrefId"/>
8900
+ <xsl:call-template name="generateIndexXrefId">
8901
+ <xsl:with-param name="docid" select="$docid"/>
8902
+ </xsl:call-template>
8885
8903
  </xsl:variable>
8886
8904
  <xsl:copy> <!-- add id to xref -->
8887
8905
  <xsl:apply-templates select="@*" mode="index_add_id"/>
8888
8906
  <xsl:attribute name="id">
8889
8907
  <xsl:value-of select="$id"/>
8890
8908
  </xsl:attribute>
8891
- <xsl:apply-templates mode="index_add_id"/>
8909
+ <xsl:apply-templates mode="index_add_id">
8910
+ <xsl:with-param name="docid" select="$docid"/>
8911
+ </xsl:apply-templates>
8892
8912
  </xsl:copy>
8893
8913
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
8894
8914
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -8900,7 +8920,9 @@
8900
8920
  <xsl:attribute name="id">
8901
8921
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
8902
8922
  </xsl:attribute>
8903
- <xsl:apply-templates mode="index_add_id"/>
8923
+ <xsl:apply-templates mode="index_add_id">
8924
+ <xsl:with-param name="docid" select="$docid"/>
8925
+ </xsl:apply-templates>
8904
8926
  </xsl:copy>
8905
8927
  </xsl:if>
8906
8928
  </xsl:template>
@@ -8937,12 +8959,33 @@
8937
8959
  </xsl:when>
8938
8960
  <xsl:when test="self::* and local-name(.) = 'xref'">
8939
8961
  <xsl:variable name="id" select="@id"/>
8940
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
8941
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8942
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
8943
8962
 
8963
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8944
8964
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
8945
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
8965
+
8966
+ <xsl:variable name="pages_">
8967
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
8968
+ <xsl:choose>
8969
+ <xsl:when test="@id = $id">
8970
+ <page><xsl:value-of select="."/></page>
8971
+ </xsl:when>
8972
+ <xsl:when test="@id = $id_next">
8973
+ <page_next><xsl:value-of select="."/></page_next>
8974
+ </xsl:when>
8975
+ <xsl:when test="@id = $id_prev">
8976
+ <page_prev><xsl:value-of select="."/></page_prev>
8977
+ </xsl:when>
8978
+ </xsl:choose>
8979
+ </xsl:for-each>
8980
+ </xsl:variable>
8981
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
8982
+
8983
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
8984
+ <xsl:variable name="page" select="$pages/page"/>
8985
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
8986
+ <xsl:variable name="page_next" select="$pages/page_next"/>
8987
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
8988
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
8946
8989
 
8947
8990
  <xsl:choose>
8948
8991
  <!-- 2nd pass -->
@@ -9002,16 +9045,20 @@
9002
9045
  </xsl:template>
9003
9046
 
9004
9047
  <xsl:template name="generateIndexXrefId">
9048
+ <xsl:param name="docid"/>
9049
+
9005
9050
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9006
9051
 
9007
- <xsl:variable name="docid">
9008
- <xsl:call-template name="getDocumentId"/>
9052
+ <xsl:variable name="docid_curr">
9053
+ <xsl:value-of select="$docid"/>
9054
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9009
9055
  </xsl:variable>
9056
+
9010
9057
  <xsl:variable name="item_number">
9011
9058
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9012
9059
  </xsl:variable>
9013
9060
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9014
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9061
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9015
9062
  </xsl:template>
9016
9063
 
9017
9064
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -7392,6 +7392,18 @@
7392
7392
  </xsl:copy>
7393
7393
  </xsl:template>
7394
7394
 
7395
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7396
+ <xsl:copy>
7397
+ <xsl:apply-templates mode="contents_item"/>
7398
+ </xsl:copy>
7399
+ </xsl:template>
7400
+
7401
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7402
+ <xsl:copy>
7403
+ <xsl:apply-templates mode="contents_item"/>
7404
+ </xsl:copy>
7405
+ </xsl:template>
7406
+
7395
7407
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7396
7408
  <xsl:copy-of select="."/>
7397
7409
  </xsl:template>
@@ -8874,21 +8886,29 @@
8874
8886
  </xsl:variable>
8875
8887
 
8876
8888
  <xsl:template match="@*|node()" mode="index_add_id">
8889
+ <xsl:param name="docid"/>
8877
8890
  <xsl:copy>
8878
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
8891
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
8892
+ <xsl:with-param name="docid" select="$docid"/>
8893
+ </xsl:apply-templates>
8879
8894
  </xsl:copy>
8880
8895
  </xsl:template>
8881
8896
 
8882
8897
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
8898
+ <xsl:param name="docid"/>
8883
8899
  <xsl:variable name="id">
8884
- <xsl:call-template name="generateIndexXrefId"/>
8900
+ <xsl:call-template name="generateIndexXrefId">
8901
+ <xsl:with-param name="docid" select="$docid"/>
8902
+ </xsl:call-template>
8885
8903
  </xsl:variable>
8886
8904
  <xsl:copy> <!-- add id to xref -->
8887
8905
  <xsl:apply-templates select="@*" mode="index_add_id"/>
8888
8906
  <xsl:attribute name="id">
8889
8907
  <xsl:value-of select="$id"/>
8890
8908
  </xsl:attribute>
8891
- <xsl:apply-templates mode="index_add_id"/>
8909
+ <xsl:apply-templates mode="index_add_id">
8910
+ <xsl:with-param name="docid" select="$docid"/>
8911
+ </xsl:apply-templates>
8892
8912
  </xsl:copy>
8893
8913
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
8894
8914
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -8900,7 +8920,9 @@
8900
8920
  <xsl:attribute name="id">
8901
8921
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
8902
8922
  </xsl:attribute>
8903
- <xsl:apply-templates mode="index_add_id"/>
8923
+ <xsl:apply-templates mode="index_add_id">
8924
+ <xsl:with-param name="docid" select="$docid"/>
8925
+ </xsl:apply-templates>
8904
8926
  </xsl:copy>
8905
8927
  </xsl:if>
8906
8928
  </xsl:template>
@@ -8937,12 +8959,33 @@
8937
8959
  </xsl:when>
8938
8960
  <xsl:when test="self::* and local-name(.) = 'xref'">
8939
8961
  <xsl:variable name="id" select="@id"/>
8940
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
8941
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8942
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
8943
8962
 
8963
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8944
8964
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
8945
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
8965
+
8966
+ <xsl:variable name="pages_">
8967
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
8968
+ <xsl:choose>
8969
+ <xsl:when test="@id = $id">
8970
+ <page><xsl:value-of select="."/></page>
8971
+ </xsl:when>
8972
+ <xsl:when test="@id = $id_next">
8973
+ <page_next><xsl:value-of select="."/></page_next>
8974
+ </xsl:when>
8975
+ <xsl:when test="@id = $id_prev">
8976
+ <page_prev><xsl:value-of select="."/></page_prev>
8977
+ </xsl:when>
8978
+ </xsl:choose>
8979
+ </xsl:for-each>
8980
+ </xsl:variable>
8981
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
8982
+
8983
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
8984
+ <xsl:variable name="page" select="$pages/page"/>
8985
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
8986
+ <xsl:variable name="page_next" select="$pages/page_next"/>
8987
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
8988
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
8946
8989
 
8947
8990
  <xsl:choose>
8948
8991
  <!-- 2nd pass -->
@@ -9002,16 +9045,20 @@
9002
9045
  </xsl:template>
9003
9046
 
9004
9047
  <xsl:template name="generateIndexXrefId">
9048
+ <xsl:param name="docid"/>
9049
+
9005
9050
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9006
9051
 
9007
- <xsl:variable name="docid">
9008
- <xsl:call-template name="getDocumentId"/>
9052
+ <xsl:variable name="docid_curr">
9053
+ <xsl:value-of select="$docid"/>
9054
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9009
9055
  </xsl:variable>
9056
+
9010
9057
  <xsl:variable name="item_number">
9011
9058
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9012
9059
  </xsl:variable>
9013
9060
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9014
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9061
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9015
9062
  </xsl:template>
9016
9063
 
9017
9064
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -6563,6 +6563,18 @@
6563
6563
  </xsl:copy>
6564
6564
  </xsl:template>
6565
6565
 
6566
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
6567
+ <xsl:copy>
6568
+ <xsl:apply-templates mode="contents_item"/>
6569
+ </xsl:copy>
6570
+ </xsl:template>
6571
+
6572
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
6573
+ <xsl:copy>
6574
+ <xsl:apply-templates mode="contents_item"/>
6575
+ </xsl:copy>
6576
+ </xsl:template>
6577
+
6566
6578
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
6567
6579
  <xsl:copy-of select="."/>
6568
6580
  </xsl:template>
@@ -8037,21 +8049,29 @@
8037
8049
  </xsl:variable>
8038
8050
 
8039
8051
  <xsl:template match="@*|node()" mode="index_add_id">
8052
+ <xsl:param name="docid"/>
8040
8053
  <xsl:copy>
8041
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
8054
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
8055
+ <xsl:with-param name="docid" select="$docid"/>
8056
+ </xsl:apply-templates>
8042
8057
  </xsl:copy>
8043
8058
  </xsl:template>
8044
8059
 
8045
8060
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
8061
+ <xsl:param name="docid"/>
8046
8062
  <xsl:variable name="id">
8047
- <xsl:call-template name="generateIndexXrefId"/>
8063
+ <xsl:call-template name="generateIndexXrefId">
8064
+ <xsl:with-param name="docid" select="$docid"/>
8065
+ </xsl:call-template>
8048
8066
  </xsl:variable>
8049
8067
  <xsl:copy> <!-- add id to xref -->
8050
8068
  <xsl:apply-templates select="@*" mode="index_add_id"/>
8051
8069
  <xsl:attribute name="id">
8052
8070
  <xsl:value-of select="$id"/>
8053
8071
  </xsl:attribute>
8054
- <xsl:apply-templates mode="index_add_id"/>
8072
+ <xsl:apply-templates mode="index_add_id">
8073
+ <xsl:with-param name="docid" select="$docid"/>
8074
+ </xsl:apply-templates>
8055
8075
  </xsl:copy>
8056
8076
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
8057
8077
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -8063,7 +8083,9 @@
8063
8083
  <xsl:attribute name="id">
8064
8084
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
8065
8085
  </xsl:attribute>
8066
- <xsl:apply-templates mode="index_add_id"/>
8086
+ <xsl:apply-templates mode="index_add_id">
8087
+ <xsl:with-param name="docid" select="$docid"/>
8088
+ </xsl:apply-templates>
8067
8089
  </xsl:copy>
8068
8090
  </xsl:if>
8069
8091
  </xsl:template>
@@ -8100,12 +8122,33 @@
8100
8122
  </xsl:when>
8101
8123
  <xsl:when test="self::* and local-name(.) = 'xref'">
8102
8124
  <xsl:variable name="id" select="@id"/>
8103
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
8104
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8105
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
8106
8125
 
8126
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
8107
8127
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
8108
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
8128
+
8129
+ <xsl:variable name="pages_">
8130
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
8131
+ <xsl:choose>
8132
+ <xsl:when test="@id = $id">
8133
+ <page><xsl:value-of select="."/></page>
8134
+ </xsl:when>
8135
+ <xsl:when test="@id = $id_next">
8136
+ <page_next><xsl:value-of select="."/></page_next>
8137
+ </xsl:when>
8138
+ <xsl:when test="@id = $id_prev">
8139
+ <page_prev><xsl:value-of select="."/></page_prev>
8140
+ </xsl:when>
8141
+ </xsl:choose>
8142
+ </xsl:for-each>
8143
+ </xsl:variable>
8144
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
8145
+
8146
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
8147
+ <xsl:variable name="page" select="$pages/page"/>
8148
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
8149
+ <xsl:variable name="page_next" select="$pages/page_next"/>
8150
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
8151
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
8109
8152
 
8110
8153
  <xsl:choose>
8111
8154
  <!-- 2nd pass -->
@@ -8165,16 +8208,20 @@
8165
8208
  </xsl:template>
8166
8209
 
8167
8210
  <xsl:template name="generateIndexXrefId">
8211
+ <xsl:param name="docid"/>
8212
+
8168
8213
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
8169
8214
 
8170
- <xsl:variable name="docid">
8171
- <xsl:call-template name="getDocumentId"/>
8215
+ <xsl:variable name="docid_curr">
8216
+ <xsl:value-of select="$docid"/>
8217
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
8172
8218
  </xsl:variable>
8219
+
8173
8220
  <xsl:variable name="item_number">
8174
8221
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
8175
8222
  </xsl:variable>
8176
8223
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
8177
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
8224
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
8178
8225
  </xsl:template>
8179
8226
 
8180
8227
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -170,6 +170,11 @@ module IsoDoc
170
170
  @wordstylesheet.unlink if @wordstylesheet.is_a?(Tempfile)
171
171
  end
172
172
 
173
+ def table_attrs(node)
174
+ node["class"] == "modspec" and node["width"] = "100%"
175
+ super
176
+ end
177
+
173
178
  include BaseConvert
174
179
  include Init
175
180
  end
@@ -18,11 +18,6 @@ module IsoDoc
18
18
  n = section_names(doc.at(ns("//sections/definitions")), n, 1)
19
19
  clause_names(doc, n)
20
20
  end
21
- if @parse_settings.empty?
22
- middle_section_asset_names(doc)
23
- termnote_anchor_names(doc)
24
- termexample_anchor_names(doc)
25
- end
26
21
  end
27
22
 
28
23
  def preface_anchor_names(doc)