using-plugin-URI-extension.dita 4.4 KB

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