Reputation: 152
I'm trying to create a custom display of a list view web part using XSLT. I have linked to a xsl file and populated it with the following code:
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office">
<xsl:template match="/">
<table class="ms-listviewtable" cellspacing="0" cellpadding="1" width="100%" border="0">
<thead>
<th class="ms-vh2">Title</th>
<th class="ms-vh2">Status</th>
<th class="ms-vh2">Percent Complete</th>
</thead>
</table>
</xsl:template>
<xsl:template match="Row">
<tr>
<td>
<xsl:value-of select="@Title"/>
</td>
<td>
<xsl:value-of select="@Status"/>
</td>
<td>
<xsl:value-of select="@PercentComplete"/>
</td>
</tr>
</xsl:template>
It is only display the headings at the moment. Can someone point out what i am doing wrong?
Thanks in Advance
Upvotes: 1
Views: 12312
Reputation: 10345
You need to call your Row
template. In coding terms, you effectively have a Row method that is never called by your Main.
Try adding xsl:apply-templates to your root template:
<xsl:template match="/">
<table class="ms-listviewtable" cellspacing="0" cellpadding="1" width="100%" border="0">
<thead>
<th class="ms-vh2">Title</th>
<th class="ms-vh2">Status</th>
<th class="ms-vh2">Percent Complete</th>
</thead>
<xsl:apply-templates select="/dsQueryResponse/Rows/Row"/>
</table>
</xsl:template>
Upvotes: 4