The transformation of source document follows these rules:
- First, source document must be split to independent nametrees (nametree is a maximal coherent subtree of a XML node tree in which each element node belongs to same namespace. Element may contain attributes from another namespaces).
- Each nametree contains special processing instructions 'generefs' (<?generef id?>) marking places where another nametrees' root elements were placed before the document was split.
- Root nametree is transformed automatically, other nametrees are transformed when generefs are found in transformation chain output of the root nametree. It is therefore important for exporters to transfer generefs.
- Each nametree propagates through the transform graph, transforming in each exporter. If there is no exporter left the nametree is given to the coordinator to preprocess it (this is done by invoking coordinator's partialResultEvent() method. The output of this method is the output of the transformation chain.
- If coordinator's partialResultEvent() produces stream or object result then generefs are lost and no child nametree is processed.
- If an exporter produces document with multiple namespaces then the document is split into nametrees and processed as described above.
- Finally, after all relevant nametrees have been processed, the result document is put together and given to the coordinator.