110,537
社区成员
发帖
与我相关
我的任务
分享
<xsl:output method="html" encoding="gb2312" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" indent="no" standalone="yes" omit-xml-declaration="no" />
<xsl:text disable-output-escaping="yes"> </xsl:text>
<xsl:text disable-output-escaping="yes"> </xsl:text>
public void ResponseHTML(System.Web.UI.Page page, string xmlPath, string xlstPath, string encoding, XmlResolver resources)
{
try
{
//加载Xslt文件
XslTransform objXslTran = new XslTransform();
objXslTran.Load(xlstPath);
XPathNavigator doc = new XPathDocument(xmlPath).CreateNavigator();
//输出到响应流
XmlTextWriter writerPage = new XmlTextWriter(page.Response.OutputStream, System.Text.Encoding.GetEncoding(encoding));
writerPage.WriteDocType("html", "-//W3C//DTD XHTML 1.0 Transitional//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", null);
objXslTran.Transform(doc, null, writerPage, resources);
writerPage.Close();
}
catch (Exception error)
{
throw new Exception("向客户端发送HTML失败:" + error.Message);
}
}