I've no idea what sharepoint 2007 is (there are zillions of technologies out there, and the only one you can assume people know on this forum is XSLT). If you can't express your problem in XSLT terms, then I suggest you try a different forum. Expressing it in XSLT terms basically means telling us what the XML input of your transformation is, and what XML or HTML output you want to produce.
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference