473,770 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
+ 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 1287
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:attribut e name="src">
<xsl:choose>
<xsl:when test="xpath/to/othercell='Comp lete'">
<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='Othe r'">
<xsl:text>C.gif </text>
</xsl:when>
<xsl:otherwis e>
<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.g if, 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.s ilmaril.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:attribut e name="src">
<xsl:choose>
<xsl:when test="xpath/to/othercell='Comp lete'">
<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='Othe r'">
<xsl:text>C.gif </text>
</xsl:when>
<xsl:otherwis e>
<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.g if, 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
2747
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 straight XML file http://www.discovertravelandtours.com/test/templates/test.xml?Location=Germany To another XML file http://www.discovertravelandtours.com/test/templates/test2.xml?Location=Germany
1
8686
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 <COMPANY> <EMPLOYEE currentEmployee="true"> <NAME>Victor</NAME>
12
3236
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 (xml->html) doen't happen! I have XSLT files for this, they work, I mean when I put the output of the app as an XML file on some server, and make it use the XSLT files to transform into HTML, it works, I get a HTML page.
5
7641
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 business components that can be consumed by WebForms, WinForms, mobile devices, etc? Is it even fair to compare the such technologies? - How about for cases when you need to display dynamic elements on the form/grid (as compared to knowing data elements...
4
1832
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
2170
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 XSLT to produce HTML code. The problem I have is that no matter what translation it runs through, it ALWAYS includes data that I don't match in the XSLT!! All I want to do is extract specific fields from the XML. Here's the XML source....
7
2868
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 parameter to the XSLT stylesheet XsltArgumentList xsltArgList = new XsltArgumentList(); xsltArgList.AddParam("pmID", "", pmID); xmlItems.TransformArgumentList = xsltArgList;
3
2010
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 processor input. The basic class hierarchy is:
18
2087
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 look up what each feature depends on and gerenate a text file. For example, in the following file, I would like to find out feature A depends on A1 and A2 and feature B depends on B1 and B2. And write that to a text file.
15
2162
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 XML from a Barracuda Spam server that has grown to 2. Here is a snip from my form draw. Imports System Imports System.IO Imports System.Net
0
9618
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10101
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2849
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.