Home Forums DITA and XMetaL Discussion Cross reference to a target element with ID works in PDF but not in Eclipse/HTML Reply To: Cross reference to a target element with ID works in PDF but not in Eclipse/HTML

Derek Read

Reply to: Cross reference to a target element with ID works in PDF but not in Eclipse/HTML

In order to get a browser to jump to a specific part in a document the HTML needs an “anchor” in addition to the link that is inserted for the itself. Anchors in HTML use the element. The DITA Open Toolkit is generating links in the HTML properly, however, it is not inserting a corresponding for the

element.

What needs to appear in the HTML output is something like the following (roughly the same as the other types of anchors the DITA OT generates for HTML output):

[code]…

 

YYYY Property

…[/code]

Note that I have simplified the HTML above for clarity. The DITA OT actually puts in a lot more attributes.

The simplest workaround I can think of that requires making no modifications to the DITA OT is to:
 1. Wrap the contents of the inside another element that the DITA OT [u]does[/u] insert an anchor for when linked to.
     This includes

. So you will then have this type of content:
     

YYYY Property


 2. Create the xref so that it points to the

.

The proper fix (to support your xrefs as written) would be to modify the DITA OT so that it does insert elements when you link to a table element. You may wish to submit a request for this to the DITA OT project at SourceForge. Note that in my testing it seems that some browsers (notably FireFox) will not take you to an anchor located directly inside a

, only inside a

. This is relevant because for all other elements the DITA OT's logic is to place the
just before the opening tag of the element being linked to, in this case before the

(not inside the ). That would result in an anchor that would not work for some browsers. I think a special case would need to be made in the DITA OT so that such an anchor is inserted inside the .

I have not tested this with Eclipse, but since it ultimately consumes HTML as well the issue must be similar.

Reply

Products
Downloads
Support