I think my previous question was not clear so I am describing the situtation again.
Thanks for your help on this. I tried this but could not resolve my problem. I think I need to provide more insight into my issue.
<TXLife>
<TXLifeResponse>
<Coverage>
<LifeParticipant id="Party_040_01">
<ParticipantName>Sam</ParticipantName>
<LifeParticipantRoleCode tc="1">Primary Insured</LifeParticipantRoleCode>
<RateDecision>Rating C 100%</RateDecision>
</LifeParticipant>
</Coverage>
<Coverage>
<LifeParticipant id="Party_040_02">
<ParticipantName>Renny</ParticipantName>
<LifeParticipantRoleCode tc="2">Additional Insured</LifeParticipantRoleCode>
<RateDecision>Rating B 200%</RateDecision>
</LifeParticipant>
</Coverage>
<Coverage>
<LifeParticipant id="Party_040_01">
<ParticipantName>Sam</ParticipantName>
<LifeParticipantRoleCode tc="1">Primary Insured</LifeParticipantRoleCode>
<RateDecision>Rating D 700%</RateDecision>
</LifeParticipant>
</Coverage>
</TXLifeResponse>
<TXLifeResponse>
<Coverage>
<LifeParticipant id="Party_040_01">
<ParticipantName>Marry</ParticipantName>
<LifeParticipantRoleCode tc="1">Primary Insured</LifeParticipantRoleCode>
<RateDecision>Rating C 100%</RateDecision>
</LifeParticipant>
</Coverage>
<Coverage>
<LifeParticipant id="Party_040_03">
<ParticipantName>Sherry</ParticipantName>
<LifeParticipantRoleCode tc="2">Primary Insured</LifeParticipantRoleCode>
<RateDecision>Rating H 300%</RateDecision>
</LifeParticipant>
</Coverage>
<Coverage>
<LifeParticipant id="Party_040_01">
<ParticipantName>Marry</ParticipantName>
<LifeParticipantRoleCode tc="1">Primary Insured</LifeParticipantRoleCode>
<RateDecision>Rating A 50%</RateDecision>
</LifeParticipant>
</Coverage>
</TXLifeResponse>
</TXLife>
I need to find the RateDecision information by LifeParticipantRoleCode from multiple Coverage elements within TXLifeResponse at a time. And repeat the same for second TXLifeResponse and so on.
Meaning I need to generate output like
<TXLife>
<TXLifeResponse>
<RateDecision>Sam Rating C 100%, Rating D 700%</RateDecision>
<RateDecision>Renny Rating B 200%</RateDecision>
</TXLifeResponse>
<TXLifeResponse>
<RateDecision>Marry Rating C 100%, Rating A 50%</RateDecision>
<RateDecision>Sherry Rating H 300%</RateDecision>
</TXLifeResponse>
</TXLife>
I don't want to generate two elements for Sam. I want to combine Sam's rating information from two different Coverage elements under single TXLifeResponse node and display it and then repeat the same process for second TXLifeResponse node.
I hope, I am able to clarify my question. Any help is appreciated.
I tried to implement the below logic and its still not working. Please assist.
<xsl:key name="LifeParticipant-by-LifeParticipantRoleCode" match="LifeParticipant" use="LifeParticipantRoleCode[@tc = '1' or @tc = '2' or @tc = '3' or @tc = '4' or @tc = '5' or @tc = '6']" />
<xsl:apply-templates select="Life/Coverage/LifeParticipant[generate-id() = generate-id(key('LifeParticipant-by-LifeParticipantRoleCode', LifeParticipantRoleCode/@tc)[1])]" />
<xsl:template match="LifeParticipant">
<!-- Business Logic -->
</xsl:template>
Removing duplicates (in XSLT 1.0) is best handled through a technique known as Muenchian grouping.
The variation required here is to include the id of the parent node in the key. Here's an example of implementation:
XSLT 1.0
Applied to the given example input, the result will be:
I didn't see anything concerning "multiple files" here.
I don't have a environment that could test this so only sudo code and not 100% sure it will work but what I would attempt with an issue like this is
Then the function would use recursion something like the below
Not sure if the context stuff will work but need to do something here otherwise the function will change the context in the outer section.