У меня есть следующий xml:
<Metro>
<MeasurementList>
<Measurement>
<MeasurementX>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1212</AcqSettingsRef>
<SensSettingsRef>#33</SensSettingsRef>
</MeasurementX>
<MeasurementY>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1213</AcqSettingsRef>
<SensSettingsRef>#34</SensSettingsRef>
</MeasurementY>
</Measurement>
<Measurement>
<MeasurementX>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1212</AcqSettingsRef>
<SensSettingsRef>#33</SensSettingsRef>
</MeasurementX>
<MeasurementY>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1214</AcqSettingsRef>
<SensSettingsRef>#35</SensSettingsRef>
</MeasurementY>
</Measurement>
<Measurement>
<MeasurementX>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1215</AcqSettingsRef>
<SensSettingsRef>#36</SensSettingsRef>
</MeasurementX>
<MeasurementY>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1216</AcqSettingsRef>
</MeasurementY>
</Measurement>
</MeasurementList>
<References>
<AcqSettings>
<Id>1212</Id>
<Prop2>bla<Prop2>
</AcqSettings>
<AcqSettings>
<Id>1213</Id>
<Prop2>bla<Prop2>
</AcqSettings>
<AcqSettings>
<Id>1214</Id>
<Prop2>bla<Prop2>
</AcqSettings>
<AcqSettings>
<Id>1215</Id>
<Prop2>bla<Prop2>
</AcqSettings>
<AcqSettings>
<Id>1216</Id>
<Prop2>bla<Prop2>
</AcqSettings>
<SensSettings>
<Id>33</Id>
<Prop3>bla33<Prop3>
</SensSettings>
<SensSettings>
<Id>34</Id>
<Prop3>bla34<Prop3>
</SensSettings>
<SensSettings>
<Id>35</Id>
<Prop3>bla35<Prop3>
</SensSettings>
<SensSettings>
<Id>36</Id>
<Prop3>bla36<Prop3>
</SensSettings>
</References>
И мне нужно переместить «SensSettings» из его собственного элемента в «AcqSettings» на основе отношения ID, которое имеет «MeasurementX или MeasurementY». SensSettings может отсутствовать для некоторых.
Результат xml должен выглядеть следующим образом:
<Metro>
<MeasurementList>
<Measurement>
<MeasurementX>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1212</AcqSettingsRef>
</MeasurementX>
<MeasurementY>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1213</AcqSettingsRef>
</MeasurementY>
</Measurement>
<Measurement>
<MeasurementX>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1212</AcqSettingsRef>
</MeasurementX>
<MeasurementY>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1214</AcqSettingsRef>
</MeasurementY>
</Measurement>
<Measurement>
<MeasurementX>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1215</AcqSettingsRef>
</MeasurementX>
<MeasurementY>
<Prop1>bla<Prop1>
<AcqSettingsRef>#1216</AcqSettingsRef>
</MeasurementY>
</Measurement>
</MeasurementList>
<References>
<AcqSettings>
<Id>1212</Id>
<Prop2>bla<Prop2>
<Prop3>bla33<Prop3>
</AcqSettings>
<AcqSettings>
<Id>1213</Id>
<Prop2>bla<Prop2>
<Prop3>bla34<Prop3>
</AcqSettings>
<AcqSettings>
<Id>1214</Id>
<Prop2>bla<Prop2>
<Prop3>bla35<Prop3>
</AcqSettings>
<AcqSettings>
<Id>1215</Id>
<Prop2>bla<Prop2>
<Prop3>bla36<Prop3>
</AcqSettings>
<AcqSettings>
<Id>1216</Id>
<Prop2>bla<Prop2>
</AcqSettings>
</References>
Это должно быть сделано с помощью XSLT-преобразования. Пока я не уверен, как связать SensSettings с AcqSettings на основе идентификатора в измерении.