Hi Zain,

I think <td bgcolor="{Color/@hex}"> is what you're looking for.

This is not the best place to ask general XSLT questions. You may want to
check out the XSL FAQ (http://www.dpawson.co.uk/xsl/xslfaq.html), as well
as the xsl-list (http://mulberrytech.com/xsl/xsl-list/index.html) and
their archives.

Cheers,
Gordon

On Fri, 18 Jul 2003, Ali Zain Banatwala wrote:

> Hi everyone,
>
>   each stock has it's own row and each cell represents
> a trading day. i'm trying to set the bgcolor of each
> cell to the color(in hex) for that particular node. my
> knowledge of XSLT is quite limited and i have no idea
> how to do this. i've attached both the xslt file and a
> snippet of the xslt file. i'm using Xalan and Xerces
> thru JAXP. pls help!
>
> thanks....Zain
>
>
>   here is a sample of my XML file....
>
>  <Equities-List>
>    <Equity name="CP">
>      <EquityNode date="2000-01-03" close="9.6">
>        <Color hex="246f15">
>      </EquityNode>
>      <EquityNode date="2000-01-04" close="9.7">
>        <Color hex="227017">
>      </EquityNode>
>      <EquityNode date="2000-01-05" close="9.9">
>        <Color hex="1f731a">
>      </EquityNode>
>    </Equity>
>  </Equities-List>
>
>
>   and here's my XSLT file....
>
>   <xsl:template match="/">
>    <html>
>     <body>
>      <table>
>       <xsl:for-each select="//Equity">
>        <tr>
>         <td>
>           <xsl:value-of select="@name">
>         </td>
>         <td>
>           <xsl:apply-templates select="EquityNode"/>
>         </td>
>       </xsl:for-each>
>      </table>
>     </body>
>    </html>
>   </xsl:template>
>
>   <xsl:template match=EquityNode">
>     <td bgcolor="<!-- SET COLOR TO @HEX IN COLOR NODE
> -->">
>       <xsl:value-of select="@date"/>
>       <xsl:text> close= </xsl:text>
>       <xsl:value-of select="@close"/>
>       <br/><br/>
>       <xsl:apply-templates select="Color"/>
>     </td>
>   </xsl:template>
>
>   <xsl:template match=Color">
>       <xsl:text> Hex= </xsl:text>
>       <xsl:value-of select="@hex"/>
>   </xsl:template>
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>

Reply via email to