Hi
How can i get the single node value if i have node value is in multiple nodes under parent node.
I need <START_DATE> in output ..what code should i need to write in XSL so that below XML give me <START_DATE> only once whichever found first in multiple nodes for same <ASSET_NUMBER> and <PAYMENT_TYPE>
I am getting <START_DATE> for each node in output..Suppose if there is no <START_DATE> in first node it should print 2nd node<START_DATE> ..If found in first then no check for other nodes and it should print first <START_DATE> in output
Eg of 2 nodes given as:
XML Code
--------------
<XXD_PMT_TBL_TYPE>
<KHR_ID>558965</KHR_ID>
<CLE_ID>124374202321956236402685913568035337442</CLE_ID>
<CONTRACT_LINE_TYPE>Financial Asset ne</CONTRACT_LINE_TYPE> <ASSET_NUMBER>LP501100</ASSET_NUMBER> <PAYMENT_TYPE>RENT</PAYMENT_TYPE>
<STRUCTURE>0</STRUCTURE> <FREQUENCY>M</FREQUENCY>
<ARREARS>Y</ARREARS>
<START_DATE>2007-05-01T00:00:00</START_DATE>
</XXD_PMT_TBL_TYPE>
<XXD_PMT_TBL_TYPE>
<KHR_ID>558965</KHR_ID>
<CLE_ID>124738878561124662445007628105477903460</CLE_ID>
<CONTRACT_LINE_TYPE>Financial Asset Line</CONTRACT_LINE_TYPE>
<ASSET_NUMBER>LP501100</ASSET_NUMBER>
<PAYMENT_TYPE>RENT</PAYMENT_TYPE>
<STRUCTURE>0</STRUCTURE> <FREQUENCY>M</FREQUENCY>
<ARREARS>Y</ARREARS>
<START_DATE>2008-04-01T00:00:00</START_DATE>
</XXD_PMT_TBL_TYPE>
-----------------------------------------------------------------------
My XSLT looks like:
---------------------
<interimRent>
<xsl:for-each select="$Vvar3_CTA_PSS_SELECT_INQUIRY_Response/ora:X_PMT_TBL">
<xsl:for-each select="ora:XXD_PMT_TBL_TYPE">
<xsl:variable name="flag" select="position()"/>
<xsl:variable name="var_XXD_PMT_TBL_TYPE" select="."/>
<xsl:for-each select="ora:START_DATE">
<xsl:variable name="var_START_DATE" select="."/>
<xsl:for-each select="$var_XXD_ASSET_TBL_TYPE/ora:ASSET_NUMBER">
<xsl:variable name="var_ASSET_NUMBER" select="."/>
<xsl:for-each select="$var_XXD_PMT_TBL_TYPE/ora:ASSET_NUMBER">
<xsl:variable name="var1_ASSET_NUMBER" select="."/>
<xsl:variable name="var_RESULTOF_equal" select="$var_ASSET_NUMBER = $var1_ASSET_NUMBER"/>
<xsl:for-each select="$var_XXD_PMT_TBL_TYPE/ora:PAYMENT_TYPE">
<xsl:variable name="var_PAYMENT_TYPE" select="."/>
<xsl:variable name="var_CONST" select="'RENT'"/>
<xsl:variable name="var1_RESULTOF_equal" select="$var_PAYMENT_TYPE = $var_CONST"/>
<xsl:variable name="var_RESULTOF_logicaland" select="$var_RESULTOF_equal and $var1_RESULTOF_equal"/>
<xsl:if test="string($var_RESULTOF_logicaland)='true'">
<xsl:choose>
<xsl:when test="$flag">
<startDate>
... <xsl:value-of select="($var_START_DATE)}"/>
</startDate>
</xsl:when>
<xsl:otherwise> ...
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</interimRent>
----------------------------------
this part above need code change in XSLT..Plz tell some logic to reassign flag value if possible ,how or anything if any1 work ..
<xsl:choose>
<xsl:when test="$flag">
<startDate>
... <xsl:value-of select="($var_START_DATE)}"/>
</startDate>
</xsl:when>
<xsl:otherwise> ...
Thanx in advance
rajan sood