|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Hi XML problem,:toggle display effecti 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/Forums.aspx/asp-net/200609/1 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@uwe> wrote in message news:65fc42ecd19e0@uwe...Show quote > 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/Forums.aspx/asp-net/200609/1 > 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: Show quote >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 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...Show quote >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 > Actually it was my boss who wants this, i was also confused
Kevin Spencer wrote: Show quote >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 |
|||||||||||||||||||||||