I
Iain
I want to create an XML configuration file which might look like
<REGION Name="Europe" WingDing="Blue">
<COUNTRY Name="UK" WingDing="white">
<TOWN Name="London" WingDing="Orange" />
</COUNTRY>
</REGION>
<REGION Name="NorthAmerica" WingDing="Yellow">
<COUNTRY Name="Canada">
<TOWN Name="Quebec" WingDing="Brown" />
<TOWN Name="Ontario" />
</COUNTRY>
</REGION>
Then I want to find a node (E.g. NorthAmerica/Canada/Ontario) and create an
XML Node with the values in that node PLUS any other values in nodes higher
up.
Specifically for any attribute I should pick the lowest occuring value.
Quebec would have a WIngDing of Yellow ('inheriting' from the Region node),
Quebec, Brown and London Orange.
Finding the node is easy with XPath, but I'm unsure how to pick the lowest
occuring attribute value, some kind of max(depth) operator would be required
and I do not seem to find one int my reference books. This sort of thing
can often be done with a chain of ifs, but it is inelegant.
Can any one make any suggestions?
thanks in advance
Iain
<REGION Name="Europe" WingDing="Blue">
<COUNTRY Name="UK" WingDing="white">
<TOWN Name="London" WingDing="Orange" />
</COUNTRY>
</REGION>
<REGION Name="NorthAmerica" WingDing="Yellow">
<COUNTRY Name="Canada">
<TOWN Name="Quebec" WingDing="Brown" />
<TOWN Name="Ontario" />
</COUNTRY>
</REGION>
Then I want to find a node (E.g. NorthAmerica/Canada/Ontario) and create an
XML Node with the values in that node PLUS any other values in nodes higher
up.
Specifically for any attribute I should pick the lowest occuring value.
Quebec would have a WIngDing of Yellow ('inheriting' from the Region node),
Quebec, Brown and London Orange.
Finding the node is easy with XPath, but I'm unsure how to pick the lowest
occuring attribute value, some kind of max(depth) operator would be required
and I do not seem to find one int my reference books. This sort of thing
can often be done with a chain of ifs, but it is inelegant.
Can any one make any suggestions?
thanks in advance
Iain