Hi Mathieu,
xmllint does not report this as an issue because it is valid DocBook, in that the
linkend value matches some id value in the document.
However, the stylesheet is trying to generate link text for the xref and is failing.
An xref requires that text be generated from the target element, but some elements do
not have a simple title or number to reference, and that is what you are seeing here.
The anchor you are linking to is an empty element so it is not suitable. For such
elements, the stylesheet looks at the parent element and tries to use that to generate
the text. The parent here is a para, which is also unsuitable because it can contain
unlimited text and many other elements, including block elements. So the stylesheet
goes up again, trying the listitem. Since this is an itemizedlist rather than an
orderedlist, such a listitem also does not have suitable text for a generated xref.
At that point, it gives up and issues the error message.
What is lost here is the id of the original target element. The recursion up the line
of ancestors should keep track of that. That's a bug that should be fixed. If you
care to file a bug report on the DocBook SourceForge site with your example, that
would be great.
My question is, what do you expect such an xref to display in the output? "bla"? If
so, you can use endterm to force the stylesheet to use the text of the para:
<itemizedlist>
<listitem>
<para id="mypara"><anchor id="myidx"/>bla</para>
</listitem>
</itemizedlist>
<xref linkend="myidx" endterm="mypara"/>
See this reference for more on the use of endterm:
http://www.sagehill.net/docbookxsl/CrossRefs.html#XrefEndterm
Bob Stayton
Sagehill Enterprises
[email protected]
----- Original Message -----
From: "Mathieu Malaterre" <[email protected]>
To: "DocBook Apps" <[email protected]>
Sent: Thursday, February 18, 2010 8:19 AM
Subject: [docbook-apps] Re: Xref is only supported to listitems in an
orderedlist:
On Thu, Feb 18, 2010 at 4:48 PM, Mathieu Malaterre
<[email protected]> wrote:
hi,
I am trying to track down an error reported during the xsltproc
transformation:
...
Xref is only supported to listitems in an orderedlist:
...
What I do not understand is that xmllint does not report any issue. Is
there a way for me to print out the line number where this error occur
in my input XML document.
Steps:
xsltproc --stringparam keep.relative.image.uris 1 --xinclude
/usr/share/xml/docbook/stylesheet/docbook-xsl/html/chunkfast.xsl
input.xml
Validation step does not return any error:
xmllint --xinclude --postvalid --noout --nonet input.xml
I found out this is caused by something like:
<itemizedlist>
<listitem>
<para><anchor id="myidx"/>bla</para>
</listitem>
</itemizedlist>
<xref linkend="myidx"/>
what I do not understand is that the error message is incapable of
displaying any context information or line number to help me find the
missing xreflabel attribute...
the XSL is:
$ cat docbook-xsl/common/gentext.xsl
...
<xsl:message>
<xsl:text>Xref is only supported to listitems in an</xsl:text>
<xsl:text> orderedlist: </xsl:text>
<xsl:value-of select="@id|@xml:id"/>
</xsl:message>
Thanks for suggestions,
--
Mathieu
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]