RE: The DSSSList Digest V3 #168

Subject: RE: The DSSSList Digest V3 #168
From: "Weininger, Nicholas (MN65)" <weininger_nicholas@xxxxxxxxxxxxxxxxx>
Date: Wed, 15 Sep 1999 07:57:07 -0500
-----Original Message-----
From: owner-dssslist-digest@xxxxxxxxxxxxxxxx
Sent: Tuesday, September 14, 1999 11:30 PM
To: dssslist-digest@xxxxxxxxxxxxxxxx
Subject: The DSSSList Digest V3 #168


Date: Tue, 14 Sep 1999 15:46:51 -0400
From: Norman Walsh <ndw@xxxxxxxxxx>
Subject: Re: testing whether current-node is defined

/ "Weininger, Nicholas  (MN65)" <weininger_nicholas@xxxxxxxxxxxxxxxxx> was
heard to say:
| Is it possible to define a function which tests whether (current-node) is
| defined in the current context? In the course of extending the Modular
| DocBook Stylesheets for HTML, I'm attempting to define a function which is
| called once per chunk-- a conditional definition of the prefix for the
| filename which depends on an attribute of the root element. It appears
| for the first chunk (i.e. the chunk corresponding to the root element),
| (current-node) is not defined. If I had a way to test for that case, I
| put in a special workaround for it.

No, that's not quite it. You must be trying to call current-node before
the first chunk is defined. I do this occasionally. I can't quite follow
what you're trying to do. If you describe the functionality you want, I'll
happily point you in the right direction...

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).

Nick Weininger
Honeywell Technology Center

 DSSSList info and archive:

Current Thread