Subject: Re: Newbie question: From: "Raffaele Sena" <raff@xxxxxxxxxxxx> Date: Mon, 20 Mar 2000 23:31:30 -0800 |
> A beginner question again :-) Can I put <table > command in the body of a > <xsl:when test ... > tag ? I mean, I wish to change the Background color of a > table, depending on the value of a tag. > So I wish to do something like this, but it does not work... > > <xsl:choose> > <xsl:when test='@ODD="O"'><table bgcolor="#000066"></td></xsl:when> > <xsl:when test='@ODD="N"'><table bgcolor="3366CC"></td></xsl:when> > </xsl:choose> > Yap! It doesn't work because you cannot leave the <table> tag open. But you should be able to change your code into: <table> <xsl:choose> <xsl:when test='@ODD="O"'><xsl:attribute name="bgcolor" value="#000066"/></xsl:when> <xsl:when test='@ODD="N"'><xsl:attribute name="bgcolor" value="#3366CC"/></xsl:when> </xsl:choose> <!-- table content goes here --> </table> or <xsl:variable name="bgcolor"> <xsl:choose> <xsl:when test='@ODD="O"'>#000066</xsl:when> <xsl:when test='@ODD="N"'>#3366CC</xsl:when> </xsl:choose> </xsl:variable> <table bgcolor="{$bgcolor}"> <!-- table content here --> </table> (I hope I got the syntax right :) -- Raffaele ----------------------------------------------------- raff@xxxxxxxxxxxx (::) http://www.aromatic.org/~raff/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Newbie question:, Steve Muench | Thread | Anyone got Inlogix NS 4.x XML/XSL p, Randall J. Parr |
Re: Newbie question:, Steve Muench | Date | RE: How to get XML tag attribute, Linda van den Brink |
Month |