XPATH/XSLT like access to Clojure data structures?

460 views
Skip to first unread message

Henrik Heine

unread,
Feb 27, 2015, 7:53:51 AM2/27/15
to clo...@googlegroups.com
Hi folks,

do you know of a lib that let's you navigate around nested Clojure structures like XPATH does on XML?
I'm aware of core.match, walk and zippers. But has anyone put those together in order to produce an API
that gives you XPATH/XSLT?

- Henrik

Michael Griffiths

unread,
Feb 27, 2015, 8:15:32 AM2/27/15
to clo...@googlegroups.com
Maybe clojure.data.zip.xml (in clojure.data.zip) is close to what you're looking for? http://clojure.github.io/data.zip/#clojure.data.zip.xml

Henrik Heine

unread,
Feb 27, 2015, 9:08:19 AM2/27/15
to clo...@googlegroups.com
This seems to work on XML/JDOM - right?

I'm looking for something that works on Clojure data structures. And I wouldn't like to go from Clojure data structures->XML/JDOM only to do the transformation on XML/JDOM and then back to Clojure data structures.

Any idea?

Michael Griffiths

unread,
Feb 27, 2015, 10:14:13 AM2/27/15
to clo...@googlegroups.com
Sorry, please ignore me. I misread your post entirely :-). I think clojure.zip and clojure.data.zip (not the XML parts) will get you partway to where you want, but I do not know of any XPATH-like API over the top of them.

Christopher Small

unread,
Feb 27, 2015, 1:12:38 PM2/27/15
to clo...@googlegroups.com
Interesting idea... Haven't seen anything myself. I think that would be useful though! Someone should build it if it doesn't exist yet.

Jeremy Heiler

unread,
Feb 27, 2015, 1:32:51 PM2/27/15
to clo...@googlegroups.com
I have written a library that wraps the built in JDK XPath functionality. It's not complete, because it doesn't deal with namespaces or custom functions. Regardless, it worked for what I needed it for. If you need a certain feature, I'd be happy to work it in or accept patches.

henrik42

unread,
Feb 28, 2015, 4:40:46 AM2/28/15
to clo...@googlegroups.com
Thanks. But I'm looking for something that may
(a) clojure.walk a clojure data structure
(b) let me use clojure.match rules to say what I'm interested in (like xpath does) and
(c) use zippers to 'mutate'.
- Henrik

Jeremy Heiler

unread,
Feb 28, 2015, 6:08:31 PM2/28/15
to clo...@googlegroups.com
Sorry, I misread your email.

Ivan L

unread,
Feb 28, 2015, 7:23:22 PM2/28/15
to clo...@googlegroups.com
instar and balagan are two libs that are in this space. ive been looking for something like youre describing as well - i think something like xslt would be wondrous.

Philippe Guillebert

unread,
Mar 1, 2015, 9:17:47 AM3/1/15
to clo...@googlegroups.com

Hi

Looks like the latest announcement from Nathan Marz (specter)  may be of use 😀

Philippe

Reply all
Reply to author
Forward
0 new messages