Subject: Re: Root of a not-yet-parsed document? From: Paul Prescod <papresco@xxxxxxxxxxxxxxxx> Date: Fri, 01 May 1998 09:23:56 -0400 |
Chris Maden wrote: > > So that's the practical answer. The more interesting, but not > immediately useful, theoretical question is: What if I couldn't? What > if I needed to access some property of the root node of the document > outside of an node context? What would I do? How could you? You can't start outputting anything until the tree traversal starts. I handle it this way. If I want: (define doc-title (string-append "SomeText: " (attribute-string "TITLE" (current-root)))) So that I can use it this way: (make element gi: "TITLE" doc-title) Then I just change it to: (define (doc-title) (string-append "SomeText: " (attribute-string "TITLE" (current-root)))) (make element gi: "TITLE" (doc-title)) That delays evaluation until the right information is available. As someone else pointed out, in lazy languages this would not be required...it would only look for the current-root when it was really needed to output something. Paul Prescod - http://itrc.uwaterloo.ca/~papresco "Perpetually obsolescing and thus losing all data and programs every 10 years (the current pattern) is no way to run an information economy or a civilization." - Stewart Brand, founder of the Whole Earth Catalog http://www.wired.com/news/news/culture/story/10124.html DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Root of a not-yet-parsed docume, James Clark | Thread | RE: Allowed characters in element i, Wroth, Mark |
Administrivia -changed, DSSSList Owner | Date | ANNOUNCEMENT: SGML/DSSSL Presentati, G. Ken Holman |
Month |