on 04-24-2008 11:09 AM
Hi all,
I am using XSLT mapping in my scenario.
I have below structure.
<Node>
<emp_id>123<emp_id>
<begin_date>dd/mm/yyyy<begin_date/>
<end_date>dd/mm/yyyy<end_date/>
<check_date>dd/mm/yyyy<check_date/>
<Node/>
I want to filter out the records based on check_date. If checkdate is less than enddate, i want to filter out that particular records.
If anyone knows, Please suggest me in this issue.
Thank u all for ur valuable suggestions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
<xsl:variable name="checkdate">
<xsl:for-each select="Node/check_date">
<xsl:value-of select="substring(concat(substring(Node/checkdate,1,2),substring
(Node/checkdate,4,2),substring(Node/checkdate,7,4)),1,8)"/>
</xsl:for-each>
</xsl:variable>
Like wise create a variable for end date....
<xsl:for-each select="Node">
<xsl:if test="$checkdate > ''$enddate">
<emp_id>
<xsl:value-of select="Node/emp_id"/>
</emp_id>
like wise create map for other filed...
</xsl:if>
</xsl:for-each>
I think this will solve your requirement......
Regards,
Prakasu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Radhika,
I hope u can achieve it.
First, your requirement is to display only those data which mets the condition (Check date<end date). For this, use <xsl:for-each> with <xsl:if test> followed by it.
And in the test condition compare the dates. Even though there are no funtions in XSL to compare the dates directly, you can first convert the dates into numeric values using the existing date functions. That means, get the year, month, and date from the given dates and then compare those numbers.
I think this will acieve your requirement.
Regards
Bhanu
Intelligroup.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Radhika
you may use some piece of java code to perform this comparison !
here is the link for code sample
XSL date manipulation
http://www.topxml.com/forum/m_302/mpage_1/key_/tm.htm#302
some more threads
http://www.w3.org/2001/08/date-util.xslt
http://www.ibm.com/developerworks/library/x-xdexslt.html
regards
sandeep
if helpful reward points
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI ,
You need to use XSLT(XPath) to reach the exact element in
and then you can compare the two dates.
Pls refer the following link for reaching the nodes and transformation.
http://www.w3schools.com/xsl/xsl_transformation.asp
Thanks,
Ramu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I'm not sure XSLT provides native date manipulator (in your case, compare), so you may have to embed some piece of java code to perform this comparison !
I think I have a sample somewhere, I'll try to find it
Rgds
Chris
PS : there is another solution, change your dates format to YYYYMMDD and perform simple string comparison in your XSLT, it should work as explained here : http://www.stylusstudio.com/xsllist/200603/post60720.html
Edited by: Christophe PFERTZEL on Apr 24, 2008 12:58 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.