DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12270>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12270 Not able to transform in-memory documents ------- Additional Comments From [EMAIL PROTECTED] 2002-09-03 19:58 ------- Here is the source code (code snippet) of the servlet which does the transformation: response.setContentType("text/html"); PrintWriter out = response.getWriter(); try{ DOMParser parser = new DOMParser(); parser.parse(request.getContextPath()+"/files/orders.xml"); Document orders = parser.getDocument(); DocumentImpl newDoc = new DocumentImpl(); Element orderSystem = newDoc.createElement("orderSystem"); orderSystem.setAttribute("xmlns:ord", "http://www.nicholaschase.com/orders/"); orderSystem.setAttribute("xmlns:prod", "http://www.nicholaschase.com/products/") ; newDoc.appendChild(orderSystem); Node orderRoot = orders.getFirstChild(); processNode(orderRoot,out,orderSystem,newDoc, "http://www.nicholaschase.com/orders/","ord:"); parser.parse(request.getContextPath()+"/products.xml"); Document products = parser.getDocument(); Node productRoot = products.getFirstChild(); processNode(productRoot,out,orderSystem,newDoc, "http://www.nicholaschase.com/products/","prod:"); OutputFormat format = new OutputFormat(); XMLSerializer output = new XMLSerializer(out,format); output.serialize(newDoc); File mergedOrderFile = new File(request.getContextPath() +"/files/mergedOrders.xml"); if(!mergedOrderFile.exists()) { saveDocument(newDoc,mergedOrderFile,out); } printTree(new DOMSource(orderSystem).getNode(),out,"-"); TransformerFactory transFactory = TransformerFactory.newInstance(); Transformer transformer = transFactory.newTransformer( new StreamSource(request.getContextPath() +"/ReviewOrder.xsl")); transformer.transform(new DOMSource(orderSystem),new StreamResult(out)); I have already described the contents of the ReviewOrder.xsl and also the contents of the DOM in memory. I do set the output to be of type html. I installed the MSXML 4.0(sp1). After I install this version of MSXML I get the following displayed on the browser which is different (though more illustrative) from what was displayed earlier: >BR3452<br xmlns:ord="http://www.nicholaschase.com/orders/" xmlns:prod="http://www.nicholaschase.com/products/"> View Source of this document on the browser shows the following contents: <?xml version="1.0" encoding="UTF-8"?> <orderSystem xmlns:ord="http://www.nicholaschase.com/orders/" xmlns:prod="http://www.nicholaschase.com/products/"><ord:orders> <ord:order ord:order_id="9tZjC41e96fZ3"> <ord:order_status>in progress</ord:order_status> <ord:item ord:product_id="BR3452"> <ord:quantity>2</ord:quantity> </ord:item> </ord:order> </ord:orders><prod:products> <prod:vendor prod:webvendor="full"> <prod:advertisement> <prod:ad_sentence> Conners Chair Company presents their annual big three day only chair sale. We're making way for our new stock! <prod:b>All current inventory must go! </prod:b> Regular prices slashed by up to 60%! </prod:ad_sentence> </prod:advertisement> <prod:product> <prod:product_id>QA3452</prod:product_id> <prod:short_desc>Queen Anne Chair</prod:short_desc> <prod:price prod:pricetype="cost">$85</prod:price> <prod:price prod:pricetype="sale">$125</prod:price> <prod:price prod:pricetype="retail">$195</prod:price> <prod:inventory prod:color="royal blue" prod:location="warehouse">12</prod:inventory> <prod:inventory prod:color="royal blue" prod:location="showroom">5</prod:inventory> <prod:inventory prod:color="flower print" prod:location="warehouse">16</prod:inventory> <prod:inventory prod:color="flower print" prod:location="showroom">3</prod:inventory> <prod:inventory prod:color="seafoam green" prod:location="warehouse">20</prod:inventory> <prod:inventory prod:color="seafoam green" prod:location="showroom">20</prod:inventory> <prod:inventory prod:color="teal" prod:location="warehouse">15</prod:inventory> <prod:inventory prod:color="teal" prod:location="showroom">14</prod:inventory> <prod:inventory prod:color="burgundy" prod:location="showroom">35</prod:inventory> <prod:giveaway> <prod:giveaway_item> Matching Ottoman included </prod:giveaway_item> <prod:giveaway_desc> While supplies last </prod:giveaway_desc> </prod:giveaway> </prod:product> <prod:product> <prod:product_id>RC2342</prod:product_id> <prod:short_desc>Early American Rocking Chair</prod:short_desc> <prod:product_desc>with brown and tan plaid upholstery</prod:product_desc> <prod:price prod:pricetype="cost">$75</prod:price> <prod:price prod:pricetype="sale">$62</prod:price> <prod:price prod:pricetype="retail">$125</prod:price> <prod:inventory prod:location="warehouse">40</prod:inventory> <prod:inventory prod:location="showroom">5</prod:inventory> </prod:product> <prod:product> <prod:product_id>BR3452</prod:product_id> <prod:short_desc>Bentwood Rocker</prod:short_desc> <prod:price prod:pricetype="cost">$125</prod:price> <prod:price prod:pricetype="sale">$160</prod:price> <prod:price prod:pricetype="retail">$210</prod:price> <prod:inventory prod:location="showroom">3</prod:inventory> </prod:product> </prod:vendor> </prod:products></orderSystem>BR3452<br xmlns:ord="http://www.nicholaschase.com/orders/" xmlns:prod="http://www.nicholaschase.com/products/"> Everything seems to be fine till we get to the end of the document and for some reason, there seems to be a repetition of BR3452 followed by name spaces. This I think is the reason why the browser is complaining. Is the ReviewOrder.xsl is wrong or is in an issue I have to take it up with Microsoft?
