Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSLT if help

From: Peter Flynn <peter.nosp@-.--------.-->
To: 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent