|
Subject: Accessing attribute names. From: Alexander Taranov <tay@xxxxxxxxxx> Date: Thu, 28 Jan 1999 11:53:02 +0300 |
Jon Haugsand writes:
> I have a DTD which is based on a simplified html 3.2 DTD, that is, it
> contains most of the familiar html tags, like <strong>, <p>, <ol> and
> so on. I did this because I am writing a document whose main purpose
> is to be publicized on the web, and I did not wish to bother with
> reinventing microstructure in such documents. (You are welcome to
> comment on this issue.)
>
> Anyway, an advantage with this approach is that my dsssl specification
> becomes simpler. For any of the html-tags I merely have the following
> dsssl statements:
>
> (element pre (pass-through))
> (element tt (pass-through))
> (element i (pass-through))
> (element b (pass-through))
> (element u (pass-through))
> (element ol (pass-through))
> (element ul (pass-through))
> (element li (pass-through))
> ...
>
> (define (pass-through)
> (make element gi: (gi)
> (make sequence
> (process-children))))
>From J.Clark's example:
(define (copy-attributes #!optional (nd (current-node)))
(let loop ((atts (named-node-list-names (attributes nd))))
(if (null? atts)
'()
(let* ((name (car atts))
(value (attribute-string name nd)))
(if value
(cons (list name value)
(loop (cdr atts)))
(loop (cdr atts)))))))
(define (pass-throgh #!optional (nd (current-node)))
(make element
gi: (gi nd)
attributes: (copy-attributes nd)))
Also you can simplify part of your stylesheet
specifying default rule
(default (pass-throgh))
which will be applied to all elements for which
explicit rules are not specified.
>
> There is one problem though. I do not get the proper attributes. So my
> question is: Is there any way to get access to all the attributes
> without knowing in advance which ones I am looking for?
>
> Thanks,
>
> --
> Jon Haugsand
> Norwegian Computing Center, <http://www.nr.no/engelsk/>
> <mailto:haugsand@xxxxx> Pho: +47 22852608 / +47 22852500,
> Fax: +47 22697660, Pb 114 Blindern, N-0314 OSLO, Norway
>
>
>
> DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Accessing attribute names., Jon Haugsand | Thread | Modes as function parameters?, Jon Haugsand |
| Accessing attribute names., Jon Haugsand | Date | Modes as function parameters?, Jon Haugsand |
| Month |