How to render asp.net mvc controls in XSLT
I would like to use the asp.net mvc actionlink and form controls in xs开发者_JAVA技巧lt code. How do I go about doing this? is this notpossible to do in xslt? I could not find a solution online.
It's possible. Check out these links to get you started.
http://blog.stevensanderson.com/category/xslt/
http://weblogs.asp.net/jigardesai/archive/2008/02/08/xslt-transformation-in-asp-net-mvc-framework.aspx
http://derek-says.blogspot.com/2008/05/creating-views-using-xsl-in-aspnet-mvc.html
Last but not least.... A sample on codeplex doing this. http://tpeczek.codeplex.com/releases/view/45199
EDIT: Upon further thought...
Since it seems you are wanting to use XSLT at runtime then rendering an action link or other controls using the helpers in MVC won't work. The XSLT will spit out the action link or control based on your entered transformation but the MVC engine will not execute on it to create the resultant html.
If you were doing this at design time say as part of a code generator then you could use the XSLT to create your views but you would still have to take the resultant file and use that as your view in your application.
Not possible. The ASP.NET MVC HTML helpers produce strings, while XSLT produce a tree of nodes.
精彩评论