<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
		<xsl:processing-instruction name="edi_segment">~</xsl:processing-instruction>
		<xsl:processing-instruction name="edi_element">:</xsl:processing-instruction>
        <xsl:apply-templates select="node()"/>
    </xsl:template>
    <xsl:template match="QTY02">
        <xsl:element name="{local-name(.)}">
            <xsl:apply-templates select="comment()"/>
            <xsl:value-of select=". * 2"/>
        </xsl:element>
    </xsl:template>
    <xsl:template match="node()">
        <xsl:choose>
            <xsl:when test="local-name(.) = '#text'">
                <xsl:value-of select="."/>
            </xsl:when>
            <!--xsl:when test="local-name(.) = '#comment'"/-->
            <!-- to preserve comments, remove the above line and replace with the next three-->
            <xsl:when test="local-name(.) = '#comment'">
                <xsl:comment><xsl:value-of select="."/></xsl:comment>
            </xsl:when>
            <xsl:otherwise>
                <xsl:element name="{local-name(.)}">
                    <xsl:apply-templates select="node()"/>
                </xsl:element>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>
