How can I use XSLT to retrieve element closest to but not after a certain date?

zl0ca

New Member
Given a list of elements with a date attribute, for example, \[code\]<foo> <bar date="2001-04-15"/> <bar date="2002-01-01"/> <bar date="2005-07-04"/> <bar date="2010-11-10"/></foo>\[/code\]I would like to retrieve the element closest to but not after a given date using XSLT.Calling this function with parameter "2008-01-01" should print \[code\]<bar date="2005-07-04">\[/code\]. Assume the context node is already \[code\]<foo>\[/code\].I'm not sure what would be easier, but I could also set up three attributes: day, month, year, instead of having one date attribute.
 
Back
Top