This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
So I have a small java program that uses an XSL template to sort an incoming XML document. (only the OrderLine elements in the below example are sorted, the sort itself is working great)
Also, it is sorting based on the OrderLine attributes: IsHazmat="Y" (first) number="S-3" (second)
Input XML Document:
Output XML Document:
As you can see, the formatting is off a little making the output XML document look messy.
My goal, is to take the Input document and produce an Output document that looks exactly like the Input document except with the sort applied.
Do you guys have any tips that will make an Output XML format nicely?
Joined: Aug 03, 2013
appologies, I posted incorrect input XML doc, here is the input doc:
I have to say, I don't quite understand your transformation. It seems to be looking for OrderLine elements, and there aren't any such elements in the document you said was your input. But anyway, your problem is that you need to manage the whitespace you're sending to the output with that transformation. Here's a couple of links you might read:
Apart from possible mixed up OrderLine and mailbox (but not only, far from that, the template OrderLine cannot be corrected by only changing name back to mailbox...) this xsl:sort line cannot be correct. It should look at least like this.