Years ago (.net 2005, C#) I used to make an AJAX call via javascript to an HTTPHandler (controller), and have it call it call business objects that returned XML (model). This XML was parsed through a gener开发者_StackOverflow中文版ic routine using an XSLT (view) then returned as HTML using the Response.Write method where it was dynamically rendered on the master page using Javascript.
Using MVC2 I see how the controller and the model are the same but I can't see how to use an Xslt file as the view and have a generic transformation process render my html in a clean fashion without the overhead of using an aspx/ascx with System.Web.UI.Webcontrols.Xml object. This seems neither generic nor lightweight. Is there a way to do this? Ideally I would love to write a generic View method where I would pass the view name and the xml and get the two merged via 1 single transformation pipeline.
Thanks,
You probably want to have a custom view rendering engine registered to do the same.. You could use the following links as reference:
http://bradwilson.typepad.com/blog/2008/08/partial-renderi.html and http://www.singingeels.com/Articles/Creating_a_Custom_View_Engine_in_ASPNET_MVC.aspx
Also there is an open source project out there that does the same for you.. here is the link
http://mvccontrib.codeplex.com/Wiki/View.aspx?title=XSLT
Also I want to add functional language style like XSLT makes flow control difficult..
精彩评论