]> Property value expressions for SGML/HTML style sheets

Property value expressions for SGML/HTML style sheets

In many cases, the value of a property will be a simple value, such as `red', `20', or `true'. But sometimes the value must be computed in some way, based on other properties or SGML attributes.

The style language should therefore allow the value to be specified with an expression, consisting of constants, variables, operators, and perhaps some special functions. The values themselves can be of several types, depending on the property.

Types of values


This is a list of the variables that can be used in an expression:


Operations on values include the following:

`Interpolate' is a function of three arguments. It may be useful in situations like this (notation borrowed from Metafont): (AGE/7days)[white, yellow], which means: white + (AGE/7days)(yellow - white)


Operations can be written in a mixture of the usual infix notation and functional notation: 7 - 2 * max(4, 3), or in S-expressions: (- 7 (* 2 (max 4 3))), or in a pure functional notation: sub(7, prod(2, max(4, 3))). The mixture is easiest to read.

Attributes must be distinguished from symbols with the help of punctuation. Possibilities include: !HREF!, ${HREF}, $(HREF), $HREF, !HREF, (attr "HREF"), (attr 'HREF), attr(HREF), attr("HREF").

Meta variables can be written with similar punctuation, or they can be written without any puntuation, taking up a part of the name space for symbols.

Counters can be numbered (if there are more than 2), or given symbolic names (counter, extracounter).

Inherited property values can be distinguished from attributes and meta-variables with yet other punctuation.

(Back) to style sheet overview

Bert Bos, 11 May 1995