Publishing a Global Configuration Hierarchy

How can I add a datasource schema to a document template that is based on a Global Configuration hierarchy so that I can get an local contributions (and their types and project areas) for that global config as well as the global config's custom attributes?
I'd like to iterate through a global configuration's hierarchy and for each contributing configuration load the RM stream and publish the artifacts in that stream.