Try something like this:
Code:
<xsl:template match="irp_account">
<IRP_ACCOUNT>
<xsl:apply-templates select="IRP_CARRIER_ID_NUMBER"/>
<xsl:apply-templates select="IRP_ACCOUNT_NUMBER"/>
<IRP_NAME>
<xsl:apply-templates select="IRP_ACCOUNT_TYPE"/>
<xsl:apply-templates select="NAME_TYPE"/>
<xsl:apply-templates select="ADDRESS_TYPE"/>
</IRP_NAME>
</IRP_ACCOUNT>
</xsl:template>
<xsl:template match="NAME_TYPE">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="NAME">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="ADDRESS_TYPE">
<IRP_ADDRESS>
<xsl:copy-of select="."/>
</IRP_ADDRESS>
</xsl:template>
The templates that you have written like this:
Code:
<xsl:template match="IRP_CARRIER_ID_NUMBER">
<xsl:copy-of select="descendant-or-self::IRP_CARRIER_ID_NUMBER"/>
</xsl:template>
aren't wrong, but they had me very confused: it would be much clearer to write <xsl:copy-of select="."/>. Alternatively, you could use the "identity template" pattern where the default template for all elements is
[code]
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
[/copy]
and then only override this when you want to do something other than copy the element unchanged.