xsl-list
[Top] [All Lists]

generic sorting problem

2005-09-06 12:21:50
hi,

I'm having problems with a sort.

I wish to sort some xml, and indent the result. I can do the indent, but the sorting is proving a problem.

My xml will be in the format of the below, though the element names may differ per document.

<xml>
<root_elem>
  <item_elem>
     <value1> xyz</value1>
     <value2> asd </value2>
     ...
  </item_elem>
  <item_elem>
     ...
  </item_elem>
</root_elem>

I want to sort all the "item_elem" elements based on the value of the "value1" sublements.

As per abovve, the names of these elements are dynamic, and this is where I am having difficulty. I.e., in another document, "root_elem", "item_elem" and "valueX" could have different names, but the structure is the very same.

I need to sort the children of the root element by _their_ first child.

Is there a generic way to do this ?

Can the result be indented in the same operation ?

Any help appreciated.

Peter

_________________________________________________________________
MSN Messenger 7.5 is now out. Download it for FREE here. http://messenger.msn.co.uk


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>