Can't use xml:id as the target of a link
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 24
- Joined: Sat Jul 12, 2008 3:46 am
- Location: Brisbane, Australia
Can't use xml:id as the target of a link
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?
[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?
-
- Posts: 9438
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Can't use xml:id as the target of a link
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:
Regards,
Radu
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>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 24
- Joined: Sat Jul 12, 2008 3:46 am
- Location: Brisbane, Australia
Re: Can't use xml:id as the target of a link
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
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:Regards,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>
Radu
-
- Posts: 9438
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Can't use xml:id as the target of a link
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:
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
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>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 24
- Joined: Sat Jul 12, 2008 3:46 am
- Location: Brisbane, Australia
Re: Can't use xml:id as the target of a link
Hi Radu,
Attaching a file. This one generates another warning.
Here's the XML.
Attaching a file. This one generates another warning.
Code: Select all
[warning] unresolved internal destination: 'd0e2'
[warning] unresolved internal destination: 'ksr-return-dis'
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:
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?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>
Regards,
Radu
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Can't use xml:id as the target of a link
Post by sorin_ristache »
Hello,
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
The XSLT processor issues the following message a few times on your DocBook 5 XML document which you can see in the Messages view: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'
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
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service