title: Creating an xsl converting xml with headers and footers for to another xml with xslt transformation,
body: <p>I am a newbie in XSLT, I have an XML converted from csv file looks like below with Open and Close rows distict by text, type rows and value. They all come in with same record tags, 
   with distinction only in the string values itself</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Items&gt;
  &lt;Row&gt;
    &lt;Transaction&gt;Open&lt;/Transaction&gt;
  &lt;/Row&gt;
  &lt;Row&gt;
    &lt;Transaction&gt;Type plus&lt;/Transaction&gt;
  &lt;/Row&gt;
  &lt;Row&gt;
    &lt;Transaction&gt;A&lt;/Transaction&gt;
  &lt;/Row&gt;
  &lt;Row&gt;
    &lt;Transaction&gt;B&lt;/Transaction&gt;
  &lt;/Row&gt;    
  &lt;Row&gt;
    &lt;Transaction&gt;Close&lt;/Transaction&gt;
  &lt;/Row&gt;
  &lt;Row&gt;
    &lt;Transaction&gt;Open&lt;/Transaction&gt;
  &lt;/Row&gt;
  &lt;Row&gt;
    &lt;Transaction&gt;Type minus&lt;/Transaction&gt;
  &lt;/Row&gt;
  &lt;Row&gt;
    &lt;Transaction&gt;C&lt;/Transaction&gt;
  &lt;/Row&gt;
  &lt;Row&gt;
    &lt;Transaction&gt;D&lt;/Transaction&gt;
  &lt;/Row&gt;    
  &lt;Row&gt;
    &lt;Transaction&gt;Close&lt;/Transaction&gt;
  &lt;/Row&gt;
  ...
  ...
  ...
  ...
  ...   
  &lt;/Items&gt;
  </code></pre>
  
  <p>I want the result to look as the following.I tried using a variable to store the using variable "Type" for storing plus or minus, but seems like I can't update the variable. Can anyone create an xsl which can do the transformation to the following.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;result&gt;
  &lt;message&gt;
      &lt;to&gt;plus&lt;/to&gt;
      &lt;from&gt;A&lt;/from&gt;
  &lt;/message&gt;
  &lt;message&gt;
      &lt;to&gt;plus&lt;/to&gt;
      &lt;from&gt;B&lt;/from&gt;
  &lt;/message&gt;
  &lt;message&gt;
      &lt;to&gt;minus&lt;/to&gt;
      &lt;from&gt;C&lt;/from&gt;
  &lt;/message&gt;
  &lt;message&gt;
      &lt;to&gt;minus&lt;/to&gt;
      &lt;from&gt;D&lt;/from&gt;
  &lt;/message&gt;
  ...
  ...
  ...
  &lt;/result&gt;
  </code></pre>