I want to obtain a better xml file using some xslt and xml below.

<?xml version="1.0" encoding="UTF-8"?>

<Pallets><Pallet>

<PalletNumber>2</PalletNumber>
<Product>1</Product>
<Quantity>2</Quantity>
</Pallet>
<Pallet>
<PalletNumber>2</PalletNumber>
<Product>1</Product>
<Quantity>4</Quantity>
</Pallet>
<Pallet>
<PalletNumber>2</PalletNumber>
<Product>2</Product>
<Quantity>1</Quantity>
</Pallet>
<Pallet>
<PalletNumber>3</PalletNumber>
<Product>1</Product>
<Quantity>2</Quantity>
</Pallet>
<Pallet>
<PalletNumber>4</PalletNumber>
<Product>2</Product>
<Quantity>2</Quantity>
</Pallet></Pallets>

I need to sum up quantity per pallet number and product(see first node below) .Also sequence number is needed in the right part of palletnumber value based on first appearance in the xml.Results should look like :

<?xml version="1.0" encoding="UTF-8"?>

<Pallets><Pallet>
<PalletNumber>2_1</PalletNumber>
<Product>1</Product>
<Quantity>6</Quantity>
</Pallet>
<Pallet>
<PalletNumber>2_2</PalletNumber>
<Product>2</Product>
<Quantity>1</Quantity>
</Pallet>
<Pallet>
<PalletNumber>3_1</PalletNumber>
<Product>1</Product>
<Quantity>2</Quantity>
</Pallet>
<Pallet>
<PalletNumber>4_1</PalletNumber>
<Product>2</Product>
<Quantity>2</Quantity>
</Pallet></Pallets>

Please provide XSLT 1.0 support .Thanks a lot.