XSLT displays a multi-select column

Thanks to MarcĀ again for this helpful article.

Here is the xsl code:

<xsl:template name=”MultiSelectDisplay”>
<xsl:param name=”MultiSelectValue”/>
<xsl:param name=”MultiSelectSeparator”/>
<xsl:choose>
<xsl:when test=”contains($MultiSelectValue, ‘;’)”>
<xsl:value-of select=”concat(substring-before($MultiSelectValue, ‘;’), $MultiSelectSeparator)” disable-output-escaping=”yes”/>
<xsl:call-template name=”MultiSelectDisplay”>
<xsl:with-param name=”MultiSelectValue” select=”substring-after($MultiSelectValue, ‘;’)”/>
<xsl:with-param name=”MultiSelectSeparator” select=”$MultiSelectSeparator”/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=”$MultiSelectValue” disable-output-escaping=”yes”/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

Other useful SharePoint xsl templates written by Marc & Co can be found here.

Show file attachments for SharePoint list items in a Data View Web Part (DVWP)

I needed to display all the attachments of a SharePoint list item in a DVWP. Thanks to Marc’s article for helping me out.

I added the code that Marc provided between a <td> tag. Magically, it worked!

 

<td>
<xsl:text>Attachments: </xsl:text>
<xsl:element name=”SharePoint:AttachmentsField”>
<xsl:attribute name=”runat”>server</xsl:attribute>
<xsl:attribute name=”FieldName”>Attachments</xsl:attribute>
<xsl:attribute name=”ControlMode”>Display</xsl:attribute>
<xsl:attribute name=”Visible”>true</xsl:attribute>
<xsl:attribute name=”ItemId”>
<xsl:value-of select=”@ID”/>
</xsl:attribute>
</xsl:element>
</td>