Re: Processing Siblings As Though They Were Children

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-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)
                        (if (node-list=? test-node
                            (gcs-loop (node-list-rest raw-list)
                                      (+ list-index

I haven't debugged this, and it's a little sloppy, but I should be
going home; I hope this shows the idea.

<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL> <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>

 DSSSList info and archive:

Current Thread