Oxygen webhelp customization

Posts: 32
Joined: Wed Jun 20, 2018 11:30 am

Oxygen webhelp customization

Post by pieterjan_vdw » Tue Mar 16, 2021 2:57 pm

I am trying to write a customization for Oxygen Webhelp but I don't succeed. This is what I am trying to do:
  • Publish DITAMAP with passthrough DITAVAL.
  • The filtering attribute is set on topic level, not topicref. This was not possible in this particular case.
  • I want to add the filtering attribute as attribute in the side toc.

When I look into the sidetoc.xsl of the plug-in I see this line of code <xsl:copy-of select="@*[starts-with(local-name(), 'data-')]"/> collects the filtering attributes, for example audience, when they are set on the topicref of the DITAMAP and adds it to the side-toc.

Code: Select all

<xsl:template match="toc:topic" mode="topic2html">
    <xsl:param name="currentLevelHTML" tunnel="yes" as="node()*"/>
        <xsl:param name="currentNode" as="xs:boolean" tunnel="yes"/>
        <xsl:param name="precedingSiblings" tunnel="yes" as="xs:integer" select="0"/>
        <xsl:param name="followingSiblings" tunnel="yes" as="xs:integer" select="0"/>
        <xsl:variable name="vPosition" select="position()" />
        <xsl:variable name="moreNext" select="$followingSiblings - $nodesVisible"/>
        <xsl:variable name="morePrev" select="$precedingSiblings - $nodesVisible"/>
            Add the css selector for the side-toc compactation
            <xsl:if test="$currentNode"><xsl:attribute name="class" select="'active'"/> </xsl:if>
            <xsl:if test="$followingSiblings and ($vPosition &gt; $nodesVisible) and ($moreNext &gt; 1)"><xsl:attribute name="class" select="'hide-after'"/></xsl:if>
            <xsl:if test="$precedingSiblings and ((($precedingSiblings - $nodesVisible + 1) &gt; $vPosition ) and ($morePrev &gt; 1))"><xsl:attribute name="class" select="'hide-before'"/></xsl:if>
            <xsl:if test="$currentNode">
                     The HTML content corresponding to the child topics will only be generated
                     if this node is the topic which the Publication TOC is being generated for.
                <xsl:attribute name="data-processing-mode" select="'linkPoint'"/>
            <span data-tocid="{@wh-toc-id}">
                <xsl:attribute name="class">
                    <xsl:value-of select="'topicref'"/>
                    <xsl:if test="@outputclass">
                        <xsl:value-of select="concat(' ', @outputclass)"/>
                <!-- WH-1820 Copy the Ditaval "pass through" attributes. -->
                <xsl:copy-of select="@*[starts-with(local-name(), 'data-')]"/>
                <xsl:attribute name="data-state">
                    <xsl:variable name="hasChildren" as="xs:boolean">
                            <xsl:when test="$WEBHELP_PUBLICATION_TOC_HIDE_CHUNKED_TOPICS = 'yes' and contains(@chunk, 'to-content')">
                                <xsl:value-of select="false()"/>
                                <xsl:value-of select="count(toc:topic) > 0"/>
                        <xsl:when test="boolean($hasChildren)">
                                <xsl:when test="$currentNode">expanded</xsl:when>
                <xsl:variable name="hrefValue">
                    <xsl:call-template name="computeHrefAttr"/>
                <span class="wh-expand-btn"/>
                <span class="title">
                    <a href="{$hrefValue}" id="{@wh-toc-id}-link">
                        <xsl:if test="@scope='external'">
                            <!-- Mark the current link as being external to the DITA map. -->
                            <xsl:attribute name="data-scope">external</xsl:attribute>
                      <xsl:copy-of select="toc:title/node()"/>
                    <xsl:apply-templates select="toc:shortdesc" mode="topic2html"/>
What change do I have to make to the XSLT not to take the filtering attributes set on the topicref level, but the filtering attributes in the referenced topic?

Please find an example DITAMAP attached with passthrough ditaval.
I added the audience="de" attribute to the <topic> element in the file topic2.dita and I would like this attribute to be added to the side-toc of the Oxygen webhelp responsive.
(1.53 KiB) Downloaded 13 times
Anyone who can help me with this?
Thanks a lot in advance.

Site Admin
Posts: 187
Joined: Thu Dec 24, 2009 11:21 am

Re: Oxygen webhelp customization

Post by alin » Tue Mar 23, 2021 5:30 pm


The Publication TOC (Side TOC) is generated based on the structure of the expanded DITA map (that is the DITA map created in the WebHelp transformation's temporary directory).
The profiling attributes declared at topic level are not being transferred by default to the associated topicref elements in the DITA map.

DITA-OT has a dedicated pre-processing (mappull) step in which the topic's attributes and metadata are copied in the DITA map.
You can create a custom DITA-OT plugin that registers an XSLT file on the dita.xsl.mappull extension point and overrides the mappull step in the pre-processing pipeline. Here you can decide which attribute is copied from the DITA topic to the map's topicref.
The profiling attributes found on each topicref are transfered to the Publication TOC's entries as data-* attributes.

You can use the following DITA-OT plugin as an example: https://github.com/oxygenxml/oxygen-pub ... le.mappull

Alin Balasa
Software Developer
<oXygen/> XML Editor

Post Reply