Challenge:
On a Welcome Page of a Publishing Site I had few Managed Metadata fields. I was to implement a functionality that would fetch items from a list located on another site and filter the items using value of a metadata field of the current Welcome Page.
The idea is brilliant: there is a customer site, and there is a common list of contacts. Due to requirements, one common contacts list was preferred, so I decided to map contacts to customers by adding Metadata to contact AND to the same Metadata customer Welcome Page.
Solution:
As you cannot reference page field values in DFWP like it is done with CQWP, you must use Control parameter in Location attribute inside your ParameterBinding node (thank you Tomas Breen).
<ParameterBinding Name="Customer" Location="Control(CustomerName,ItemFieldValue)" DefaultValue=""/>
Customer above is the name of the parameter you will use in XSL. CustomerName is the ID of the Control on the Page Layout that contains the value you want to use as a filter. ItemFieldValue is the magic word I had to look for way too long.
Then, in the xsl:stylesheet of your DFWP, you will have
<xsl:param name="Customer" />
and finally you will do the filtering like this
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[@Customer= substring-before($Customer, '|')]"/>
Note that @Customer is the value of the Customer metadata field of one of the list items we're about to display. $Customer is the xsl:param that contains the value from the Customer metadata field of the current Welcome Page. Substring is done because Welcome Page metadata value comes in the form CompanyX|GUID.
Not yet working? No, because what is still missing is the actual CustomerName control that will contain the Customer value of the current Welcome Page. In my case I used TaxonomyFieldControl and added the ID attribute. You could also use SharePointWebControls:FieldValue, or SharePointWebControls:ListItemProperty, but TaxonomyFieldControl allows editing of the value when in Edit mode and I needed that.
<Taxonomy:TaxonomyFieldControl FieldName="becb57f8-ac0e-45b1-a0b4-e5fa71c0d7fa" ID="CustomerName" runat="server"></Taxonomy:TaxonomyFieldControl>
Note that you will not be able to preview the functionality in SPD. You will have to browse to the page to see your beautiful markup magic.