Subject: RE: Sorted table of contents? From: Avi Kivity <Avi@xxxxxxxxxxxxx> Date: Mon, 26 Apr 1999 18:05:29 +0200 |
On Monday, April 26, 1999 14:12, De-Wille_Eberhard [SMTP:eberhard.de-wille@xxxxxxxxxxxxx] wrote: > Sorted table of contents? > > I have a data table with a large number of "datatableelement". The > each > "variablename" > appears in the table of contents produced by a special mode. How do > I get > them sorted > in alpabetical order? > > <datatable> > <datatableelement href="v3130"> > <variablenumber>3130</variablenumber> > <variablename>iSwitch</variablename> > <dataclass></dataclass> > . . . > </datatableelement> > <datatableelement href="v3131"> > <variablenumber>3131</variablenumber> > <variablename>iSwitch2</variablename> > <dataclass></dataclass> > . . . > </datatableelement> > Use (node-list->list) to convert the children of <datatable> to a scheme list (as opposed to a node-list). Then apply the (sort) procedure (downloadable from mulberry's site). You need to supply a comparison function which defines the ordering. Something like (define (dataelement<=? de1 de2) (string<=? (dataelement->string de1) (dataelement->string de2)) ) (define (dataelement->string de) (data (select-elements (children de) "VARIABLENAME")) ) Finally, apply (list->nodelist) to the result, and (process-node-list) with your favorite mode. In short: (mode toc (element datatable (process-node-list (list->node-list (sort dataelement<=? (node-list->list (children (current-node))))) ) ) ) The (string|char)(-ci)?(([<>]=?)|=)\? function family is not implemented by Jade (except for string=?), but I have a patch which does that which I can post. Hope this helps, Avi --- "The only words which have meaning are the last ones spoken" DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Sorted table of contents?, De-Wille_Eberhard | Thread | RE: Sorted table of contents?, Peter Nilsson |
Sorted table of contents?, De-Wille_Eberhard | Date | copying of selected attributes, Steffen Heinrich |
Month |