Group by in xslt from xml file

Posted by Nagababu under XML on 7/27/2011 | Points: 10 | Views : 1954 | Status : [Member] | Replies : 0
Hi,

I have added my xml file and expected output below.
I would like to know how to write an xslt file with output as xml type.
My requirement is to group the xml data based on the "NameDocumentCategor" and to bind the final xml file to a treeview.

-----------------------------------------------

XMl file

-----------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<people>
<Category>
<NameDocumentCategory>JPEG</NameDocumentCategory>
<FileNetId>1</FileNetId>
<IndexDate>Dec 2011</IndexDate>
<ChildNode>12/05/2011 -- &lt;a href="#" onclick="window.print();"&gt;NameImageType1&lt;/a&gt;JPEG</ChildNode>
<IndexType>NameImageDatetype1</IndexType>
</Category>
<Category>
<NameDocumentCategory>PDF</NameDocumentCategory>
<FileNetId>2</FileNetId>
<IndexDate>Dec 2011</IndexDate>
<ChildNode>12/07/2011 -- &lt;a href="#" onclick="window.print();"&gt;NameImageType2&lt;/a&gt;PDF</ChildNode>
<IndexType>NameImageDatetype2</IndexType>
</Category>
<Category>
<NameDocumentCategory>PDF</NameDocumentCategory>
<FileNetId>4</FileNetId>
<IndexDate>Mar 2011</IndexDate>
<ChildNode>03/02/2011 -- &lt;a href="#" onclick="window.print();"&gt;NameImageType2&lt;/a&gt;PDF</ChildNode>
<IndexType>NameImageDatetype2</IndexType>
</Category>
<Category>
<NameDocumentCategory>MDF</NameDocumentCategory>
<FileNetId>3</FileNetId>
<IndexDate>Dec 2011</IndexDate>
<ChildNode>12/09/2011 -- &lt;a href="#" onclick="window.print();"&gt;NameImageType4&lt;/a&gt;MDF</ChildNode>
<IndexType>NameImageDateType3</IndexType>
</Category>
</people>
-----------------------------------------------------------------

Expected output:

----------------------------------------------

PDF

3/2/2011 12:00:00 AM_NameImageType2
12/7/2011 12:00:00 AM_NameImageType2

JPEG

12/5/2011 12:00:00 AM_NameImageType1

MDF

12/9/2011 12:00:00 AM_NameImageType4
--------------------------------------------------------------

Thanks,
Nagababu.




Responses

(No response found.)

Login to post response