是否可以在C#asp.net代码背后的页面中传递一个公共变量,以供在XSL 1.0中使用?
I believe so - this would be an example
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("order.xsl");
// Create the XsltArgumentList.
XsltArgumentList xslArg = new XsltArgumentList();
// Create a parameter which represents the current date and time.
DateTime d = DateTime.Now;
xslArg.AddParam("date", "", d.ToString());
// Transform the file.
xslt.Transform("order.xml", xslArg, XmlWriter.Create("output.xml"));
The parameter date is replaced from within the xslt stylesheet
The XSLT fragement that is replaced looks like this
<date><xsl:value-of select="$date"/></date>
This is all from MSDN . It works from ASP.Net 2.0 onwards
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.