The solution to this problem is to move the xml:id attributes from the para elements up to their respective listitem elements. You want the xref to generate the listitem number.

The xref element uses its target element to generate the link text, but a para is not considered appropriate for generated text because it could be very long.  The stylesheet recognizes that problem and issues this warning:

WARNING: xref to <para id="Ref1"> has no generated text. Trying its ancestor elements.

but then it doesn't seem to handle the attempt properly in this case.

Bob Stayton
[email protected]

On 3/25/2021 2:50 PM, Philo Calhoun wrote:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.1/rng/docbook.rng <http://docbook.org/xml/5.1/rng/docbook.rng>" schematypens="http://relaxng.org/ns/structure/1.0 <http://relaxng.org/ns/structure/1.0>"?> <?xml-model href="http://docbook.org/xml/5.1/sch/docbook.sch <http://docbook.org/xml/5.1/sch/docbook.sch>" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron <http://purl.oclc.org/dsdl/schematron>"?> <articlexmlns="http://docbook.org/ns/docbook <http://docbook.org/ns/docbook>" xmlns:xlink="http://www.w3.org/1999/xlink <http://www.w3.org/1999/xlink>"version="5.1">
<info>
<title>This is a test Docbook</title>
</info>
<sect1>
<title>First Section</title>
<para>This links to first endnote[<xreflinkend="Ref1"/>]</para>
<para>This links to second endnote[<xreflinkend="Ref2"/>]</para>
<sect2>
<title>Endnotes</title>
<para>
<orderedlist>
<listitem>
<paraxml:id="Ref1"> www.google.com <http://www.google.com> </para>
</listitem>
<listitem>
<paraxml:id="Ref2">Doe, J. "This is a Docbook". Journal of everything XML. 2021:1(1):1-2.</para>
</listitem>
</orderedlist>
</para>
</sect2>
</sect1>
</article>

Reply via email to