Q: Grouping elements under a new node in xslt I need to group some elements together and pull them together under a new element. 
Below is a sample record, I would like to group together the address information into an additional layer.
Here is the original record -
  <Records>
    <People>
     <FirstName>John</FirstName>  
     <LastName>Doe</LastName>  
     <Middlename />
     <Age>20</Age>  
     <Smoker>Yes</Smoker>  
     <Address1>11 eleven st</Address1>  
     <Address2>app 11</Address2>
     <City>New York</City>
     <State>New York</State>
     <Status>A</Status>
    </People>
  </Records>

expected Result: I need to group address data under a new element as such -
  <Records>
    <People>
     <FirstName>John</FirstName>  
     <LastName>Doe</LastName>  
     <Middlename />
     <Age>20</Age>  
     <Smoker>Yes</Smoker>
     <Address>       
       <Address1>11 eleven st</address1>  
       <Address2>app 11</address2>
       <City>New York</City>
       <State>New York</State>
     </Address>       
     <Status>A</Status>
    </People>
  </Records>

Any help would be great! Thank you

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

  <xsl:template match="@* | node()" name="copy">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="People">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()[not(self::Address1 or 
                                                   self::Address2 or 
                                                   self::City or 
                                                   self::State)]" />
    </xsl:copy>
  </xsl:template>

  <xsl:template match="Smoker">
    <xsl:call-template name="copy" />
    <Address>
      <xsl:apply-templates select="../Address1 | 
                                   ../Address2 | 
                                   ../City | 
                                   ../State" />
    </Address>
  </xsl:template>
</xsl:stylesheet>

When run on your input XML, this produces:
<Records>
  <People>
    <FirstName>John</FirstName>
    <LastName>Doe</LastName>
    <Middlename />
    <Age>20</Age>
    <Smoker>Yes</Smoker>
    <Address>
      <Address1>11 eleven st</Address1>
      <Address2>app 11</Address2>
      <City>New York</City>
      <State>New York</State>
    </Address>
    <Status>A</Status>
  </People>
</Records>

