Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to pull the value of a property, from a web part into XSL?

I need to build something similar to the standard Summary Link Web Part, but would like to extend the default control with only a single property which will allow the editors of the site to supply a URL to a link, located in the footer-item of the SummaryLinkMainQuery.xsl.

share|improve this question

2 Answers 2

up vote 8 down vote accepted

Definitely passing webpart values to XSLT is possible for all classes which inherit from DataFormWebPart, and can be easily done through ParameterBinding:

<ParameterBinding Name="WPPropertyBinding" Location="WPProperty(Title)" />

Use your custom property name instead of Title.

If you're using a standard SummaryLinkWebPart and you need only to fix XSL transformation, then all you have to do to achieve this, is to add the parameter binding string shown above to ParameterBindings property of SummaryLinkWebPart.

Then, in XSLT, reference this parameter using following xsl code:

<xsl:param name="WPPropertyBinding" />

From this point, you will be able to use the parameter in XPath queries, for example:

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

Read more about ParameterBindings on Stefan Stanev's blog, he has a really comprehensive article about it:

share|improve this answer

Watch out as SummaryLinkWebPart is a sealed class - you can't inherit it. Basically you'd have to build it from scratch.

share|improve this answer
    
just saw that as well. i wanted to get assurance that there is a way to call property values in xls, let's say "MyProperty {get; set;}", how would I call that in XSL? "<%=this.MyProperty%>" or something similar? –  JadedEric Oct 26 '11 at 7:29
    
You could /try/ and adding to the list of xsl params that are at the top of the Main xsl. –  James Love Oct 26 '11 at 8:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.