XSL doubt!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jai80
    New Member
    • Nov 2006
    • 30

    XSL doubt!

    Hi Frenz,

    am working with xsl, and with a specific criteria, am trying to change the font color of the date value, as it can be seen from the code.
    Its a table with many rows. Instead of changing the color of the date value in that particular td of the table, i want to change the background color of tht td for tht date. please help me how to modify my code. its urgent.

    [html]<xsl:template match="//row" >
    <xsl:variable name='JoinCntFl ag' select="//row[@Element='Count Flag' and @Date=$TDate]/@Cnt"/>
    <tr>
    <td class="text1" align="left" style="backgrou nd-color: gainsbro">
    <a class="link1">
    <xsl:attribut e name="href" >javascript:Ope nVisitType('<xs l:value-of select="@Date" />')
    </xsl:attribute>
    <xsl:choose>
    <xsl:when test ="$JoinCntFl ag = 1" >
    <font color="brown">< xsl:value-of select="@Date"/> </font>
    </xsl:when>
    <xsl:otherwis e>
    <xsl:value-of select="@Date"/>
    </xsl:otherwise>
    </xsl:choose>
    </a>
    </td>
    <td>......... </td>
    </tr>
    ....
    </xsl:template>[/html]

    Thanks,
    jai
  • dorinbogdan
    Recognized Expert Contributor
    • Feb 2007
    • 839

    #2
    Try something like this:
    [html]....
    <td class="text1" align="left">
    <xsl:attribut e name="style">
    <xsl:choose>
    <xsl:when test ="$JoinCntFl ag = 1" >
    'background-color:red'
    </xsl:when>
    <xsl:otherwis e>
    'background-color:blue'
    </xsl:otherwise>
    </xsl:choose>
    </xsl:attribute>
    <a class="link1">
    <xsl:attribut e name="href">jav ascript:OpenVis itType('<xsl:va lue-of select="@Date" />')
    </xsl:attribute>
    <xsl:value-of select="@Date"/>
    </a>
    </td>
    ....[/html]

    Comment

    Working...