DITA and XMetaL Discussion
XMetaL Community Forum › DITA and XMetaL Discussion › WebHelp Link on Image Not Working
mervynd June 8, 2011 at 8:23 am
WebHelp Link on Image Not WorkingJune 8, 2011 at 8:23 amParticipants 1Replies 2Last Activity 11 years, 9 months ago
I'm working in XMetal Version#: 6.0.1.030 on Vista Professional. It is functioning well (after replacing XFRunner.dll per instructions elsewhere in the forum). However, I cannot get an image to link to another topic or image file in Webhelp output.
The requirement is to display a reduced dialog box image within a topic, but with a link to the full-size (quite large) version. My workaround is to insert a text link above the image, but this is less than professional. I have tried the following without success:
– within a figure tag: xref surrounding the image tag to link to .png file
– within a figure tag: xref surrounding the image tag to link to topic
– within a paragraph tag: xref surrounding the image tag to link to .png file
– within a paragraph tag: xref surrounding the image tag to link to topic
A quick review of the WebHelp output code shows that the text link is in regular form, whereas all the links on images contain code pairs within the code pair. I assume this is why the link fails in all the cases above.
Is this a known problem? If so, is there a workaround short of editing the output code before publishing? If not, I can send sample files.
Thanks.Derek Read June 8, 2011 at 10:49 am
Reply to: WebHelp Link on Image Not WorkingJune 8, 2011 at 10:49 am
The most logical solution is to place your inside an
element, so that you have this in your XML:
That makes the most sence with regard to the DITA markup and available elements. If you do that the DITA OT will also produce the HTML you need:
…and all browsers will take you to that location (usually by opening a new window or tab) when you click on the image.
Note the absense of an id attribute. That is the key here.
One point of clarification as well. This is not a “Webhelp” issue, it affects all HTML-based outputs generated by the DITA OT (Webhelp is just one of the consumers of the HTML generated by the DITA OT).
So, why aren't you getting that result? It must be because you have an id attribute set on your . For any element with an id attribute set on it the DITA Open Toolkit puts before that element in HTML output. It does this blindly without much (or any) regard for the element type or the context (I have not actually read through the XSLT to see which it is). The assumption the DITA OT is making here seems to be that you may want to link to that HTML content from somewhere (or allow someone else on the Internet to link to that content I suppose). This means that if you have this in your XML:
…then the DITA OT will produce something like this:
This is well-intensioned because, in theory, now anyone can link to that first .
However, and unfortunately as you have seen, the major browsers (perhaps all browsers) do not treat such an image as a link (clickable).
Having nested links actually breaks the rules for XHTML 1.0 (the DOCTYPE that the DITA OT claims to be generating HTML to validate against) so that is probably why browsers don't have support for this (though they support lots of other wacky non-standard stuff — go figure). I will follow up with the DITA OT project at SourceForge regarding this particular issue. I can see how this might have been overlooked because you cannot validate a document using the XHTML DTD to catch this issue and it is listed in a fairly obscure section http://www.w3.org/TR/xhtml1/#prohibitions) that was originally written in the 1990s and just carried forward to later specs.
So, that explains why things aren't working for you…
One solution (the easiest) is to manually remove any id attributes that had been previously set for images in files that you had already saved and that you want to treat as links in your output.
However, keep in mind that by default XMetaL Author Enterprise is configured to set id attributes for elements automatically (and this occurs during save for missing id values). You can (and will need to) turn that feature off for the image element in Tools > DITA Options dialog. On the General tab in that dialog you will need to select the Options button next to the “Auto-assign element ids” checkbox and then remove “image” from the list of elements to auto-id. If you can't follow what I just said then have a look in the Help (F1) under the topic “DITA options” which explains the “auto-id” feature.
Of course this would mean that if you wish to have @id set on some elements (to get the default DITA OT output for them or so that you can use them with @conref or possibly other reasons) you would need to manually set an @id for them.
If that is not acceptable then the XSLT that generates the HTML (as part of the DITA Open Toolkit) would need to be modified. You could do that for all cases (try to suppress this surrounding by for all elements) or you might implement some conditional code instead (“is the parent of this image an xref?” type of logic). Alternatively, you could take advantage of the DITA @outputclass and then modify the DITA OT to handle elements with that attribute set to a specific value in your special way.
- You must be logged in to reply to this topic.