Outside the toolkit, create the directory
org.example.faq-question.html to contain your plugin. I use the convention of "moduleName.transtype" for the plugin name, thus "faq-question.html" for the HTML plugin, "faq-question.fo" for the PDF plugin, etc.
org.example.faq-question.htmldirectory create the file
plugin.xmlwith this content:
<!-- Plugin descriptor for the FAQ question HTML extensions. --> <plugin id="org.example.faq-question.html"> <require plugin="org.example.faq-question.doctype"/> <feature extension="dita.xsl.xhtml" value="xsl/faq-question2html.xsl" type="file"/> </plugin>
This descriptor names the plugin ("org.example.faq-question.html"), indicates that it is dependent on the FAQ question document type plugin, and binds the plugin's XSLT module to the extension point "dita.xsl.xhtml", which is defined in the base DITA-to-HTML transformation type.
<require> element is not strictly required but it makes it clearer that this module supports the FAQ question vocabulary module and is not, for example, a more general extension or override. Note also that the document type plugin does not state a dependency on the HTML plugin. This is because there may be users who want to use the vocabulary but not your particular implementation of the processing for it. Thus you should always have separate plugins for the vocabulary modules and their supporting processing so that users of your vocabulary modules can easily substitute their own processing if they want to.
org.example.faq-question.htmldirectory. In the
xsldirectory create the file
faq-question2html.xslwith this content:
<?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" exclude-result-prefixes="xs" version="2.0"> <!-- =========================================================== HTML generation templates for the FAQ Question DITA topic specialization. Copyright (c) 2010 Your Name Here =========================================================== --> </xsl:stylesheet>
At the moment this stylesheet does nothing.
You can test the plugin by deploying it to your Toolkit and running the HTML transformation type against one of the FAQ question test documents. The processing should produce completely generic output but should not fail with any XSLT-related errors.
Note that this XSLT module is an XSLT 2 module. As of version 1.4.3 of the Open Toolkit, the Toolkit uses the Saxon XSLT engine exclusively. Saxon implements XSLT 2 so it is safe to use XSLT 2 with the Toolkit. It doesn't matter that the base transformation modules are XSLT 1 modules.