Reputation:
I want to display a sharepoint list in such a way that rows are displayed with different content, based on the value of some field.
For example, if a row is a "Company", then I want to display the name of the company, the address, etc. Also, this row should be shaded and displayed in bold. If the row is a "Person", then I want to display the name, e-mail, Job description, etc.
Question: Would that be possible by manipulating the XSLT templates?
In fact, I want to create some sort of "switch"-statement in each field, which populates the field dynamically, depending on data in another column.
I'm asking beforehand, because it seems that it would be quite a lot of work to go in depth with the XSLT topic. (The code generated in Sharepoint Deisgner is about 10.000 lines long ...)
My intention is to create a compact, printer-friendly report. We have already tried the grouping function of lsits, but that is not sufficient for our task.
Upvotes: 1
Views: 786
Reputation: 101730
Yes, this should be possible with XSLT. I imagine that your XSLT has a template like this:
<xsl:template match="Row">
<!-- XSLT for generating row -->
</xsl:template>
You should be able to override this template by adding your own that are more specific. Assuming that Type is the name of the column that you will use to determine the row type:
<xsl:template match="Row[@Type = 'Company']">
<tr>
<!-- Content for a company row -->
</tr>
</xsl:template>
<xsl:template match="Row[@Type = 'Person']">
<tr>
<!-- Content for a company row -->
</tr>
</xsl:template>
An approach like this should theoretically work, but it would be necessary to see some of your XSLT to be sure. Perhaps you could upload it to someplace like PasteBin?
Upvotes: 1