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

I've used a parameter in the query string to filter a dataview. The parameter is declared in "SelectParameters" tag and used in the "selectcommand" parameter as a filter in the query.

Now, is there a way to use that parameter in the "XSL" tag? I tried : <xsl:value-of select="$PARAM" /> <xsl:value-of select="@PARAM" /> <xsl:value-of select="{PARAM}" /

And it doesn't work... I'm with Sharepoint 2007.

share|improve this question
add comment

3 Answers

OK, I forgot something in the dataview definition...

First, you have to put a line like :

<WebPartPages:DataFormParameter Name="PARAMNAM" ParameterKey="PARAMNAME" PropertyName="ParameterValues" />

Inside the XSL tag, at the beginning, you need (that's what I forgot) :

<xsl:param name="PARAMNAME">DEFAULT VALUE</xsl:param>

And you also need, in parameterbindings :

<ParameterBinding Name="PARAMNAME" Location="QueryString(PARAMNAM)" DefaultValue="DEFAULT VALUE" />

Now to output the value, for example, you can do :

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

share|improve this answer
add comment

If the query string parameter is in the parameter bindings and listed as a param, you should be able to use it as <xsl:value-of select="$PARAM" />

share|improve this answer
add comment

Very doable from the SharePoint Designer GUI. See Laura Rogers' blog post on this:

http://www.sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=81

Inspect the XSL generated to see how it works.

share|improve this answer
    
The link doesn't work here :( –  user2518 Feb 28 '11 at 18:10
    
Apologies, wrong link! Updated. –  James Love Feb 28 '11 at 22:22
add comment

Your Answer

 
discard

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