Many problems in information integration rely on specifications, called schema mappings, that model the relationships between schémas. Schema mappings for both relational and nested data are well-known. In this work, we present a new formalism for schema mapping that ex-tends these existing formalisms in two significant ways. First, our nested mappings allow for nesting and correlation of mappings. This results in a natural programming paradigm that often yields more accurate specifications. In particular, we show that nested mappings can naturally preserve correlations among data that existing mapping formalisms cannot. We also show that using nested mappings for pur-Poses of exchanging data from a source to a target will result in less redundancy in the target data. The second extension to the mapping formalism is the ability to express, in a declarative way, grouping and data merging semantics. This semantics can be easily changed and customized to the integration task at hand. We present a new algorithm for the automatic generation of nested mappings from schema matchings (that is, simple element-to-element correspondences beween schemas). We have implemented this algorithm, along with algorithms for the generation of transformation queries (e.g., XQuery) ased on the nested mapping specification. We show that the generation algorithms scale well to large, highly nested schemas. We also show that using nested mappings in data exchange can drastically re-uce the execution cost of producing a target instance, particularly over large data sources, and can also dramatically improve the qual-ity of the generated data.