473,480 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XSLT if help

CK
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.

Thanks,
CK
Feb 1 '06 #1
2 1274
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/
Feb 2 '06 #2
CK
Terrific. Thanks Peter
"Peter Flynn" <pe********@m.silmaril.ie> wrote in message
news:44************@individual.net...
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/

Feb 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2719
by: Pete | last post by:
I am just getting to grips with XML and I was wondering if you could help me with something that no-one seems able or willing to help with.. I have an XSLT file which should be transforming a...
1
8660
by: Victor | last post by:
Hi, this might sound silly but I cannot figure out how to incorporate some XML of employees into some XML of a company to give new XML containing them all. For example, this is the company now ...
12
3193
by: gipsy boy | last post by:
Hello, I have sort of a big problem. I would really appreciate any help you could give me. I made a web service in C++ that throws XML to the client (browser). But, the XSLT transormation...
5
7603
by: Fred | last post by:
Not much expertise on XSLT and trying to understand it's uses when creating apps in VS.NET? If I wanted flexibility on the UI (View aspect of M.V.C.): - How does it compare with creating...
4
1815
by: Chris Kettenbach | last post by:
Hi Peter, I get error when processing the stylesheet. It errors here. <xsl:for-each select="registration)=1]"> specifically: Expression does not return a DOM node. registration)=1]<--
4
2138
by: Moogy | last post by:
I'm pulling my hair out here. First, I'm new to XML, so that doesn't help, but none of this makes any sense to me. All I'm trying to do is take a simple source XML file and translate it with an...
7
2825
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
3
1995
by: thomas.porschberg | last post by:
Hi, I want to read records from a database and export it in an arbitrary format. My idea was to feed a class with a String array fetched from the database and let this class fire SAX events as...
18
2040
by: yinglcs | last post by:
Hi, I have a newbie XSLT question. I have the following xml, and I would like to find out the children of feature element in each 'features' element. i.e. for each <featuresI would like to...
15
2134
by: Jeff Uchtman | last post by:
Can I draw from 2 XML sources, the structure is exactly the same execpt for data contained into 1 xslt using math to add some structrure, and displaying others as node 1 and node 2? This data is...
0
7054
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6918
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7057
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5357
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3008
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
570
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.