Random photo
Loading...
Domains for sale
|
May 5, 2005Declarative way to expose methods as XSLT extension functions?I had a conversation with somebody about how EXSLT.NET worked around the hyphenated EXSLT function names problem and if there are better ways to solve it. Here is a suggestion for Microsoft: give us more control over exposing .NET methods as extension functions and make it declarative. Currently when one exposes an object as an extension object to XSLT, all its public instance and static methods become accessible as XSLT extension functions. One has no control over which methods are exposed and which aren't. Also one has no control over how object methods are exposed to XSLT:
/// <summary>
/// Calculates the circumference of a circle given the radius.
/// </summary>
[XsltExtensionObject(Namespace="http://example.com/calculate")]
public class Calculate
{
private double circ = 0;
[XsltExtensionFunction(Name="circumference", Memoization=true)]
public double Circumference(double radius)
{
circ = Math.PI*2*radius;
return circ;
}
}
Benefits are evident, aren't they? You would say - dream on, who cares? Ok, but I believe that such stuff is inevitable as XML penetrates to the core of modern programming languages such as C# or Java.
Oh well, I filed above as a suggestion to the MSDN Product Feedback Center, go vote for it if you like the idea. Any comments would be appreciated too. May 5, 2005 7:48 PM
| #System.Xml v2.0
Comments
I would be nice for Xslt compiler to bind it while compiling (loading) transform to assembly to avoid high cost Invokes. Posted by: ysw at May 6, 2005 11:49 AM
Post a comment
Listed below are links to weblogs that reference this post:
Кто такие MVP from Alexander Lozhechkin [MSFT]
Кто такие MVP from Alexander Lozhechkin [MSFT]
Кто такие MVP from Alexander Lozhechkin [MSFT]
Кто такие MVP from Alexander Lozhechkin [MSFT] |