Multiple levels of menu in Webhelp Responsive Tree

mdslup
Posts: 144
Joined: Tue Mar 06, 2018 1:34 am

Multiple levels of menu in Webhelp Responsive Tree

Post by mdslup » Fri Feb 14, 2020 4:33 am

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: 168
Joined: Thu Dec 24, 2009 11:21 am

Re: Multiple levels of menu in Webhelp Responsive Tree

Post by alin » Fri Feb 14, 2020 12:57 pm

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

Post Reply