I tend to use code-generation to avoid "dumb" work where possible. Xslt is a valueable tool to create the templates for the code that is to be generated. The available functions in Xpath have been limited in number; with the advent of C# the following becomes possible:
<?xml version="1.0" encoding="UTF-8" ?>
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="http://pareto.nl/PAS">
<msxsl:script language="CSharp" implements-prefix="user">
<![CDATA[
public string CamelCase(string value)
{
return value[0].ToString().ToLower() + value.Substring(1);
}
public string UpperCase(string value)
{
return value.ToUpper();
}
Although it'll probably be some time before we can use this within an application as client-side script, it sure does make the Xsl/Xpath-combination a more powerful solution for generating code.