DITA and XMetaL Discussion
super-structure December 17, 2010 at 2:45 am
Help with DITA-OTDecember 17, 2010 at 2:45 amParticipants 3Replies 4Last Activity 12 years, 1 month ago
I've been banging around with this one for a while now and I just can't seem to locate where to put my modification.
Product: XMetaL Author v5.5
Specifically, I'd like to add a new line with “or” between
items in a list to match our company's style. Now, normally, I'd just use some CSS to do this but, sadly, it seems that HTML Help cannot make use of the :after pseudo element. So it seems just as easy to modify the XSL transform to produce this for me. I know pretty much how to write the XML Stylesheet to do this:
…but I cannot locate where in the DITA-OT files to place the extra style bit (and there's sure to be more to it, but until I even find where this transform takes place, I won't know).
I've located what appears to be the inclusion of the unordered list for the
element in the .../xsl/xslhtml/taskdisplay.xsl file, around line 619. The unordered list is in this template, anyway. However, the templates “commonattributes,” “gen-style,” and “setid” don't appear to have anything to do with the display of list items (but surely that's wrong as there's nothing else there!). Further, my searching through the DITA-OT files using FileLocator Lite has turned up nothing (e.g., choice-fmt turns up nothing).
(Note: Yes, I've made backup copies of all of these files before I ever started tinkering.)
I solved this one myself after a spending a couple of hours away from it. It seems that I was looking in exactly the right spot, just not identifying what I was seeing (I'll be cracking some books on XSL to be sure).
This is a cleaned up portion of what I modified in taskdisplay.xsl:
[/code]Derek Read December 17, 2010 at 6:40 am
Reply to: Help with DITA-OTDecember 17, 2010 at 6:40 am
Good to see you've figured this out. I have not tried the change, but it looks like it makes sense.
This change should affect all HTML output types (CHM, WebHelp, Multiple HTML, Single HTML, Eclipse and Java Help), in case that was not obvious.
Regarding the support for CSS :after — this is not a WebHelp issue, it is a browser support for CSS issue. So, unless you can guarantee the browser and version your readers would be using I wouldn't rely on it at present. Some newer versions of browsers support it (my copy of FF 3.6 does and Microsoft specifically documents support for :after and :before as one of the great new things in IE8).
Your solution seems better anyway as I should think that the “or” you are inserting should actually be present in the content (this is the “purist” part of my brain talking). I can't think of any really bad things that would occur if this was done using CSS (for supported browsers) except that in some of them a copy action might not include it because the browser doesn't treat it as “real” content. The main thing however (as you have seen in your testing) is that for many browsers the reader will see nothing.gcrews December 17, 2010 at 6:50 am
Reply to: Help with DITA-OTDecember 17, 2010 at 6:50 am
the code around 619 is for the choices, the actual li choice items are created in the call on line 661. This calls the template matching topic/li since there is no matching templates for task/choice. The topic/li template is around line 1273 of to dita2htmlImpl.xsl.
It calls this because of the dita inheritance of “- topic/li task/choice “
You will most likely want to add your code around line 1304 just before the ending li tag. Since your not matching items in a for loop but rather a template match the position code you have will not quite work since it counts text nodes. It might work if you use last() – 1 but im not sure if it would work if there are child nodes on the last choice. There a couple of ways o go about figuring out if your on the last node. you might try something like:
or,gcrews December 17, 2010 at 4:15 pm
Reply to: Help with DITA-OTDecember 17, 2010 at 4:15 pm
your code above may work but since you are overriding the default processing with a simple for loop you may run into unintended consequences. If you look at the topic/li template mentioned above its also flagging the output based on your ditaval and preforming some rev attribute flagging if needed. It also calls commonattributes and setidaname. if you ever try and use a xref to a li now it will likely not work because the id attribute was not applied. Essentially any attribute on the choice tag will no longer work properly.super-structure December 17, 2010 at 5:39 pm
Reply to: Help with DITA-OTDecember 17, 2010 at 5:39 pm
You're correct, it is a function of Internet Explorer and not so much HTML Help Viewer. Though Microsoft claims that the :before and :after pseudo elements and generated content are now supported in IE8, I still don't see them (Win 7 64-bit with IE8). Either way, previous version are far too prevalent to make it okay for our users.
I do agree that adding “actual” content instead of browser rendered content is preferable when it comes to text (and far more reliable). It was intentional that this be used for all HTML output, though .CHM is the only HTML output I currently use. At least in this case, missing an “or” between two lines doesn't dramatically affect the users ability to understand what is required.
Excellent advice. This does work to suite my current needs (ref. attached image), but that isn't to say that larger projects in the future (when other writers are making use of this), that changes won't be needed. Honestly, I cannot think of many cases when we'll need to reference or reuse just a single
list item, as opposed to the entire . However, it is always best to limit the effect a modification like this to as small a set as possible. I appreciate your help.
- You must be logged in to reply to this topic.