On 10/11/24 08:34, Schild Martin wrote:
We use XMLMind pro and I have the following question:
Is it possible to embed html code in a DITA topic so that this html code
remains as html code after conversion to WebHelp?
The problem I want to solve is the following: In the WebHelp output I
want to insert a checkbox incl. Javascript.
This checkbox is used to show or hide optional text (these are separate
sections).
My current workaround is that I create a placeholder (normal text) and
replace this text in all html files after the conversion in a separate tool.
This is time-consuming and uncool and if there was a way to embed html
code directly in the DITA topic, that would be very helpful.
No, sorry this is not possible.
Note that the "normal" way to achieve what you want is to customize the
XSLT2 stylesheets generating the HTML (hence the Web Help).
For example, add attribute outputclass="optionaltext" to the DITA
<section> you want to hide and show and add a custom XSLT template to
process these special DITA sections:
Excerpts from "XXE_install_dir/addon/config/dita/xsl/topic.xsl":
----------------------------------------------------------------
<!-- section ==================================================== -->
<xsl:template match="*[contains(@class,' topic/section ')]">
<xsl:element name="{$sectionQName}">
<xsl:call-template name="commonAttributes"/>
<xsl:call-template name="namedAnchor"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
----------------------------------------------------------------
You could add something like:
----------------------------------------------------------------
<xsl:template match="*[contains(@class,' topic/section ') and
@outputclass eq 'optionaltext']">
<!-- GENERATE THE HTML CHECKBOX HERE. -->
<xsl:element name="{$sectionQName}">
<xsl:call-template name="commonAttributes"/>
<xsl:call-template name="namedAnchor"/>
<!-- OR GENERATE THE HTML CHECKBOX HERE. -->
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
----------------------------------------------------------------
In order to do that safely, please open your DITA map or bookmap then
select "Options|Customize Configuration|Customize Document Conversion
Stylesheets". Once the "Customize Document Conversion Stylesheets"
dialog box", please select "Convert to Web Help" from the combox box and
then click "Customize...". This lets you create a "blank" customization
of the stock XSLT stylesheet (e.g. in file
"C:\Users\martin\custom_webhelp.xsl").
Once created, you'll have to add by hand your XSLT template to
"C:\Users\martin\custom_webhelp.xsl".
More information: the "Customize Document Conversion Stylesheets" dialog
box",
https://www.xmlmind.com/xmleditor/_distrib/doc/help/conversion_stylesheets_editor.html
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support