I have an xml with repeating DPART segment and need to pick ADDRESS value from any segment having PARTN_ROLE as 'UU' and use this address to get variables of NAME and STREET from other repeatable segment DCOAD. so need to extract 2 variables:-
<xsl:variable name="Cust_Name"
<xsl:variable name="Cust_Street"
.
Output variable should be like:-
<Cust_Name>Michael</Cust_Name>
<Cust_Street>ABCH</Cust_Street>
Part of Input XML:-
<Z1E1P SEGMENT="1">
<ORDER>5467899</ORDER>
<ACCOUNT>X</ACCOUNT>
<Z1BP_ISAORDER SEGMENT="1">
<DPART SEGMENT="1">
<PARTN_ROLE>JK</PARTN_ROLE>
<CONTACT>0000000000</CONTACT>
<ADDRESS>0000027647</ADDRESS>
</DPART>
<DPART SEGMENT="1">
<PARTN_ROLE>UU</PARTN_ROLE>
<CONTACT>0000000000</CONTACT>
<ADDRESS>9164412232</ADDRESS>
</DPART>
<DCOAD SEGMENT="1">
<ADDRESS>0000023378</ADDRESS>
<NAME>John</NAME>
<STREET>gyhu</STREET>
<COUNTRY>US</COUNTRY>
</DCOAD>
<DCOAD SEGMENT="1">
<ADDRESS>9164412232</ADDRESS>
<NAME>Michael</NAME>
<STREET>ABCH</STREET>
<COUNTRY>US</COUNTRY>
</DCOAD>
</Z1BP_ISAORDER>
</Z1E1P>
It needs to be handled using XSLT 1.0 I tried below XSLT but not getting the output, part of xslt:-
<xsl:variable name="Cust_Name">
<xsl:if test="node()/Z1BP_ISAORDER/DPART[PARTN_ROLE='UU']/ADDRESS = node()/Z1BP_ISAORDER/DCOAD/ADDRESS">
<xsl:copy-of select="node()/Z1BP_ISAORDER/DCOAD/NAME">
</xsl:copy-of>
</xsl:if>
</xsl:variable>
<xsl:variable name="Cust_Street">
<xsl:if test="node()/Z1BP_ISAORDER/DPART[PARTN_ROLE='UU']/ADDRESS = node()/Z1BP_ISAORDER/DCOAD/ADDRESS">
<xsl:copy-of select="node()/Z1BP_ISAORDER/DCOAD/STREET">
</xsl:copy-of>
</xsl:if>
</xsl:variable>