Subject: Re: Problems with attributes. From: Reyes <reyes.garcia@xxxxxxxxxx> Date: Thu, 21 Oct 1999 14:31:50 +0200 |
At 15:53 20.10.99 -0500, you wrote: Hi! I have understood the problem with the list. Before to recieve this message I have used (append list-att (list (attribute-string att (node-list-first nl)))) and this works good [ like (cons ...) I think ]. > Here, we just gather the list of "son" elements, filter it down >based on the "att" values, and construct a list of the ancestor "tag" >nodes for those which are selected. This may need some modification >based on what, exactly, you want for results. For instance, the same >"tag" (WERK) node could show up more than once in the result, if it >contained more than one unique "son" (SONW) element. I have thougth in this problem, I have try to solve using (node-list-contains? ...) : (define (node-list-contains? nl snl) (node-list-reduce nl (lambda (result i) (or result (node-list=? snl i))) #f)) but gave me an error in (node-list-reduce ...) [ didn't understand ]. Then I have used (node-list=? ...). The final procedure is the next: (define (unique-son node tag son att) (let loop ((result (empty-node-list)) (nl (select-elements (descendants node) son)) (list-att '())) (if (node-list-empty? nl) result (let* ((n (node-list-first nl)) (att-value (attribute-string att n))) (if (member att-value list-att) (loop result (node-list-rest nl) list-att) (if (node-list=? (node-list-first result) (ancestor tag n)) (loop result (node-list-rest nl) (append list-att (list att-value))) (loop (node-list result (ancestor tag n)) (node-list-rest nl) (append list-att (list att-value))))))))) This works good and "my head is on my shoulders", thank goodness!! :-) Thanks for all and "see you later", Reyes :-) DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Problems with attributes., Brandon Ibach | Thread | Re: Problems with attributes., Brandon Ibach |
CALS Table to HTML Table, Maltby, David G | Date | RE: Hopefully simple -- include a q, DPawson |
Month |