plugin-xsltparams.dita 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. <prolog>
  10. <metadata>
  11. <keywords>
  12. <indexterm><xmlelement>xsl:param</xmlelement></indexterm>
  13. <indexterm><xmlelement>param</xmlelement></indexterm>
  14. <indexterm><xmlelement>dummy</xmlelement></indexterm>
  15. <indexterm>plug-ins<indexterm>parameters</indexterm></indexterm>
  16. <indexterm>parameters<indexterm>adding</indexterm></indexterm>
  17. <indexterm>plug-ins<indexterm>XSLT</indexterm></indexterm>
  18. <indexterm>XSLT<indexterm>parameters</indexterm></indexterm>
  19. </keywords>
  20. </metadata>
  21. </prolog>
  22. <taskbody>
  23. <steps>
  24. <step id="create-xml-file">
  25. <cmd>Create an XML file that contains one or more Ant <xmlelement>param</xmlelement> elements nested within a
  26. <xmlelement>dummy</xmlelement> wrapper element.</cmd>
  27. <stepxmp>
  28. <codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace">&lt;dummy>
  29. <i>&lt;!-- Any Ant code allowed in xslt task is possible. Example: --></i>
  30. &lt;param name="paramNameinXSLT" expression="${antProperty}"
  31. if="antProperty"/>
  32. &lt;/dummy></codeblock>
  33. <draft-comment author="Kristen Eberlein" time="31 March 2013">Need a better example here, or replace the
  34. <xmlelement>stepxmp</xmlelement> with a generic code sample in an <xmlelement>info</xmlelement>
  35. element.</draft-comment>
  36. </stepxmp>
  37. </step>
  38. <step>
  39. <cmd>Construct a <filepath>plugin.xml</filepath> file that contains the following content:</cmd>
  40. <info><codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace">&lt;plugin id="<varname>plugin-id</varname>">
  41. &lt;feature extension="<varname>extension-point</varname>" file="<varname>file</varname>"/>
  42. &lt;/plugin></codeblock>where:
  43. <ul>
  44. <li><varname>plugin-id</varname> is the plug-in identifier, for example,
  45. <codeph>com.example.newparam</codeph>.</li>
  46. <li><varname>extension-point</varname> is the DITA-OT extension point, for example,<codeph>
  47. dita.conductor.xhtml.param</codeph>. This indicates the DITA-OT processing step where the parameters
  48. will be available.</li>
  49. <li><varname>file</varname> is the name of the XML file that you created in step
  50. <xref href="#./create-xml-file" format="dita"/>, for example, <filepath>insertParameters.xml</filepath>.
  51. </li>
  52. </ul></info>
  53. </step>
  54. <step>
  55. <cmd>Install the plug-in.</cmd>
  56. </step>
  57. </steps>
  58. <result>The <filepath>plugin.xml</filepath> file passes the parameters to the specified transformation or
  59. pre-processing module.</result>
  60. <example>
  61. <title>Example</title>
  62. <p>The following plug-in passes the parameters defined in the <filepath>insertParameters.xml</filepath> file as
  63. input to the XHTML process. Generally, an additional XSLT override will make use of the parameters to do
  64. something new with the generated content.</p>
  65. <codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace">&lt;plugin id="com.example.newparam">
  66. &lt;feature extension="dita.conductor.xhtml.param"
  67. file="insertParameters.xml"/>
  68. &lt;/plugin></codeblock>
  69. </example>
  70. </taskbody>
  71. </task>