using-plugin-URI-extension.dita 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA General Task//EN" "generalTask.dtd">
  3. <task id="using-plugin-URI-extension">
  4. <title>Referencing files from other plug-ins</title>
  5. <shortdesc>Starting with DITA-OT 1.5.4, you can use the <filepath id="plugin-uri-ext"
  6. >plugin:<varname>plugin-id</varname></filepath> URI extension and the <filepath id="antvar"
  7. >${dita.plugin.<varname>plugin-id</varname>.dir}</filepath> Ant variable to reference the
  8. base path of another installed DITA-OT plug-in.</shortdesc>
  9. <taskbody>
  10. <section>
  11. <p>Sometimes you need to reference content in another DITA-OT plug-in. However, the path to an
  12. installed plug-in is not guaranteed to be the same between different installed instances of
  13. the DITA-OT. The <filepath conref="#using-plugin-URI-extension/plugin-uri-ext"/> URI
  14. extension and <filepath conref="#using-plugin-URI-extension/antvar"/> Ant variable are
  15. provided so your build and XSLT files always use the correct path to the plug-in.</p>
  16. <p>Within a single plug-in, you can safely use relative path references, for example,
  17. <filepath>xsl/my.xsl</filepath> without specifying the path to the plug-in itself.</p>
  18. </section>
  19. <steps-unordered>
  20. <step>
  21. <cmd>Use <filepath conref="#using-plugin-URI-extension/antvar"/> in Ant build files.</cmd>
  22. <info>
  23. <p>Use the Ant variable <filepath conref="#using-plugin-URI-extension/antvar"/> anywhere
  24. in your build file or template to point to the base path of an installed DITA-OT
  25. plug-in.</p>
  26. </info>
  27. <stepxmp>
  28. <p>The following example copies CSS files from the HTML5 plug-in:</p>
  29. <codeblock>&lt;copy todir="${dita.temp.dir}/css">
  30. &lt;fileset dir="${dita.plugin.org.dita.html5.dir}/css" includes="*.css"/>
  31. &lt;/copy></codeblock>
  32. </stepxmp>
  33. </step>
  34. <step>
  35. <cmd>Use <filepath conref="#using-plugin-URI-extension/plugin-uri-ext"/> in XSLT
  36. files.</cmd>
  37. <info>
  38. <p>Use the URI extension <filepath conref="#using-plugin-URI-extension/plugin-uri-ext"/>
  39. at the beginning of a file reference—usually in <xmlelement>xsl:import</xmlelement>—to
  40. point to the base path of an installed DITA-OT plug-in.</p>
  41. </info>
  42. <stepxmp>
  43. <p>The following example imports the base output-message.xsl processing:</p>
  44. <codeblock>&lt;xsl:import href="plugin:org.dita.base:xsl/common/output-message.xsl"/></codeblock>
  45. </stepxmp>
  46. <info>
  47. <p>To use the URI extension, your plug-in must reference the DITA-OT catalog file. In your
  48. Ant build file, add an <xmlelement>xmlcatalog</xmlelement> element referencing the
  49. DITA-OT catalog file as a child of the <xmlelement>xslt</xmlelement> element.</p>
  50. </info>
  51. <stepxmp>
  52. <codeblock>&lt;xslt style="xsl/my.xsl"
  53. in="${dita.temp.dir}/input.file" out="${dita.temp.dir}/output.file">
  54. &lt;xmlcatalog refid="dita.catalog"/>
  55. &lt;/xslt></codeblock>
  56. </stepxmp>
  57. </step>
  58. </steps-unordered>
  59. <tasktroubleshooting>
  60. <p>For both of these methods, make sure you use the plug-in ID (defined in the
  61. <filepath>plugin.xml</filepath> file) rather than the folder name of the plug-in. In many
  62. cases, the folder name is not the same as the plug-in ID.</p>
  63. </tasktroubleshooting>
  64. </taskbody>
  65. </task>