XRX/Content Routing
From Wikibooks, the open-content textbooks collection
< XRX
[edit] Motivation
You want all your XForms application to us a single save.xq submission. This makes it easier to autogenerate XForms applications and makes it easier to update insert and update operations in a central location.
[edit] Method
Create a single save XQuery that inspects the content of a POST operation. Use the name of the root element or other content patterns within the submitted XML file to process the incoming saved documents. Use a table-driven rule engine to determine if the incoming XML document is a new record (and requires a new ID assigned), an update (and requires versioning) or other business rules.