plugin-xsltparams.dita 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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-xsltparams" xml:lang="en-US">
  5. <title>Adding parameters to existing XSLT steps</title>
  6. <shortdesc>You can pass parameters from the Ant build to existing XSLT steps in both the pre-processing pipeline and
  7. certain DITA-OT transformations. This can be useful if you want to make the parameters available as global
  8. <xmlelement>xsl:param</xmlelement> values within XSLT overrides.</shortdesc>
  9. <taskbody>
  10. <steps>
  11. <step id="create-xml-file">
  12. <cmd>Create an XML file that contains one or more Ant <xmlelement>param</xmlelement> elements nested within a
  13. <xmlelement>dummy</xmlelement> wrapper element.</cmd>
  14. <stepxmp>
  15. <codeblock>&lt;dummy>
  16. &lt;!-- Any Ant code allowed in xslt task is possible. Common example: -->
  17. &lt;param name="paramNameinXSLT" expression="${antProperty}" if="antProperty"/>
  18. &lt;/dummy></codeblock>
  19. <draft-comment author="Kristen Eberlein" time="31 March 2013">Need a better example here, or replace the
  20. <xmlelement>stepxmp</xmlelement> with a generic code sample in an <xmlelement>info</xmlelement>
  21. element.</draft-comment>
  22. </stepxmp>
  23. </step>
  24. <step>
  25. <cmd>Construct a <filepath>plugin.xml</filepath> file that contains the following content:</cmd>
  26. <info><codeblock>&lt;plugin id="<varname>plugin-id</varname>">
  27. &lt;feature extension="<varname>extension-point</varname>" file="<varname>file</varname>"/>
  28. &lt;/plugin></codeblock>where:
  29. <ul>
  30. <li><varname>plugin-id</varname> is the plug-in identifier, for example,
  31. <codeph>com.example.newparam</codeph>.</li>
  32. <li><varname>extension-point</varname> is the DITA-OT extension point, for example,<codeph>
  33. dita.conductor.xhtml.param</codeph>. This indicates the DITA-OT processing step where the parameters
  34. will be available.</li>
  35. <li><varname>file</varname> is the name of the XML file that you created in step
  36. <xref href="#./create-xml-file" format="dita"/>, for example, <filepath>insertParameters.xml</filepath>.
  37. </li>
  38. </ul></info>
  39. </step>
  40. <step>
  41. <cmd>Install the plug-in.</cmd>
  42. </step>
  43. </steps>
  44. <result>The <filepath>plugin.xml</filepath> file passes the parameters to the specified transformation or
  45. pre-processing module.</result>
  46. <example>
  47. <title>Example</title>
  48. <p>The following plug-in passes the parameters defined in the <filepath>insertParameters.xml</filepath> file as
  49. input to the XHTML process. Generally, an additional XSLT override will make use of the parameters to do
  50. something new with the generated content.</p>
  51. <codeblock>&lt;plugin id="com.example.newparam">
  52. &lt;feature extension="dita.conductor.xhtml.param" file="insertParameters.xml"/>
  53. &lt;/plugin></codeblock>
  54. </example>
  55. </taskbody>
  56. </task>