Re: The DSSSList Digest V3 #168

Subject: Re: The DSSSList Digest V3 #168
From: Norman Walsh <ndw@xxxxxxxxxx>
Date: Wed, 15 Sep 1999 14:05:17 -0400
/ "Weininger, Nicholas  (MN65)" <weininger_nicholas@xxxxxxxxxxxxxxxxx> was heard to say:
| I want the HTML file generator to generate file names which are prefixed
| with a prefix
| conditional on the role attribute of the root element. I looked in
| dbparam.dsl and saw that 
| %html-prefix% could be defined for the purpose of prefixing the filenames.
| So I wrote:
| (define %html-prefix%
|    (if (equal? (attribute-string "role" (sgml-root-element)) (normalize
| "foo")) "foo_" "bar_"))
| and got errors of the form "trying to use current-node when current-node not
| defined." Upon further
| investigation, of course, I found that both (sgml-root-element) and
| (normalize "foo") call (current-node).

Right. Because it isn't a function, the definition of %html-prefix%
is evaluated at compile time before the document is loaded, hence you can't
call (current-node).

There is, however, (html-prefix) in dbchunk.dsl:

(define (html-prefix nd) 
  (let ((dbhtml-prefix (inherited-dbhtml-value nd "prefix")))
    (if dbhtml-prefix

If you change it to:

(define (html-prefix nd) 
  (if (equal? (attribute-string "role" (sgml-root-element))
              (normalize "foo"))

you'll get the result you want.

You've even got the node in question at hand in this function, so
you can do more complex things if you'd like.

Yes, clearly having both %html-prefix% and (html-prefix) is
confusing.  If I was doing it again, I wouldn't. But there's
historical legacy, unfortunately. :-/


Norman Walsh <ndw@xxxxxxxxxx>      | The fundamental delusion of                 | humanity is to suppose that I am
                                   | here and you are out
                                   | there.--Yasutani Roshi

 DSSSList info and archive:

Current Thread