繁体   English   中英

将变量从asp.net代码背后传递给xsl

[英]Passing a variable from an asp.net codebehind to an xsl

是否可以在C#asp.net代码背后的页面中传递一个公共变量,以供在XSL 1.0中使用?

我相信-这将是一个例子

 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"));

从xslt样式表中替换参数date

被替换的XSLT碎片看起来像这样

<date><xsl:value-of select="$date"/></date>

这全部来自MSDN 从ASP.Net 2.0开始可以使用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM