This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

XSLT Question


I have written an application that performs
 querries, but to allow maximum flexability, I
 defined the following interfaces:

 public interface QueryEngine
 {
   QueryResults doQuery(SearchParameters sp);
 }

 public interface QueryResults()
 {
   String getString(String fieldname);
   void next();
   boolean hasMoreElements();
 }

 The only assumption made in this archetecture is
 that the results returned by the QueryEngine is in
 a tabluar form.  However, we have made the move to
 performing querries using a Message Queue and the
 format of the queries is in XML, and the resutls
 are XML too.  here's the problem: Consider the
 following query results gained by a traditional
 SQL query:

 OrderID  ModelId  ModelDesc  Qty  Price Status
 Order1    ModelA    DvD        1    1.00  Done
 Order1    ModelB    Monitor    1    3.00  Wait
 Order2    ModelA    DvD        2    2.00  Wait
 Order2    ModelD    CPU        1    5.00  Done

 This query results indicates that there is 2
 orders, with 2 line items each.  Now, consider the
 following query results as an XML document that we
 will be getting from our new system:

 <order id="Order1">
     <line>
         <model id='ModelA'>DvD</model>
         <quantity>1</quantity>
         <price>5</price>
         <status>Done</status>
     </line>
     <line>
         <model id='ModelD'>Monitor</model>
         <quantity>2</quantity>
         <price>7</price>
         <status>Wait</status>
     </line>
 </order>
 <order id="Order2">
     <line>
         <model id='ModelA'>DvD</model>
         <quantity>1</quantity>
         <price>5</price>
         <status>Done</status>
     </line>
     <line>
         <model id='Modeld'>CPU</model>
         <quantity>2</quantity>
         <price>7</price>
         <status>Wait</status>
     </line>
 </order>

 The question is: how can i transform this XML
 document into tabluar form.  better yet, is there
 a generic transformation that i can apply to any
 XML document that will flatten it into a table?

 Any help would be greatly appreciated.  You can
 contact me with answers at knoll@eclipse.net

 -Chris



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]