pretty.xsl 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?xml version="1.0" encoding="UTF-8" ?>
  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. <!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->
  6. <xsl:stylesheet version="1.0"
  7. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  8. <!-- pretty.xsl
  9. | This stylesheet is the standard "identity transform" from the
  10. | XSLT Recommendation, augmented by the one property, indent="yes",
  11. | and a filter to keep out some fixed values from the DITA DTDs.
  12. | This stylesheet copies an input XML source file into its indented
  13. | equivalent, with the exception that fixed/defaulted attributes are
  14. | filtered out. Remove the [] block in line 19 to
  15. | re-enable the copying through of these attributes.
  16. +-->
  17. <xsl:output method="xml" indent="yes" />
  18. <xsl:template match="*">
  19. <xsl:variable name="class" select="generate-id(@class)"/>
  20. <xsl:variable name="space" select="generate-id(@xml:space)"/>
  21. <xsl:copy>
  22. <xsl:copy-of select="@*[(generate-id(.)!=$class) and (generate-id(.)!=$space)]" />
  23. <xsl:apply-templates />
  24. </xsl:copy>
  25. </xsl:template>
  26. <xsl:template match="comment()|processing-instruction()">
  27. <xsl:copy />
  28. </xsl:template>
  29. </xsl:stylesheet>