referencing-other-plugins.dita 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 base path of another
  8. installed DITA-OT plug-in.</shortdesc>
  9. <prolog>
  10. <metadata>
  11. <keywords>
  12. <indexterm><xmlelement>xsl:import</xmlelement></indexterm>
  13. <indexterm><xmlelement>xmlcatalog</xmlelement></indexterm>
  14. <indexterm><xmlelement>xslt</xmlelement></indexterm>
  15. <indexterm>plug-ins
  16. <indexterm>using file in another plug-in</indexterm></indexterm>
  17. <indexterm>XSLT
  18. <indexterm>using another plug-in</indexterm></indexterm>
  19. <indexterm>preprocessing
  20. <indexterm>XSLT</indexterm></indexterm>
  21. <indexterm>catalog
  22. <indexterm>referencing</indexterm></indexterm>
  23. <indexterm>CSS
  24. <indexterm>HTML5</indexterm></indexterm>
  25. <indexterm>HTML5
  26. <indexterm>CSS</indexterm></indexterm>
  27. </keywords>
  28. </metadata>
  29. </prolog>
  30. <taskbody>
  31. <section>
  32. <p>Sometimes you need to reference content in another DITA-OT plug-in. However, the path to an installed plug-in
  33. is not guaranteed to be the same between different installed instances of DITA-OT. The <filepath
  34. conref="#using-plugin-URI-extension/plugin-uri-ext"/> URI extension and <filepath
  35. conref="#using-plugin-URI-extension/antvar"/> Ant variable are provided so your build and XSLT files always
  36. use the correct path to the plug-in.</p>
  37. <p>Within a single plug-in, you can safely use relative path references, for example,
  38. <filepath>xsl/my.xsl</filepath> without specifying the path to the plug-in itself.</p>
  39. </section>
  40. <steps-unordered>
  41. <step>
  42. <cmd>Use <filepath conref="#using-plugin-URI-extension/antvar"/> in Ant build files.</cmd>
  43. <info>
  44. <p>Use the Ant variable <filepath conref="#using-plugin-URI-extension/antvar"/> anywhere in your build file or
  45. template to point to the base path of an installed DITA-OT plug-in.</p>
  46. </info>
  47. <stepxmp>
  48. <p>The following example copies CSS files from the HTML5 plug-in:</p>
  49. <codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace">&lt;copy todir="${dita.temp.dir}/css">
  50. &lt;fileset dir="${dita.plugin.org.dita.html5.dir}/css"
  51. includes="*.css"/>
  52. &lt;/copy></codeblock>
  53. </stepxmp>
  54. </step>
  55. <step>
  56. <cmd>Use <filepath conref="#using-plugin-URI-extension/plugin-uri-ext"/> in XSLT files.</cmd>
  57. <info>
  58. <p>Use the URI extension <filepath conref="#using-plugin-URI-extension/plugin-uri-ext"/> at the beginning of a
  59. file reference—usually in <xmlelement>xsl:import</xmlelement>—to point to the base path of an installed
  60. DITA-OT plug-in.</p>
  61. </info>
  62. <stepxmp>
  63. <p>The following example imports the base output-message.xsl processing:</p>
  64. <codeblock outputclass="language-xml">&lt;xsl:import href="plugin:org.dita.base:xsl/common/output-message.xsl"/></codeblock>
  65. </stepxmp>
  66. <info>
  67. <p>To use the URI extension, your plug-in must reference the DITA-OT catalog file. In your Ant build file, add
  68. an <xmlelement>xmlcatalog</xmlelement> element referencing the DITA-OT catalog file as a child of the
  69. <xmlelement>xslt</xmlelement> element.</p>
  70. </info>
  71. <stepxmp>
  72. <codeblock outputclass="language-xml normalize-space show-line-numbers show-whitespace">&lt;xslt style="xsl/my.xsl"
  73. in="${dita.temp.dir}/input.file"
  74. out="${dita.temp.dir}/output.file">
  75. &lt;xmlcatalog refid="dita.catalog"/>
  76. &lt;/xslt></codeblock>
  77. </stepxmp>
  78. </step>
  79. </steps-unordered>
  80. <tasktroubleshooting>
  81. <p>For both of these methods, make sure you use the plug-in ID (defined in the <filepath>plugin.xml</filepath>
  82. file) rather than the folder name of the plug-in. In many cases, the folder name is not the same as the plug-in
  83. ID.</p>
  84. </tasktroubleshooting>
  85. </taskbody>
  86. </task>