The goal is to emit XML with namespaces aggregated at the document root, and with prefixes customised. data.xml provides {{aggregate-xmlns}} for this. Unfortunately it seems to interfere with xmlns prefix {{:attrs}}.
To reproduce first set up some test data:
`
(xml/alias-uri 'foo "http://foo", 'bar "http://bar")
(def document
(xml/element ::foo/x {}
(xml/element ::bar/y {} "...")))
`
Namespace aggregation with {{(xml/aggregate-xmlns document)}} works fine, but now I would like to customise the prefixes. Here the {{:attrs}} seem to have no effect:
`
(xml/emit-str
(-> (xml/aggregate-xmlns document)
(assoc-in [:attrs :xmlns/bar] "http://bar")
(assoc-in [:attrs :xmlns/foo] "http://foo")))
`
`
<?xml version="1.0" encoding="UTF-8"?>
<a:x xmlns:a="http://foo" xmlns:b="http://bar">
<b:y>...</b:y>
</a:x>
`
Doing {{aggregate-xmlns}} last instead throws an exception:
`
(xml/emit-str
(xml/aggregate-xmlns
(-> document
(assoc-in [:attrs :xmlns/bar] "http://bar")
(assoc-in [:attrs :xmlns/foo] "http://foo"))))
`
ExceptionInfo The xmlns binding for prefix `xmlns` is fixed to `http://www.w3.org/2000/xmlns/` clojure.core/ex-info
I could verify that the right prefixes are generated when I leave {{aggregate-xmlns}} out of the picture - but aggregation is the goal.