From: Makoto O. <oni...@la...> - 2007-01-20 06:04:01
|
Hello Luis Alberto, If you want to sort elements by key values as integer type, = you need to specify -t option. = In your example, probably what you want to do is done by = xsort -t "/inicio/*/area:%i" -c /inicio -e "*" -k "area" your.xml; The text data of area is treated as integer, so the result becomes = as follows. I tested it by xmltk1.1 which is the latest version I = maintain. <inicio> <sortD> <nombre>ff</nombre> <area>2</area> </sortD> <sortD a=3D"2"> <nombre>aa</nombre> <area>4</area> </sortD> <sortD> <nombre>ww</nombre> <area>4</area> </sortD> <sortD> <nombre>bb</nombre> <area>6</area> </sortD> <sortD> <nombre>cc</nombre> <area>24</area> </sortD> </inicio> makoto From: "Luis Alberto Ramirez Albino" <soa...@ho...> Subject: [Xmltk-devs] Xsort problems with XML attributes Date: Fri, 19 Jan 2007 19:48:41 +0000 Message-ID: <BAY...@ph...l> >Hello, good day My name is Luis Alberto Ram=EDrez, I'm from Mexico an= d I'm = >trying to use >the xsort util from the xmltk package, but I found an error, I explain= here = >the details : > > I try to sort a simple document like this > > <?xml version=3D"1.0"?> > <inicio> > <sortD a=3D"2" > > <nombre>aa</nombre> > <area>4</area> > </sortD> > <sortD> > <nombre>ff</nombre> > <area>2</area> > </sortD> > <sortD> > <nombre>bb</nombre> > <area>6</area> > </sortD> > <sortD> > <nombre>ww</nombre> > <area>4</area> > </sortD> > <sortD> > <nombre>cc</nombre> > <area>24</area> > </sortD> > </inicio> > > > with the next command : xsort -c "/inicio" -e "*" -k "area/text()= " = >midocument.xml > and I get the output : <inicio> , and iterates indefinitely > > Like I can realize, this output just iterates when my document contai= ns = >attributes, > because I've typed the same command with my document w= ithout = >attributes and > the output was: > > <inicio> > <sortD> > <nombre>cc</nombre> > <area>24</area> > </sortD> > <sortD> > <nombre>ff</nombre> > <area>2</area> > </sortD> > <sortD> > <nombre>ww</nombre> > <area>4</area> > </sortD> > <sortD> > <nombre>aa</nombre> > <area>4</area> > </sortD> > <sortD> > <nombre>bb</nombre> > <area>6</area> > </sortD> > </inicio> > > I've read the xsort documentation and it has not commentaries about t= he = >attributes, > So, I'll like to know if is there a way or a command which I can use = to = >sort the > document, I use fedora Core 6,with the xmltk 2.0 , gcc 4.1.1 and I = >downloaded the > document from = >http://www.cs.washington.edu/homes/suciu/XMLTK/xmltk-v2.0.zip. > > > I'll thank you for your help, and thanks for your time. > >_________________________________________________________________ >Personnalisez votre Messenger avec Live.com = >http://www.windowslive.fr/livecom/ > > >----------------------------------------------------------------------= --- >Take Surveys. Earn Cash. Influence the Future of IT >Join SourceForge.net's Techsay panel and you'll get the chance to shar= e your >opinions on IT & business topics through brief surveys - and earn cash= >http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID= =3DDEVDEV >_______________________________________________ >Xmltk-devs mailing list >Xml...@li... >https://lists.sourceforge.net/lists/listinfo/xmltk-devs > |