mappull-plugin.xsl 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?xml version="1.0"?>
  2. <!-- This file is part of the DITA Open Toolkit project hosted on
  3. Sourceforge.net. See the accompanying license.txt file for
  4. applicable licenses.-->
  5. <!--
  6. | (C) Copyright IBM Corporation 2006. All Rights Reserved.
  7. *-->
  8. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  9. <xsl:param name="TRANSTYPE"/>
  10. <xsl:template match="*|@*|text()|comment()|processing-instruction()" mode="createPlugin">
  11. <xsl:copy>
  12. <xsl:apply-templates select="*|@*|text()|comment()|processing-instruction()" mode="createPlugin"/>
  13. </xsl:copy>
  14. </xsl:template>
  15. <!-- Should inherit these from map, if they are not specified locally. If local, the local one will
  16. copy over these values. -->
  17. <xsl:template name="inheritMapAttributesForEclipse">
  18. <xsl:copy-of select="../@format|../@linking|../@audience|../@platform|../@product|
  19. ../@otherprops|../@importance|../@scope|../@toc|../@print|../@type"/>
  20. </xsl:template>
  21. <xsl:template match="*[contains(@class,' map/topicref ')]" mode="createPlugin">
  22. <xsl:copy>
  23. <xsl:call-template name="inheritMapAttributesForEclipse"/>
  24. <xsl:copy-of select="@*"/>
  25. <xsl:apply-templates select="*|text()|comment()|processing-instruction()" mode="createPlugin"/>
  26. </xsl:copy>
  27. </xsl:template>
  28. <xsl:template match="*[contains(@class,' eclipsemap/indexExtension ')] |
  29. *[contains(@class,' eclipsemap/contentExtension ')] |
  30. *[contains(@class,' eclipsemap/contextExtension ')] |
  31. *[contains(@class,' eclipsemap/extension ')]">
  32. <xsl:copy>
  33. <xsl:call-template name="inheritMapAttributesForEclipse"/>
  34. <xsl:copy-of select="@*"/>
  35. <xsl:apply-templates select="*|text()|comment()|processing-instruction()"/>
  36. </xsl:copy>
  37. </xsl:template>
  38. <xsl:template match="*[contains(@class,' eclipsemap/tocref ') or contains(@class,' eclipsemap/primarytocref ')][@href][@format!='ditamap']">
  39. <!-- Do not try to process a reference to an XML file or other file -->
  40. <xsl:copy>
  41. <xsl:call-template name="inheritMapAttributesForEclipse"/>
  42. <xsl:copy-of select="@*"/>
  43. <xsl:apply-templates select="*|text()|comment()|processing-instruction()"/>
  44. </xsl:copy>
  45. </xsl:template>
  46. <xsl:template match="/">
  47. <xsl:choose>
  48. <xsl:when test="contains($TRANSTYPE,'eclipse') and *[contains(@class,' eclipsemap/plugin ')]">
  49. <xsl:apply-templates mode="createPlugin"/>
  50. </xsl:when>
  51. <xsl:otherwise>
  52. <xsl:apply-templates/>
  53. </xsl:otherwise>
  54. </xsl:choose>
  55. </xsl:template>
  56. </xsl:stylesheet>