Page 1 of 1
					
				Can't use xml:id as the target of a link
				Posted: Wed Oct 22, 2008 6:25 am
				by pbw
				I'm using 9.3, and rendering with XEP. If I specify xml:id on a element, and try to link to it with <link linkend="name-of-xml-id">, I get
[warning] unresolved internal destination: 'ksr-return-dis'
That's understandable, because no target id is generated in the fo file. So it looks like a bug in the stylesheets. Does anyone know anything about this?
			 
			
					
				Re: Can't use xml:id as the target of a link
				Posted: Wed Oct 22, 2008 8:16 am
				by Radu
				Hi, 
You are probably using Docbook to write your XML files.
You should use "id" to set id's to elements and not "xml:id"'s
See the sample Docbook XML below:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
                         "http://www.docbook.org/xml/4.4/docbookx.dtd">
<article>
    <title>Welcome to the Docbook</title>
    <sect1 id="sect">
        <title>Inline Markup and Images</title>
        <para><link linkend="sect">Link to Section</link></para>
    </sect1>
</article>
Regards,
Radu
 
			
					
				Re: Can't use xml:id as the target of a link
				Posted: Thu Oct 23, 2008 12:49 am
				by pbw
				Thanks for that. Yes, I am using DocBook, as I forgot to mention in the first place.
However, when I try to add an 
id attribute to a 
sect4 element, I am told
E [oNVDL] attribute "id" not allowed at this point; ignored
Any ideas?
Peter
Radu wrote:Hi, 
You are probably using Docbook to write your XML files.
You should use "id" to set id's to elements and not "xml:id"'s
See the sample Docbook XML below:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
                         "http://www.docbook.org/xml/4.4/docbookx.dtd">
<article>
    <title>Welcome to the Docbook</title>
    <sect1 id="sect">
        <title>Inline Markup and Images</title>
        <para><link linkend="sect">Link to Section</link></para>
    </sect1>
</article>
Regards,
Radu
 
 
			
					
				Re: Can't use xml:id as the target of a link
				Posted: Thu Oct 23, 2008 8:18 am
				by Radu
				Hi Peter,
Just realised from your post that you are using Docbook 5 and I was referring to Docbook 4. Indeed in Docbook 5 you should use xml:id's to set ID's to elements and then refer to them.
I tried a small sample using XEP 4.13 and a duplicate of our "Docbook to PDF" read-only scenario but could not reproduce the problem:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" type="xml"?>
<article xmlns="http://docbook.org/ns/docbook"
    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
    <info>
        <title>Article Template Title</title>
    </info>
    <sect1>
        <title>Section1 Title</title>
        <subtitle>Section1 Subtitle</subtitle>
        <para><link linkend="sect4">Section 1</link></para>
        <sect2>
            <title>Sect2</title>
            <sect3>
                <title>Sect 3</title>
                <sect4 xml:id="sect4">
                    <title>Sect4</title>
                    <para>Sect 4 para</para>
                </sect4>
            </sect3>
        </sect2>
    </sect1>
</article>
Indeed your problem could come from a bug in the stylesheets, can you post a cut down sample of your file to try and reproduce it on our side?
Regards,
Radu
 
			
					
				Re: Can't use xml:id as the target of a link
				Posted: Fri Oct 24, 2008 1:10 am
				by pbw
				Hi Radu,
Attaching a file. This one generates another warning.
Code: Select all
[warning] unresolved internal destination: 'd0e2'
    [warning] unresolved internal destination: 'ksr-return-dis'
Here's the XML.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" type="xml"?>
<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
    <chapter xml:id="signatures">
        <title>XML Digital Signatures</title>
        <sect1>
            <title>A verifying implementation</title>
            <sect2>
                <title><code>X509KeySelector</code></title>
                <example>
                    <?dbfo pgwide="1"?>
                    <title>X509KeySelector class</title>
                    <programlisting>public class X509KeySelector extends KeySelector {
                final PublicKey key = ((X509Certificate)o).getPublicKey();
                return new <anchor xml:id="ksr-return"/><link linkend="ksr-return-dis">KeySelectorResult()</link> {
                    public Key getKey() { return key; }
                };
            }
        }
        throw new KeySelectorException("No key found!");
    }
}</programlisting>
                </example>
            </sect2>
            <sect2>
                <title xml:id="ksr-return-dis"><link linkend="ksr-return">Return
                            <code>KeySelectorResult</code></link></title>
                <para> The PublicKey derived above is placed in the <code>final</code>
                    automatic variable <code>key</code>. An anonymous inner class is then
                    created, implementing <code>KeySelectorResult</code>, which will return
                    the value in <code>key</code>. This anonymous
                    <code>KeySelectorResult</code> implementation is the return value.
                </para>
            </sect2>
        </sect1>
    </chapter>
</book>
Radu wrote:Hi Peter,
Just realised from your post that you are using Docbook 5 and I was referring to Docbook 4. Indeed in Docbook 5 you should use xml:id's to set ID's to elements and then refer to them.
I tried a small sample using XEP 4.13 and a duplicate of our "Docbook to PDF" read-only scenario but could not reproduce the problem:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" type="xml"?>
<article xmlns="http://docbook.org/ns/docbook"
    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
    <info>
        <title>Article Template Title</title>
    </info>
    <sect1>
        <title>Section1 Title</title>
        <subtitle>Section1 Subtitle</subtitle>
        <para><link linkend="sect4">Section 1</link></para>
        <sect2>
            <title>Sect2</title>
            <sect3>
                <title>Sect 3</title>
                <sect4 xml:id="sect4">
                    <title>Sect4</title>
                    <para>Sect 4 para</para>
                </sect4>
            </sect3>
        </sect2>
    </sect1>
</article>
Indeed your problem could come from a bug in the stylesheets, can you post a cut down sample of your file to try and reproduce it on our side?
Regards,
Radu
 
 
			
					
				Re: Can't use xml:id as the target of a link
				Posted: Fri Oct 24, 2008 12:15 pm
				by sorin_ristache
				Hello,
pbw wrote:Attaching a file. This one generates another warning.
Code: Select all
[warning] unresolved internal destination: 'd0e2'
    [warning] unresolved internal destination: 'ksr-return-dis'
 
The XSLT processor issues the following message a few times on your DocBook 5 XML document which you can see in the 
Messages view:
Don't know what gentext to create for xref to: "anchor"
That means the DocBook XSL stylesheets do not generate a link if the target of the link (the 
xml:id attribute) is an 
anchor element inside a 
programlisting. Also a link is not generated if the target is a 
title element. However the stylesheets generate a correct link when 
anchor is used in other elements (inside 
para, inside 
sect2 but after 
title, etc). Also they generate a correct link to other elements than 
title that have an 
xml:id attribute like 
para, 
sect1, 
sect2, 
example, 
programlisting, etc. So the practical solution for you is to set the 
xml:id attribute on elements for which the DocBook XSL stylesheets can generate the link.
Other solution is 
creating a customization of the DocBook XSL stylesheets for generating a link to an 
anchor element and to a 
title element.
Regards,
Sorin