plugin-overridestyle.dita 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. <prolog>
  9. <metadata>
  10. <keywords>
  11. <indexterm>plug-ins<indexterm>XSLT</indexterm></indexterm>
  12. <indexterm>XSLT<indexterm>preprocessing</indexterm></indexterm>
  13. <indexterm>XHTML</indexterm>
  14. </keywords>
  15. </metadata>
  16. </prolog>
  17. <taskbody>
  18. <steps>
  19. <step>
  20. <cmd>Develop an XSL file that contains the XSL override.</cmd>
  21. </step>
  22. <step>
  23. <cmd>Construct a <filepath>plugin.xml</filepath> file that contains the following content:</cmd>
  24. <info><codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace">&lt;?xml version="1.0" encoding="UTF-8"?>
  25. &lt;plugin id="<varname>plugin-id</varname>">
  26. &lt;feature extension="<varname>extension-point</varname>" file="<varname>relative-path</varname>"/>
  27. &lt;/plugin></codeblock>where:
  28. <ul>
  29. <li><varname>plugin-id</varname> is the plug-in identifier, for example, com.example.brandheader.</li>
  30. <li><varname>extension-point</varname> is the DITA-OT extension point, for example,<codeph>
  31. dita.xsl.xhtml</codeph>. This indicates the DITA-OT processing step that the XSL override applies
  32. to.</li>
  33. <li><varname>relative-path</varname> is the relative path and name of the XSLT file, for example,
  34. <filepath>xsl/header.xsl</filepath>. </li>
  35. </ul></info>
  36. </step>
  37. <step>
  38. <cmd>Install the plug-in.</cmd>
  39. </step>
  40. </steps>
  41. <result>The plug-in installer adds an XSL import statement to the default DITA-OT code, so that the XSL override
  42. becomes part of the normal build.</result>
  43. <example>
  44. <title>Example: Overriding XHTML header processing</title>
  45. <p>The following two files represent a complete, simple style plug-in.</p>
  46. <p>The <filepath>plugin.xml</filepath> file declares an XSLT file that extends XHTML processing:</p>
  47. <codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace">&lt;?xml version="1.0" encoding="UTF-8"?>
  48. &lt;plugin id="com.example.brandheader">
  49. &lt;feature extension="dita.xsl.xhtml" file="xsl/header.xsl"/>
  50. &lt;/plugin></codeblock>
  51. <p>The <filepath>xsl/header.xsl</filepath> XSLT file referenced in <filepath>plugin.xml</filepath> overrides the
  52. default header processing to add a banner:</p>
  53. <codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace">&lt;?xml version="1.0" encoding="UTF-8"?>
  54. &lt;xsl:stylesheet version="1.0"
  55. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  56. &lt;xsl:template name="gen-user-header">
  57. &lt;div>&lt;img src="http://www.example.com/company_banner.jpg"
  58. alt="Example Company Banner"/>&lt;/div>
  59. &lt;/xsl:template>
  60. &lt;/xsl:stylesheet></codeblock>
  61. </example>
  62. <!--<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>-->
  63. </taskbody>
  64. </task>