Page 1 of 1

Webhelp XSLT glossentry override

Posted: Fri Mar 25, 2016 6:16 pm
by urbanrobots
Hi,

Where do we configure the glossary output structure for glossary entries in the Webhelp XSL files?

For the PDF plugin, we use the following template and FO blocks. We'd like to do something similar in the Webhelp plugin.

Code: Select all


   <xsl:template match="*[contains(@class,' glossentry/glossentry')]">

<xsl:variable name="glossSynonym" select="*[contains(@class, ' glossentry/glossBody ')]/*[contains(@class, ' glossentry/glossAlt ')]/*[contains(@class, ' glossentry/glossSynonym ')]/node()"/>
<xsl:variable name="glossAcronym" select="*[contains(@class, ' glossentry/glossBody ')]/*[contains(@class, ' glossentry/glossAlt ')]/*[contains(@class, ' glossentry/glossAcronym ')]/node()"/>
<xsl:variable name="glossdef" select="*[contains(@class, ' glossentry/glossdef ')]/node()"/>
<xsl:variable name="glossterm" select="*[contains(@class, ' glossentry/glossterm ')]/node()"/>


<fo:block xsl:use-attribute-sets="__glossary__entry">
<xsl:call-template name="commonattributes"/>
<fo:block>
<xsl:attribute name="id">
<xsl:call-template name="generate-toc-id"/>
</xsl:attribute>
<fo:block xsl:use-attribute-sets="__glossary__term">
<xsl:apply-templates select="$glossSynonym"/>
</fo:block>

<fo:block xsl:use-attribute-sets="__glossary__def">
<xsl:if test="$glossAcronym">
<xsl:apply-templates select="$glossterm"/>
<xsl:text>. </xsl:text>
</xsl:if>
<xsl:apply-templates select="$glossdef"/>
</fo:block>
</fo:block>
</fo:block>


</xsl:template>
Thanks. I am still quite new to the web publishing side of building XSLTs.

Take care,
- Nick

Re: Webhelp XSLT glossentry override

Posted: Mon Mar 28, 2016 12:26 pm
by Radu
Hi Nick,

Ideally you would avoid XSLT customization and use a custom CSS instead:

https://www.oxygenxml.com/doc/versions/ ... n-css.html

After the publishing is done you can open from the output folder the HTML document corresponding to your glossentry and look for @class attribute values, for example the glossentry title will be something like:

Code: Select all

<h1 class="title title glossterm topictitle1">some title</h1>
so you can match it from a custom CSS using a selector like:

Code: Select all


.glossterm{
....
}
As for the XSLT based approach, the XSLT stylesheet:

DITA-OT\plugins\org.dita.xhtml\xsl\xslhtml\dita2htmlImpl.xsl

has some generic processing for any type of topic (including glossentry):

Code: Select all

<xsl:template match="/dita | *[contains(@class, ' topic/topic ')]">
so I guess you could add more specific templates if you want to output glossentry in a special way.

Regards,
Radu

Re: Webhelp XSLT glossentry override

Posted: Sat Apr 02, 2016 8:43 pm
by urbanrobots
Hi Radu -

Okay, thanks. The CSS controls the styling, while the XSLT controls the structure, correct? I always look at CSS as formatting, similar to XSL attributes.

Can CSS change the structure of the glossary entry itself in output? We'd like to make glossSynonym the entryhead and not glossterm. This seems more like XSLT than CSS. Also, it doesn't seem like a CSS-only approach would allow us to hide certain elements from HTML output.

Take care,
- Nick

Re: Webhelp XSLT glossentry override

Posted: Tue Apr 05, 2016 9:03 am
by bogdan_cercelaru
Hi Nick,

Yes, you are right, the CSS cannot change the structure of the generated HTML.
If you need to change the structure of the glossary entry, you need to modify the XSLT files. As Radu already said, take a look at the DITA-\OT/plugins\org.dita.xhtml\xsl\xslhtml\dita2htmlImpl.xsl file.

Regards,
Bogdan

Re: Webhelp XSLT glossentry override

Posted: Tue Apr 12, 2016 7:26 pm
by urbanrobots
Thanks both!

Hi Bogdan,
Do you happen to know where the abbreviated-form is controlled for the left-hand navigation? We would like titles (in the topics and in the left-hand navigation) to always use the abbreviated-form. The left-hand navigation doesn't seem to follow the same templates as the main topics, for some reason.

Take care,
- Nick

Re: Webhelp XSLT glossentry override

Posted: Thu Apr 14, 2016 4:09 pm
by Radu
Hi Nick,

WebHelp produced using Oxygen 17.1 should expand abbreviated forms in the table of contents titles.
The XSLT stylesheet:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT2.x\plugins\com.oxygenxml.webhelp\xsl\dita\tocDita.xsl

has a template like:

Code: Select all

  <xsl:template match="*[contains(@class, ' map/topicref ') 
and not(@processing-role='resource-only')
and not(@toc='no')
and not(ancestor::*[contains(@class, ' map/reltable ')])]"
mode="toc-webhelp">
.............
Regards,
Radu

Re: Webhelp XSLT glossentry override

Posted: Thu Aug 19, 2021 2:04 am
by aabuan123
Hi,

Thanks for this solution. I was able to use this to change the side-toc menu for my acronyms to just show the acronym instead of the glossterm.

But for the topic title I want to use the glossSurfaceForm as the title for the acronym topic instead of the glossterm. How do I do this? I can't seem to find the xsl to override for the topic title.

Thanks,
Alice