title: Parse through multiple nodes using xslt
body: <p>Below is my input xml       </p>
  
  <pre><code>        &lt;Record&gt;
            &lt;Header&gt;
                &lt;field1/&gt;
            &lt;/Header&gt;
            &lt;Body&gt;
                &lt;firstname&gt;x1&lt;/firstname&gt;
                &lt;lastname&gt;y1&lt;/lastname&gt;
                &lt;company&gt;Test1&lt;/company&gt;
            &lt;Body&gt;
            &lt;Body&gt;
                &lt;firstname&gt;x2&lt;/firstname&gt;
                &lt;lastname&gt;y2&lt;/lastname&gt;
                &lt;company&gt;&lt;/company&gt;
            &lt;Body&gt;
            &lt;Body&gt;
                &lt;firstname&gt;x3&lt;/firstname&gt;
                &lt;lastname&gt;y3&lt;/lastname&gt;
                &lt;company&gt;Test2&lt;/company&gt;
            &lt;Body&gt;
          &lt;/Record&gt;
  </code></pre>
  
  <ol>
  <li><p>I am trying to loop through body and check if the company value is blank,to output the corresponding first name and last name.This whole output,I am mapping to DATA on the target using xslt mapper.Can someone help me with the below code which is not working</p>
  
  <pre><code>    &lt;?xml version='1.0' ?&gt;
      &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="Namespace"&gt;
          &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/&gt;
              &lt;xsl:variable name="NAME" select="/RecordSet/Body"/&gt;
              &lt;xsl:variable name="break"&gt;&amp;lt;br&amp;gt;&lt;/xsl:variable&gt;
          &lt;xsl:variable name="tableB"&gt;&amp;lt;table Border="1" BorderColor="#000000"  cellpadding="4" cellspacing="0" &amp;gt;&lt;/xsl:variable&gt;
          &lt;xsl:variable name="tableE"&gt;&amp;lt;/table&amp;gt;&lt;/xsl:variable&gt;
          &lt;xsl:variable name="trB"&gt;&amp;lt;tr&amp;gt;&lt;/xsl:variable&gt;
          &lt;xsl:variable name="trE"&gt;&amp;lt;/tr&amp;gt;&lt;/xsl:variable&gt;
          &lt;xsl:variable name="tdB"&gt;&amp;lt;td&amp;gt;&lt;/xsl:variable&gt;
          &lt;xsl:variable name="tdE"&gt;&amp;lt;/td&amp;gt;&lt;/xsl:variable&gt;
          &lt;xsl:variable name="nbsp"&gt;&amp;amp;nbsp;&lt;/xsl:variable&gt;
          &lt;xsl:variable name="thB"&gt;&amp;lt;tr BGCOLOR="#CCCCCC"&amp;gt;&lt;/xsl:variable&gt;
          &lt;xsl:template match="/"&gt;
      &lt;DATA&gt;
              &lt;xsl:value-of select="$tableB"/&gt;
          &lt;xsl:value-of select="$thB"/&gt;
      &lt;xsl:value-of select="$tdB"/&gt;&amp;lt;B&amp;gt;FirstName&amp;lt;/B&amp;gt;
  
                      &lt;xsl:value-of select="$nbsp"/&gt;
                      &lt;xsl:value-of select="$tdE"/&gt;
                      &lt;xsl:value-of select="$tdB"/&gt;&amp;lt;B&amp;gt;LASTNAME &amp;lt;/B&amp;gt;
  
                      &lt;xsl:value-of select="$nbsp"/&gt;
                      &lt;xsl:value-of select="$tdE"/&gt;
      &lt;xsl:value-of select="$trE"/&gt;
                      &lt;xsl:value-of select="$trB"/&gt;
                      &lt;xsl:for-each select="$NAME/Body[string-length(company) &amp;gt; 0]"&gt;
      &lt;xsl:value-of select="$tdB"/&gt;
                          &lt;xsl:value-of select="$MT_NAME/firstname"/&gt;
                          &lt;xsl:value-of select="$nbsp"/&gt;
                          &lt;xsl:value-of select="$tdE"/&gt;
      &lt;xsl:value-of select="$tdB"/&gt;
                          &lt;xsl:value-of select="$MT_NAME/lastname"/&gt;
                          &lt;xsl:value-of select="$nbsp"/&gt;
                          &lt;xsl:value-of select="$tdE"/&gt;
  &lt;xsl:if test="position() mod 2 = 0"&gt;
              &lt;xsl:value-of select="$trE"/&gt;
          &lt;/xsl:if&gt;
      &lt;/xsl:for-each&gt;
                      &lt;xsl:value-of select="$tableE"/&gt;
      &lt;/DATA&gt;
  </code></pre></li>
  <li><p>The output should be </p></li>
  </ol>
  
  <hr>
  
  <h2>|FIRSTNAME|LASTNAME|</h2>
  
  <h2>| X2      | Y2     |</h2>