I am creating a custom print function for our Sharepoint data as we have some requirements about the way the data is formatted and some of this depends on the content. I am using xml and xsl for this as we are not really allowed to use xslt dataview webparts. I have most of this working but I really miss the ddwrt:FormatDate and FormatDateTime functions. I thought I could just include the namespace in my stylesheet but this does not seem to work. I was hoping to find the code of that namespace, but I can not locate that anywhere. I need a way to duplicate that functionality.
Man, your hands are just always tied. Do the powers that be realize that, by forcing you around different ways, they are getting less standard (and supportable) solutions?
I believe that the ddwrt namespace functions are embedded in some of the Microsoft.SharePoint assemblies, so you can't use them easily outside of the SharePoint context.
However, check out http://www.exslt.org/. I've looked at it in the past, and there seem to be some great capabilities there. I'm not sure how you implement it frankly, but you probably can figure it out.
I used reflector to copy the ddwruntime into my own class. I had to comment out some functions. Once that was done, I was able to do my own xslt transform using some code similar to this:
I've had great success taking xslt from sharepoint designer and using them in my custom webpart using this method.