QUESTION: How can I take in an element with attributes from an XML and output the same element and attributes while preserving the order of those attributes?

The following code will parse and XML document and generate (practically) unchanged output. However, all attributes are ordered a-z
Example: The following element
<work_item_type work_item_db_site="0000000000000000" work_item_db_id="0" work_item_type_code="3" user_tag_ident="Step" name="Work Step" gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_site="0000000000000000" last_upd_db_id="0" rstat_type_code="1">
</work_item_type>

is output as:
<work_item_type gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_id="0" last_upd_db_site="0000000000000000" name="Work Step" rstat_type_code="1" user_tag_ident="Step" work_item_db_id="0" work_item_db_site="0000000000000000" work_item_type_code="3">
</work_item_type>

As you may notice, there is no difference in these besides order of the attributes!

I am convened that the problem is not in the stylesheet.xslt but if you are not then it is posted bellow.

Please, someone help me out with this! I have a feeling the solution is simple :D

Java Code:
public class CRISbuilder {
    private static XPathFactory xfactory = XPathFactory.newInstance();
    private static XPath xpath = xfactory.newXPath();
    private Document INPUT;
    private DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

    CRISbuilder(String filename) throws ParserConfigurationException, SAXException, IOException{
	File file = new File(filename);
	this.factory.setNamespaceAware(false);
	DocumentBuilder builder = factory.newDocumentBuilder();
	this.INPUT = builder.parse(file);
    }

    /***********************************************************************************
     * OutputFile(filename)
     * Will output the contents of the DOM into the passed file
     *
     * Sets encoding:	 UTF-8
     * Sets indentation: true
     * Destination:		 [note/output]
     ***********************************************************************************/
    private void OutputFile(String DEST_filename, String style_filename){
	StreamSource stylesheet = new StreamSource(style_filename);

	try{
		File dest_file = new File(DEST_filename);
		if(!dest_file.exists())
		    dest_file.createNewFile();

		TransformerFactory tranFactory = TransformerFactory.newInstance();
		tranFactory.setAttribute("indent-number", 3);
		Transformer aTransformer = tranFactory.newTransformer(stylesheet);
		
		aTransformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
		aTransformer.setOutputProperty(OutputKeys.INDENT,     "yes");
		aTransformer.setOutputProperty(OutputKeys.METHOD,     "xml");
		Source src = new DOMSource(this.INPUT);
		Result dest = new StreamResult(dest_file);

		aTransformer.transform(src, dest);
		System.out.println("Finished");
	}
	catch(Exception e){
		System.err.print(e);
		System.exit(-1);
	}
    }
    public boolean appendUUID() throws XPathExpressionException{
	Element root = this.INPUT.getDocumentElement();
	NodeList crisElems = (NodeList) xpath.evaluate("child::*", root, XPathConstants.NODESET);
	for(int i=0; i<crisElems.getLength(); i++){
	    Element crisEnt = (Element) crisElems.item(i);
	    NodeList attributes = (NodeList) xpath.evaluate("attribute::*", crisEnt, XPathConstants.NODESET);
	    StringBuffer uuidKey = new StringBuffer();
	    for(int x=0; x<attributes.getLength(); x++)
		uuidKey.append(attributes.item(x).getNodeValue());
	    //UUID uuid = UUID.randomUUID();
	    //System.out.println("uuid: "+uuid.toString());
	    //crisEnt.setAttribute("cirID", uuid.toString());
	    System.out.println(i);
	}
	this.OutputFile("output.xml", "stylesheet.xslt");
	return true;
    }
}
stylesheet.xslt
Java Code:
 
    <xsl:output method="xml" indent="yes" xalan:indent-amount="3"/> 
      
    <!-- copy out the xml -->
	<xsl:template match="* | @*">
		<xsl:copy>
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>
	
	<xsl:template match="comment() | processing-instruction()">
		<xsl:copy/>
	</xsl:template>
    
 
</xsl:stylesheet>