Skip to main content

XML to XML using XSLT

1 reply [Last post]
Joined: 2007-04-13

Am XSLT newbie. Need to read XML file, swap the order of two complex objects, and write XML file. If I understand the XSLT capabilities correctly, this is not the kind of transformation that XSLT is designed to do. I understand that XSLT can extract the values of XML elements, and the programmer can insert those values into the output XML. But I really need to copy whole XML element declarations, meaning tags, attributes, etc., not just the values. Can XSLT do this?

The genesis of this problem is JAXB's apparent refusal to enforce a specification in an input XSD. Elements are coming out randomly, in apparent disregard for the specification. Posted a message on this point some time ago and saw no replies.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-05-29

If I understand your question correctly, you should look at the



If your input is:



applying the following XSLT transform:

would result in



However, it sounds like this is not the core of the problem. I haven't used JAXB (much / recently), so I can't comment on the random ordering.