Question

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.

Was it helpful?

Solution

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:

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top