View Full Version : Crossreferences (xref) always lead to top of page


georg3200
01-12-2009, 01:01 PM
Hi there,

I try to create XREFs in my epubs. The link should lead to a specific position in a document.
But clicking on a link always leads to the top of the specific document and NOT to the position where the target ist specified.
This happens no matter if I use <xref.. or <link...
I have tested it with ADE.

Here is what I do in XML-code:

XREF:
<entry align="left" valign="top"><xref linkend="654321"/></entry>
XREF-target:
<para id ="654321" xreflabel ="44"><token>44</token>Der Begriff...</para>

or I do this:

XREF:
<entry align="left" valign="top"><link linkend="123456">3</link></entry>
XREF-target:
<para id="123456"><token>3</token>Das TMG wu...</para>

But whatever I try, I always get to the top of the HTML-Page when clicking the link in ADE :angry:

Does someone has a idea?

Thanks
Georg

Jellby
01-12-2009, 01:15 PM
Hmm... I don't know how that markup is supposed to work, but those tags are not mentioned in the required XHTML tags: http://www.idpf.org/2007/ops/OPS_2.0_0.984_draft.html#Section2.2

Is is maybe some ADE-specific extension?

georg3200
01-13-2009, 05:51 AM
Sorry, the code above is not the resulting XHTML. It is the original XML. I use docbook.xsl to convert the XML to XHTML. The xml complies to the docbook specification.

The resulting XHTML looks like this:

here is the link
<a class="link" href="ch01.html#123456">4</a>

and it points to this target (within the same file ch01.html):
<p><a id="123456"/><span class="token">1</span>Das Telemediengesetz... </p>

Clicking the link in ADE leads to the top of page ch01.html.
Unzipping the ebook and opening ch01.html in firefox shows me, that the links work fine! It leads me to the exact position!
But not in ADE :angry:

Thanks
georg

llasram
01-13-2009, 10:05 AM
here is the link
<a class="link" href="ch01.html#123456">4</a>

and it points to this target (within the same file ch01.html):
<p><a id="123456"/><span class="token">1</span>Das Telemediengesetz... </p>

If your fragment identifier actually is "123456" or otherwise begins with a number, there's your problem. The letter of the XHTML spec requires that the values of 'id' attributes match the pattern [A-Za-z][A-Za-z0-9:_.-]*, and thus must begin with an ASCII alphabetic character. Other renderers are a bit more flexible, but in my quick test ADE actually does seem to care (example attached).

georg3200
01-13-2009, 10:38 AM
Indeep. I tried id="abcdef" instead of id="123456".

That did the trick :)

Many, many thanks!

Georg