Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Hi XML problem,:toggle display effect

Reply
Thread Tools

Hi XML problem,:toggle display effect

 
 
gauravkg via DotNetMonster.com
Guest
Posts: n/a
 
      09-08-2006
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

 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      09-08-2006
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>

<xsltherwise>
<tr class="spec_item_odd">
</xsltherwise>
</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@uwe> wrote 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
>



 
Reply With Quote
 
 
 
 
gauravkg via DotNetMonster.com
Guest
Posts: n/a
 
      09-08-2006
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>
>
> <xsltherwise>
> <tr class="spec_item_odd">
> </xsltherwise>
> </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

 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      09-08-2006
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@uwe> wrote 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>
>>
>> <xsltherwise>
>> <tr class="spec_item_odd">
>> </xsltherwise>
>> </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
>



 
Reply With Quote
 
gauravkg via DotNetMonster.com
Guest
Posts: n/a
 
      09-09-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to display color in excel not able to display color in excel using xml sed_y XML 0 02-15-2012 09:46 PM
Re: Tkinter (and IDLE) window "docking?" effect when dragging rootwindow to edge of display Jerry Hill Python 0 10-20-2010 05:44 PM
set struts.devMode to true in struts.xml does not effect as the docsays? lightning Java 0 07-14-2008 02:57 PM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
mixing raw xml display w/ formated display blank101 XML 2 02-05-2005 03:10 PM



Advertisments