How to add a version switch dropdown list to the header?
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 115
- Joined: Mon Jul 10, 2023 11:49 am
How to add a version switch dropdown list to the header?
Hi,
I'm trying to add a version switch dropdown list to the top right corner of our website. Somewhere like this:
<script src='/vendors/react/umd/react.development.js' defer></script>
<script src='/vendors/react-dom/umd/react-dom.development.js' defer></script>
<script src='/vendors/dayjs/dayjs.min.js' defer></script>
<script src='/vendors/antd/dist/antd.js' defer></script>
<script src='/vendors/@ant-design/icons/dist/index.umd.min.js' defer></script>
<script src='/zh/index.js' type='module'></script>
I added an xml file containing the scripts he gave me to the publishing template folder:
Note that the following file paths specified for attribute "src" locates in the server end, not local drive.
<?xml version="1.0" encoding="UTF-8"?>
<div class="after-search">
<script src='/vendors/react/umd/react.development.js' defer></script>
<script src='/vendors/react-dom/umd/react-dom.development.js' defer></script>
<script src='/vendors/dayjs/dayjs.min.js' defer></script>
<script src='/vendors/antd/dist/antd.js' defer></script>
<script src='/vendors/@ant-design/icons/dist/index.umd.min.js' defer></script>
<script src='/zh/index.js' type='module'></script>
</div>
Do I need to create an xslt file defining a component that contain this dropdown list after the search bar and add the following to the opt file?
....
<parameter name="custom.webhelp.after.search.fragment" value="after-search-fragment.xml" type="filePath"/>
</parameters>
<xslt>
<extension file="xsl/custom-content-after-search.xsl" id="com.oxygenxml.webhelp.xsl.createMainPage"/>
<extension file="xsl/custom-content-after-search.xsl" id="com.oxygenxml.webhelp.xsl.createSearchPage"/>
<extension file="xsl/custom-content-after-search.xsl" id="com.oxygenxml.webhelp.xsl.dita2webhelp"/>
</xslt>
Am I walking on the right path?
I'm trying to add a version switch dropdown list to the top right corner of our website. Somewhere like this:
verswitch.png
The front-end engineer has developed some js files and saved them in the root directory of our server, and told me that I need to add the following scripts to the header of each webhelp page:<script src='/vendors/react/umd/react.development.js' defer></script>
<script src='/vendors/react-dom/umd/react-dom.development.js' defer></script>
<script src='/vendors/dayjs/dayjs.min.js' defer></script>
<script src='/vendors/antd/dist/antd.js' defer></script>
<script src='/vendors/@ant-design/icons/dist/index.umd.min.js' defer></script>
<script src='/zh/index.js' type='module'></script>
I added an xml file containing the scripts he gave me to the publishing template folder:
Note that the following file paths specified for attribute "src" locates in the server end, not local drive.
<?xml version="1.0" encoding="UTF-8"?>
<div class="after-search">
<script src='/vendors/react/umd/react.development.js' defer></script>
<script src='/vendors/react-dom/umd/react-dom.development.js' defer></script>
<script src='/vendors/dayjs/dayjs.min.js' defer></script>
<script src='/vendors/antd/dist/antd.js' defer></script>
<script src='/vendors/@ant-design/icons/dist/index.umd.min.js' defer></script>
<script src='/zh/index.js' type='module'></script>
</div>
Do I need to create an xslt file defining a component that contain this dropdown list after the search bar and add the following to the opt file?
....
<parameter name="custom.webhelp.after.search.fragment" value="after-search-fragment.xml" type="filePath"/>
</parameters>
<xslt>
<extension file="xsl/custom-content-after-search.xsl" id="com.oxygenxml.webhelp.xsl.createMainPage"/>
<extension file="xsl/custom-content-after-search.xsl" id="com.oxygenxml.webhelp.xsl.createSearchPage"/>
<extension file="xsl/custom-content-after-search.xsl" id="com.oxygenxml.webhelp.xsl.dita2webhelp"/>
</xslt>
Am I walking on the right path?
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 275
- Joined: Thu Dec 24, 2009 11:21 am
Re: How to add a version switch dropdown list to the header?
Oxygen WebHelp 25.1 has a special placeholder named webhelp.fragment.after.search.input that allows you to insert a custom HTML fragment after the search input. Thus you do not need additional XSLT extension to include the dropdown in the output content.
Have a look at the following Publishing Template: https://github.com/oxygenxml/oxygen-pub ... ter-search
Have a look at the following Publishing Template: https://github.com/oxygenxml/oxygen-pub ... ter-search
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 115
- Joined: Mon Jul 10, 2023 11:49 am
Re: How to add a version switch dropdown list to the header?
Thanks! I'll give it a try.
Besides adding html fragment similar to this to the <html-fragments/> tag,
<html-fragments>
<fragment file="fragments/after-search-fragment.xml" placeholder="webhelp.fragment.after.search.input"/>
</html-fragments>
Do I also need to specify the file path as value for parameter "webhelp.fragment.after.search.input" like this in opt file?
<parameter name="webhelp.fragment.after.search.input" value="fragments/after-search-fragment.xml" type="filePath"/>
Besides adding html fragment similar to this to the <html-fragments/> tag,
<html-fragments>
<fragment file="fragments/after-search-fragment.xml" placeholder="webhelp.fragment.after.search.input"/>
</html-fragments>
Do I also need to specify the file path as value for parameter "webhelp.fragment.after.search.input" like this in opt file?
<parameter name="webhelp.fragment.after.search.input" value="fragments/after-search-fragment.xml" type="filePath"/>
-
- Site Admin
- Posts: 275
- Joined: Thu Dec 24, 2009 11:21 am
Re: How to add a version switch dropdown list to the header?
The two options are equivalent.
You can contribute an HTML fragment file by referencing it either in the dedicated <html-fragments> section or in the <parameters> section.
Under the hood every configuration in the Publishing Template descriptor file is translated as some parameter value
You can contribute an HTML fragment file by referencing it either in the dedicated <html-fragments> section or in the <parameters> section.
Under the hood every configuration in the Publishing Template descriptor file is translated as some parameter value

Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service