English 中文(简体)
需要帮助将XSL的转变从XML转化为ASP的超文本。 NET MVC
原标题:Need help preforming an XSL Transform from XML to HTML in ASP.NET MVC
最佳回答

查阅http://www.geekzilla.co.uk/ViewD245BBE0-2EAB-44C0-91-8038467926EE.htm

守则一最后使用(与上述联系和我具体情况的一些变化相联)是:

String TransactionXML = item.Action;    

System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.IO.Stream xmlStream;
System.Xml.Xsl.XslCompiledTransform xsl = new System.Xml.Xsl.XslCompiledTransform();
ASCIIEncoding enc = new ASCIIEncoding();
System.IO.StringWriter writer = new System.IO.StringWriter();

// Get Xsl and XML
xsl.Load(HttpContext.Current.Server.MapPath("~/App_Data/xmlverbatimwrapper.xsl"));
xmlDoc.LoadXml(TransactionXML);

// Get the bytes
xmlStream = new System.IO.MemoryStream(enc.GetBytes(xmlDoc.OuterXml), true);

// Load Xpath document
System.Xml.XPath.XPathDocument xp = new System.Xml.XPath.XPathDocument(xmlStream);

// Perform Transform
xsl.Transform(xp, null, writer);

// output
Response.Write(writer.ToString()); 

希望能帮助人们!

问题回答

仅是一gues,但有效的超文本并不一定是有效的XML,你再使用一个叫XmlWriter的类别。 如果看不到你的XSL和投入XML,就很难说什么。 我怀疑你的产物文件不完善。

我想,你需要提供不同的文字执行,可以处理超文本产出。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签