I. XSLT 2.0 solution
As simple as this (no variables, no conditionals, no literal-result elements, no intermediate-result document, no xsl:for-each) :
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="kOutlineByText" match="outline" use="@text"/>
<xsl:key name="kUpdatedNodesByText" match="node" use="."/>
<xsl:param name="pupdSpec">
<row>
<node>some text A</node>
<newParent>child 2</newParent>
</row>
</xsl:param>
<xsl:template match="node()|@*" mode="#default copy">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="outline[@text = $pupdSpec/*/newParent]">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:apply-templates mode="copy" select="key('kOutlineByText', $pupdSpec/*/node)"/>
</xsl:copy>
</xsl:template>
<xsl:template match="outline[key('kUpdatedNodesByText', @text, $pupdSpec)]" />
</xsl:stylesheet>
When this transformation is applied on the provided XML document:
<opml>
<body>
<outline text="root">
<outline text="child 1">
<outline text="some text A">
<outline text="some text B"/>
<outline text="some text C"/>
</outline>
</outline>
<outline text="child 2">
<outline text="some text D">
<outline text="some text E"/>
<outline text="some text F"/>
</outline>
</outline>
</outline>
</body>
</opml>
the wanted, correct result is produced:
<opml>
<body>
<outline text="root">
<outline text="child 1"/>
<outline text="child 2">
<outline text="some text D">
<outline text="some text E"/>
<outline text="some text F"/>
</outline>
<outline text="some text A">
<outline text="some text B"/>
<outline text="some text C"/>
</outline>
</outline>
</outline>
</body>
</opml>
II. XSLT 1.0 Solution:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="kOutlineByText" match="outline" use="@text"/>
<xsl:param name="pupdSpec">
<row>
<node>some text A</node>
<newParent>child 2</newParent>
</row>
</xsl:param>
<xsl:variable name="vupdSpec" select="document('')/*/xsl:param[@name='pupdSpec']/*"/>
<xsl:template match="node()|@*">
<xsl:if test="not(current()/@text = $vupdSpec/node)">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:copy-of select="key('kOutlineByText', $vupdSpec/node)
[current()[self::outline and @text = $vupdSpec/newParent]]"/>
</xsl:copy>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
When this transformation is applied on the same (above) XML document, the same correct, wanted result is produced:
<opml>
<body>
<outline text="root">
<outline text="child 1"/>
<outline text="child 2">
<outline text="some text D">
<outline text="some text E"/>
<outline text="some text F"/>
</outline>
<outline text="some text A">
<outline text="some text B"/>
<outline text="some text C"/>
</outline>
</outline>
</outline>
</body>
</opml>