To create a plugin, you need to first create one or more new or overridden templates xslt files, second create a plugin.xml file to point to your xslt files, and then install this plug-in to your DITA OT.
To create templates
- Create a folder in dita-ot/demo to store your plug-in, such as my-plugin.
- Create a folder to store your xslt files in dita-ot/demo/my-plugin, such as xsl.
- Create a new xslt file to contain the template. It's better that one xslt file only include one function.
To create plugin.xml
- Copy a plugin.xml file from any existing plugins into dita-ot/demo/my-plugin.
- If there are more than one <feature> elements, delete the rest and only keep one <feature>.
- Change the value in the remaining
element to point to your new xslt files, separated by commas: < feature extension="dita.xsl.xml" value="xsl/yourxslt1.xsl,xsl.yourxslt2.xsl" type="file" / >
To install your plugin
- In your dita-ot folder, run startcmd.bat.
- In the cmd.exe window, type: ant -f integrator.xml.
The plugin that you have created can be easily packed and installed once you upgrade your DITA OT, or pass to others.
3 comments:
Lisha, I'm very grateful to you for posting this topic. I've been trying to create a simple plug-in by following the OT documentation, with no luck.
The OT doc has lots of concept and reference information, but not much in the way of procedures or examples. Your simple procedure showed me the step I was missing: running the integration.
As a long-time DocBook user, I'm spoiled by its great documentation and community support. Learning DITA would be a lot easier if there were more users like you sharing their knowledge.
Thanks very much,
Denis
I was missing the final part of setting up the plugin. Thanks for putting up your steps, it was helpful!
The “final part” mentionned above, actually is mentionned too in the DITA-OT documentation. See UserGuid ‑> Developer Reference ‑> Installing DITA‑OT plug‑ins.
There's also another tutorial on the topic of overriding default transformations and styles:
http://www.scriptorium.com/whitepapers/hackingot/index.html
Have a nice time :)
With thanks to Lisha Li
Post a Comment