For the purpose of this tutorial, we'll explain how to convert the "Simple Section" document being edited to a single HTML page.
A XSLT stylesheet will be used for this task. Excerpts from rng_section_config/html.xsl (same file for all variants):
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s="http://www.xmlmind.com/ns/sect"
exclude-result-prefixes="s"
version="1.0">
<xsl:output method="html"
encoding="ISO-8859-1"
indent="no"/>
...
<xsl:template match="s:bold">
<b>
<xsl:call-template name="processCommonAttributes"/>
<xsl:apply-templates/>
</b>
</xsl:template>
...
</xsl:stylesheet>It should be noted that XXE has no high-level construct (e.g. an hypothetical convertDocument configuration element) allowing to integrate an XSLT stylesheet. Instead, XXE relies on its menu, toolBar, binding, macro command, process command, etc, to do that.
For example, our "Section" menu element ends with:
...
<separator />
<item label="_Convert to HTML"
icon="xxe-config:common/mime_types/html.png"
command="sect.convertToHTML" />
</menu>Macro-command sect.convertToHTML allows the user to choose a save file for the HTML page which will be the result of the conversion (by the means of native command selectConvertedFile in XMLmind XML Editor - Commands) and then invokes process command sect.toHTML which will perform the conversion. Excerpts from rng_section_config/common.incl (same file for all variants):
<command name="sect.convertToHTML">
<macro>
<sequence>
<command name="selectConvertedFile"
parameter="saveFileURLWithExtension=html" />
<command name="sect.toHTML" parameter='"%_"' />
<command name="preview" parameter="[lastConverted]" />
</sequence>
</macro>
</command>In the above macro,
The command parameter contains | |
Command |