title: Script to reformat XML file
body: <p>I am trying to change an XML file from one format to another and have no clue as to how to write a script for it. Can someone help, please?<br>
  The source file looks like this:</p>
  
  <pre><code>&lt;Record&gt;
       &lt;FieldValue fieldName="rapportage_nihil" fieldValue="false" fieldValueIsNull="false" fieldValueNatural="false"/&gt;
       &lt;FieldValue fieldName="periode" fieldValue="2009-23-31" fieldValueIsNull="false" fieldValueNatural="2009-10-31 00:23:23"/&gt;
       &lt;FieldValue fieldName="formulierid" fieldValue="9001HK1V10" fieldValueIsNull="false" fieldValueNatural="9001HK1V10"/&gt;
       &lt;FieldValue fieldName="versie" fieldValue="1" fieldValueIsNull="false" fieldValueNatural="1"/&gt;
       &lt;FieldValue fieldName="frequentie" fieldValue="M" fieldValueIsNull="false" fieldValueNatural="M"/&gt;
       &lt;FieldValue fieldName="variant_type" fieldValue="Landen" fieldValueIsNull="false" fieldValueNatural="Landen"/&gt;
       &lt;FieldValue fieldName="value" fieldValue="5F" fieldValueIsNull="false" fieldValueNatural="5F"/&gt;
       &lt;FieldValue fieldName="post_value" fieldValue="0.00" fieldValueIsNull="false" fieldValueNatural="1.037E-4"/&gt;
       &lt;FieldValue fieldName="cube" fieldValue="c01" fieldValueIsNull="false" fieldValueNatural="c01"/&gt;
       &lt;FieldValue fieldName="rij" fieldValue="r_24_100_1_000_0" fieldValueIsNull="false" fieldValueNatural="r_24_100_1_000_0"/&gt;
       &lt;FieldValue fieldName="kolom" fieldValue="c_2250_SPU" fieldValueIsNull="false" fieldValueNatural="c_2250_SPU"/&gt;
  &lt;/Record&gt;
  &lt;Record&gt;
       &lt;FieldValue fieldName="rapportage_nihil" fieldValue="false" fieldValueIsNull="false" fieldValueNatural="false"/&gt;
       &lt;FieldValue fieldName="periode" fieldValue="2009-23-31" fieldValueIsNull="false" fieldValueNatural="2009-10-31 00:23:23"/&gt;
       &lt;FieldValue fieldName="formulierid" fieldValue="9001HK1V10" fieldValueIsNull="false" fieldValueNatural="9001HK1V10"/&gt;
       &lt;FieldValue fieldName="versie" fieldValue="1" fieldValueIsNull="false" fieldValueNatural="1"/&gt;
       &lt;FieldValue fieldName="frequentie" fieldValue="M" fieldValueIsNull="false" fieldValueNatural="M"/&gt;
       &lt;FieldValue fieldName="variant_type" fieldValue="Landen" fieldValueIsNull="false" fieldValueNatural="Landen"/&gt;
       &lt;FieldValue fieldName="value" fieldValue="5F" fieldValueIsNull="false" fieldValueNatural="5F"/&gt;
       &lt;FieldValue fieldName="post_value" fieldValue="0.00" fieldValueIsNull="false" fieldValueNatural="1.037E-4"/&gt;
       &lt;FieldValue fieldName="cube" fieldValue="c01" fieldValueIsNull="false" fieldValueNatural="c01"/&gt;
       &lt;FieldValue fieldName="rij" fieldValue="r_24_108_0_000_0" fieldValueIsNull="false" fieldValueNatural="r_24_108_0_000_0"/&gt;
       &lt;FieldValue fieldName="kolom" fieldValue="c_2250_SPU" fieldValueIsNull="false" fieldValueNatural="c_2250_SPU"/&gt;
  &lt;/Record&gt;
  &lt;Record&gt;
      &lt;FieldValue fieldName="rapportage_nihil" fieldValue="false" fieldValueIsNull="false" fieldValueNatural="false"/&gt;
      &lt;FieldValue fieldName="periode" fieldValue="2009-23-31" fieldValueIsNull="false" fieldValueNatural="2009-10-31 00:23:23"/&gt;
      &lt;FieldValue fieldName="formulierid" fieldValue="9001HK1V10" fieldValueIsNull="false" fieldValueNatural="9001HK1V10"/&gt;
      &lt;FieldValue fieldName="versie" fieldValue="1" fieldValueIsNull="false" fieldValueNatural="1"/&gt;
      &lt;FieldValue fieldName="frequentie" fieldValue="M" fieldValueIsNull="false" fieldValueNatural="M"/&gt;
      &lt;FieldValue fieldName="variant_type" fieldValue="Landen" fieldValueIsNull="false" fieldValueNatural="Landen"/&gt;
      &lt;FieldValue fieldName="value" fieldValue="5F" fieldValueIsNull="false" fieldValueNatural="5F"/&gt;
      &lt;FieldValue fieldName="post_value" fieldValue="0.00" fieldValueIsNull="false" fieldValueNatural="1.6049E-4"/&gt;
      &lt;FieldValue fieldName="cube" fieldValue="c01" fieldValueIsNull="false" fieldValueNatural="c01"/&gt;
      &lt;FieldValue fieldName="rij" fieldValue="r_06_000_1_010_0" fieldValueIsNull="false" fieldValueNatural="r_06_000_1_010_0"/&gt;
      &lt;FieldValue fieldName="kolom" fieldValue="c_2250_SPU" fieldValueIsNull="false" fieldValueNatural="c_2250_SPU"/&gt;
  &lt;/Record&gt;
  </code></pre>
  
  <p>This is the format that I need as a result:</p>
  
  <pre><code>&lt;bestand registratienummer="123"&gt;
  &lt;rapportage nihil="false" periode="2009-23-31" formulierid="9001HK1V10" versie="1" frequentie="M"&gt;
          &lt;variant type="Landen" value="5F" /&gt;
          &lt;post value="0.00" cube="c01" rij="r_24_100_1_000_0" kolom="c_2250_SPU" /&gt;
  &lt;/rapportage&gt;
  &lt;rapportage nihil="false" periode="2009-23-31" formulierid="9001HK1V10" versie="1" frequentie="M"&gt;
          &lt;variant type="Landen" value="5F" /&gt;
          &lt;post value="0.00" cube="c01" rij="r_24_108_0_000_0" kolom="c_2250_SPU" /&gt;
  &lt;/rapportage&gt;
  &lt;rapportage nihil="false" periode="2009-23-31" formulierid="9001HK1V10" versie="1" frequentie="M"&gt;
          &lt;variant type="Landen" value="5F" /&gt;
          &lt;post value="0.00" cube="c01" rij="r_06_000_1_010_0" kolom="c_2250_SPU" /&gt;
  &lt;/rapportage&gt;
  &lt;/bestand&gt;  
  </code></pre>
  
  <p>Thanks very much!</p>