stripComments.xsl 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: fmmd
  5. (C) Copyright IBM Corp. 2003, 2013
  6. US Government Users Restricted Rights - Use, duplication or disclosure
  7. restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  10. <xsl:output encoding="utf-8" method="xml"/>
  11. <xsl:template match="/*[local-name()='project']">
  12. <xsl:element name="{local-name()}" namespace="{namespace-uri()}">
  13. <xsl:for-each select="@*">
  14. <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
  15. </xsl:for-each>
  16. <xsl:apply-templates select="node()"/>
  17. </xsl:element>
  18. </xsl:template>
  19. <xsl:template match="*">
  20. <xsl:element name="{local-name(.)}" namespace="{$defNS}">
  21. <xsl:for-each select="@*">
  22. <xsl:attribute name="{local-name(.)}"><xsl:value-of select="."/></xsl:attribute>
  23. </xsl:for-each>
  24. <xsl:apply-templates select="node()"/>
  25. </xsl:element>
  26. </xsl:template>
  27. <xsl:template match="/">
  28. <xsl:apply-templates select="node()"/>
  29. </xsl:template>
  30. <xsl:template match="comment()"/>
  31. <xsl:variable name="defNS">
  32. <xsl:value-of select="namespace-uri(/*[local-name()='project'])"/></xsl:variable>
  33. </xsl:stylesheet>