title: Identity Template specific elements, exclude everything else
body: <p>Using the below XML how would I extract only the Address details into a CSV format?</p>
  
  <p>I believe I need to have a style sheet based on the Identity template, though the examples I found are simple and state to the list the elements you want to exclude. Is there a short way to exclude everything except Address and AddressLine?</p>
  
  <p>I am using .NET to process the XLST transformation. The stylesheet I have come up with so far doesn't return anything.</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;xsl:output method="text" encoding="utf-8" /&gt;
    &lt;xsl:strip-space elements="*"/&gt;
  
    &lt;xsl:param name="delim" select="','" /&gt;
    &lt;xsl:param name="quote" select="'&amp;quot;'" /&gt;
    &lt;xsl:param name="break" select="'&amp;#xa;'" /&gt;
  
    &lt;xsl:template match="node()| @*"&gt;
      &lt;xsl:copy&gt;
        &lt;xsl:apply-templates select="node()| @*"/&gt;
      &lt;/xsl:copy&gt;
    &lt;/xsl:template&gt;
  
    &lt;xsl:template match="AddressLine" priority="9"&gt;
      &lt;xsl:value-of select="concat($quote, ., $quote, $delim)"/&gt;
    &lt;/xsl:template&gt;
  
    &lt;xsl:template match="*" priority="0" /&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  
  
  <pre><code>&lt;Sample Version="6" Date="2012-05-11"&gt;
    &lt;Header&gt;
      &lt;CreatedDate&gt;2015-12-02&lt;/CreatedDate&gt;
      &lt;CreatedTime&gt;10:31:42&lt;/CreatedTime&gt;
    &lt;/Header&gt;
    &lt;Message Group="1" Type="1" Protocol="1"&gt;
      &lt;MessageHeader&gt;
        &lt;MessageReferenceNumber&gt;1&lt;/MessageReferenceNumber&gt;
      &lt;/MessageHeader&gt;
      &lt;TransactionHeader&gt;
        &lt;ReportPeriodStartDate&gt;2002-04-01&lt;/ReportPeriodStartDate&gt;
        &lt;ReportPeriodEndDate&gt;2015-11-30&lt;/ReportPeriodEndDate&gt;
      &lt;/TransactionHeader&gt;
      &lt;Episode&gt;
        &lt;Person&gt;
          &lt;General&gt;
            &lt;Verified Status="02"&gt;
              &lt;Identifier&gt;001&lt;/Identifier&gt;
              &lt;PersonName&gt;
                &lt;Name&gt;
                  &lt;FirstName&gt;Foo&lt;/FirstName&gt;
                  &lt;Surname&gt;Bar&lt;/Surname&gt;
                &lt;/Name&gt;
              &lt;/PersonName&gt;
              &lt;Address&gt;
                &lt;AddressLine&gt;&lt;/AddressLine&gt;
                &lt;AddressLine&gt;Street&lt;/AddressLine&gt;
                &lt;AddressLine&gt;Town&lt;/AddressLine&gt;
                &lt;AddressLine&gt;City&lt;/AddressLine&gt;
              &lt;/Address&gt;
            &lt;/Verified&gt;
          &lt;/General&gt;
        &lt;/Person&gt;
        &lt;Session&gt;
          &lt;Input&gt;
            &lt;StartDate&gt;2015-10-31&lt;/StartDate&gt;
            &lt;StartTime&gt;17:15:00&lt;/StartTime&gt;
          &lt;/Input&gt;
          &lt;Output&gt;
            &lt;StatusCode&gt;8&lt;/StatusCode&gt;
            &lt;LocationCode&gt;9&lt;/LocationCode&gt;
          &lt;/Output&gt;
        &lt;/Session&gt;
      &lt;/Episode&gt;
      &lt;MessageTrailer&gt;
        &lt;MessageReferenceNumber&gt;1&lt;/MessageReferenceNumber&gt;
      &lt;/MessageTrailer&gt;
    &lt;/Message&gt;
    &lt;Message Group="1" Type="1" Protocol="1"&gt;
      &lt;MessageHeader&gt;
        &lt;MessageReferenceNumber&gt;2&lt;/MessageReferenceNumber&gt;
      &lt;/MessageHeader&gt;
      &lt;TransactionHeader&gt;
        &lt;ReportPeriodStartDate&gt;2002-04-01&lt;/ReportPeriodStartDate&gt;
        &lt;ReportPeriodEndDate&gt;2015-11-30&lt;/ReportPeriodEndDate&gt;
      &lt;/TransactionHeader&gt;
      &lt;Episode&gt;
        &lt;Person&gt;
          &lt;General&gt;
            &lt;Verified Status="02"&gt;
              &lt;Identifier&gt;002&lt;/Identifier&gt;
              &lt;PersonName&gt;
                &lt;Name&gt;
                  &lt;FirstName&gt;Foo&lt;/FirstName&gt;
                  &lt;Surname&gt;Bar&lt;/Surname&gt;
                &lt;/Name&gt;
              &lt;/PersonName&gt;
              &lt;Address&gt;
                &lt;AddressLine&gt;&lt;/AddressLine&gt;
                &lt;AddressLine&gt;Street&lt;/AddressLine&gt;
                &lt;AddressLine&gt;Town&lt;/AddressLine&gt;
                &lt;AddressLine&gt;City&lt;/AddressLine&gt;
              &lt;/Address&gt;
            &lt;/Verified&gt;
          &lt;/General&gt;
        &lt;/Person&gt;
        &lt;Session&gt;
          &lt;Input&gt;
            &lt;StartDate&gt;2015-10-31&lt;/StartDate&gt;
            &lt;StartTime&gt;17:15:00&lt;/StartTime&gt;
          &lt;/Input&gt;
          &lt;Output&gt;
            &lt;StatusCode&gt;8&lt;/StatusCode&gt;
            &lt;LocationCode&gt;9&lt;/LocationCode&gt;
          &lt;/Output&gt;
        &lt;/Session&gt;
      &lt;/Episode&gt;
      &lt;MessageTrailer&gt;
        &lt;MessageReferenceNumber&gt;2&lt;/MessageReferenceNumber&gt;
      &lt;/MessageTrailer&gt;
    &lt;/Message&gt;
    &lt;Trailer&gt;
      &lt;RecordCount&gt;2&lt;/RecordCount&gt;
    &lt;/Trailer&gt;
  &lt;/Sample&gt;
  </code></pre>