title: XSLT move element and add ID link
body: <p>I have the following XML:</p>
  
  <pre><code>&lt;Metro&gt;
  &lt;MeasurementList&gt;
      &lt;Measurement&gt;
          &lt;MeasurementX&gt;
              &lt;Prop1&gt;bla&lt;/Prop1&gt;
              &lt;AcqSettingsRef&gt;#1212&lt;/AcqSettingsRef&gt;
          &lt;/MeasurementX&gt;
          &lt;MeasurementY&gt;
              &lt;Prop1&gt;bla&lt;/Prop1&gt;
              &lt;AcqSettingsRef&gt;#1213&lt;/AcqSettingsRef&gt;
          &lt;/MeasurementY&gt;
      &lt;/Measurement&gt;
      &lt;Measurement&gt;
          &lt;MeasurementX&gt;
              &lt;Prop1&gt;bla&lt;/Prop1&gt;
              &lt;AcqSettingsRef&gt;#1212&lt;/AcqSettingsRef&gt;
          &lt;/MeasurementX&gt;
          &lt;MeasurementY&gt;
              &lt;Prop1&gt;bla&lt;/Prop1&gt;
              &lt;AcqSettingsRef&gt;#1214&lt;/AcqSettingsRef&gt;
          &lt;/MeasurementY&gt;
      &lt;/Measurement&gt;
      &lt;Measurement&gt;
          &lt;MeasurementX&gt;
              &lt;Prop1&gt;bla&lt;/Prop1&gt;
              &lt;AcqSettingsRef&gt;#1215&lt;/AcqSettingsRef&gt;
          &lt;/MeasurementX&gt;
          &lt;MeasurementY&gt;
              &lt;Prop1&gt;bla&lt;/Prop1&gt;
              &lt;AcqSettingsRef&gt;#1216&lt;/AcqSettingsRef&gt;
          &lt;/MeasurementY&gt;
      &lt;/Measurement&gt;
  &lt;/MeasurementList&gt;
  &lt;References&gt;
      &lt;AcqSettings&gt;
          &lt;Id&gt;1212&lt;/Id&gt;
          &lt;Prop2&gt;bla&lt;/Prop2&gt;
          &lt;Prop3&gt;bla33&lt;/Prop3&gt;
      &lt;/AcqSettings&gt;
      &lt;AcqSettings&gt;
          &lt;Id&gt;1213&lt;/Id&gt;
          &lt;Prop2&gt;bla&lt;/Prop2&gt;
          &lt;Prop3&gt;bla34&lt;/Prop3&gt;
      &lt;/AcqSettings&gt;
      &lt;AcqSettings&gt;
          &lt;Id&gt;1214&lt;/Id&gt;
          &lt;Prop2&gt;bla&lt;/Prop2&gt;
          &lt;Prop3&gt;bla35&lt;/Prop3&gt;
      &lt;/AcqSettings&gt;
      &lt;AcqSettings&gt;
          &lt;Id&gt;1215&lt;/Id&gt;
          &lt;Prop2&gt;bla&lt;/Prop2&gt;
          &lt;Prop3&gt;bla36&lt;/Prop3&gt;
      &lt;/AcqSettings&gt;
      &lt;AcqSettings&gt;
          &lt;Id&gt;1216&lt;/Id&gt;
          &lt;Prop2&gt;bla&lt;/Prop2&gt;
      &lt;/AcqSettings&gt;
  &lt;/References&gt;
  &lt;/Metro&gt;
  </code></pre>
  
  <p>I have to move the <code>&lt;Prop3&gt;</code> tag from inside the <code>&lt;AcqSettings&gt;</code> to it's own element tag and add an <code>ID</code>. This <code>ID</code> also has to be added in another element so that those will be linked. Also, the <code>&lt;Prop3&gt;</code> might not be  present and one <code>&lt;AcqSettings&gt;</code> may have multiple links.</p>
  
  <p>The expected file should be this.</p>
  
  <pre><code>&lt;Metro&gt;
  &lt;MeasurementList&gt;
      &lt;Measurement&gt;
          &lt;MeasurementX&gt;
              &lt;Prop1&gt;bla&lt;Prop1&gt;
              &lt;AcqSettingsRef&gt;#1212&lt;/AcqSettingsRef&gt;
              &lt;SensSettingsRef&gt;#33&lt;/SensSettingsRef&gt;
          &lt;/MeasurementX&gt;
          &lt;MeasurementY&gt;
              &lt;Prop1&gt;bla&lt;Prop1&gt;
              &lt;AcqSettingsRef&gt;#1213&lt;/AcqSettingsRef&gt;
              &lt;SensSettingsRef&gt;#34&lt;/SensSettingsRef&gt;
          &lt;/MeasurementY&gt;
      &lt;/Measurement&gt;
      &lt;Measurement&gt;
          &lt;MeasurementX&gt;
              &lt;Prop1&gt;bla&lt;Prop1&gt;
              &lt;AcqSettingsRef&gt;#1212&lt;/AcqSettingsRef&gt;
              &lt;SensSettingsRef&gt;#33&lt;/SensSettingsRef&gt;
          &lt;/MeasurementX&gt;
          &lt;MeasurementY&gt;
              &lt;Prop1&gt;bla&lt;Prop1&gt;
              &lt;AcqSettingsRef&gt;#1214&lt;/AcqSettingsRef&gt;
              &lt;SensSettingsRef&gt;#35&lt;/SensSettingsRef&gt;
          &lt;/MeasurementY&gt;
      &lt;/Measurement&gt;
      &lt;Measurement&gt;
          &lt;MeasurementX&gt;
              &lt;Prop1&gt;bla&lt;Prop1&gt;
              &lt;AcqSettingsRef&gt;#1215&lt;/AcqSettingsRef&gt;
              &lt;SensSettingsRef&gt;#36&lt;/SensSettingsRef&gt;
          &lt;/MeasurementX&gt;
          &lt;MeasurementY&gt;
              &lt;Prop1&gt;bla&lt;Prop1&gt;
              &lt;AcqSettingsRef&gt;#1216&lt;/AcqSettingsRef&gt;
          &lt;/MeasurementY&gt;
      &lt;/Measurement&gt;
  &lt;/MeasurementList&gt;
  &lt;References&gt;
      &lt;AcqSettings&gt;
          &lt;Id&gt;1212&lt;/Id&gt;
          &lt;Prop2&gt;bla&lt;Prop2&gt;
      &lt;/AcqSettings&gt;
      &lt;AcqSettings&gt;
          &lt;Id&gt;1213&lt;/Id&gt;
          &lt;Prop2&gt;bla&lt;Prop2&gt;
      &lt;/AcqSettings&gt;
      &lt;AcqSettings&gt;
          &lt;Id&gt;1214&lt;/Id&gt;
          &lt;Prop2&gt;bla&lt;Prop2&gt;
      &lt;/AcqSettings&gt;
      &lt;AcqSettings&gt;
          &lt;Id&gt;1215&lt;/Id&gt;
          &lt;Prop2&gt;bla&lt;Prop2&gt;
      &lt;/AcqSettings&gt;
      &lt;AcqSettings&gt;
          &lt;Id&gt;1216&lt;/Id&gt;
          &lt;Prop2&gt;bla&lt;Prop2&gt;
      &lt;/AcqSettings&gt;
      &lt;SensSettings&gt;
          &lt;Id&gt;33&lt;/Id&gt;
          &lt;Prop3&gt;bla33&lt;Prop3&gt;
      &lt;/SensSettings&gt;
      &lt;SensSettings&gt;
          &lt;Id&gt;34&lt;/Id&gt;
          &lt;Prop3&gt;bla34&lt;Prop3&gt;
      &lt;/SensSettings&gt;
      &lt;SensSettings&gt;
          &lt;Id&gt;35&lt;/Id&gt;
          &lt;Prop3&gt;bla35&lt;Prop3&gt;
      &lt;/SensSettings&gt;
      &lt;SensSettings&gt;
          &lt;Id&gt;36&lt;/Id&gt;
          &lt;Prop3&gt;bla36&lt;Prop3&gt;
      &lt;/SensSettings&gt;
  &lt;/References&gt;
  &lt;/Metro&gt;
  </code></pre>
  
  <p>I can generate the <code>ID</code> using 'generate-id', but I am not sure on how to add that to the new element and to the <code>&lt;MeasurementX/Y&gt;</code> elements for link. Also This has to be done in XSLT version 1.</p>