Page 1 of 1

Displaying ShortDesc of Xref Topics in Imagemap

Posted: Tue Mar 31, 2015 10:59 pm
by dgallo
I am using the <imagemap> element to create linkable areas over an image to other topics. In my HTML output, when you hover-over the linkable areas, the <title> of the topics being cross referenced displays as hover text. I do not want to display the linked topic's <title> as hover text, I want to show the linked topic's <shortdesc>.

Is there a way to easily do this if you are not a person that codes? Below is some sample text.

Code: Select all


<imagemap id="imagemap_vnj_5qy_gr">
<image href="../../images/workspace_vwt.png" id="image_tzj_wqy_gr"/>
<area class="+ topic/figgroup ut-d/area ">
<shape>rect</shape>
<coords>161, 251,278,278</coords>
<xref href="brow_model_c.dita#concept_u5d_z3c_zq"/>
</area>
</imagemap>

Re: Displaying ShortDesc of Xref Topics in Imagemap

Posted: Wed Apr 01, 2015 3:13 pm
by Radu
Hi,

You will probably need to make some XSLT customizations for this.

The XSLT stylesheet:

OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/plugins/org.dita.xhtml/xsl/xslhtml/ut-d.xsl

has a template which matches the imagemap and generates HTML output from it:

You should also consider registering on the Yahoo Groups DITA Users List, it is a very good place where to ask DITA publishing customization questions.

Code: Select all

<xsl:template match="*[contains(@class,' ut-d/imagemap ')]" name="topic.ut-d.image
...........
which at some point computes the title which will be set on the HTML <a> element corresponding to the DITA xref:

Code: Select all

          <!-- create ALT text from XREF content-->
<!-- if no XREF content, use @HREF, & put out a warning -->
<xsl:choose>
<xsl:when test="*[contains(@class, ' topic/xref ')]">
<xsl:variable name="alttext"><xsl:apply-templates select="*[contains(@class, ' topic/xref ')]/*[contains(@class, ' topic/desc ')]" mode="text-only"/></xsl:variable>
<xsl:attribute name="alt"><xsl:value-of select="normalize-space($alttext)"/></xsl:attribute>
<xsl:attribute name="title"><xsl:value-of select="normalize-space($alttext)"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="ditamsg:area-element-without-linktext"/>
</xsl:otherwise>
</xsl:choose>
and you would probably need to modify the alttext variable to take only the description from the xref link like:

Code: Select all

              <xsl:variable name="alttext"><xsl:apply-templates select="*[contains(@class, ' topic/xref ')]/*[contains(@class, ' topic/desc ')]" mode="text-only"/></xsl:variable>
Regards,
Radu

Re: Displaying ShortDesc of Xref Topics in Imagemap

Posted: Wed Apr 08, 2015 11:58 pm
by dgallo
Once I have made the changes in the .xsl file, how to I append them to Oxygen? I am not allowed to overwrite that existing file.

Re: Displaying ShortDesc of Xref Topics in Imagemap

Posted: Thu Apr 09, 2015 8:56 am
by Radu
Hi,

When Oxygen is installed in the Program Files folder, Windows requires administrative privileges in order to modify any file in there.

So you would have several options:

1) Start the application you want to use to edit the XSLT (Oxygen for example) with administrative privileges. This is usually done by right clicking its executable file and choosing "Run as administrator".

2) Install Oxygen in a folder where you have full access rights for the current user and use it from there.

3) Copy the entire DITA Open Toolkit folder:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT

to a location where you have full access rights, make the modification there and then use that external DITA OT folder for publishing:

http://www.oxygenxml.com/doc/ug-oxygen/ ... ta-ot.html

4) Perform option (3) but instead of directly modifying the XSLT stylesheet create a DITA Open Toolkit plugin which adds an XSLT customization for the XHTML output like:

http://blog.oxygenxml.com/2013/12/creat ... olkit.html

Hope this helps,
Regards,
Radu

Re: Displaying ShortDesc of Xref Topics in Imagemap

Posted: Thu Apr 09, 2015 10:22 pm
by dgallo
That worked!!!!! Thank you so much for your help!

Re: Displaying ShortDesc of Xref Topics in Imagemap

Posted: Tue May 28, 2019 10:42 am
by Radu
Hi,

Just to update this thread, there is now a DITA OT plugin on the Oxygen XML GitHub account which can be installed to do this:

https://github.com/oxygenxml/dita-html- ... desc-links

Regards,
Radu