This post shows how you can use the DataView web part (aka the DataFormWebPart) to display a list of items from another SharePoint 2007 site using SharePoint designer.
1. Using SharePoint designer, insert a data view web part onto the page you want to display in the list by selecting Data View > Insert Data View from the main menu.
2. Using the Data Source Library Task Pane in SharePoint designer select 'Connect to another library' and browse to the site that contains the list you wish to display.
3. Expand the new site in the Data Source Library Task Pane and select the list or library that contains the information you wish to display. From the drop down select 'Show Data' to populate the Data Preview tab.
4. From the list of columns, select the ones that you wish to display and select ‘Insert selected fields as… multiple item view' from the drop down menu at the top of the window. This will populate the data view with sample information (in a table by default). At this stage you may get an error in the design view that states:
"The server returned a non-specific error when trying to get data from the data source. Check the format and content of your query and try again. If the problem persists, contact the server administrator".
This can be corrected by modifying the <SelectParameters> tag of the <SharePoint:SPDataSource> element of the data view to contain the reletive url of the site for the WebUrl parameter (look at the default parameters to find this out - should be something similar to '/news/').
5. (Optional) Modify the XSL for the data view to display the information in the format you require. By default there is often a large amount of redundant information, and in simple cases can be replaced with the following:
<XSL>
<xsl:stylesheet ...>
<xsl:output method="html" indent="no"/>
<xsl:template match="/">
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
<ul>
<xsl:for-each select="$Rows">
<li>
<a href="{substring-before(@URL, ', ')}"><xsl:value-of select="substring-after(@URL, ', ')"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
</XSL>
6. Now you have the basic data coming through you can select to filter, sort, group or perform other data view related tasks by clicking on the arrow next to the data view in design view. I will cover some of these options in a later post.