Hi XML problem,:toggle display effect

Discussion in 'ASP .Net' started by gauravkg via DotNetMonster.com, Sep 8, 2006.

  1. 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
    gauravkg via DotNetMonster.com, Sep 8, 2006
    #1
    1. Advertising

  2. 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.

    "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/Forums.aspx/asp-net/200609/1
    >
    Kevin Spencer, Sep 8, 2006
    #2
    1. Advertising

  3. 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: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>
    >
    >> 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
    gauravkg via DotNetMonster.com, Sep 8, 2006
    #3
  4. 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>
    >>
    >> <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>
    >>
    >>> 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
    >
    Kevin Spencer, Sep 8, 2006
    #4
  5. 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
    gauravkg via DotNetMonster.com, Sep 9, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry Hill
    Replies:
    0
    Views:
    465
    Jerry Hill
    Oct 20, 2010
  2. kiran

    Toggle Image - Problem in IE

    kiran, Jun 3, 2004, in forum: Javascript
    Replies:
    4
    Views:
    103
    Grant Wagner
    Jun 4, 2004
  3. Yourself
    Replies:
    1
    Views:
    115
    Evertjan.
    May 23, 2006
  4. Pawel_Iks

    problem with toggle script

    Pawel_Iks, Apr 16, 2009, in forum: Javascript
    Replies:
    5
    Views:
    140
    Thomas 'PointedEars' Lahn
    Apr 17, 2009
  5. neetu
    Replies:
    1
    Views:
    211
Loading...

Share This Page