In source Structure src3, src4, src5, src6 are of same level and fld1 and fld2 are also of same level and under "src7" node.

Receiver structure

<rcv1>

#####<rcv2>

##########<rcv3>

##########<rcv4>

here i am facing the problem -

the <field1> in receiver structure can have the values of "Y" or "N" under different <src7> nodes. but in the receiver structure the <rcv2> needs to be created only when the <field1> value is "Y". I mean

If the source structure is as below

<src1>

#####<src2> (1 to unbounded)

##########<src3>

##########<src4>

##########<src5>

##########<src6>

#############<src7>

#################<field1> "N"

#################<field2>

#############<src7>

#################<field1> "Y"

#################<field2>

#############<src7>

#################<field1> "N"

#################<field2>

#############<src7>

#################<field1> "N"

#################<field2>

#####<src2> (1 to unbounded)

##########<src3>

##########<src4>

##########<src5>

##########<src6>

#############<src7>

#################<field1> "N"

#################<field2>

#############<src7>

#################<field1> "N"

#################<field2>

#############<src7>

#################<field1> "N"

#################<field2>

#####<src2> (1 to unbounded)

##########<src3>

##########<src4>

##########<src5>

##########<src6>

#############<src7>

#################<field1> "N"

#################<field2>

#############<src7>

#################<field1> "N"

#################<field2>

#############<src7>

#################<field1> "Y"

#################<field2>

#############<src7>

#################<field1> "N"

#################<field2>

#############<src7>

#################<field1> "Y"

#################<field2>

Then The receiver structure needs to be like this

<rcv1>

#####<rcv2>

##########<rcv3> "Y"

##########<rcv4>

#####<rcv2>

##########<rcv3> "Y"

##########<rcv3> "Y"

##########<rcv4>

The <rcv2> needs to be created only when <src2> exists and the <field1> value in that perticular context is "Y"

As here the value of <field1> is "Y" in two instances of <src2>. I mean first instance of <src2> is having the <field1> value as "y" and third instance of <src2> is having the <field1> value as "y" but second instance of <src2> is not having atleast one value of <field1> value as "y" so we need to get the <rcv2> only two times for those intances of <src2> having <field1> value as "y" .