With XSLT 2.0 and the input xml as:
Code:
<root>
<test2>text 1</test2>
<test3>text 2</test3>
<test2>text 3</test2>
<test2>text 4</test2>
<test3>text 5</test3>
</root>
<p>I have given below two snippets. First will put <test3> as the last child in <root> and the next snippet will put <test3> out of <root></p>
Code:
<xsl:template match="root">
<xsl:copy>
<xsl:copy-of select="* except test3"/>
<xsl:copy-of select="test3"/>
</xsl:copy>
</xsl:template>
Code:
<xsl:template match="root">
<xsl:copy>
<xsl:copy-of select="* except test3"/>
</xsl:copy>
<xsl:copy-of select="test3"/>
</xsl:template>