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]

How to Sort, Group, sub-Total and Total in XSL


Hello,
     I'm fairly new to XSL and I would like to produce results similar to
the following:

Product Based XSL:

Product Id: AAA
     Invoice #: 1234   Qty Ordered: 500
     Invoice #: 5678   Qty Ordered: 200
Total for Product AAA: 700

Product Id: BBB
     Invoice #: 1234   Qty Ordered: 400
Total for Product BBB: 400

Total Ordered:  1100


Invoice Based XSL:

Invoice #: 1234
     Product Id:  AAA   Qty Ordered: 500
     Product Id: BBB   Qty Ordered: 400
Total for Invoice # 1234: 900

Invoice #: 5678
     Product Id: AAA   Qty Ordered: 200
Total for Invoice # 5678: 200

Total Ordered: 1100


Both XSL documents would be based on the same XML document, similar to the
following:

<order_history>
     <order_information>
          <invoice>1234</invoice>
          <product>AAA</product>
          <qty_ordered>500</qty_ordered>
     </order_information>

     <order_information)
          <invoice>5678</invoice>
          <product>AAA</product>
          <qty_ordered>200</qty_ordered>
     </order_information>

     <order_information>
          <invoice>1234</invoice>
          <product>BBB</product>
          (qty_ordered>400</qty_ordered>
     </order_information>
</order_history>

So far, I've been able to sort the XML data in the proper order by using
<xsl:for-each select="order_information" order-by="product_id"> and the
appropriate xsl:value-of select statements.  I've found examples of how to
total two fields, but I'm not sure how to perform the required level-break
logic for the subtotals within XSL.

Can something like this be done with XSL?  I'm using  Vendor: Microsoft
Processor version: Original IE5 (or old version of other processor)

Thanks in advance for any help.




 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]