DITA and XMetaL Discussion
XMetaL Community Forum › DITA and XMetaL Discussion › Cross reference to a target element with ID works in PDF but not in Eclipse/HTML
-
jepry July 26, 2011 at 2:26 am
Cross reference to a target element with ID works in PDF but not in Eclipse/HTML
July 26, 2011 at 2:26 amParticipants 1Replies 2Last Activity 11 years, 6 months agoIf I create a cross ref like this:
[code]../../reference/topics/xxxx_properties.xml#xxxx_properties/yyyy_Prop[/code]
to a target like this:
[code]
YYYY Property [/code](with “entry” being a cell in a table)
…it works in the PDF output, but not in either Webhelp or Eclipse HTML output.
In the PDF, the link goes right to that target id in the table, but in the HTML it just goes to the xxxx_properties.xml page, at the top of the page.
I created it by inserting a cross reference, selecting the target file, and then selecting that particular ID, which was offered as a choice if I selected “All” as the ID type in the link dialog box.
For the xref the format is set to “dita”, the scope is set to “local”, and the type is “topic”.
Anyone know how to make this work for both PDF and Eclipse?
XMetal Author 6.0 with Render X XEP
Derek Read July 26, 2011 at 6:05 pm
Reply to: Cross reference to a target element with ID works in PDF but not in Eclipse/HTML
July 26, 2011 at 6:05 pmIn 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 theinside 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.
jepry July 26, 2011 at 6:31 pm
Reply to: Cross reference to a target element with ID works in PDF but not in Eclipse/HTML
July 26, 2011 at 6:31 pmThanks for that, I had just discovered that wrapping the table text in a
tag does in fact create a link that works in both PDF and HTML output, but your more detailed explanation about why is very useful.
One little thing that threw me off is that at the start of this I did have the entries in paragraphs, as in
text here
, but when I selected the
element and assigned the ID there, it assigned the ID to the entry, not the paragraph.
Which makes sense, since it's going to assign the ID to whatever element your cursor is in when you add the ID. To assign the ID to the paragraph you have to just put the cursor inside of it, because if you select it, you're really located in the
tag instead. I was changing the code by hand to move the id from the tags into the tags, until I realized that.
I guess what you describe could be the ultimate fix, but for me just telling everyone that we have to put table entries inside of paragraph tags, and the right way to assign the ID, seems close enough.
This does all work in Eclipse by the way which as you say is really just HTML, and it works with Chrome and Firefox, takes me right to the specific table cell.
Thanks again,
-
AuthorPosts
- You must be logged in to reply to this topic.