]> granicus.if.org Git - docbook-dsssl/commitdiff
Make glossary.collection (usually) work when chunking is used; allow the use of gloss...
authorNorman Walsh <ndw@nwalsh.com>
Fri, 4 Jan 2002 16:40:19 +0000 (16:40 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Fri, 4 Jan 2002 16:40:19 +0000 (16:40 +0000)
xsl/fo/glossary.xsl
xsl/html/glossary.xsl
xsl/html/inline.xsl

index c5e84b03dadc50058e46224040634a7ed1ca1afa..5cd838d9106d75a0c50f5f861eba52f7df0a4f6e 100644 (file)
@@ -348,7 +348,7 @@ GlossEntry ::=
     </xsl:if>
 
     <xsl:choose>
-      <xsl:when test="$collection//glossdiv">
+      <xsl:when test="glossdiv and $collection//glossdiv">
         <xsl:for-each select="$collection//glossdiv">
           <!-- first see if there are any in this div -->
           <xsl:variable name="exist.test">
@@ -431,7 +431,7 @@ GlossEntry ::=
         </xsl:if>
 
         <xsl:choose>
-          <xsl:when test="$collection//glossdiv">
+          <xsl:when test="glossdiv and $collection//glossdiv">
             <xsl:for-each select="$collection//glossdiv">
               <!-- first see if there are any in this div -->
               <xsl:variable name="exist.test">
index afcffdc883e71fd0c8c19b08012ccc6e7bfc74dd..c83c7fa4ebe80ab99488ecf9e4bc91f2122cc8e5 100644 (file)
@@ -230,7 +230,7 @@ GlossEntry ::=
     <xsl:call-template name="glossary.titlepage"/>
 
     <xsl:choose>
-      <xsl:when test="$collection//glossdiv">
+      <xsl:when test="glossdiv and $collection//glossdiv">
         <xsl:for-each select="$collection//glossdiv">
           <!-- first see if there are any in this div -->
           <xsl:variable name="exist.test">
index dfd50dc8491eb6cef34f12c1fcab0669878cd72d..a392b0c21b8b2b8670e740091e49f3b048667dc4 100644 (file)
           <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
         </xsl:choose>
       </xsl:variable>
+
       <xsl:variable name="cterm"
            select="(document($glossary.collection,.)//glossentry[glossterm=$term])[1]"/>
 
+      <!-- HACK HACK HACK! But it works... -->
+      <!-- You'd need to do more work if you wanted to chunk on glossdiv, though -->
+
+      <xsl:variable name="glossary" select="//glossary[@role='auto']"/>
+
+      <xsl:if test="count($glossary) != 1">
+        <xsl:message>
+          <xsl:text>Warning: glossary.collection specified, but there are </xsl:text>
+          <xsl:value-of select="count($glossary)"/>
+          <xsl:text> automatic glossaries</xsl:text>
+        </xsl:message>
+      </xsl:if>
+
+      <xsl:variable name="glosschunk">
+        <xsl:call-template name="href.target">
+          <xsl:with-param name="object" select="$glossary"/>
+        </xsl:call-template>
+      </xsl:variable>
+
+      <xsl:variable name="chunkbase">
+        <xsl:choose>
+          <xsl:when test="contains($glosschunk, '#')">
+            <xsl:value-of select="substring-before($glosschunk, '#')"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$glosschunk"/>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:variable>
+
       <xsl:choose>
         <xsl:when test="not($cterm)">
           <xsl:message>
               </xsl:otherwise>
             </xsl:choose>
           </xsl:variable>
-          <a href="#{$id}">
+          <a href="{$chunkbase}#{$id}">
             <xsl:call-template name="inline.italicseq"/>
           </a>
         </xsl:otherwise>