[interchange-docs] xmldocs - docelic modified
docbook/html-chunks.xsl
docs at icdevgroup.org
docs at icdevgroup.org
Tue Mar 28 05:17:01 EST 2006
User: docelic
Date: 2006-03-28 10:16:59 GMT
Modified: docbook html-chunks.xsl
Log:
* Happy Crappy! Update XSL code that was generating broken glossary links
when glossary was referenced from chunked html documents.
This was on my neck for a while, thanks Racke for motivation and docbook
for not being too hard to write ;-)
Revision Changes Path
1.16 +111 -0 xmldocs/docbook/html-chunks.xsl
rev 1.16, prev_rev 1.15
Index: html-chunks.xsl
===================================================================
RCS file: /var/cvs/xmldocs/docbook/html-chunks.xsl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- html-chunks.xsl 28 Mar 2006 09:12:18 -0000 1.15
+++ html-chunks.xsl 28 Mar 2006 10:16:59 -0000 1.16
@@ -96,6 +96,117 @@
<xsl:copy-of select="$link"/>
</xsl:template>
+
+ <!-- Make links to glossary properly prefixed with ../ for chunked
+ docs -->
+<xsl:template match="olink" name="olink">
+
+ <xsl:call-template name="anchor"/>
+
+ <xsl:variable name="localinfo" select="@localinfo"/>
+
+ <xsl:variable name="targetdoc.att" select="@targetdoc"/>
+ <xsl:variable name="targetptr.att" select="@targetptr"/>
+
+ <xsl:variable name="olink.lang">
+ <xsl:call-template name="l10n.language">
+ <xsl:with-param name="xref-context" select="true()"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="target.database.filename">
+ <xsl:call-template name="select.target.database">
+ <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
+ <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="target.database" select="document($target.database.filename,/)"/>
+
+ <xsl:if test="$olink.debug != 0">
+ <xsl:message>
+ <xsl:text>Olink debug: root element of target.database '</xsl:text>
+ <xsl:value-of select="$target.database.filename"/>
+ <xsl:text>' is '</xsl:text>
+ <xsl:value-of select="local-name($target.database/*[1])"/>
+ <xsl:text>'.</xsl:text>
+ </xsl:message>
+ </xsl:if>
+
+ <xsl:variable name="olink.key">
+ <xsl:call-template name="select.olink.key">
+ <xsl:with-param name="targetdoc.att" select="$targetdoc.att"/>
+ <xsl:with-param name="targetptr.att" select="$targetptr.att"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
+ <xsl:with-param name="target.database" select="$target.database"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="string-length($olink.key) = 0">
+ <xsl:message>
+ <xsl:text>Error: unresolved olink: </xsl:text>
+ <xsl:text>targetdoc/targetptr = '</xsl:text>
+ <xsl:value-of select="$targetdoc.att"/>
+ <xsl:text>/</xsl:text>
+ <xsl:value-of select="$targetptr.att"/>
+ <xsl:text>'.</xsl:text>
+ </xsl:message>
+ </xsl:if>
+
+ <xsl:variable name="href">
+ <xsl:if test="starts-with(@targetdoc, 'glossary')">../</xsl:if>
+ <xsl:call-template name="make.olink.href">
+ <xsl:with-param name="olink.key" select="$olink.key"/>
+ <xsl:with-param name="target.database" select="$target.database"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="hottext">
+ <xsl:call-template name="olink.hottext">
+ <xsl:with-param name="target.database" select="$target.database"/>
+ <xsl:with-param name="olink.key" select="$olink.key"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="olink.docname.citation">
+ <xsl:call-template name="olink.document.citation">
+ <xsl:with-param name="olink.key" select="$olink.key"/>
+ <xsl:with-param name="target.database" select="$target.database"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="olink.page.citation">
+ <xsl:call-template name="olink.page.citation">
+ <xsl:with-param name="olink.key" select="$olink.key"/>
+ <xsl:with-param name="target.database" select="$target.database"/>
+ <xsl:with-param name="olink.lang" select="$olink.lang"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$href != ''">
+ <a href="{$href}" class="olink">
+ <xsl:copy-of select="$hottext"/>
+ </a>
+ <xsl:copy-of select="$olink.page.citation"/>
+ <xsl:copy-of select="$olink.docname.citation"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <span class="olink"><xsl:copy-of select="$hottext"/></span>
+ <xsl:copy-of select="$olink.page.citation"/>
+ <xsl:copy-of select="$olink.docname.citation"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+</xsl:template>
+
+
+
+ <!-- This chunk inserts <meta name="area" content="REFENTRY_GROUP" />,
+ to help Swish index documentation properly. Thanks Scott Hudson. -->
<xsl:template match="refclass[1]">
<xsl:variable name="area">
<xsl:value-of select="." />
More information about the docs
mailing list