some people claim that what was done with a cocoon 8 or 10 years ago is now best done with REST. (search for REST or calm with goolge)
Combined with XProc, its very powerful, but can be lightweight. I think calabash is the best option for XProc, but there are others. (One example may exist db, but probably not easy.)
Nonetheless,
for a very small project can be crowded. but you can always use XProc and REST in later projects.
What you are describing can be done using java, python or perl. (lightweight but not frame ...)
source share