SGML macros using DSSSL expressions

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">
	...
	&copyStatement;

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
		x CDATA #REQUIRED
		y NUMBER #REQUIRED
		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.

Dan

Received on Saturday, 24 February 1996 09:40:10 UTC