473,394 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Hi XML problem,:toggle display effect

Thanks to allof u how have given pain to see my problem
i have an xml file having this tructure

<specifications>
<row>
<heading>MegaPixels(Effective)</heading>
<data>6.0</data>
</row>
<row>
<heading>MegaPixels(Total)</heading>
<data>6.2</data>
</row>
</specifications>

the xslt file is this
<table class="spec_item_table">

<xsl:for-each select="specifications/row">
<tr class="spec_item_odd">
<td>
<xsl:value-of select="heading"></xsl:value-of>
</td>
<td>
<xsl:value-of select="data"></xsl:value-of>
</td>
</tr>
</xsl:for-each>
</table>
my problem is that for each row it should show different colors like
row1:grey color
row2.yellow

for that i used
<tr class="spec_item_odd">

bit it will have same for all the rows so i can achive this in xml .thanks
in advance

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200609/1

Sep 8 '06 #1
4 1061
If I understand you correctly, you want to use a different style background
color for alternating rows in a table, correct?

If so, something like the following will work:

<table class="spec_item_table">

<xsl:for-each select="specifications/row">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">
<tr class="spec_item_even">
</xsl:when>

<xsl:otherwise>
<tr class="spec_item_odd">
</xsl:otherwise>
</xsl:choose>
<td>
<xsl:value-of select="heading"></xsl:value-of>
</td>
<td>
<xsl:value-of select="data"></xsl:value-of>
</td>
</tr>
</xsl:for-each>
</table>

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.

"gauravkg via DotNetMonster.com" <u25584@uwewrote in message
news:65fc42ecd19e0@uwe...
Thanks to allof u how have given pain to see my problem
i have an xml file having this tructure

<specifications>
<row>
<heading>MegaPixels(Effective)</heading>
<data>6.0</data>
</row>
<row>
<heading>MegaPixels(Total)</heading>
<data>6.2</data>
</row>
</specifications>

the xslt file is this
<table class="spec_item_table">

<xsl:for-each select="specifications/row">
<tr class="spec_item_odd">
<td>
<xsl:value-of select="heading"></xsl:value-of>
</td>
<td>
<xsl:value-of select="data"></xsl:value-of>
</td>
</tr>
</xsl:for-each>
</table>
my problem is that for each row it should show different colors like
row1:grey color
row2.yellow

for that i used
<tr class="spec_item_odd">

bit it will have same for all the rows so i can achive this in xml
.thanks
in advance

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200609/1

Sep 8 '06 #2
u have understood the problem rightly, can u tell whether we can use repeater
to show the data

in this scenario that is
<specifications>
<row>

<heading>MegaPixels(Effective)</heading>
<data>6.0</data>
</row>
</specifications>
if yes then how ?

Kevin Spencer wrote:
>If I understand you correctly, you want to use a different style background
color for alternating rows in a table, correct?

If so, something like the following will work:

<table class="spec_item_table">

<xsl:for-each select="specifications/row">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">
<tr class="spec_item_even">
</xsl:when>

<xsl:otherwise>
<tr class="spec_item_odd">
</xsl:otherwise>
</xsl:choose>
<td>
<xsl:value-of select="heading"></xsl:value-of>
</td>
<td>
<xsl:value-of select="data"></xsl:value-of>
</td>
</tr>
</xsl:for-each>
</table>
>Thanks to allof u how have given pain to see my problem
i have an xml file having this tructure
[quoted text clipped - 35 lines]
>.thanks
in advance
--
Message posted via http://www.dotnetmonster.com

Sep 8 '06 #3
Sorry, I'm confused now. Your question sounded like a question about XSLT,
which has nothing to do with Repeaters. So I don't know what to tell you at
this point.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.

"gauravkg via DotNetMonster.com" <u25584@uwewrote in message
news:65fd5c41a48b4@uwe...
>u have understood the problem rightly, can u tell whether we can use
repeater
to show the data

in this scenario that is
<specifications>
<row>

<heading>MegaPixels(Effective)</heading>
<data>6.0</data>
</row>
</specifications>
if yes then how ?

Kevin Spencer wrote:
>>If I understand you correctly, you want to use a different style
background
color for alternating rows in a table, correct?

If so, something like the following will work:

<table class="spec_item_table">

<xsl:for-each select="specifications/row">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">
<tr class="spec_item_even">
</xsl:when>

<xsl:otherwise>
<tr class="spec_item_odd">
</xsl:otherwise>
</xsl:choose>
<td>
<xsl:value-of select="heading"></xsl:value-of>
</td>
<td>
<xsl:value-of select="data"></xsl:value-of>
</td>
</tr>
</xsl:for-each>
</table>
>>Thanks to allof u how have given pain to see my problem
i have an xml file having this tructure
[quoted text clipped - 35 lines]
>>.thanks
in advance

--
Message posted via http://www.dotnetmonster.com

Sep 8 '06 #4
Actually it was my boss who wants this, i was also confused
Kevin Spencer wrote:
>Sorry, I'm confused now. Your question sounded like a question about XSLT,
which has nothing to do with Repeaters. So I don't know what to tell you at
this point.
>>u have understood the problem rightly, can u tell whether we can use
repeater
[quoted text clipped - 43 lines]
>>>.thanks
in advance
--
Message posted via http://www.dotnetmonster.com

Sep 9 '06 #5

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

Similar topics

2
by: leegold2 | last post by:
I wondered if anyone would give me code- I think it would be easy, but I'm a complete newbie. What I want to do is to show many tables in a brief truncated format and then for each table offer the...
7
by: Nik | last post by:
I'm trying to combine css-popups with an images-in-inline-lists gallery. The problem I see with http://www.niksally.f2s.com/upload/gallery/gallery.html is that the images jog when the mouse...
12
by: David | last post by:
Hi, I am trying to achieve the following: 1/ To have a standard form in an asp web page which has various check boxes and radio buttons. As a user selects a form item it updates a text box,...
1
Markus
by: Markus | last post by:
I've made the peice of code below to toggle the selected elements 'display' from 'display' to 'none' and vice versa. Now i'd like to know if it's possible for me to toggle the display elements of 2...
1
by: swiftouch | last post by:
I'm getting an error message in FF2.0: document.getElementById(toggle) has no properties The goal of the script is, when I hover my mouse over an image, to make one div element visible while...
11
by: Stevo | last post by:
I have a problem with Firefox 2 where if I resize the height of a DIV (using JavaScript), but the rest of the page below isn't being updated to reflect the new positions that affected items should...
1
by: student4lifer | last post by:
Hello, I currently have a hyperlink to toggle the node, showing and hiding the list. Could someone show me how to use a checkbox instead of the hyperlink to do the same thing? Thanks. I...
1
by: Amit1980 | last post by:
I have to toggle the arrow image on onclick event. Here is the code with the required functionility. What I want now is, when the page loads there will be right arrow images. The arrow should be...
2
by: slapsh0t11 | last post by:
So, I've been working on this Game of Life (http://www.bitstorm.org/gameoflife/) project, and all the code has been written. However, it will not run. First, I will post the error message and the...
3
by: metaphysics | last post by:
http://wexcode.com/portfolio.php For some reason, this page doesn't work in IE, but seems to work fine in all other browsers. Can anyone identify why this isn't working in IE? Thanks. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...
0
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...

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.