using-plugin-URI-extension.html 9.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!DOCTYPE html
  2. SYSTEM "about:legacy-compat">
  3. <html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="copyright" content="(C) Copyright 2019"><meta name="DC.rights.owner" content="(C) Copyright 2019"><meta name="DC.type" content="task"><meta name="description" content="Starting with DITA-OT 1.5.4, you can use the plugin:plugin-id URI extension and the ${dita.plugin.plugin-id.dir} Ant variable to reference the base path of another installed DITA-OT plug-in."><meta name="DC.subject" content=", xsl:import, xmlcatalog, xslt, plug-ins, using file in another plug-in, XSLT, using another plug-in, preprocessing, catalog, referencing, CSS, HTML5"><meta name="keywords" content=", xsl:import, xmlcatalog, xslt, plug-ins, using file in another plug-in, XSLT, using another plug-in, preprocessing, catalog, referencing, CSS, HTML5"><meta name="DC.relation" scheme="URI" content="../topics/plugin-applications.html"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="using-plugin-URI-extension"><link rel="stylesheet" type="text/css" href="../css/commonltr.css"><link rel="stylesheet" type="text/css" href="../css/dita-ot-doc.css"><title>Referencing files from other plug-ins</title></head><body id="using-plugin-URI-extension"><header role="banner"><div class="header">
  4. <p>DITA Open Toolkit</p>
  5. <hr>
  6. </div></header><nav role="toc"><ul><li><a href="../index.html">DITA Open Toolkit 3.3</a></li><li><a href="../release-notes/index.html">Release Notes</a></li><li><a href="../topics/installing-client.html">Installing DITA-OT</a></li><li><a href="../topics/alternative-input-formats.html">Authoring formats</a></li><li><a href="../topics/building-output.html">Building output</a></li><li><a href="../parameters/index.html">Setting parameters</a></li><li><a href="../topics/customizing.html">Customizing DITA-OT</a><ul><li><a href="../topics/html-customization.html">Customizing HTML</a></li><li><a href="../topics/pdf-customization.html">Customizing PDF</a></li><li><a href="../topics/custom-plugins.html">Working with plug-ins</a><ul><li><a href="../topics/plugins-installing.html">Installing plug-ins</a></li><li><a href="../topics/plugins-removing.html">Removing plug-ins</a></li><li><a href="../topics/plugins-registry.html">Plug-in registry</a></li><li><a href="../topics/plugin-configfile.html">Plug-in descriptor file</a></li><li><a href="../topics/plugin-dependencies.html">Plug-in dependencies</a></li><li><a href="../topics/plugin-applications.html">Plug-in applications</a><ul><li><a href="../topics/plugin-xmlcatalog.html">Extending an XML catalog file</a></li><li><a href="../topics/plugin-anttarget.html">Adding a new target to the Ant build process</a></li><li><a href="../topics/plugin-antpreprocess.html">Adding an Ant target to the pre-processing pipeline</a></li><li><a href="../topics/plugin-newtranstype.html">Adding a new transformation type</a></li><li><a href="../topics/plugin-overridestyle.html">Overriding an XSLT-processing step</a></li><li class="active"><a href="../topics/using-plugin-URI-extension.html">Referencing files from other plug-ins</a></li><li><a href="../topics/plugin-xsltparams.html">Adding parameters to existing XSLT steps</a></li><li><a href="../topics/plugin-javalib.html">Adding a Java library to the classpath</a></li><li><a href="../topics/plugin-messages.html">Adding new diagnostic messages</a></li><li><a href="../topics/plugin-newextensions.html">Creating a new plug-in extension point</a></li><li><a href="../topics/implement-saxon-customizations.html">Adding Saxon customizations</a></li></ul></li><li><a href="../topics/plugin-sample.html">Example plugin.xml file</a></li><li><a href="../topics/plugin-best-practices.html">Best practices</a></li><li><a href="../topics/plugin-coding-conventions.html">Coding conventions</a></li></ul></li><li><a href="../extension-points/plugin-extension-points.html">Extension points</a></li><li><a href="../topics/migration.html">Migrating customizations</a></li><li><a href="../topics/globalization.html">Globalizing DITA content</a></li><li><a href="../topics/rebuilding-docs.html">Rebuilding documentation</a></li></ul></li><li><a href="../topics/troubleshooting-overview.html">Troubleshooting</a></li><li><a href="../reference/index.html">Reference</a></li><li><a href="../topics/dita-and-dita-ot-resources.html">Resources</a></li></ul></nav><main role="main"><article role="article" aria-labelledby="ariaid-title1">
  7. <h1 class="title topictitle1" id="ariaid-title1">Referencing files from other plug-ins</h1>
  8. <div class="body taskbody"><p class="shortdesc">Starting with DITA-OT 1.5.4, you can use the <span class="ph filepath" id="using-plugin-URI-extension__plugin-uri-ext">plugin:<var class="keyword varname">plugin-id</var></span> URI extension and the <span class="ph filepath" id="using-plugin-URI-extension__antvar">${dita.plugin.<var class="keyword varname">plugin-id</var>.dir}</span> Ant variable to reference the
  9. base path of another installed DITA-OT plug-in.</p>
  10. <section class="section">
  11. <p class="p">Sometimes you need to reference content in another DITA-OT plug-in. However, the path to an installed plug-in
  12. is not guaranteed to be the same between different installed instances of DITA-OT. The <span class="ph filepath">plugin:<var class="keyword varname">plugin-id</var></span> URI extension and <span class="ph filepath">${dita.plugin.<var class="keyword varname">plugin-id</var>.dir}</span> Ant variable are provided so your build and XSLT files always
  13. use the correct path to the plug-in.</p>
  14. <p class="p">Within a single plug-in, you can safely use relative path references, for example,
  15. <span class="ph filepath">xsl/my.xsl</span> without specifying the path to the plug-in itself.</p>
  16. </section>
  17. <section><div class="tasklabel"><h2 class="sectiontitle tasklabel">Procedure</h2></div><ul class="ul steps-unordered"><li class="li step stepexpand">
  18. <span class="ph cmd">Use <span class="ph filepath">${dita.plugin.<var class="keyword varname">plugin-id</var>.dir}</span> in Ant build files.</span>
  19. <div class="itemgroup info">
  20. <p class="p">Use the Ant variable <span class="ph filepath">${dita.plugin.<var class="keyword varname">plugin-id</var>.dir}</span> anywhere
  21. in your build file or template to point to the base path of an installed DITA-OT
  22. plug-in.</p>
  23. </div>
  24. <div class="itemgroup stepxmp">
  25. <p class="p">The following example copies CSS files from the HTML5 plug-in:</p>
  26. <pre class="pre codeblock language-xml normalize-space show-line-numbers show-whitespace"><code>&lt;copy todir="${dita.temp.dir}/css"&gt;
  27. &lt;fileset dir="${dita.plugin.org.dita.html5.dir}/css"
  28. includes="*.css"/&gt;
  29. &lt;/copy&gt;</code></pre>
  30. </div>
  31. </li><li class="li step stepexpand">
  32. <span class="ph cmd">Use <span class="ph filepath">plugin:<var class="keyword varname">plugin-id</var></span> in XSLT
  33. files.</span>
  34. <div class="itemgroup info">
  35. <p class="p">Use the URI extension <span class="ph filepath">plugin:<var class="keyword varname">plugin-id</var></span>
  36. at the beginning of a file reference—usually in <code class="keyword markupname xmlelement">&lt;xsl:import&gt;</code>—to
  37. point to the base path of an installed DITA-OT plug-in.</p>
  38. </div>
  39. <div class="itemgroup stepxmp">
  40. <p class="p">The following example imports the base output-message.xsl processing:</p>
  41. <pre class="pre codeblock language-xml"><code>&lt;xsl:import href="plugin:org.dita.base:xsl/common/output-message.xsl"/&gt;</code></pre>
  42. </div>
  43. <div class="itemgroup info">
  44. <p class="p">To use the URI extension, your plug-in must reference the DITA-OT catalog file. In your
  45. Ant build file, add an <code class="keyword markupname xmlelement">&lt;xmlcatalog&gt;</code> element referencing the
  46. DITA-OT catalog file as a child of the <code class="keyword markupname xmlelement">&lt;xslt&gt;</code> element.</p>
  47. </div>
  48. <div class="itemgroup stepxmp">
  49. <pre class="pre codeblock language-xml normalize-space show-line-numbers show-whitespace"><code>&lt;xslt style="xsl/my.xsl"
  50. in="${dita.temp.dir}/input.file"
  51. out="${dita.temp.dir}/output.file"&gt;
  52. &lt;xmlcatalog refid="dita.catalog"/&gt;
  53. &lt;/xslt&gt;</code></pre>
  54. </div>
  55. </li></ul></section>
  56. <section class="section tasktroubleshooting">
  57. <p class="p">For both of these methods, make sure you use the plug-in ID (defined in the
  58. <span class="ph filepath">plugin.xml</span> file) rather than the folder name of the plug-in. In many
  59. cases, the folder name is not the same as the plug-in ID.</p>
  60. </section>
  61. </div>
  62. <nav role="navigation" class="related-links"><div class="familylinks"><div class="parentlink"><strong>Parent topic:</strong> <a class="link" href="../topics/plugin-applications.html" title="Plug-ins allow you to extend the functionality of DITA-OT. This might entail adding support for specialized document types, integrating processing overrides, or defining new output transformations.">Plug-in applications</a></div></div></nav></article></main></body></html>