Hi XML problem,:toggle display effect

  • Thread starter gauravkg via DotNetMonster.com
  • Start date
G

gauravkg via DotNetMonster.com

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
 
K

Kevin Spencer

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:eek:therwise>
<tr class="spec_item_odd">
</xsl:eek:therwise>
</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.
 
G

gauravkg via DotNetMonster.com

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 said:
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:eek:therwise>
<tr class="spec_item_odd">
</xsl:eek:therwise>
</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>
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
 
K

Kevin Spencer

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 said:
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 said:
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:eek:therwise>
<tr class="spec_item_odd">
</xsl:eek:therwise>
</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>
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
 
G

gauravkg via DotNetMonster.com

Actually it was my boss who wants this, i was also confused
Kevin said:
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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top