I have the following input XML:
<root>
<aaa>some string aaa</aaa>
<bbb>some string bbb</bbb>
<ddd>some string ddd</ddd>
</root>
Using XSLT I want to the following output:
<root>
<aaa>some string aaa</aaa>
<bbb>some string bbb</bbb>
<ccc>some string ccc</ccc>
<ddd>some string ddd</ddd>
</root>
My XSLT is:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="root">
<root>
<ccc>some string ccc</ccc>
<xsl:apply-templates select="@*|node()"/>
</root>
</xsl:template>
</xsl:stylesheet>
But I'm not getting my desired output. How could I put the ccc
element between bbb
and ddd
elements using the identity template?
I can use XSLT 3.0 if that helps.