Subject: Re: Finding the root element From: ht@xxxxxxxxxxxxxxx (Henry S. Thompson) Date: 29 Oct 1998 15:32:22 +0000 |
Daniel Speck <dspeck@xxxxxxx> writes: > W. Eliot Kimber wrote: > > > At 07:38 AM 10/29/98 -0500, Norman Walsh wrote: > > >Apologies if I asked this once before... > > > > > >Is it possible to find the node of the document element outside > > >the context of another element? Specifically, can I find it in > > >a function called from (root)? > > > > This should work from any node in the grove: > > > > (define (docelem node) > > (node-propety 'document-element > > (node-property 'grove-root node))) > > > > So with what argument what do you call this function in the (root ...) > construction rule? (current-node) isn't defined in the root construction > rule. (process-children) is defined in the standard such that it behaves > differently (or the definition of "children" is different, I'm not sure > which) in the (root ...) construction rule. I've had this problem myself > and I usually just end up looking for the document element while processing > some element. Any ideas? > Actually, undocumented feature of Jade is that (current-node) does in fact return the root inside a root rule. So the following works: (root (literal (debug (node-property 'gi (node-property 'document-element (current-node)))))) ht -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@xxxxxxxxxxxxxxx URL: http://www.ltg.ed.ac.uk/~ht/ DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Finding the root element, Daniel Speck | Thread | Re: Finding the root element, G. Ken Holman |
Re: Finding the root element, Daniel Speck | Date | Re: Finding the root element, G. Ken Holman |
Month |