SharePoint xslt calculate age


This is some xslt I have been fiddling with in order to calculate the age of persons in a list from their birthday (or in fact their CPR number, the danish social security number).

Unfortunately calculated columns in SharePoint doesn’t support getting today’s date, this is because their values are calculated columns are calculated at time of storage. Thus the only viable alternative to some custom code or javascript is xslt. This template will return the age in years. It requires two input, born, the date of birth, and today, today’s date. The format of the input must be MM/dd/yyyy.

I call the template the following way: