Subject: Re: Processing Siblings As Though They Were Children From: Chris Maden <crism@xxxxxxxxxxx> Date: Fri, 23 Oct 1998 18:12:33 -0400 (EDT) |
[W. Eliot Kimber] > Right, I can loop over the node list and quit when I hit the next > subhead, but how do leave the context of the level-2-container and > then have the higher-level process (the process-children of > container1) take up where I've left off and not take up with the > sibling following the SubHead, which is where I would expect it to > resume, as the subordinate process-node-list won't, as far as I > know, affect the process-children processing. The trick is that within the context of each <SubHead>, you only process the appropriate following nodes. Let's see... (element containter1 (make element gi: "level-1-container")) (element SubHead (make element gi: "level-2-container" (make element gi: "level-2-title" (process-children)) (process-node-list (get-child-sibs)))) (define (get-child-sibs #!optional (snl (current-node))) (let* ((raw-list (rsiblings snl)) (last-node (node-list-last raw-list))) (let gcs-loop ((test-node (node-list-first raw-list)) (list-index 0)) (node-list (if (equal? (gi test-node) "SubHead") (empty-node-list) test-node) (if (node-list=? test-node last-node) (empty-node-list) (gcs-loop (node-list-rest raw-list) (+ list-index 1))))))) I haven't debugged this, and it's a little sloppy, but I should be going home; I hope this shows the idea. -Chris -- <!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN"> <!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN" "<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487 <USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek> DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Processing Siblings As Though T, W. Eliot Kimber | Thread | rtf function 'mirror-margins', Webb Alex |
Re: Processing Siblings As Though T, W. Eliot Kimber | Date | SGML Where are you, David_A Cobb |
Month |