Try this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/Orders">
<Orders>
<xsl:apply-templates select="Order"/>
</Orders>
</xsl:template>
<xsl:template match="Order">
<xsl:variable name="o" select="."/>
<xsl:variable name="pi" select="PaymentInfo"/>
<xsl:for-each select="OrderDetails/Detail/ShippedRemarks">
<xsl:variable name="shr" select="."/>
<xsl:variable name="d" select=".."/>
<xsl:for-each select="$o/ProductDetails/DetailName">
<xsl:variable name="dn" select="."/>
<Order>
<xsl:copy-of select="$o/OrderID | $o/CustomerID | $o/OrderDate"/>
<xsl:copy-of select="$d/ProductID | $d/Quantity"/>
<xsl:copy-of select="$shr/*"/>
<xsl:copy-of select="$dn/ProductName"/>
<xsl:copy-of select="$pi/*"/>
</Order>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Instead of “*”, you can specify the names explicitly.