1

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.

3 Answers 3

1

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" />

0

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" />

0

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.

2
  • The link doesn't work here :(
    – user2518
    Commented Feb 28, 2011 at 18:10
  • Apologies, wrong link! Updated.
    – James Love
    Commented Feb 28, 2011 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.