What is the suggested approach to a following problem, which seems to be quite common to me.
We need to generate the xml document for which we have a schema, xsd file. Our application generates the data that is to be put into the document. What kind of xsl file should be used for that? I believe there must be snippets that would be common for all such tasks, because the xsd format is constant.
For example I imagine xsd is first preprocessed to generate a data template. Then the application may use this data template to generate real data. Finally there is main processing which produces the output file. And the main processing xsl stylesheet could also be auto-generated from xsd. Of course after all the auto-processing, manual tuning of the stylesheets is done.
I see such specific common tasks:
- Treatment of
minOccurs=0
elements. They would be generated only if the data contains given element. - Default values if no data is given, but the element is obligatory.
- Controlling alternative elements with a parameter or data node.