Re: (dsssl) DSSSL engines for ASCII output

Subject: Re: (dsssl) DSSSL engines for ASCII output
From: "John R. Sheets" <dusk@xxxxxxxxxxxxx>
Date: Thu, 3 May 2001 10:02:33 -0500
On Apr 18, 2001, "John R. Sheets" <dusk@xxxxxxxxxxxxx> wrote:
> 
> The one thing I couldn't get to work is child node processing inside
> those paragraphs.  I used (data (current-node)) to grab the <para>
> contents, which slurps up child text without processing it.  For first
> time usage of names in screenplays, you want to display them in ALL
> CAPS.  I got this working with the tex backend, but can't figure out
> how to capitalize things before (data ...) grabs it.  Would that have
> to take place in the transformation phase, or would it be possible to
> hack something together in the style phase?  Could I force processing
> of (PARA NAME) inside the construction rule of (PARA), _before_ the
> call to (data ...)?

FYI, I finally got this working.  I ended up using a modification of
the (ndl->string) sample procedure in grove.dsl, in the tutorial by
Markus Reinsch, at:

  http://heuss.techfak.uni-bielefeld.de/www/mreinsch/dsssl/

It iterates through the (current-node) list manually.  Here's what it
looks like:

;; Parse through paragraph node-list and manually capitalize
;; sub-elements.
(define (process-para #!optional (ndl (current-node)))
  (cond
   ((not ndl) #f)
   ((node-list-empty? ndl) "")
   (else
    (let ((node (node-list-first ndl)))
      (string-append
       (case (node-property 'class-name node)
         ;; Process child elements
         ((element)
          (process-para (node-property 'content node)))
         ;; Process character data
         ((data-char)
          (if (or
               ;; Always capitalize embedded NAME and SOUND elements
               (ancestor-child-number "NAME" node)
               (ancestor-child-number "SOUND" node)
              (case-fold-up (data node))
              (data node))
          ))
       (process-para (node-list-rest ndl)))
      ))))

Works great!  Thanks Markus!

John

-- 
dusk@xxxxxxxxxxxxx                            http://www.gnome.org
jsheets@xxxxxxxxxxxxxxx                  http://www.worldforge.org
jsheets@xxxxxxxxxxxxxxxxxxxxx     http://openbooks.sourceforge.net
               http://advogato.org/person/jsheets

                   Writing GNOME Applications
          http://www.aw.com/cseng/titles/0-201-65791-0/

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

Current Thread