Using localized variables in webhelp HTML fragments
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 16
- Joined: Mon Apr 23, 2018 8:38 am
Using localized variables in webhelp HTML fragments
Hi,
We're created a customization of the responsive webhelp plugin where we run custom XSLT tasks for generating HTML fragments with localized texts (such as "Last updated" in the footer) from the webhelp localization framework. Is there any easier way to do this, especially with the new publishing templates, so that I wouldn't need to use XSLT tasks to generate the fragments?
Additionally, what kind of variables can I use in a publishing template? For example, I'd like to refer to the output folder (which can of course change depending on the environment) in the publishing template by using a variable that stores the location of the output folder during build time. Is that possible?
Best regards,
Antti
We're created a customization of the responsive webhelp plugin where we run custom XSLT tasks for generating HTML fragments with localized texts (such as "Last updated" in the footer) from the webhelp localization framework. Is there any easier way to do this, especially with the new publishing templates, so that I wouldn't need to use XSLT tasks to generate the fragments?
Additionally, what kind of variables can I use in a publishing template? For example, I'd like to refer to the output folder (which can of course change depending on the environment) in the publishing template by using a variable that stores the location of the output folder during build time. Is that possible?
Best regards,
Antti
-
- Site Admin
- Posts: 275
- Joined: Thu Dec 24, 2009 11:21 am
Re: Using localized variables in webhelp HTML fragments
Hello,
You can find the Publishing Templates derived from the above example in the following GitHub project: https://github.com/oxygenxml/oxygen-pub ... omizations
Regards,
Alin
Unfortunatelly, you cannot contribute custom localized strings using the Publishing Template. However, you can use the Publishing Template to contribute your customization stylesheets. Here is an example in our User Manual: https://www.oxygenxml.com/doc/versions/ ... mport.htmleccc wrote:We're created a customization of the responsive webhelp plugin where we run custom XSLT tasks for generating HTML fragments with localized texts (such as "Last updated" in the footer) from the webhelp localization framework. Is there any easier way to do this, especially with the new publishing templates, so that I wouldn't need to use XSLT tasks to generate the fragments?
You can find the Publishing Templates derived from the above example in the following GitHub project: https://github.com/oxygenxml/oxygen-pub ... omizations
Can you please give us more details about your use case? More specific, where do you want to use such a variable for the output directory: in the Publishing Template descriptor file (opt) or in an HTML fragment file? For the HTML fragment file you can refer to the following topic in our User Guide: https://www.oxygenxml.com/doc/versions/ ... -html.htmleccc wrote:Additionally, what kind of variables can I use in a publishing template? For example, I'd like to refer to the output folder (which can of course change depending on the environment) in the publishing template by using a variable that stores the location of the output folder during build time. Is that possible?
Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 16
- Joined: Mon Apr 23, 2018 8:38 am
Re: Using localized variables in webhelp HTML fragments
We use a custom XSL template to generate, for example, the webhelp.fragment.footer fragment out of an XML file. How would I be able to execute the custom XSLT transformation via the publishing template? I don't see a suitable extension point for it.alin wrote: Unfortunatelly, you cannot contribute custom localized strings using the Publishing Template. However, you can use the Publishing Template to contribute your customization stylesheets. Here is an example in our User Manual: https://www.oxygenxml.com/doc/versions/ ... mport.html
You can find the Publishing Templates derived from the above example in the following GitHub project: https://github.com/oxygenxml/oxygen-pub ... omizations
I'd like to be able to refer to the output folder using a variable in the OPT file. The HTML fragments are regenerated by XSLT transformations whenever the webhelp output is built and I'd like to be able to store the generated HTML fragments in the output folder instead of the DITA-OT folder so that the DITA-OT folder remains "clean".alin wrote: Can you please give us more details about your use case? More specific, where do you want to use such a variable for the output directory: in the Publishing Template descriptor file (opt) or in an HTML fragment file? For the HTML fragment file you can refer to the following topic in our User Guide: https://www.oxygenxml.com/doc/versions/ ... -html.html
-
- Site Admin
- Posts: 275
- Joined: Thu Dec 24, 2009 11:21 am
Re: Using localized variables in webhelp HTML fragments
Hello,
I hope I have correctly understood your use case. Please correct me if I am wrong.
So, you are trying to customize the content of the footer sections in the WebHelp Responsive output HTML pages.
I understand that your custom content is not static and you need to regenerate it at each transformation.
Thus generating an intermediate HTML fragment file is not the best approach in this case.
You should register an XSLT extension file which overrides the template that outputs the default footer content. Use this template to directly generate your custom footer content in each HTML page. This way you will not have to generate an additional HTML fragment file and then reference that file using the "webhelp.fragment.footer" parameter.
For this you will have to register your XSLT file on the following XSLT extension points:
A stub for the template that will generate your custom content may look like this:
We have a similar example in our User Manual: https://www.oxygenxml.com/doc/versions/ ... mport.html
Regards,
Alin
I hope I have correctly understood your use case. Please correct me if I am wrong.
So, you are trying to customize the content of the footer sections in the WebHelp Responsive output HTML pages.
I understand that your custom content is not static and you need to regenerate it at each transformation.
Thus generating an intermediate HTML fragment file is not the best approach in this case.
You should register an XSLT extension file which overrides the template that outputs the default footer content. Use this template to directly generate your custom footer content in each HTML page. This way you will not have to generate an additional HTML fragment file and then reference that file using the "webhelp.fragment.footer" parameter.
For this you will have to register your XSLT file on the following XSLT extension points:
- com.oxygenxml.webhelp.xsl.dita2webhelp
- com.oxygenxml.webhelp.xsl.createMainPage
- com.oxygenxml.webhelp.xsl.createSearchPage
- com.oxygenxml.webhelp.xsl.createIndexTermsPage
A stub for the template that will generate your custom content may look like this:
Code: Select all
<xsl:template match="*:div[contains(@class, 'footer-container')]" mode="copy_template">
<!-- Optional: Apply the default processing -->
<xsl:next-match/>
<!-- Add a div containing your custom footer content -->
<div class="custom-footer">
<!-- Generate your content here -->
</div>
</xsl:template>
Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
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