Pass an argument into the XSL of Content Query Webpart

摘自:http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/47a63dfd-8eb3-4442-a4d0-75883a2264b9

If create a custom content query webpart you should be able to pass an argument into the XSL via the XslCompiledTransform.Transform() method.  This takes in a XslArgumentList which you could populate with the editorpart properties.

http://msdn.microsoft.com/en-us/library/system.xml.xsl.xslcompiledtransform.transform(VS.80).aspx

By the way ToolParts are the old version you should use EditorParts http://www.thesug.org/blogs/lsuslinky/Lists/Posts/Post.aspx?List=ee6ea231%2D5770%2D4c2d%2Da99c%2Dc7c6e5fec1a7&ID=8 and webparts should inherit from System.Web.UI.WebControls.WebParts.WebPart class.

 

Override ModifyXsltArgumentList and add the custom parameter to the argument list: 

protected
override void ModifyXsltArgumentList(ArgumentClassWrapper
argList)
{
    base
.ModifyXsltArgumentList(argList);
    argList.AddParameter(
"ParameterName", "", "ParameterValue"
);
}

Once this method runs the new ParameterName is then available for use within the xslt.



 

posted on 2009-07-16 19:04  王丹小筑  阅读(195)  评论(0)    收藏  举报

导航