Re: Using entity ids to generate attributes for HREF in html output.

Subject: Re: Using entity ids to generate attributes for HREF in html output.
From: Brandon Ibach <bibach@xxxxxxxxxxxxxx>
Date: Mon, 6 Dec 1999 10:37:07 -0600
Quoting Peter Bennett <peter.bennett@xxxxxxxxxxxxxxxx>:
> So I try to produce a hyperlink using the activity ID,
> (element activity
> (make sequence
> (make element
> 	gi: "A"
> 		attributes: '(("HREF" (attribute-string "id"))
> 		(process-first-descendant 'activitytitle))
> (make entity
> 	system-id: (attribute-string "id"))))
> But then I get the following error message:
> invalid value for "attributes" characteristic.
   This is an essential Scheme issue: quoting.  By placing the single
quote before the argument to attributes:, you're telling Scheme to not
evaluate *anything* within that argument.  Thus, the value of your
HREF here is a list containing the symbol "attribute-string" and the
string "id".
   There are two ways around this.  First, you can construct your
argument using the (list) primitive:
	(list (list "HREF" (attribute-string "id")))
Or, you can use quasiquoting, which works much the same way as regular
quoting, except it allows you to "unquote" certain elements in your
expression, so that they will be evaluated.  This can be a
terrifically confusing construct, but once you understand it, it's
quite powerful.  Here's how you'd do it:
	`(("HREF" ,(attribute-string "id")))
   Quasiquoting is started with a backquote, and parts of the
expression are unquoted with a comma.  There's a full (though not
necessarily clear) description of this in Chapter 8 of the DSSSL spec.
   On another note, you also appear to be missing a closing parens at
the end of this expression in your listing above.

-Brandon :)

 DSSSList info and archive:

Current Thread