Replacing XML nodes based on internal condition, then re-sorting



Hi,

I have some xml which is generated and looks something like:

<item>
--<title>Alpha</title>
--<stats>
----<rank>100</rank>
--</stats>
</item>
<item>
--<title>Beta</title>
--<stats>
----<rank>20</rank>
--</stats>
</item>
<item>
--<title>Carrot</title>
--<stats>
----<rank>12</rank>
--</stats>
</item>

What I want to do is replace the item node with the lowest rank value
with a new node:

<item>
--<title>Aardvark</title>
--<stats>
----<rank>999</rank>
--</stats>
</item>

And then resort based on the title.

I am really stuck with the best means of doing this. I've looked at
XPath for the node search, but am stumped at the best way of doing a
node replacement and then sorting based on title.

Thanks in advance!

.



Relevant Pages

  • Re: Sorting problem
    ... change the type to int16 for the appropriate node or read in the xml as ... Because when sorting, different data type has ... >>> DataColumns' DAtaType in the DataTable. ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: XML Collating sequence
    ... Just to add to what Bob said, XML uses binary comparisons for comparison and sorting. ... Efficient, but does not account for the little things we've grown accustomed to like dictionary sorting, accent insensitivity, case insensitivity, etc. ... Case sensitivity, Accent sensitivity? ...
    (microsoft.public.sqlserver.xml)
  • Re: Custom sorting through xslt extension object
    ... > I don't have a source xml but let me give you a scenario. ... the sorting mechanism won't be alphabetical. ... > sorting order may be defined by the application arbitrarily. ...
    (microsoft.public.dotnet.xml)
  • Re: sorting a dataset
    ... Ideally, I would like to return the data in structured hierarchical xml, eg: ... I know I can copy my dataset into a dataview and sort the ... >> are sorting a dataview. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: sorting a dataset
    ... Ideally, I would like to return the data in structured hierarchical xml, eg: ... I know I can copy my dataset into a dataview and sort the ... >> are sorting a dataview. ...
    (microsoft.public.dotnet.xml)