My brain is fried -- extra crispy -- and I'm not sure where to even look to how to do this.
I have been given the following construct:
I need to 'in-line' the ranges with the sequence, as such:
So I need to:
I don't know where to start to do this. I'm sure using something like /ranges[position()=$sequence-item@value-lookup] ... but I keep getting garbage when I try something this simple ... and I don't know how to copy the whole 'range' item.
Also, to make things even harder, I need to add a GUID-based range-id field to each range item, and maintain that between the copies. I know how to add the new -id bit and the GUID ... pretty simple stuff.
Can this be done fairly easily in one-pass, or should I run in two passes, first with the GUID insertion, then do the copy translation?
No, this isn't homework ... I'm back on this project that was bumped due to higher priorities.
XML is hard ...
I have been given the following construct:
Code:
<sequence>
<sequence-item order="1" value-lookup="2" />
<sequence-item order="2" value-lookup="3" />
<sequence-item order="3" value-lookup="1" />
</sequence>
<ranges>
<range>
<min>10</min>
<max>20</max>
</range>
<range>
<min>15</min>
<max>25</max>
</range>
<range>
<min>30</min>
<max>45</max>
</range>
</ranges>
I need to 'in-line' the ranges with the sequence, as such:
Code:
<sequence>
<sequence-item order="1">
<range>
<range-id>128</range-id>
<min>15</min>
<max>25</max>
</range>
</sequence-item
<sequence-item order="2">
<range>
<range-id>244</range-id>
<min>30</min>
<max>45</max>
</range>
</sequence-item>
<sequence-item order="3">
<range>
<range-id>542</range-id>
<min>10</min>
<max>20</max>
</range>
</sequence-item>
<sequence>
<ranges>
<range>
<range-id>128</range-id>
<min>10</min>
<max>20</max>
</range>
<range>
<range-id>244</range-id>
<min>15</min>
<max>25</max>
</range>
<range>
<range-id>542</range-id>
<min>30</min>
<max>45</max>
</range>
</ranges>
So I need to:
- grab the value-lookup number, n
- go to the nth item, positionally, in the ranges 'list' and
- copy that nth range item into the sequence
I don't know where to start to do this. I'm sure using something like /ranges[position()=$sequence-item@value-lookup] ... but I keep getting garbage when I try something this simple ... and I don't know how to copy the whole 'range' item.
Also, to make things even harder, I need to add a GUID-based range-id field to each range item, and maintain that between the copies. I know how to add the new -id bit and the GUID ... pretty simple stuff.
Can this be done fairly easily in one-pass, or should I run in two passes, first with the GUID insertion, then do the copy translation?
No, this isn't homework ... I'm back on this project that was bumped due to higher priorities.
XML is hard ...