|
Subject: copying of selected attributes From: "Steffen Heinrich" <heinrich@xxxxxxxxxxxx> Date: Tue, 27 Apr 1999 15:15:57 +0100 |
Hi,
I'm doing some SGML transformation into HTML and have difficulties to
accomplish selective attribute copying, even after I spent some time
trying (yet not succeeding) to understand the (copy-attributes)
function. (list, cons, car and cdr startet to loop in my brain.)
Here is the problem:
The source DTD defines a TABLE element with almost the same attlist
like the target DTD (HTML). All attributes are implied and the
sources additional ID-attribute (optional) has to be transformed
into an <A>-element with respective NAME-attribute.
So, all but the ID-attribute have to be copied to the target TABLE-
element.
Yet the following code produces errors on any lacking values, of
course:
(element TABLE
(make element gi:"P"
(if (attribute-string "ID")
(make element gi:"A"
attributes: (list (list "NAME" (attribute-string "ID")))
(make element gi:"TABLE"
attributes: (list
(list "ALIGN" (attribute-string "ALIGN"))
(list "WIDTH" (attribute-string "WIDTH"))
(list "BORDER" (attribute-string "BORDER"))
(list "CELLSPACING" (attribute-string "CELLSPACING"))
(list "CELLPADDING" (attribute-string "CELLPADDING")))
(process-children)))
(make element gi:"TABLE"
attributes: (list
(list "ALIGN" (attribute-string "ALIGN"))
(list "WIDTH" (attribute-string "WIDTH"))
(list "BORDER" (attribute-string "BORDER"))
(list "CELLSPACING" (attribute-string "CELLSPACING"))
(list "CELLPADDING" (attribute-string "CELLPADDING")))
(process-children)))))
How can this be done properly, and maybe more economically?
Thank you,
steffen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steffen Heinrich, Peschkestr.14, D-12161 Berlin
Tel (0)49-030- 851 86 53, heinrich@xxxxxxxxxxxx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: Sorted table of contents?, Peter Nilsson | Thread | Re: copying of selected attributes, Norman Walsh |
| RE: Sorted table of contents?, Avi Kivity | Date | Re: copying of selected attributes, Norman Walsh |
| Month |