Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old December 10th, 2006, 07:55 PM
David Cox
Guest
 
Posts: n/a
Default I have a smple xml

<root >
<employee id="111">Douglas</employee>
<wife n="1">Kitty</wife>
<kid no="1">Polo</kid>
<kid no="2">Paolo</kid>
<wife num="2">Peck</wife>
<kid no="1">Poke</kid>

<employee id="000">Jitto</employee>
<wife n="1">Kitten</wife>
<kid no="1">Po</kid>
</root>

I'd like to sort them outputing into 2 ways, sort by id, sort by name
of the emploee and in each sort, the subchilds also get sorted by
number and by name.
How can i do this ?

  #2  
Old December 11th, 2006, 01:45 AM
Joe Kesselman
Guest
 
Posts: n/a
Default Re: I have a smple xml

David Cox wrote:
Quote:
I'd like to sort them outputing into 2 ways, sort by id, sort by name
of the emploee and in each sort, the subchilds also get sorted by
number and by name.
How can i do this ?
First thing you want to do is fix your markup so you're consistant about
whether the numbering attribute is called "num", "no", "n", or something
else. The machine can't read your mind, and you really don't want to
waste effort trying to explain that these all have the same intent.

You also probably want to fix the hierarchy so each <employeeelement
contains the related <wifeelements, and each <wifecontains its
related <kid>s, rather than merely being followed by them. Indentation
is not semantically useful; containment is.


After fixing your document design problems, I'd suggest an XSLT
stylesheet; this is a very standard application thereof.


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles