Displaying ShortDesc of Xref Topics in Imagemap

Questions about XML that are not covered by the other forums should go here.
dgallo
Posts: 83

Displaying ShortDesc of Xref Topics in Imagemap

Tue Mar 31, 2015 10:59 pm

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>
Radu
Posts: 5562

Re: Displaying ShortDesc of Xref Topics in Imagemap

Wed Apr 01, 2015 3:13 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dgallo
Posts: 83

Re: Displaying ShortDesc of Xref Topics in Imagemap

Wed Apr 08, 2015 11:58 pm

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.
Radu
Posts: 5562

Re: Displaying ShortDesc of Xref Topics in Imagemap

Thu Apr 09, 2015 8:56 am

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/#tasks/use-new-dita-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/creating-simple-dita-open-toolkit.html

Hope this helps,
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dgallo
Posts: 83

Re: Displaying ShortDesc of Xref Topics in Imagemap

Thu Apr 09, 2015 10:22 pm

That worked!!!!! Thank you so much for your help!

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 0 guests