Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-25-2012, 11:30 PM   PM User | #1
chopstix21
New to the CF scene

 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
chopstix21 is an unknown quantity at this point
muenchian sum based on multiple grouping - xslt

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.
chopstix21 is offline   Reply With Quote
Reply

Bookmarks

Tags
grouping, xml, xsl, xslt

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:34 PM.


Advertisement
Log in to turn off these ads.