|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
-->
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
|
|
Packit |
e4b6da |
xmlns:l="http://docbook2x.sourceforge.net/xsl/localization"
|
|
Packit |
e4b6da |
xmlns="http://docbook2x.sourceforge.net/xmlns/Texi-XML"
|
|
Packit |
e4b6da |
exclude-result-prefixes="doc l"
|
|
Packit |
e4b6da |
version='1.0'
|
|
Packit |
e4b6da |
xml:lang="en">
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
$Id: xref.xsl,v 1.23 2004/08/22 22:46:07 stevecheng Exp $
|
|
Packit |
e4b6da |
********************************************************************
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
(C) 2000-2004 Steve Cheng <stevecheng@users.sourceforge.net>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
This file is part of the docbook2X XSLT stylesheets for
|
|
Packit |
e4b6da |
converting DocBook to Texinfo.
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
See ../../COPYING for the copyright status of this software.
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
******************************************************************** -->
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<doc:reference xmlns="">
|
|
Packit |
e4b6da |
<title>Handle cross references and links</title>
|
|
Packit |
e4b6da |
</doc:reference>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template name="anchor">
|
|
Packit |
e4b6da |
<xsl:if test="@id">
|
|
Packit |
e4b6da |
<anchor id="{@id}" />
|
|
Packit |
e4b6da |
</xsl:if>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="anchor">
|
|
Packit |
e4b6da |
<xsl:call-template name="anchor" />
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template name="check-xref">
|
|
Packit |
e4b6da |
<xsl:param name="target" />
|
|
Packit |
e4b6da |
<xsl:param name="content" />
|
|
Packit |
e4b6da |
<xsl:param name="bad-content" />
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:choose>
|
|
Packit |
e4b6da |
<xsl:when test="not($target)">
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:call-template name="user-message">
|
|
Packit |
e4b6da |
<xsl:with-param name="arg-1" select="@linkend" />
|
|
Packit |
e4b6da |
<xsl:with-param name="key">reference to non-existent ID</xsl:with-param>
|
|
Packit |
e4b6da |
<xsl:with-param name="content">reference to non-existent ID "<l:a1 />"</xsl:with-param>
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:copy-of select="$bad-content" />
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:otherwise>
|
|
Packit |
e4b6da |
<xsl:copy-of select="$content" />
|
|
Packit |
e4b6da |
</xsl:otherwise>
|
|
Packit |
e4b6da |
</xsl:choose>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="xref">
|
|
Packit |
e4b6da |
<xsl:variable name="target" select="key('id', @linkend)"/>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:call-template name="check-xref">
|
|
Packit |
e4b6da |
<xsl:with-param name="target" select="$target" />
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:with-param name="bad-content">
|
|
Packit |
e4b6da |
<xsl:call-template name="gentext-rendering">
|
|
Packit |
e4b6da |
<xsl:with-param name="key" select="'dangling-xref'" />
|
|
Packit |
e4b6da |
<xsl:with-param name="content" select="string(@linkend)" />
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
</xsl:with-param>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:with-param name="content">
|
|
Packit |
e4b6da |
<ref>
|
|
Packit |
e4b6da |
<xsl:attribute name="idref">
|
|
Packit |
e4b6da |
<xsl:call-template name="print-id">
|
|
Packit |
e4b6da |
<xsl:with-param name="node" select="$target" />
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
</xsl:attribute>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:apply-templates select="$target" mode="xref-to" />
|
|
Packit |
e4b6da |
</ref>
|
|
Packit |
e4b6da |
</xsl:with-param>
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="link">
|
|
Packit |
e4b6da |
<xsl:variable name="target" select="key('id', @linkend)"/>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:call-template name="check-xref">
|
|
Packit |
e4b6da |
<xsl:with-param name="target" select="$target" />
|
|
Packit |
e4b6da |
<xsl:with-param name="bad-content">
|
|
Packit |
e4b6da |
<xsl:call-template name="gentext-rendering">
|
|
Packit |
e4b6da |
<xsl:with-param name="key" select="'dangling-xref'" />
|
|
Packit |
e4b6da |
<xsl:with-param name="content" select="string(@linkend)" />
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
</xsl:with-param>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:with-param name="content">
|
|
Packit |
e4b6da |
<xsl:choose>
|
|
Packit |
e4b6da |
<xsl:when test="$links-use-pxref">
|
|
Packit |
e4b6da |
<xsl:apply-templates />
|
|
Packit |
e4b6da |
<xsl:text> (</xsl:text>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<pxref>
|
|
Packit |
e4b6da |
<xsl:attribute name="idref">
|
|
Packit |
e4b6da |
<xsl:call-template name="print-id">
|
|
Packit |
e4b6da |
<xsl:with-param name="node" select="$target" />
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
</xsl:attribute>
|
|
Packit |
e4b6da |
</pxref>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:text>)</xsl:text>
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:otherwise>
|
|
Packit |
e4b6da |
<ref>
|
|
Packit |
e4b6da |
<xsl:attribute name="idref">
|
|
Packit |
e4b6da |
<xsl:call-template name="print-id">
|
|
Packit |
e4b6da |
<xsl:with-param name="node" select="$target" />
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
</xsl:attribute>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:apply-templates />
|
|
Packit |
e4b6da |
</ref>
|
|
Packit |
e4b6da |
</xsl:otherwise>
|
|
Packit |
e4b6da |
</xsl:choose>
|
|
Packit |
e4b6da |
</xsl:with-param>
|
|
Packit |
e4b6da |
</xsl:call-template>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="ulink">
|
|
Packit |
e4b6da |
<uref>
|
|
Packit |
e4b6da |
<xsl:attribute name="url"><xsl:value-of select="@url"/></xsl:attribute>
|
|
Packit |
e4b6da |
<xsl:apply-templates/>
|
|
Packit |
e4b6da |
</uref>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="olink">
|
|
Packit |
e4b6da |
<xsl:apply-templates/>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<doc:mode mode="xref-to" xmlns="">
|
|
Packit |
e4b6da |
<refpurpose>Give cross-reference markup</refpurpose>
|
|
Packit |
e4b6da |
<refdescription>
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
Processing an element with this mode returns the markup/text that should
|
|
Packit |
e4b6da |
be used for referring to it in cross-references.</para>
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
Since Texinfo already handles cross references to nodes, this mode
|
|
Packit |
e4b6da |
does mostly nothing. FIXME: However we need something for anchors...
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
</refdescription>
|
|
Packit |
e4b6da |
</doc:mode>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="*" mode="xref-to">
|
|
Packit |
e4b6da |
<xsl:choose>
|
|
Packit |
e4b6da |
<xsl:when test="@xreflabel">
|
|
Packit |
e4b6da |
<xsl:value-of select="@xreflabel" />
|
|
Packit |
e4b6da |
</xsl:when>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:otherwise>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
If the title doesn't exist, $title is empty,
|
|
Packit |
e4b6da |
then we let Texinfo take care of it.
|
|
Packit |
e4b6da |
-->
|
|
Packit |
e4b6da |
<xsl:apply-templates select="." mode="for-title">
|
|
Packit |
e4b6da |
<xsl:with-param name="suppress-error" select="true()" />
|
|
Packit |
e4b6da |
</xsl:apply-templates>
|
|
Packit |
e4b6da |
</xsl:otherwise>
|
|
Packit |
e4b6da |
</xsl:choose>
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<xsl:template match="co" mode="xref-to">
|
|
Packit |
e4b6da |
<xsl:apply-templates select="." mode="co" />
|
|
Packit |
e4b6da |
</xsl:template>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
</xsl:stylesheet>
|