Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Grouping with XSLT 1.0

From: Ana <anicuta2003@-----.--->
To: NULL
Date: 6/1/2005 8:40:00 PM
Hi 

I've seen some examples grouping by content, but I can't make it work
for the following XML:

<Item>
   <Item_Name>Item1</Item_Name>
   <Qty>10</Qty>
   <Destination>
       <Code_E3>Store 1</Code_E3>
       <Qty_E4>2</Qty_E4>
       <Code_E5>Store 2</Code_E5>
       <Qty_E6>2</Qty_E6>
       <Code_E7>Store 3</Code_E7>
       <Qty_E8>6</Qty_E8>
   <Destination>
   <AltDest>DC</AltDest>
</Item>
<Item>
   <Item_Name>Item2</Item_Name>
   <Qty>20</Qty>
   <Destination>
       <Code_E3>Store 1</Code_E3>
       <Qty_E4>10</Qty_E4>
       <Code_E5>Store 5</Code_E5>
       <Qty_E6>10</Qty_E6>
   <Destination>
</Item>
<Item>
   <Item_Name>Item4</Item_Name>
   <Qty>30</Qty>
   <Destination>
       <Code_E3>Store 1</Code_E3>
       <Qty_E4>30</Qty_E4>  
   <AltDest>DC</AltDest>
</Item>

The xml above is a simplified version of the XML received (EDI 850).

I need to group the items by content of Code_E* (store) and AltDest
The problem is that the number of elements of type Code_E* is variabil
and the AltDest element is optional, but when present affects the
grouping.

For the sample above the desire result is:

<store>
   <Code>Store 1</Code>
   <AltDest>DC</AltDest>
   <Item>
       <Item_Name>Item1</Item_Name>
       <Qty>2</Qty>
   </Item>
   <Item>
       <Item_Name>Item4</Item_Name>
       <Qty>30</Qty>
   </Item>
</Store>
<store>
   <Code>Store 2</Code>
   <AltDest>DC</AltDest>
   <Item>
   	<Item_Name>Item1</Item_Name>
	<Qty>2</Qty>
   </Item>
</Store>
<store>
   <Code>Store 3</Code>
   <AltDest>DC</AltDest>
   <Item>
	   <Item_Name>Item1</Item_Name>
	   <Qty>6</Qty>
   </Item>
</Store>
<store>
   <Code>Store 1</Code_E3>
   <AltDest/>
   <Item>
	<Item_Name>Item 2</Item_Name>
	<Qty>10</Qty>
   </Item>
</Store>
<store>
   <Code>Store 5</Code_E3>
   <AltDest/>
   <Item>
	<Item_Name>Item 2</Item_Name>
	<Qty>10</Qty>
   </Item>
</Store>

If anybody can provide some ideas I would greatly appreciate it. 

Thanks a lot!

Ana

*** Sent via Developersdex http://www.developersdex.com ***


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent