]> granicus.if.org Git - docbook-dsssl/commitdiff
Added support for index.on.role into internatinalized indexing
authorJirka Kosek <jirka@kosek.cz>
Sun, 16 May 2004 11:11:14 +0000 (11:11 +0000)
committerJirka Kosek <jirka@kosek.cz>
Sun, 16 May 2004 11:11:14 +0000 (11:11 +0000)
xsl/fo/autoidx-ng.xsl
xsl/html/autoidx-ng.xsl

index 525ea8181838215f2429a7ad86e435a6203ef943..1e7e45ec3ee5ce21d67983cb190edc5ac2d315ed 100755 (executable)
@@ -9,7 +9,8 @@
 <!ENTITY tertiary  'normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)]))'>
 
 <!ENTITY sep '" "'>
-<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())'>
+<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())
+                and ($role = @role or string-length($role) = 0)'>
 ]>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
 <xsl:template name="generate-index">
   <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
 
+  <xsl:variable name="role">
+    <xsl:if test="$index.on.role != 0">
+      <xsl:value-of select="@role"/>
+    </xsl:if>
+  </xsl:variable>
+
   <xsl:variable name="terms"
                 select="//indexterm[count(.|key('group-code',
                                                 i:group-index(&primary;))[&scope;][1]) = 1
 
   <xsl:apply-templates select="$terms" mode="index-div">
     <xsl:with-param name="scope" select="$scope"/>
+    <xsl:with-param name="role" select="$role"/>
     <xsl:sort select="i:group-index(&primary;)" data-type="number"/>
   </xsl:apply-templates>
 </xsl:template>
 
 <xsl:template match="indexterm" mode="index-div">
   <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
 
   <xsl:variable name="key"
                 select="i:group-index(&primary;)"/>
@@ -66,6 +75,7 @@
                              mode="index-primary">
           <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
           <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
         </xsl:apply-templates>
       </fo:block>
     </fo:block>
index 0357df8c02baf81fda49e9ee0a3c3e66c35977aa..c47445fa1cc2ac3a2d6b74c6ea081db96472272e 100755 (executable)
@@ -9,7 +9,8 @@
 <!ENTITY tertiary  'normalize-space(concat(tertiary/@sortas, tertiary[not(@sortas)]))'>
 
 <!ENTITY sep '" "'>
-<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())'>
+<!ENTITY scope 'count(ancestor::node()|$scope) = count(ancestor::node())
+                and ($role = @role or string-length($role) = 0)'>
 ]>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
 <xsl:template name="generate-index">
   <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>
 
+  <xsl:variable name="role">
+    <xsl:if test="$index.on.role != 0">
+      <xsl:value-of select="@role"/>
+    </xsl:if>
+  </xsl:variable>
+
   <xsl:variable name="terms"
                 select="//indexterm[count(.|key('group-code',
                                                 i:group-index(&primary;))[&scope;][1]) = 1
@@ -43,6 +50,7 @@
   <div class="index">
     <xsl:apply-templates select="$terms" mode="index-div">
       <xsl:with-param name="scope" select="$scope"/>
+      <xsl:with-param name="role" select="$role"/>
       <xsl:sort select="i:group-index(&primary;)" data-type="number"/>
     </xsl:apply-templates>
   </div>
@@ -50,6 +58,7 @@
 
 <xsl:template match="indexterm" mode="index-div">
   <xsl:param name="scope" select="."/>
+  <xsl:param name="role" select="''"/>
 
   <xsl:variable name="key"
                 select="i:group-index(&primary;)"/>
@@ -66,6 +75,7 @@
                              mode="index-primary">
           <xsl:sort select="translate(&primary;, &lowercase;, &uppercase;)"/>
           <xsl:with-param name="scope" select="$scope"/>
+          <xsl:with-param name="role" select="$role"/>
         </xsl:apply-templates>
       </dl>
     </div>