Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XSLT if help >Thread Next - Re: XSLT if help Re: XSLT if helpTo: NULL Date: 2/2/2006 10:18:00 PM CK wrote:
> Hi Everyone,
> I have a custom web part in SharePoint. I want a cell in the table to be
> conditionally formatted. Using Front Page it's fairly easy to make general
> formatting chnages, like color, italics, and bold, etc... My problem is that
> I want to show an image in a cell. The image will be based on the content in
> another cell. If the value of the cell is "Complete" I want to show image A,
> if "In Progress" image B, and if "Other" then image C. Does anyone have any
> examples of how to do this? Any links or sample code would be appreciated.
<img alt="whatever" width="x" height="y">
<xsl:attribute name="src">
<xsl:choose>
<xsl:when test="xpath/to/othercell='Complete'">
<xsl:text>A.gif</text>
</xsl:when>
<xsl:when test="xpath/to/othercell='In Progress'">
<xsl:text>B.gif</text>
</xsl:when>
<xsl:when test="xpath/to/othercell='Other'">
<xsl:text>C.gif</text>
</xsl:when>
<xsl:otherwise>
<xsl:text>error.gif</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</img>
A shorter way would be to rename the images Complete.gif,
In%20Progress.gif, and Other.gif, then just use the value of the
specified cell as the src attribute value.
///Peter
--
XML FAQ: http://xml.silmaril.ie/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
