override template in dita2htmlImpl.xsl with Oxygen Webhelp plugin version

urbanrobots
Posts: 84
Location: San Francisco

override template in dita2htmlImpl.xsl with Oxygen Webhelp plugin version

Thu Aug 03, 2017 1:29 am

Hi,
We're trying to modify how the TOC in the Oxygen Webhelp renders glossary entries. While we can update the title in the topics to behave correctly, we cannot get the TOC to use the templates in the Oxygen Webhelp plugin. They always point to the template in org.dita.xhtml/dita2htmllImpl.xsl.

For example, we capitalize the first letter when a writer specifies @outputclass="cap_first_letter".

Code: Select all

 
    <xsl:template match="*[contains(@class, ' topic/term ')]" mode="output-term" >
        <xsl:param name="displaytext"/>
       
        <dfn class="term">
            <xsl:call-template name="commonattributes"/>
            <xsl:call-template name="setidaname"/>
            <xsl:choose>
                <xsl:when test="normalize-space($displaytext)">
                   
                    <xsl:call-template name="cap_first_letter">
                        <xsl:with-param name="displaytext">
                            <xsl:value-of select="$displaytext"/>
                        </xsl:with-param>
                    </xsl:call-template>
                   
                </xsl:when>
                <xsl:otherwise>
                    <xsl:apply-templates/>
                </xsl:otherwise>
            </xsl:choose>
        </dfn>
    </xsl:template>
   
   
     <xsl:template name="cap_first_letter">
        <xsl:param name="displaytext"/>
        <xsl:choose>
            <xsl:when test="@outputclass = 'cap_first_letter'">
                <xsl:value-of
                    select="translate(substring($displaytext, 1, 1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
                <xsl:value-of
                    select="substring($displaytext, 2, string-length($displaytext) - 1)"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:copy-of select="$displaytext"/>
            </xsl:otherwise>
        </xsl:choose>

    </xsl:template>


This works fine in the main topic but the TOC still shows the term in sentence case. I have tested adding this logic directly to the org.dita.xhtml plugin and it correctly applies the logic... I have tried setting the priority of the Oxygen Webhelp copy of this template, but it doesn't seem to do anything.

Thoughts?

Take care,
- Nick
alin
Site Admin
Posts: 132

Re: override template in dita2htmlImpl.xsl with Oxygen Webhelp plugin version

Thu Aug 03, 2017 4:58 pm

Hi Nick,

Can you please tell me which version of oXygen WebHelp plugin and which DITA-OT distribution are you using?
In an older forum post you said that you will continue to use the v17 plugin with DITA-OT 1.7.5. Is this still your current version?
Have you succeeded to upgrade to version 19?
In this case, I would need to know which type of WebHelp output are you trying to customize: Responsive or Classic (three-pane).

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
urbanrobots
Posts: 84
Location: San Francisco

Re: override template in dita2htmlImpl.xsl with Oxygen Webhelp plugin version

Thu Aug 03, 2017 8:06 pm

Hi Alin,

Yes, after some discussion we decided that supporting DITA-OT 2.x is an important opportunity, especially Markdown + LwDITA support, so I'm working through the other customization issues first and will research the generate.outer.copy = 2 issue later.

This is for Oxygen Webhelp version 19.0 on DITA-OT 2.3.3. We'll test a later version of DITA-OT once the customizations are more mature.

Take care,
- Nick
alin
Site Admin
Posts: 132

Re: override template in dita2htmlImpl.xsl with Oxygen Webhelp plugin version

Fri Aug 04, 2017 4:45 pm

Hi Nick,

I assume that you are using a DITA-OT extension plugin to apply your customization. If your customization has effect only for the topic content and not for the TOC content you probably have used only the "com.oxygenxml.webhelp.xsl.dita2webhelp" extension-point.
In order to customize the TOC content you should also register you stylesheet on the "com.oxygenxml.webhelp.xsl.createTocXML" extension point.
These extension points are described in our User Manual at: https://www.oxygenxml.com/doc/versions/ ... hing3.html

I have performed the following steps to test your scenario:
  • I have created a DITA-OT extension plugin in the [DITA_OT_DIR]/plugins folder containing the following resources:

    Code: Select all

    -- [DITA-OT-DIR]/plugins/
      -- webhelp.glossterms.caps/
        -- plugin.xml
        -- xsl/
          -- glossterms.xsl   

  • I have added the two XSLT templates from your previous post in "glossterms.xsl".
  • In "plugin.xml" I have registered the stylesheet on the two extension points I have mentioned earlier.
    "plugin.xml" looks like this:

    Code: Select all

    <?xml version="1.0" encoding="UTF-8"?>
    <plugin id="webhelp.glossterms.caps">
        <feature extension="com.oxygenxml.webhelp.xsl.dita2webhelp" file="xsl/glossterms.xsl"/>
        <feature extension="com.oxygenxml.webhelp.xsl.createTocXML" file="xsl/glossterms.xsl"/>
    </plugin>
  • I have run the "DITA-OT Integrator".


Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
alin
Site Admin
Posts: 132

Re: override template in dita2htmlImpl.xsl with Oxygen Webhelp plugin version

Fri Aug 04, 2017 4:57 pm

Another way to capitalize the first letter of each term containing the outputclass="cap_first_letter" is to add a custom CSS to you WebHelp transformation.
The CSS file should contain the following styling rule:

Code: Select all

.cap_first_letter {
  text-transform: capitalize;
}


You can read more about this topic here: https://www.oxygenxml.com/doc/versions/ ... n-css.html
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
urbanrobots
Posts: 84
Location: San Francisco

Re: override template in dita2htmlImpl.xsl with Oxygen Webhelp plugin version

Mon Aug 07, 2017 11:46 pm

Hi Alin --

Awesome~ Your first solution worked like a charm. I'm already deep in XSLT modifications, but the CSS information is quite useful to know as well. The Oxygen team is always so helpful. Thank you!

-Nick

Return to “DITA (Editing and Publishing DITA Content)”

Who is online

Users browsing this forum: No registered users and 1 guest