I would like to be able to create a hybrid document in tamino using some natively stored XML and some data already existing in a relational database (I don’t really care which one) using a mapout server extension function. I need to be able to pass parameter containing the primary key value (to create a select statment) to the mapout function( the primary key value is contained in the xml document). Does anybody have a simple example that would show how to do this?
Try the following if the primary-key-node is the same as the node for the SQL data:
Relate a Map-In Server Extension to the node with the primary key information. Let the function store its value -preferrably to the nodeinfo parameter, which ist the 4th of a Map-In fct. Upon document composition the related Map-Out fct will receive this value as a parameter and may produce the select statement with it.
If primary-key-node and SQL-data-node differ, You might want to store the primary key value elsewhere (in Tamino) and retrieve it upon document composition. But keep in mind that the Map-Out fct is called only, when there had been a successful Map-In call on this node while processing the document.
Suggestion in this case: Store the primary key using Map-In fct1 in Tamino, Store the (spaceholder) SQL-data-node unsing fct2, which queries the primary key and puts it into ist node-info parameter. Document compositon as described.
You may even store the whole SQL Query statement in the node-info parameter, asuming that doc-comp (query) is performance critical but processing (insert) is not.
Note: Map-Out fcts are currently available in X-Query only.