Link to home
Start Free TrialLog in
Avatar of KenTan85
KenTan85

asked on

Grouping

Hi,

how do i get this output??

thanks...
input:
 
<?xml version="1.0" encoding="UTF-8"?>
<content>
<CaseName>testing</CaseName>
<judgments>
<Judge>Andrew Ang J</Judge>
 
<para1>there is some text 1<para2>para 2 text 1</para2></para1>
<para1>there is some text 2</para1>
<para1>there is some text 3</para1>
<para1>there is some text 4</para1>
 
<heading1>first heading</heading1>
<para1>there is some text 5</para1>
 <Judge>Andrew Ang J</Judge>
<heading1>first heading</heading1>
<para1>there is some text 6</para1>
 
<heading2>second heading</heading2>
<para1>there is some text 7</para1>
<para1>there is some text 8</para1>
<para1>there is some text 9</para1>
 
<heading3>third heading</heading3>
<para1>there is some text 10<para2>para 2 text 2</para2></para1>
<heading3>third heading</heading3>
<para1>there is some text 10<para2>para 2 text 2</para2></para1>
 
</judgments>
</content>
 
 
output:
<content>
<CaseName>testing</CaseName>
<judgments>
<judgment>
<Judge>Andrew Ang J</Judge>
 
<para1>there is some text 1<para2>para 2 text 1</para2></para1>
<para1>there is some text 2</para1>
<para1>there is some text 3</para1>
<para1>there is some text 4</para1>
 <section>
<heading1>first heading</heading1>
<para1>there is some text 5</para1>
 <Judge>Andrew Ang J</Judge>
 </section>
 <section>
<heading1>first heading</heading1>
<para1>there is some text 6</para1>
 <section>
<heading2>second heading</heading2>
<para1>there is some text 7</para1>
<para1>there is some text 8</para1>
<para1>there is some text 9</para1>
  <section>
<heading3>third heading</heading3>
<para1>there is some text 10<para2>para 2 text 2</para2></para1>
 </section>
 <section>
<heading3>third heading</heading3>
<para1>there is some text 10<para2>para 2 text 2</para2></para1>
 </section>
 </section>
  </section>
</judgment>
</judgments>
</content>

Open in new window

Avatar of KenTan85
KenTan85

ASKER

sry... this should be the output that i need:


output:
 
<content>
<CaseName>testing</CaseName>
<judgments>
<judgment>
<Judge>Andrew Ang J</Judge>
 
<para1>there is some text 1<para2>para 2 text 1</para2></para1>
<para1>there is some text 2</para1>
<para1>there is some text 3</para1>
<para1>there is some text 4</para1>
 <section>
<heading1>first heading</heading1>
<para1>there is some text 5</para1>
 </section>
</judgment>
<judgment>
 <Judge>Andrew Ang J 2</Judge>
 
 <section>
<heading1>first heading</heading1>
<para1>there is some text 6</para1>
 <section>
<heading2>second heading</heading2>
<para1>there is some text 7</para1>
<para1>there is some text 8</para1>
<para1>there is some text 9</para1>
  <section>
<heading3>third heading</heading3>
<para1>there is some text 10<para2>para 2 text 2</para2></para1>
 </section>
 <section>
<heading3>third heading</heading3>
<para1>there is some text 10<para2>para 2 text 2</para2></para1>
 </section>
 </section>
  </section>
</judgment>
</judgments>
</content>

Open in new window

Avatar of Gertone (Geert Bormans)
can you tell me what the trigger is for a new judgment?

Is it correct that
- the source has changed and the <judgment> has gone from the source, but you need it in the result
- the <judgment>s are created by encountering a <judge> element
yup.
new <judgment> are created whenever it encounter a new <judge> element
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial