Mmh, what I did in this case was to insert the menu items one by one in the order I wanted them. (sometimes alphabetical, sometimes by relevance). That way, they would be automatically ordered on output. That may or may not be appropriate to your situation (depending on how many documents you have and wether they will be inserted alphabetically). Maybe you could write a function that traverses a branch, looks at the beginning letters of the documents and inserts the document at the right point?

One crucial function that was missing in this thread's outcome and in the great third-party script for tree management that I used (see above posts) was the ability to insert an item at a specific point in a branch. What the management script did up to now was to always insert an item at the end of the branch. If you wanted to change something, you would have to delete and rebuild that whole branch. That made the whiole thing nearly useless for me, because it was nearly unmanageable.

I wracked my brain for a while and extended the script with that specific function, plus the ability to move a whole branch to a specific point at the same level. I can post it if you're interested.