On Tue, Aug 25, 2009 at 15:44, Meikel Brandmeyer<m...@kotka.de> wrote:
>
> Hi,
>
> here's my try using for:
>
>    (defn xmlns-attr?
>      [k]
>      (or (= k :xmlns) (.startsWith (name k) "xmlns:")))
>
>    (defn ns-assoc-2
>      [attrs xmlns-map]
>      (into xmlns-map
>            (for [[k v] :when (xmlns-attr? k)]
>              [(-> k name (.replaceAll "xmlns:" "") (.replaceAll
> "xmlns" "")) v])))
>
> The second replace lokks a bit suspicious: if k is equal to :xmlns
> this will result in the key being the empty string. Is this intended?

Yes, that's precisely the intent. ("...Consider the prefix to be the
empty string in for attrs declaring a default namespace.")

// Ben

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to