plugin-overridestyle.dita 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
  3. <!-- This file is part of the DITA Open Toolkit project. See the accompanying LICENSE file for applicable license. -->
  4. <task id="plugin-overridestyle" xml:lang="en-US">
  5. <title>Overriding an XSLT-processing step</title>
  6. <shortdesc>You can override specific XSLT-processing steps in both the pre-processing pipeline and certain DITA-OT
  7. transformations.</shortdesc>
  8. <taskbody>
  9. <steps>
  10. <step>
  11. <cmd>Develop an XSL file that contains the XSL override.</cmd>
  12. </step>
  13. <step>
  14. <cmd>Construct a <filepath>plugin.xml</filepath> file that contains the following content:</cmd>
  15. <info><codeblock>&lt;?xml version="1.0" encoding="UTF-8"?>
  16. &lt;plugin id="<varname>plugin-id</varname>">
  17. &lt;feature extension="<varname>extension-point</varname>" file="<varname>relative-path</varname>"/>
  18. &lt;/plugin></codeblock>where:
  19. <ul>
  20. <li><varname>plugin-id</varname> is the plug-in identifier, for example, com.example.brandheader.</li>
  21. <li><varname>extension-point</varname> is the DITA-OT extension point, for example,<codeph>
  22. dita.xsl.xhtml</codeph>. This indicates the DITA-OT processing step that the XSL override applies
  23. to.</li>
  24. <li><varname>relative-path</varname> is the relative path and name of the XSLT file, for example,
  25. <filepath>xsl/header.xsl</filepath>. </li>
  26. </ul></info>
  27. </step>
  28. <step>
  29. <cmd>Install the plug-in.</cmd>
  30. </step>
  31. </steps>
  32. <result>The plug-in installer adds an XSL import statement to the default DITA-OT code, so that the XSL override
  33. becomes part of the normal build.</result>
  34. <example>
  35. <title>Example: Overriding XHTML header processing</title>
  36. <p>The following two files represent a complete, simple style plug-in.</p>
  37. <p>The <filepath>plugin.xml</filepath> file declares an XSLT file that extends XHTML processing:</p>
  38. <codeblock>&lt;?xml version="1.0" encoding="UTF-8"?>
  39. &lt;plugin id="com.example.brandheader">
  40. &lt;feature extension="dita.xsl.xhtml" file="xsl/header.xsl"/>
  41. &lt;/plugin></codeblock>
  42. <p>The <filepath>xsl/header.xsl</filepath> XSLT file referenced in <filepath>plugin.xml</filepath> overrides the
  43. default header processing to add a banner:</p>
  44. <codeblock>&lt;?xml version="1.0" encoding="UTF-8"?>
  45. &lt;xsl:stylesheet version="1.0"
  46. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  47. &lt;xsl:template name="gen-user-header">
  48. &lt;div>&lt;img src="http://www.example.com/company_banner.jpg"
  49. alt="Example Company Banner"/>&lt;/div>
  50. &lt;/xsl:template>
  51. &lt;/xsl:stylesheet></codeblock>
  52. </example>
  53. <!--<example><title>Example – Overriding troff formatting</title><p>To apply custom formatting for your own domain to the intermediate markup generated as input to troff processing, create a plugin that extends <codeph>dita.xsl.troff-ast</codeph> and specify the path to your custom XSL as follows:</p><codeblock>&lt;feature extension="dita.xsl.troff-ast" file="xsl/your-domain.xsl"/></codeblock></example>-->
  54. </taskbody>
  55. </task>