I can't tell you why your code is doing the wrong thing, because you haven't shown your code. (We may be specialists, and we do get a lot of practice, but it's still difficult to debug code when you can't see it.)
Don't use for-each, use template rules. Something like
<xsl:template match="Line">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="Order">
<Order>
<xsl:copy-of select="OrderNum"/>
</Order>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="Header">
<Header>
<xsl:copy-of select="Hdr"/>
</Header>
<xsl:apply-templates/>
</xsl:template>
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference