Re: [xmljs-users] Re-ordering XML data...
Brought to you by:
djoham,
witchhunter
From: David J. <dj...@ya...> - 2005-02-04 22:53:11
|
Can you do a quick example (just the XML below and how you're trying to manipulate it) so I can take a look this weekend? I know the XPATH stuff in xmljs is pretty basic and probably doesn't support what you're looking for, but it may be possible to enhance it to support what you're looking for. At the very least, it should be easy to create a function that will reorder a nodelist in whatever way you're looking for... David --- Eljon Greene <eg...@re...> wrote: > Hi, > > This is my last hurdle to overcome (I think) in using XML and the xmlJS library. I use this > technology to allow users to control the layout (order, active/inactive, labeling) of pages in > our application. However the ordering is based on an <orderNumber> element I created by it does > not change the "position" of the <section> in the XML file. My question is there a way to > re-order elements? I can only display the elements by using the XPath position() function. > Here is the way it works now and the desired result: > > How it looks now: > > > <section> > <id>1</id> > <name>My Section</name> > <orderNumber>02</orderNumber> > <active>Yes</active> > <locked>Yes</locked> > </section> > <section> > <id>2</id> > <name>My Other Section</name> > <orderNumber>01</orderNumber> > <active>Yes</active> > <locked>Yes</locked> > </section> > The desired results: > > <section> > <id>2</id> > <name>My Other Section</name> > <orderNumber>01</orderNumber> > <active>Yes</active> > <locked>Yes</locked> > </section> > <section> > <id>1</id> > <name>My Section</name> > <orderNumber>02</orderNumber> > <active>Yes</active> > <locked>Yes</locked> > </section> > > Thanks. > > Eljon Greene > CE Software Engineer > 877.394.5644 \\ main > 904.567.2127 \\ direct > eg...@re... > www.recruitmax.com > |