Hi i need to transform unorderd xml using xslt to the correct order as specified in an xsd schema
This may not be the best way, but it seems to work ok. I'm not sure if the order that the xs:element
's are processed is guaranteed though. Also, this is an XSLT 2.0 answer tested with Saxon-HE 9.3.0.5 in oXygen.
XML Input (modified the case of Person
to match the schema):
External XSD Schema file (schema.xsd):
XSLT 2.0 Stylesheet:
XML Output:
1234567890
The BFG
5
Hope this helps.