Oxygen webhelp customization
Posted: 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:
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.
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.
Anyone who can help me with this?
Thanks a lot in advance.
- 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"/>
<!--
WH-231
Add the css selector for the side-toc compactation
-->
<li>
<xsl:if test="$currentNode"><xsl:attribute name="class" select="'active'"/> </xsl:if>
<xsl:if test="$followingSiblings and ($vPosition > $nodesVisible) and ($moreNext > 1)"><xsl:attribute name="class" select="'hide-after'"/></xsl:if>
<xsl:if test="$precedingSiblings and ((($precedingSiblings - $nodesVisible + 1) > $vPosition ) and ($morePrev > 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'"/>
</xsl:if>
<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)"/>
</xsl:if>
</xsl:attribute>
<!-- 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:choose>
<xsl:when test="$WEBHELP_PUBLICATION_TOC_HIDE_CHUNKED_TOPICS = 'yes' and contains(@chunk, 'to-content')">
<xsl:value-of select="false()"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="count(toc:topic) > 0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="boolean($hasChildren)">
<xsl:choose>
<xsl:when test="$currentNode">expanded</xsl:when>
<xsl:otherwise>not-ready</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>leaf</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:variable name="hrefValue">
<xsl:call-template name="computeHrefAttr"/>
</xsl:variable>
<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:if>
<xsl:copy-of select="toc:title/node()"/>
</a>
<xsl:apply-templates select="toc:shortdesc" mode="topic2html"/>
</span>
</span>
</li>
</xsl:template>
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.
Anyone who can help me with this?
Thanks a lot in advance.