绑定值从vb.net变量值,而不是与XML值XSLT
问题描述:
我想vb.net变量值绑定到 XSLT ,我只知道绑定在 XML 值
I want to bind vb.net variable value to the xslt , i know only binding the xml value as
< xsl:value-of select="somevalue"/>
但如何将值绑定的 XSLT 当我有 vb.net varible为
but how to bind the value to xslt when i have vb.net varible as
Dim somevalue as string="Ramesh"
谢谢
拉梅什
Thanks Ramesh
答
在您的XSLT code,你需要定义一个全局参数为
In your XSLT code you need to define a global parameter as
<xsl:param name="my-param"/>
和
<xsl:value-of select="$my-param"/>
然后在.NET code当您运行转换,你可以做
then in your .NET code when you run the transformation you can do
Dim xsltArgs As New XsltArgumentList()
xsltArgs.AddParam("my-param", "", "Ramesh")
,然后当调用的 XslCompiled
变换
法通在 xsltArgs
,如
Dim xsltProc as New XslCompiledTransform()
xsltProc.Load("file.xsl")
xsltProc.Transform("input.xml", xsltArgs, Response.Output)