Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 1st, 2007, 02:45 PM
=?Utf-8?B?R3VoYW5hdGg=?=
Guest
 
Posts: n/a
Default Splitting and Renaming Xml Nodes

Hi,

Please suggest a solution for the following problem.

We get a input xml that need to be processed for grouping and sorting.
The example of one such xml

<Requests>
<Request>
......
<Results>
<Result1>
<Type>1</Type>
</Result>
<Result1>
<Type>2</Type>
</Result>
</Results>
</Request>

</Requests>

To obtain some sorting and grouping kind of thing we need to split this xml
as follwoing

<RequestsNew --Xml Node Name changed
<Request>
......
<Results>
<Result1>
<Type>1</Type>
</Result>
</Results>
</Request>

<Request>
......
<Results>
<Result1>
<Type>2</Type>
</Result>
</Results>
</Request>
</Requests>

If the type is different we need to make them as seperate requests,if the
<typeis same we need to maintain the original xml structure.

Please tell me a solution for this.


--
Guhan
  #2  
Old March 1st, 2007, 03:05 PM
Dimitre Novatchev
Guest
 
Posts: n/a
Default Re: Splitting and Renaming Xml Nodes

Read about the Muenchian grouping method -- essentially you need to
determine all <Typeelements with different values and from this node-set
then generate the new xml document -- this is so easy and straightforward.

http://www.jenitennison.com/xslt/grouping/muenchian.xml


Cheers,
Dimitre Novatchev.


"Guhanath" <Guhanath@discussions.microsoft.comwrote in message
news:764D8BC8-AD5A-4061-A068-F43943E83F7A@microsoft.com...
Quote:
Hi,
>
Please suggest a solution for the following problem.
>
We get a input xml that need to be processed for grouping and sorting.
The example of one such xml
>
<Requests>
<Request>
......
<Results>
<Result1>
<Type>1</Type>
</Result>
<Result1>
<Type>2</Type>
</Result>
</Results>
</Request>
>
</Requests>
>
To obtain some sorting and grouping kind of thing we need to split this
xml
as follwoing
>
<RequestsNew --Xml Node Name changed
<Request>
......
<Results>
<Result1>
<Type>1</Type>
</Result>
</Results>
</Request>
>
<Request>
......
<Results>
<Result1>
<Type>2</Type>
</Result>
</Results>
</Request>
</Requests>
>
If the type is different we need to make them as seperate requests,if the
<typeis same we need to maintain the original xml structure.
>
Please tell me a solution for this.
>
>
--
Guhan

 

Bookmarks

Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles