OpenJade

Experimental DSSSL extensions

Contents

Introduction

This document descibes some experimental extensions to DSSSL that are implemented in OpenJade. These are designed so that, with these extensions, DSSSL provides a superset of the semantics XSL for flow object tree construction. OpenJade has a -2 option that enables these extensions.

These extensions do not include the additional flow object classes and characteristics that will be needed for XSL; in particular they do not include the HTML/CSS flow object classes.

UpBack to top 

Imperative programming

The following features come from R4RS:

  • assignment (set!) expressions (with restrictions)
  • vectors (with restrictions)
  • call-with-current-continuation (with restrictions)
  • begin expressions
  • multiple expressions in procedure bodies, cond clauses
  • alternate in if expression optional
  • it is not an error when nothing matches in cond or case expression
  • eqv? and memv procedures; these behave as specified in R4RS for vectors but behave the same as equal? for strings and lists

    This is so that case expressions can use eqv? as required by R4RS without breaking compatibility with existing DSSSL code which assumes case expressions with strings and lists will use equal?. R4RS specifies that eqv? should return #t when its arguments "should normally be regarded as the same object". R4RS treats strings and lists as mutable and its specification of eqv? for strings and lists is consistent with this. So long as DSSSL keeps strings and lists as immutable data-types with value semantics, it is more consistent to define eqv? to behave like equal? for them.

The use of side-effects is restricted. Assignment to top-level variables is not allowed. There is also the concept that a memory location can be read-only. When a memory location is read-only, it is an error to change that location. An memory location can be recursively marked as read-only; this means that the memory location along with all memory locations reachable from that memory location become read-only. A memory location is recursively marked as read-only when:

  • an object stored in that memory location is bound to a top-level variable
  • an expression specifying a characteristic is evaluated and a variable that names that memory location occurs free in that expression; for example, this would be an error:
    
    (let ((x 10pt))
      (make paragraph
        font-size: (begin (set! x 12pt) x)))
    
  • an object stored in that memory location is returned by a (inherited-C) or (actual-C) procedure
  • an object stored in that memory location is passed as the first argument to the node-list-map procedure

A continuation created with call-with-current-continuation cannot be called if it is read-only, and can only be used to return to a stack frame in the current call chain (sometimes referred to as upwards only).

There's a void data type with a single value which can be written as #v. This is returned by cond, case and if expressions which don't match.

UpBack to top 

Style rules

When a construction rule has a keyword argument list instead of a construct expression it is treated as a style rule. For example,


(element H1
  font-size: 14pt
  font-weight: 'bold)

The keyword argument list can include a use: keyword just as with style expressions. See the XSL proposal for the semantics of style rules.

UpBack to top 

Extended patterns

The syntax for element patterns is extended. These provide provide a superset of the semantics of XSL patterns. They are allowed both in element construction rules and in contexts where a match-element? pattern is currently allowed (eg select-elements, process-matching-children, process-first-descendant).

A pattern is either a single gi or a list. A list consists of a sequence of gis, where each gi can be followed by one or more keyword/value pairs (where the value is always a single datum). A gi can be #t, a string or a symbol. The following keywords are allowed:

id:
followed by a string or symbol
class:
followed by a string or symbol
repeat:
followed by one of the symbols *,