Page 1 of 1

Adding a <div> tag around all related links in XHTML output

Posted: Fri May 25, 2012 11:19 pm
by davegibbons
I need to add a div around all the related links in XHTML output. Oxygen appears to have customized the DITA toolkit in this area. Where would I add a div with an id attribute so that the div surrounds all of the related links on an XHTML page, including "previous" and "next" links?

Thank you for your help.

Re: Adding a <div> tag around all related links in XHTML output

Posted: Mon May 28, 2012 10:55 am
by sorin_ristache
Hello,

For XHTML output you should run the DITA Map XHTML transformation. The related links are created in the template:

Code: Select all

<xsl:template match="*[contains(@class,' topic/related-links ')]" name="topic.related-links">
from the stylesheet [Oxygen-install-dir]\frameworks\dita\DITA-OT\xsl\xslhtml\rel-links.xsl. This template already contains a div element without attributes so you should add an id attribute to this div element, for example:

Code: Select all

<xsl:template match="*[contains(@class,' topic/related-links ')]" name="topic.related-links">
<div id="some_ID">
. . .
If you want to surround only the Previous Topic and Next Topic links you should modify only the template:

Code: Select all

<xsl:template name="next-prev-parent-links">
from [Oxygen-install-dir]\frameworks\dita\DITA-OT\xsl\xslhtml\rel-links.xsl. You should add the div element inside this template:

Code: Select all

<xsl:template name="next-prev-parent-links">
<div id=some_ID>

. . .

</div>
</xsl:template>

Regards,
Sorin

Re: Adding a <div> tag around all related links in XHTML output

Posted: Mon May 28, 2012 7:25 pm
by davegibbons
Excellent, Sorin! Thank you!