Input schema have field <Partycode Value="Agent" />
. Based on the this node I need to generate one destination node. Destination is single schema. If partycode is Agent I want destination node with value of Fname.
If partycode is not agent I want destination node without any value. <Participatent></Participatent>
unbounded in the schema. In destination is not unbounded
Scenario 1 Inputschema
<ns0:Schema xmlns:ns0="http://Host_service_proj.Inbound_test1">
<Participatent>
<ParticipantDetails>
<Participant>
<Partycode Value="" />
<FIRSTname>FIRSTname_0</FIRSTname>
</Participant>
<Participant>
<Partycode Value="Agent" />
<FIRSTname>Agentname1</FIRSTname>
</Participant>
</ParticipantDetails>
</Participatent>
</ns0:Schema>
Expected result
<ns0:CreateClaim xmlns:ns0="http://Host_service_proj.Oubound_Test1">
<Agent>Agentname1</Agent>
</ns0:CreateClaim>
Scenario 2 Inputschema
<ns0:Schema xmlns:ns0="http://Host_service_proj.Inbound_test1">
<Participatent>
<ParticipantDetails>
<Participant>
<Partycode Value="" />
<FIRSTname>FIRSTname_0</FIRSTname>
</Participant>
</ParticipantDetails>
</Participatent>
</ns0:Schema>
Expected result
<ns0:CreateClaim xmlns:ns0="http://Host_service_proj.Oubound_Test1">
<Agent></Agent>
</ns0:CreateClaim>
I am trying to write inline xslt for this
<xsl:for-each select="Participatent/ParticipantDetails/Participant">
<xsl:variable name="var:v1" select="userCSharp:LogicalEq(string(Partycode/@Value) , "Agent")" />
<xsl:if test="string($var:v1)='true'">
<xsl:variable name="var:v2" select="FIRSTname/text()" />
<Agent>
<xsl:value-of select="$var:v2" />
</Agent>
</xsl:if>
</xsl:for-each>
But I am not able to do blank <Agent>
in destination in the second scenario.