|
Subject: returning a nodelist From: Mike Sosteric <mikes@xxxxxxxxxxxxx> Date: Thu, 10 Dec 1998 10:02:40 -0700 (Mountain Standard Time) |
(with thanks to brandon ibach)
Okay here is the problem. I want to be able to navigate to a named
nodelist in a document grove. The assumption is that the nodelist is
a list of nodes and not a snl. The intent is to return this nodelist and
then call another function to borrow down further until I find the right element
(i've tried using (parent, etc) but hte document structure seems to complex and i get
(node-list-first (node-list-rest (children (children (node-list-first (parent nl))))))))
which still doesn't get me where I want to go. and the line is getting too long, and
this isn't generic enough for my tastes.
anyway, so steal a procedure from brandon ibach, modify it, and get
the following code which is supposed to return a nd. if i do
(gi nd), i can verify that I'm at the right location.
(define (named-nl node name)
(let* ((gr (node-property 'grove-root node))
(de (node-property 'document-element gr)))
(let loop ((nl (node-property 'content de)))
(if (node-list-empty? nl) #f
(let ((nd (node-list-first nl)))
(or (and (equal? 'element (node-property 'class-name nd))
(if (string=? name (gi nd))
(nd) ; <<<<----return the nodelist
(loop (node-property 'content nd))))
(loop (node-list-rest nl))))))))
but when I try to return just (nd) I get
C:\USR\LOCAL\JADE1.2\JADE.EXE:tortf.dsl:45:25:E: call of non-function object "#<
unknown object 10629356>"
which suggests to my untrained eye that JADE is interpreting nd as a function and
finding that it isn't one.
So my question is, how do I return a nodelist so I can process it further?
mike
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: Page numbers, margn spaces and , James Clark | Thread | Re: returning a nodelist, Norman Walsh |
| Re: 3 questions, J-P Theberge | Date | Re: Page numbers, margn spaces and , Tony Graham |
| Month |