topic2dynamicdita.xsl 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?xml version="1.0"?>
  2. <!--
  3. Stylesheet to produce normalized, resolved DITA for use
  4. within dynamic DITA renderers such as Eclipse. The output meets the
  5. following requirements:
  6. * Debug information is removed (@xtrf/@xtrc)
  7. * DITA-OT processing instructions removed (workdir and path2proj)
  8. * Draft elements are removed unless $DRAFT=yes
  9. -->
  10. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  11. <xsl:import href="plugin:org.dita.base:xsl/common/output-message.xsl"/>
  12. <xsl:import href="plugin:org.dita.base:xsl/common/dita-utilities.xsl"/>
  13. <xsl:output method="xml"/>
  14. <xsl:param name="DRAFT" select="'no'"/>
  15. <!-- Deprecated since 2.3 -->
  16. <xsl:variable name="msgprefix">DOTX</xsl:variable>
  17. <xsl:template match="*|@*|processing-instruction()|comment()|text()">
  18. <xsl:copy>
  19. <xsl:apply-templates select="@*|*|processing-instruction()|comment()|text()"/>
  20. </xsl:copy>
  21. </xsl:template>
  22. <!-- xtrf and xtrc debug attributes are removed from the output -->
  23. <xsl:template match="@xtrf|@xtrc"/>
  24. <!-- Remove DITA-OT processing PI's -->
  25. <xsl:template match="processing-instruction()[name()='workdir' or name()='workdir-uri' or name()='path2project' or name()='path2project-uri']"/>
  26. <!-- Remove draft elements unless instructed to leave them in -->
  27. <xsl:template match="*[contains(@class,' topic/draft-comment ') or
  28. contains(@class,' topic/required-cleanup ')]">
  29. <xsl:if test="$DRAFT='yes'">
  30. <xsl:copy>
  31. <xsl:apply-templates select="@*|*|processing-instruction()|comment()|text()"/>
  32. </xsl:copy>
  33. </xsl:if>
  34. </xsl:template>
  35. </xsl:stylesheet>