XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 17th, 2003, 08:10 AM
nihaarika2002 nihaarika2002 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 49 nihaarika2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
<xsl:if>

dear all
can anyone suggest me



i need to use different bgcolors depending on the condition

<table>
<tr>


<xsl:if test="$levelNo = '2'">
<td bgcolor="red">
</xsl:if>
<xsl:if test="$levelNo != '2'">
<td bgcolor="blue">
</xsl:if>
some text here
</td>
</tr>
</table>

when i use that
even closed tag of </td> exists it is giving error?

can anyone suggest the way around this pls

thank u
with regards
niha

Reply With Quote
  #2  
Old March 17th, 2003, 12:41 PM
MJEggertson MJEggertson is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2002
Location: Seattle WA
Posts: 863 MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 8
Don't forget, xsl documents are still xml. The example you gave is not valid xml, since you don't close your td elements you create within the if statements.

You need to create the element, then set it's attribute.
Code:
<td>
  <xsl:if test="$levelNo='2'">
    <xsl:attribute name="bgcolor">
      red
    </xsl:attribute>
  </xsl:if>
  <xsl:if test="$levelNo!='2'">
    <xsl:attribute name="bgcolor">
      blue
    </xsl:attribute>
  </xsl:if>
</td>

Ref: http://www.w3schools.com/xsl/el_attribute.asp

Reply With Quote
  #3  
Old March 18th, 2003, 02:07 AM
nihaarika2002 nihaarika2002 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 49 nihaarika2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
thank u

thank u
i will try that
with regards
niha

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > <xsl:if>


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway