Have a look at this thread on the MArkLogic Dev mailing list, which contains interesting info on that regard.