Hi all,
I've stumbled over an issue where application of docbook XSL fails with
$collect.xref.targets="only" (or "yes") with certain @xrefstyle's. The issue is
that
the "obj" template in common/targets.xsl applies the template in the xref-to
mode, without passing the $referrer parameter. This eventually gets verbatim to
the make.gentext.template template, which attempts to call local-
name($referrer) - which aborts the processing (at least with xsltproc):
XPath error : Invalid type
xmlXPathCompiledEval: 1 objects left on the stack.
The attached patch makes the make.gentext.template accept being called
without the $referrer argument.
Regards,
Alexey.
Index: common/gentext.xsl
===================================================================
--- common/gentext.xsl (revision 663)
+++ common/gentext.xsl (working copy)
@@ -627,6 +627,13 @@
</xsl:param>
<xsl:param name="target.elem" select="local-name(.)"/>
+ <!-- Referrer's local name, if any -->
+ <xsl:variable name="referrer.local.name">
+ <xsl:if test="$referrer">
+ <xsl:value-of select="local-name($referrer)"/>
+ </xsl:if>
+ </xsl:variable>
+
<!-- parse xrefstyle to get parts -->
<xsl:variable name="parts"
select="substring-after(normalize-space($xrefstyle), 'select:')"/>
@@ -659,11 +666,11 @@
<xsl:variable name="pagetype">
<xsl:choose>
<xsl:when test="$insert.olink.page.number = 'no' and
- local-name($referrer) = 'olink'">
+ $referrer.local.name = 'olink'">
<!-- suppress page numbers -->
</xsl:when>
<xsl:when test="$insert.xref.page.number = 'no' and
- local-name($referrer) != 'olink'">
+ $referrer.local.name != 'olink'">
<!-- suppress page numbers -->
</xsl:when>
<xsl:when test="contains($parts, 'nopage')">
@@ -687,8 +694,8 @@
<xsl:variable name="docnametype">
<xsl:choose>
<xsl:when test="($olink.doctitle = 0 or
- $olink.doctitle = 'no') and
- local-name($referrer) = 'olink'">
+ $olink.doctitle = 'no') and
+ $referrer.local.name = 'olink'">
<!-- suppress docname -->
</xsl:when>
<xsl:when test="contains($parts, 'nodocname')">
@@ -709,7 +716,7 @@
<xsl:call-template name="gentext">
<xsl:with-param name="key">
<xsl:choose>
- <xsl:when test="local-name($referrer) = 'olink'">
+ <xsl:when test="$referrer.local.name = 'olink'">
<xsl:value-of select="$target.elem"/>
</xsl:when>
<xsl:otherwise>
@@ -727,7 +734,7 @@
<xsl:with-param name="context" select="'xref-number'"/>
<xsl:with-param name="name">
<xsl:choose>
- <xsl:when test="local-name($referrer) = 'olink'">
+ <xsl:when test="$referrer.local.name = 'olink'">
<xsl:value-of select="$target.elem"/>
</xsl:when>
<xsl:otherwise>
@@ -777,7 +784,7 @@
<!-- special case: use regular xref template if just turning off page -->
<xsl:if test="($pagetype = 'nopage' or $docnametype = 'nodocname')
- and local-name($referrer) != 'olink'
+ and $referrer.local.name != 'olink'
and $labeltype = ''
and $titletype = ''">
<xsl:apply-templates select="." mode="object.xref.template">
@@ -815,7 +822,7 @@
</xsl:if>
<!-- Add reference to other document title -->
- <xsl:if test="$docnametype != '' and local-name($referrer) = 'olink'">
+ <xsl:if test="$docnametype != '' and $referrer.local.name = 'olink'">
<!-- Any separator should be in the gentext template -->
<xsl:choose>
<xsl:when test="$docnametype = 'docnamelong'">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]