File: Data.xml
<test>test</test>
File: Transform.xslt
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="no" />
<xsl:template match="test">
<test>
1.
<sample />
2.
<sample></sample>
3.
<xsl:element name="sample" />
4.
<sample color="green" />
5.
<sample color="green"></sample>
6.
<xsl:element name="sample">
<xsl:attribute name="color">green</xsl:attribute>
</xsl:element>
7.
<sample></sample>
<xsl:apply-templates />
</test>
</xsl:template>
</xsl:stylesheet>
Output:
<test>
1.
<sample/>
2.
<sample/>
3.
<sample/>
4.
<sample color="green"/>
5.
<sample color="green"/>
6.
<sample color="green"/>
7.
<sample/>test</test>
|