xsl-list
[Top] [All Lists]

[xsl] Problem with Age Calculation

2008-05-06 19:26:30
Hi
I am using Saxon 9.0.0.4 with XSLT 2.0 and XPATH 2.0. This is my first post.
I am using the following XPATH expression in an XForm. This is not an XForm 
question.It is about the XPath in the XForm.

<xforms:bind nodeset="instance('taskoutput')/fe:age" type="xs:integer" 
calculate="if((instance('taskoutput')/fe:dob) castable as xs:date) then 
(current-date() - xs:date(instance('taskoutput')/fe:dob)) div 
xdt:dayTimeDuration('P1D')
                                                                idiv 365.242199 
                                                * xdt:yearMonthDuration('P1Y') 
else()"/>

I am not familiar with XPath date functions and I am finding it hard to get the 
age from this expression.
It returns me something P33Y or something for a certain input DOB.

What can I do to get the age of a person in years and months. I am ok with  not 
having to account for leap years or small problems at the boundaries.

All help is appreciated.

thanks
ilango




      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>