SGML macros using DSSSL expressions

Daniel W. Connolly (
Sat, 24 Feb 1996 09:40:09 -0500

Message-Id: <>
Subject: SGML macros using DSSSL expressions
Date: Sat, 24 Feb 1996 09:40:09 -0500
From: "Daniel W. Connolly" <>

A bunch of people have been asking for macros in HTML, ala cpp:

	#define copyStatement "Copyright (c) 1996, all rights reserved"

The obvious thing is:

	<!entity copyStatement "Copyright (c) 1996, all rights reserved">

But that's not all that useful. Folks really want parameters:

	#define temp(x,y) "The temperature in #x is #y."

and expressions:

	#define bal(amt, absamt) (amt < 0 ? "You owe us #absamt." : "We owe you #absamt.")

I was thinking about expressing such things ala:

	<!element temp - O EMPTY>
	<!attlist temp
		macro CDATA '(sequence "The temperature in" x "is" y ".")'


	<temp x="Kansas City" y="70">

or maybe just processing instructions:

	<?dsssl (define (temp x y) (sequence "The temperature in " x " is " y ".")>


	<?dsssl (temp "Kansas City" "70")>

Hmmm... web browsers don't parse processing instructions well enough
to hide them today.  Grumble.

The other thing is that some folks want to be able to use expressions as
attribute values. I thought about defining a new media type, say text/ehtml,
where the lexical syntax of HTML is extended to include the lisp backquote syntax:

	<h2>Section `,(set! counter (+ 1 counter))</h2>

Anyway... just a few ideas I wanted to jot down before I forgot.