First write a function to compute day of week dow() for a given date: subtract a wellknown Sunday from the date, divide by the duration PT1D, then take the result modulo 7.
Now subtract the two dates, divide by the duration PT1D to get an integer number of days D, and then take W= (D div 7)*5 to get the number of weekdays in whole weeks. Then work out how many extra days you need to add based on the dayofweek of the two days: if you know that both are weekdays, this is dow(END)dow(START) if positive, otherwise 7(dow(START)dow(END)).
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
