>> Since xml->sxml accepts a namespace alist I suppose it would make sense
>> to extend sxml->xml to do the same.
Attached is a minimal patch to extend "sxml->xml" such that it accepts an
optional keyword argument "namespaces" with an alist of prefixes to
URLs, analogous to "xml->sxml".
When the namespaces alist is provided, "xmlns:prefix=url" attributes are
prepended to the element's list of attributes.
;; Define SVG document with namespaces
(define the-svg "")
;; Define alist of namespaces
(define ns '((svg . "http://www.w3.org/2000/svg")
(xlink . "http://www.w3.org/1999/xlink")))
;; Convert to SXML, abbreviate namespaces according to ns alist
(define the-sxml (xml->sxml the-svg #:namespaces ns))
;; Convert back to XML
(sxml->xml the-sxml #:namespaces ns)
=>
Does this do what you want?
~~ Ricardo