title: accessing xml stored in xslt variable
body: <p>This code is not giving desired result.Please help. This code is not giving desired result.Please help.
  This code is not giving desired result.Please help.</p>
  
  <pre><code> &lt;xsl:template match="/"&gt;
  &lt;xsl:variable name="Resp"&gt;
      &lt;Response&gt;
          &lt;Status&gt;
              &lt;A&gt;&lt;/A&gt;
          &lt;/Status&gt;
          &lt;RespRec&gt;
              &lt;Data&gt;
                  &lt;A1&gt;gmailcom&lt;/A1&gt;
                  &lt;B1&gt;YES&lt;/B1&gt;
                  &lt;C1&gt;PRIVACY&lt;/C1&gt;
                  &lt;D1&gt;00&lt;/D1&gt;
              &lt;/Data&gt;
              &lt;Data&gt;
                  &lt;A1&gt;Ymailcom&lt;/A1&gt;
                  &lt;B1&gt;DES&lt;/B1&gt;
                  &lt;C1&gt;TYPE&lt;/C1&gt;
                  &lt;D1&gt;01&lt;/D1&gt;
              &lt;/Data&gt;
          &lt;/RespRec&gt;
      &lt;/Response&gt;
  &lt;/xsl:variable&gt;
  &lt;xsl:element name="Response"&gt;
  
      &lt;xsl:for-each select="$Resp/Response/RespRec/Data"&gt;
          &lt;ABCD&gt; &lt;!-- It can repeat as many as Data element is there --&gt;
              &lt;A1&gt;
                  &lt;xsl:value-of select="$Resp/Response/RespRec/Data/A1" /&gt;
              &lt;/A1&gt;
              &lt;B1&gt;
                  &lt;xsl:value-of select="$Resp/Response/RespRec/Data/B1" /&gt;
              &lt;/B1&gt;
              &lt;C1&gt;
                  &lt;xsl:value-of select="$Resp/Response/RespRec/Data/C1" /&gt;
              &lt;/C1&gt;
              &lt;D1&gt;
                  &lt;xsl:value-of select="$Resp/Response/RespRec/Data/D1" /&gt;
              &lt;/D1&gt;
          &lt;/ABCD&gt;
      &lt;/xsl:for-each&gt;
  
  &lt;/xsl:element&gt;
   &lt;/xsl:template&gt;
  </code></pre>
  
  <p>Desired out put:</p>
  
  <pre><code> &lt;Response&gt;
    &lt;ABCD&gt;
    &lt;A1&gt;gmailcom&lt;/A1&gt;
                          &lt;B1&gt;YES&lt;/B1&gt;
                          &lt;C1&gt;PRIVACY&lt;/C1&gt;
                          &lt;D1&gt;00&lt;/D1&gt;
  &lt;/ABCD&gt;
  &lt;ABCD&gt;
  &lt;A1&gt;Ymailcom&lt;/A1&gt;
                          &lt;B1&gt;DES&lt;/B1&gt;
                          &lt;C1&gt;TYPE&lt;/C1&gt;
                          &lt;D1&gt;01&lt;/D1&gt;
    &lt;/ABCD&gt;
    &lt;/Response&gt;
  </code></pre>
  
  <p>But the above code is not giving desired result.Please help. 
  But the above code is not giving desired result.Please help. But the above code is not giving desired result.Please help. </p>