for-each select="@*" : abbreviation « XSLT stylesheet « XML






for-each select="@*"


File: Data.xml
<?xml version="1.0"?>
 
<start_date xmlns="http://www.java2s.com">1999-07-25</start_date>

File: Transform.xslt

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="*">
    <xsl:copy>
      <xsl:for-each select="@*">
        <xsl:copy/>
      </xsl:for-each>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8"?><start_date xmlns="http://www.java2s.com">1999-07-25</start_date>

 








Related examples in the same category

1.apply-templates select="*"
2.copy-of select="@*"
3.template match="/"