Multiple levels of menu in Webhelp Responsive Tree

Post here questions and problems related to editing and publishing DITA content.
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

Multiple levels of menu in Webhelp Responsive Tree

Post by mdslup »

In the Webhelp responsive tree layout, the arrows that you use to expand the menus on the main page only go 1-level deep.

Is it possible for these arrows to have a deeper level, so that I can expand multiple levels of menu while I'm still on the main page?
alin
Site Admin
Posts: 275
Joined: Thu Dec 24, 2009 11:21 am

Re: Multiple levels of menu in Webhelp Responsive Tree

Post by alin »

Hello,

Here is a quick solution for the content structure generation part:
You can use an XSLT extension file inside your current Publishing Template to override the default structure of the TOC component from the main page.

The XSLT extension file should contain:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:toc="http://www.oxygenxml.com/ns/webhelp/toc"
    exclude-result-prefixes="xs"
    version="2.0">
    <xsl:template match="toc:topic" mode="create-main-page-toc">
        <xsl:param name="applyRecursion" select="true()"/>
        
        <xsl:next-match>
            <xsl:with-param name="applyRecursion" select="true()"/>    
        </xsl:next-match>
    </xsl:template>
</xsl:stylesheet>
Afterwards, you can link your extension file in your Publishing Template's descriptor file within the <xslt> section as follows:

Code: Select all

        <xslt>
            <extension file="xsl/tree-recursive.xsl" id="com.oxygenxml.webhelp.xsl.createMainPage"/>
        </xslt>
The snippet above assumes the fact that the file is called tree-recursive.xsl and is located in the xsl subdirectory of your Publishing Template's root directory or archive.
You can read more about XSLT Extension Points in our User Manual: https://oxygenxml.com/doc/versions/22.0 ... mport.html

Note: The XSLT Extension only solves the content structure generation part of the your problem. There are some expand/collapse issues that you need to resolve using some custom JS.

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
verostarry
Posts: 17
Joined: Wed Jul 21, 2021 9:39 pm

Re: Multiple levels of menu in Webhelp Responsive Tree

Post by verostarry »

Hi,
I'm trying to do this too and the Transform fails. I've tried copying the shorter <xslt> snippet into the template descriptor file within the <webhelp>, <parameters>, and other sections but it still shows a fatal error. The tree-recursive.xml file I created lives under com.oxygenxml.webhelp.responsive > xsl.

Can someone please direct me to what I may be doing wrong? Or, is there another way to get more levels of menu items or even not the secondary level only in a webhelp responsive tree? I'm interested in displaying the 1st or 2nd folder as specified in the ditamap as well as the 3rd. Currently limited to 1st and 2nd.
Thanks!
Post Reply