Re: sgml source filenames?

Subject: Re: sgml source filenames?
From: Brandon Ibach <bibach@xxxxxxxxxxxxxx>
Date: Tue, 9 May 2000 18:15:37 -0500
Quoting Matthias Clasen <clasen@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>:
> 
> > > <!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
> > > <!entity stdin SYSTEM "<osfd>0">
> > > ]>
> > > (define %output-dir% "&stdin;")
> > 
> > that's scary - i like it ;)
> > 
> 
> But shouldn't it be &stdout; instead of &stdin; ?
> 
   Nope, file descriptor 0 is standard input, 1 is standard output,
and 2 is standard error.  On this note, for those of you who enjoyed
this technique, you can take it even further to read in a variety of
external information.
   You could either use the shell to concatenate a series of pieces of
information, then parse them back apart in your DSSSL code, or you
could use a stylesheet like this:

<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!entity stdin SYSTEM "<osfd>0">
<!entity fd3   SYSTEM "<osfd>3">
<!entity fd4   SYSTEM "<osfd>4">
]>

<style-specification>

(declare-flow-object-class formatting-instruction
  "UNREGISTERED::James Clark//Flow Object Class::formatting-instruction")

(root (make formatting-instruction data:
            "Input: &stdin;       &fd3;       &fd4;"))

</style-specification>

with this (rather clunky) command line:

uname -m | (exec 4<&0; uname -r | (exec 3<&0;
            uname -s | jade -t sgml -d inparam.dsl test.sgml))

   This works in the bash shell (which is what most Linux
distributions have, by default, nowadays), but should work in just
about any bourne-compatible shell.
   It uses a series of subshells to redirect standard input (fd 0)
into other file descriptors.  Of course, it may just be easier to
redirect the output of the uname commands into temporary files and
have the entities reference those.

-Brandon :)


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread