Re: copy-attributes+

Subject: Re: copy-attributes+
From: Brandon Ibach <bibach@xxxxxxxxxxxxxx>
Date: Fri, 21 Apr 2000 11:26:07 -0500
Quoting Maltby, David G <david.g.maltby@xxxxxxxx>:
> In a script I have been writing transforming instances from our authoring
> DTD to our publishing DTD, I found I was forever wanting to get all the
> attributes from an element copied to the transformed element plus a few more
> derived from "the environment".  James' famous (copy-attributes) handles
> arbitrary copies very well, great for maintainability when we add new
> attributes to our author DTD. But after the copy there was no way to bolt on
> my extra attributes.  The below procedure accomplishes both goals.
> Usage:
> (element author
>   (make element gi: "pub"
>         attributes: (copy-attributes+ (list (list "new-name" "new-value")))
>     (process-children)))
   You might also try:

(element author
  (make element gi: "pub"
        attributes: (append (copy-attributes)
                            (list (list "new-name" "new-value")))

   The (copy-attributes) procedure just returns the list of lists,
identical, in structure, to your "extra" attributes, so you can simply
append your list onto the one it returns.

-Brandon :)

 DSSSList info and archive:

Current Thread