Hello,

I am trying to have a parent node with an id element that is unique per parent node but anything under the parent has the same id as the parent.

This is my xml document:
Code:
<noticeProduction type="c" revision="2015-11-10">
  <prologue type="c">
    <institutionId>22</institutionId>
    <institutionName>Test INC</institutionName>
    <databaseName>testdb</databaseName>
    <terminology option="S">Savings and Checking</terminology>
    <impoundTerminology option="E">Escrow</impoundTerminology>
    <productionDate>2016-21-03</productionDate>
    <productionTime>2016-21-15 23:52:33 EDT</productionTime>
    <reportTitle>Maturity Notice Production</reportTitle>
    <currentCutoffNoticeProductionSerial>1345</currentCutoffNoticeProductionSerial>
    <priorCutoffNoticeProductionSerial>345</priorCutoffNoticeProductionSerial>
  </prologue>
  <envelope type="a">
    <person type="a">
      <serial>5432</serial>
      <personLinkCategory option="PR">Primary owner</personLinkCategory>
      <firstName>Lynn</firstName>
      <lastName>Tanner</lastName>
      <contact type="a">
        <serial>5677</serial>
        <category option="BP">Business phone</category>
        <value>(111)111-1111</value>
      </contact>
      <contact type="a">
        <serial>2456</serial>
        <category option="PE">Personal email</category>
        <value>kkkkkkkkk@eirco423.net</value>
      </contact>
      <contact type="a">
        <serial>1135</serial>
        <category option="HP">Home phone</category>
        <value>(111)111-1111</value>
      </contact>
    </person>
    <person type="a">
      <serial>5805</serial>
      <personLinkCategory option="JT">Joint owner</personLinkCategory>
      <firstName>Ultra</firstName>
      <lastName>Tanner</lastName>
    </person>
    <address type="c">
      <serial>2456</serial>
      <addressSerial>4070</addressSerial>
      <category option="R">Residence</category>
      <street>43 Times Ping Two Rail Lane</street>
      <city>Thomas Co Commons Oreland</city>
    </address>
    <notice type="a">
      <serial>1587</serial>
      <category option="F">Force pay</category>
      <account type="c">
        <serial>4358</serial>
        <accountNumber>0000000000</accountNumber>
        <eStatementOption option="E">E-statement only</eStatementOption>
        <eStatementEmailAddress>tay3456fgee@eircom.net</eStatementEmailAddress>
        <share type="c">
          <serial>35688</serial>
          <id>0004</id>
          <description>Checking</description>
          <typeSerial>6</typeSerial>
          <typeDescription>Checking</typeDescription>
        </share>
      </account>
      <transactionSerial>98432123</transactionSerial>
      <monetarySerial>34563221</monetarySerial>
      <postingDate>2016-21-02</postingDate>
      <effectiveDate>2016-21-02</effectiveDate>
      <effectiveBalance>19.72</effectiveBalance>
      <effectiveBalanceResult>-1260.28</effectiveBalanceResult>
      <availableBalance>19.72</availableBalance>
      <availableBalanceResult>-1260.28</availableBalanceResult>
      <feePostAmount>30.00</feePostAmount>
      <feeDescription>Overdraft Fee</feeDescription>
      <item type="a">
        <serial>2378</serial>
        <postingItemSerial>6532</postingItemSerial>
        <category option="W">Withdrawal</category>
        <source option="a">ACH</source>
        <description>BANK OF AMERICA</description>
        <amount>1250.00</amount>
      </item>
    </notice>
  </envelope>
  <envelope type="a">
    <person type="a">
      <serial>25258</serial>
      <personLinkCategory option="PR">Primary owner</personLinkCategory>
      <firstName>Jamie</firstName>
      <middleName>M</middleName>
      <lastName>Daniels</lastName>
      <contact type="a">
        <serial>38439</serial>
        <category option="BP">Business phone</category>
        <value>(610)789-0190</value>
      </contact>
      <contact type="a">
        <serial>38440</serial>
        <category option="PE">Personal email</category>
        <value>hgkyfyfy@YMAIL.COM</value>
      </contact>
    </person>
    <notice type="a">
      <serial>1218</serial>
      <category option="F">Force pay</category>
      <account type="c">
        <serial>20003</serial>
        <accountNumber>0000000000</accountNumber>
        <share type="c">
          <serial>42452</serial>
          <id>0004</id>
          <description>Checking</description>
          <typeSerial>6</typeSerial>
          <typeDescription>Checking</typeDescription>
        </share>
      </account>
      <transactionSerial>77313790</transactionSerial>
      <monetarySerial>27773576</monetarySerial>
      <postingDate>2016-03-02</postingDate>
      <effectiveDate>2016-03-02</effectiveDate>
      <effectiveBalanceResult>-60.00</effectiveBalanceResult>
      <availableBalanceResult>-60.00</availableBalanceResult>
      <feePostAmount>30.00</feePostAmount>
      <feeDescription>Overdraft Fee</feeDescription>
      <item type="a">
        <serial>845</serial>
        <postingItemSerial>5418</postingItemSerial>
        <category option="W">Withdrawal</category>
        <source option="a">ACH</source>
        <description>USAA CHK-INTLOIORNT</description>
        <amount>30.00</amount>
      </item>
    </notice>
    <notice type="a">
      <serial>1743</serial>
      <category option="F">Force pay</category>
      <account type="c">
        <serial>20003</serial>
        <accountNumber>0000000000</accountNumber>
        <share type="c">
          <serial>42452</serial>
          <id>0000</id>
          <description>Checking</description>
          <typeSerial>6</typeSerial>
          <typeDescription>Checking</typeDescription>
        </share>
      </account>
      <transactionSerial>77768043</transactionSerial>
      <monetarySerial>77767950</monetarySerial>
      <postingDate>2016-03-02</postingDate>
      <effectiveDate>2016-03-02</effectiveDate>
      <effectiveBalance>-60.00</effectiveBalance>
      <effectiveBalanceResult>-220.00</effectiveBalanceResult>
      <availableBalance>-60.00</availableBalance>
      <availableBalanceResult>-220.00</availableBalanceResult>
      <feePostAmount>30.00</feePostAmount>
      <feeDescription>Overdraft Fee</feeDescription>
      <item type="a">
        <serial>1370</serial>
        <postingItemSerial>7439</postingItemSerial>
        <category option="W">Withdrawal</category>
        <source option="a">ACH</source>
        <description>USAA CHK-KJHHUU</description>
        <amount>130.00</amount>
      </item>
    </notice>
  </envelope>
  <epilogue type="c">
    <envelopeCount>825</envelopeCount>
    <noticeCount>1478</noticeCount>
  </epilogue>
</noticeProduction>
Here is my XSLT file:

Code:
<?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:param name="idParam">
    <xsl:value-of select="generate-id(.)"/>
  </xsl:param>
  
  <!--Identity template, provides default behavior that copies all content into the output -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <!--match an envelope node and create an id node with a unique identifier-->
  <xsl:template match="envelope">
    <xsl:copy>
        <xsl:element name="id">
          <xsl:value-of select="generate-id(.)"/> 
        </xsl:element>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <!--match an envelope node and create an id node with a unique identifier that was created in the parent envelope node-->
  <xsl:template match="person">
    <xsl:copy>
      <id>
        <xsl:value-of select="../id/text()" />
      </id>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="contact">
    <xsl:copy>
      <id>
        <xsl:value-of select="generate-id(.)"/>
      </id>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="address">
    <xsl:copy>
      <id>
        <xsl:value-of select="generate-id(.)"/>
      </id>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="notice">
    <xsl:copy>
      <id>
        <xsl:value-of select="generate-id(.)"/>
      </id>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>
The problem is why isn't the below code copying the parent id element?

Code:
 <xsl:template match="person">
    <xsl:copy>
      <id>
        <xsl:value-of select="../id/text()" />
      </id>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>