Input XML
<root> <data> <B>value 1</B> <C>value 1</C> <D>value 1</D> <A>value 1</A> </data> </root>Expected XML
<root> <data> <A>value 1</A> <B>value 1</B> <C>value 1</C> <D>value 1</D> </data> </root>Stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output indent="yes" /> <xsl:strip-space elements="*" /> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> <xsl:template match="//A" /> <xsl:template match="//data"> <xsl:copy> <xsl:copy-of select="//A" /> <xsl:apply-templates /> </xsl:copy> </xsl:template> </xsl:stylesheet>
Add a comment