Transforming nodes with like attributes to children of the s

wxdqz

New Member
Is there a way, using XSL, to transform nodes with like attribute values tochildren of the same node? This would be easy except that I don't have apredetermined list of possibilities for the value of the attribute. I wouldalso like, if possible, to insert totals for each "group." For instance:<CUSTOMERS><CUSTOMER COMPANY="ACME" NAME="Joe" PRODUCTS="2"/><CUSTOMER COMPANY="SBC" NAME="Bob" PRODUCTS="1"/><CUSTOMER COMPANY="SBC" NAME="Jim" PRODUCTS="5"/><CUSTOMER COMPANY="ACME" NAME="George" PRODUCTS="2"/><CUSTOMER COMPANY="ACME" NAME="Marilyn" PRODUCTS="7"/></CUSTOMERS>Should transform to:<CUSTOMERS><COMPANY NAME="ACME"/><CUSTOMER NAME="Joe" PRODUCTS="2"/><CUSTOMER NAME="George" PRODUCTS="2"/><CUSTOMER NAME="Marilyn" PRODUCTS="7"/><TOTALS TOTCUST="3" TOTPRODS="11" AVG="3.67"/></COMPANY><COMPANY NAME="SBC"/><CUSTOMER NAME="Bob" PRODUCTS="1"/><CUSTOMER NAME="Jim" PRODUCTS="5"/><TOTALS TOTCUST="2" TOTPRODS="6" AVG="3"/></COMPANY></CUSTOMERS>
 
Back
Top