attributes in SGML to SGML

Subject: attributes in SGML to SGML
From: Jany Quintard <quintard.j@xxxxxx>
Date: Wed, 21 Jul 1999 18:39:50 +0200 (MEST)
I am having a little problem with the conversion of attributes from SGML
DTD1 to SGML DTD2
Suppose you have DTD1
<Elem AAAA="val1" BBBB="val2">
...
which becomes
<element xxxx="val1" yyyy="val2">
...
James Clark doc says :
attributes 
   This specifies the element's attributes as a list of lists
   each of which consists of exactly two
   strings, the first specifying the attribute name and the
   second the attribute value. It defaults to the empty list.

So this is easy to convert with :
(element Elem
    (make element gi: "element"
          attributes: (list (list "xxxx" (attribute-string "AAAA"))
                            (list "yyyy" (attribute-string "BBBB")))
    (process-children)))

But when AAAA or BBBB is not present, I get an error.
So. I tried to condition the list with things like :

attributes: 
  (list 
    (if (attribute-string "AAAA") (list "xxxx" (attribute-string "AAAA"))
                                  list_empty) 
    (if (attribute-string "BBBB") (list "yyyy" (attribute-string "BBBB"))
                                  list_empty))

The problem is what to use for list_empty ?
() gives an error 
( "" "" ) works but seems rather silly in any output other than HTML.

Does anyone know of a better solution ?

TIA. Jany.


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread