|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
<xsl:if>
dear all
can anyone suggest me i need to use different bgcolors depending on the condition <table> <tr> <xsl:if test="$levelNo = '2'"> <td bgcolor="red"> </xsl:if> <xsl:if test="$levelNo != '2'"> <td bgcolor="blue"> </xsl:if> some text here </td> </tr> </table> when i use that even closed tag of </td> exists it is giving error? can anyone suggest the way around this pls thank u with regards niha |
|
#2
|
|||
|
|||
|
Don't forget, xsl documents are still xml. The example you gave is not valid xml, since you don't close your td elements you create within the if statements.
You need to create the element, then set it's attribute. Code:
<td>
<xsl:if test="$levelNo='2'">
<xsl:attribute name="bgcolor">
red
</xsl:attribute>
</xsl:if>
<xsl:if test="$levelNo!='2'">
<xsl:attribute name="bgcolor">
blue
</xsl:attribute>
</xsl:if>
</td>
Ref: http://www.w3schools.com/xsl/el_attribute.asp |
|
#3
|
|||
|
|||
|
thank u
thank u
i will try that with regards niha |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > <xsl:if> |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|