While there is a certain degree of geeky coolness to be able to transform an XML document using a combination of T-SQL and C# I shudder to think about the poor soul who has to maintain this stuff. It makes XSLT look like child’s play …
A rule of thumb in programming: avoid arbitrary technology transitions at all costs. This is why the combination of RJS templates and ActiveRecord Migrations in Rails is so potent: it avoids JavaScript and SQL for common tasks. And the oh-so-expensive technology context switch in your brain that is required when you need to update or fix that code.
2 archived reader comments
Matt (2006/07/20)
I am not suggesting invoking every transform using a Sql Server Stored Proc and C# code. This is really meant to be a selective method to apply in certain situations. For example if the transform is enriching a message from data stored in Sql Server. From a graphical BizTalk map, database functoids would invoke multiple round trips to Sql Server to gather the data for each relevant node in the source XML message. This ultimately can affect performance of the BizTalk Service hosting the XSLT transform and the Sql Server. Under this circumstance I might elect to enrich the message using a single set operation in Sql Server. I have worked on graphical BizTalk maps that have made me shudder to imagine the cost and pain of maintaing. They can quickly turn into a spaghetti with a mix of graphical links, multiple functoids that are chained together and custom XSLT that is hidden in the map. You could also completely replace the graphical BizTalk spaghetti map with your own complete XSLT, but most developers will use the tool that is supplied and might not have the desire or time to learn how to code their own custom XSLT to replace a busy BizTalk map. The sample I provided was really only meant to show a complete example of what is possible to accomplish in Sql Server to solve specific problems and is not intended as a methodology that should be religiously followed.
John Lam (2006/07/20)
I think that the real problem is that most / all of the tools for doing real XML transforms blow chunks. I haven’t really thought much at all about this problem domain, but I have talked to people who do large-scale EDI transforms and they have some really powerful proprietary tools that do just that. It feels to me like an internal DSL in a language like Ruby would be a pretty good way of thinking about the problem - especially if it called out to some high performance code to do the stream-based processing of the document.