<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes" />

<!--  Change parameters here  -->
<xsl:variable name="tn">13</xsl:variable>
<!--                          -->

<!-- Add a Cost element to the XML in the Payments section -->

<xsl:template match="/">
  <xsl:element name="POlist">
  <xsl:apply-templates select = "//POlist/PO" />
  </xsl:element>
</xsl:template>

<xsl:template match="PO">
  <xsl:choose>
    <xsl:when test = "not (Id/trackNbr = $tn)" >
       <xsl:copy-of select = "." />
    </xsl:when>

    <xsl:otherwise>
      <PO>
      <xsl:for-each select = "./*" >
        <xsl:if test = "not(name(.) = 'Payment')" >
          <xsl:copy-of select = "." />
        </xsl:if>

        <xsl:if test = "name(.) = 'Payment'" >
          <Payment>
            <xsl:copy-of select = "./payMethod" />
            <xsl:copy-of select = "./payNumber" />
            <Cost>2256</Cost>
          </Payment>
        </xsl:if>

      </xsl:for-each> 
      </PO> 
    </xsl:otherwise>

  </xsl:choose>
</xsl:template>

</xsl:stylesheet>
