(dsssl) newbie coding question

Subject: (dsssl) newbie coding question
From: Trent Shipley <tcshipley@xxxxxxxxxxxxx>
Date: Mon, 1 Oct 2001 15:08:44 -0700


I have started working on my dissertation using TEI and the DSSSL
stylesheet for JADE (now openjade) indicated below.

==========

;; DSSSL style sheet for TEI-Lite print output
;;
;; Started 1996.07.27
;; This version 1996.12.10; V1.0
;;
;; Richard Light

==========

Light has the following style definition:

(define p-style
  (style
   font-size: *bf-size*
   line-spacing: (* *bf-size* *line-spacing-factor*)))

That he uses repeatedly, eg:

(define (STANDARD-PARAGRAPH)
 (make paragraph
       use: p-style
        ...))

However, I want to have different formatting based on context.  For
example, notes should be one font size smaller and single spaced.

=========

Unfortunately constructs like the below dont work.  Depending on the
variation that I try the OpenJade parser says there is no current 
node to provide a context, or the function fails to return a value of
type style, or it an object having a given id number can't be found. 

(define p-style-prime
  (cond ((has-ancestor "NOTE")(note-p-style))
        (else (standard-p-style))))

(define standard-p-style
  (style
   font-size: *bf-size*
   line-spacing: (* *bf-size* *line-spacing-factor*)))

(define note-p-style
  (style
   font-size: (- *bf-size* 1pt)
   line-spacing: *bf-size*))

==========

I would like to reuse this decision process as much as possible
instead of having to have near duplicate code based on a common
template that eliminates the need for the sort of repitition indicated below.

PICK-A-PARAGRAPH
   BASE-CONTEXT-PARAGRAPH
   NOTE-CONTEX-PARAGRAPH

PICK-A-LIST

PICK-A-TABLE

ETC.

=========

Ideally the cast would be polymorphic so that a call to
p-style-prime uses the current (nodal) context.  However, a call with
the form (p-style-prime this-node) would be fine provided someone can
tell me how to name "this-node".

(p-style-prime (and a long list of parameters)) would not be
satisfactory.

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

Current Thread