Sorting XML Nodes

Kirill <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CADGo9YaCPbO4rCU0_xZoY9=XTjS5doBM6Y6V-QiNmWvNdfKO0Q@mail.gmail.com>
Hey there,

I need to sort the XML tree based on one of its' nodes.
Let's say I have the following XML tree:

<root>
<item id=1/>
<item id=2/>
<item id=3/>
<item id=10/>
<item id=11/>
</root>

I've read that freemarker's sort_by built-in is pretty limited, i.e. you
cannot force the conversion of the sortable to number, for example (so you
can't do ?sort_by(["var1", "var2?number"])).
Now, when I do ?sort_by(["item","id"]), the result I get is this, of course:

<root>
<item id=1/>
<item id=10/>
<item id=11/>
<item id=2/>
<item id=3/>
</root>

My question is this - how can I emulate the natural sort order of the list,
by modifying id variables in the original XML?
I have full control of the original XML and can modify any values (add
string/digits, etc)?

Any ideas?

Thanks much,
Kirill

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.