Re: Is DSSSL Hard?

Subject: Re: Is DSSSL Hard?
From: James Clark <jjc@xxxxxxxxxx>
Date: Sun, 20 Apr 1997 18:52:17 +0700
At 19:07 19/04/97 -0400, Dave Raggett wrote:

>> (element BR (make paragraph-break))  
>Shouldn't this be a forced line break?

Yes, paragraph-break isn't quite right because the line immediately
following a paragraph-break is treated like the first line of a paragraph
and so will have first-line-start-indent applied to it. The paragraph-break
flow object is something of a hack, which is mainly intended to to handle
elements like DL.  Ideally what you want for DL is for each DT, DD pair to
end up in a single paragraph flow object with the DT in a line-field flow
object.  Unfortunately this is hard to achieve without using quite a lot of
the query language.  So instead you can make the entire DL a paragraph and
then put a paragraph-break flow object before each DT.  This is easy to do
without using much of the query language.

>Is there a line-break
>command in DSSSL for text flows?

Any displayed flow object causes a break.  Probably the easiest way is

(make display-group (empty-sosofo))

>> (element B (make sequence font-weight: 'bold))
>> (element STRONG (make sequence font-weight: 'extra-bold ))
>> (element I (make sequence font-posture: 'italic))
>> (element EM (make sequence font-posture: 'italic))
>> (element CITE (make sequence font-posture: 'italic))
>How do font-postures work? I assume they combine together
>but what happens if the combination is not available,

I don't understand what you mean by combine together: there's only ever one
applicable font-posture.

> how
>does the font selection work?

The DSSSL standard doesn't specify.  With Jade it's up to each backend to
implement font-selection as it sees fit.

>> (element IMG
>>   (make external-graphic
>> 	entity-system-id: (attribute-string "src")
>> 	display?: #t
>> 	space-before: 1em
>> 	space-after: 1em ))
>I think this needs to deal with the presence of width/height
>attributes, and the padding and other properties. How would
>I specify that I want the browser to show content early
>repainting it as image sizes are determined? Arena works this
>way while Netscape defers painting until image extents have
>been determined. This fine degree of control isn't possible
>with CSS, but should be with a richer style sheet mechanism.

DSSSL doesn't have a characteristic for this, but it would be easy enough to
add some for this.

The set of characteristics defined by DSSSL is by no means complete -- no
set every could be -- but DSSSL provides a clean way for new characteristics
to be added without breaking existing implementations and without
conflicting with each other.  In general the DSSSL standard avoids defining
very system-dependent characteristics like this, not because they're
unimportant, but because they will typically need to evolve at a faster rate
than is possible within the ISO standardization process.  This is exactly
the sort of thing that I hope will be tackled by the XML group when it comes
to consider style.

>> (element table
>>     (make table))
>> (element tr
>>     (make table-row))
>> (element td
>>     (make table-cell))
>I am acutely aware of the problems involved in formatting
>tables. Does DSSSL support the 2 pass mechanism for sizing
>(possibly nested) tables according to the content?

You can say that you want the column widths to be chosen automatically
according to their content.  DSSSL doesn't get into much detail about the
algorithms to be used, but allows you to point to a public identifier
specifying the algorithm.

>There are hidden problems in specifying table style due to
>that fact that its not a tree - cells have two parents a
>row, and a column, then row groups and column groups. 

DSSSL does support this: the table-column flow object is a special case for

>Perhaps the mess can be hidden in specialized flow objects.
>How does DSSSL allow me to specify a non-standard flow
>object?  I can envisage using Java to define a flow object
>with an API for driving it from DSSSL, can you enlighten
>me on how this works in practice?  Can you use a URL to
>bind to the Java code implementing the flow object? How
>does the object declare its properties?
>I have in mind some very much more sophistocated kinds of
>flow objects. What I would like is a means to declare a
>declarative interface for these objects, which are then
>realized in Java.

I would like to see this too.

In DSSSL you specify the semantics of a specialized flow object just by
giving a public identifier.  DSSSL provides no way to specify an
implementation for these semantics.  This is mainly because the nature of
the specification will be highly system-dependent.  A specialized flow
object might be associated with:

- a Java class, in a Java-based browser
- a COM class, in a Win32 browser
- a TeX macro, in a TeX based implementation

An implementation that allows users to add their own flow objects will have
some sort of catalog that associates public identifiers of flow object
classes with objects that implement them whether Java classes or COM classes
or whatever.

To be fully general, it must be possible to break these specialized flow
objects across lines or pages: designing an interface that supports this
well is, I think, a really challenging problem.

>Finally has anyone done any work on an easier syntax for DSSSL?
>I can imagine recasting it in a more familiar syntax e.g. using
>expressions with operators perhaps closer to Java, or scripting
>languages. I suspect that this can be done using a trivial front
>end that maps to the scheme syntax.

I have given some thought to this, and I know others have as well.

One possibility is to use an SGML/XML syntax.  Instead of:

(element P
  (make paragraph
        font-size: 12pt
        space-before: 2pt

you might have:

<element gi="P">
  <paragraph font-size="12pt" space-before="2pt">

Within attribute values specifying characteristics one could support some
simple expressions:

Instead of

  font-size: (+ (inherited-font-size) 2pt)

you could have


I don't think it makes sense to try to allow any arbitrary DSSSL construct
in this form.  Once you get beyond simple things, I don't the syntax is the
main barrier: I think the barrier is more that you have to approach things
functionally rather than imperatively.

So I would restrict this simpler syntax to the basics, but provide a way in
the simple syntax to call out to procedures defined in standard DSSSL syntax
and provide places in the simple syntax where procedures could be defined
using standard DSSSL syntax.

If anybody has got time on their hands, a cool project would be to design
such an SGML/XML based syntax and then to use the SGML transformation Jade
backend to transform this into standard DSSSL syntax.


Current Thread