This is not a complete answer, but if you give me some clarifications I might be able to work something out.
The following given an xml like :
<root>
<parent>
<child>child1</child>
<child>child2</child>
<otherChild>other1</otherChild>
</parent>
</root>
Will transform it into:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<parent>
<child>child1</child>
<child>child2</child>
<insertedChild>inserted1</insertedChild>
<otherChild>other2</otherChild>
</parent>
</root>
This is the xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/root">
<xsl:for-each select=".">
<xsl:element name="root">
<xsl:for-each select="parent">
<xsl:element name="parent">
<xsl:copy-of select="child" />
<xsl:element name="insertedChild">
inserted1
</xsl:element>
<xsl:copy-of select="otherChild" />
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
This can be altered for any number of distinct elements before and after the element we wish to add.
What I did not get from the problem description is whether the element to be added might be in any place; that is, we do not know beforehand the exact schema we wish to end with.
Is this a transformation you will need to run for multiple elements? If that is the case you may need to create multiple xsl files or include them in this one. Either way it will be a bit more complex.
XSL is however open to parametrization, as you can choose for example both the inserted element's name and value, like so :
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="insertedChild"></xsl:param>
<xsl:param name="valueOfInsertedChild"></xsl:param>
<xsl:template match="/root">
<xsl:for-each select=".">
<xsl:element name="root">
<xsl:for-each select="parent">
<xsl:element name="parent">
<xsl:copy-of select="child" />
<xsl:element name="{$insertedChild}">
<xsl:value-of select="$valueOfInsertedChild" />
</xsl:element>
<xsl:copy-of select="otherChild" />
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I hope this is even a bit close to what you're looking for. Clarify the points mentioned above for me and we might work something better out.