Re: Root of a not-yet-parsed document?

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
  • Re: Root of a not-yet-parsed document?
    • Chris Maden - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id BAA07936Fri, 1 May 1998 01:03:53 -0400 (EDT)
      • James Clark - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id HAA16576Fri, 1 May 1998 07:38:28 -0400 (EDT)
      • Paul Prescod - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id AAA05592Sat, 2 May 1998 00:24:37 -0400 (EDT) <=