I have a project where the main file we are dealing with is an old XML file where the creator made a very unstructured DTD (All elements are optional, and can occur 0 or more times. Even better the application which reads the file actually expects many of the values as required). I have created an XSD based upon known application requirements, and moved the unordered element lists into sequences in the XSD.
Is there an simple transformation process (e.g. XSLT) which can take an old XML file, and order its elements in a specified way so that we can use the new XSD to validate it?
Example:
<Top>
<A/>
<D/>
<B/>
<C/>
<A/>
</TOP>
INTO
<Top>
<A/>
<A/>
<B/>
<C/>
<D/>
</TOP>
Also children also might have elements which need to also be sorted into the new sequence expected ordering. Thanks!