If I'd be to do something similar (actually, I do) I'd use an XML (document) backend, like eXist or BaseX along with XSLT, XQuery and REST.