RE: [xsl] Re: <xsl:choose> or variable syntax incorrect?

Subject: RE: [xsl] Re: <xsl:choose> or variable syntax incorrect?
From: "Kathy Burke" <Kathy_Burke@xxxxxxxxx>
Date: Fri, 26 Sep 2003 15:48:44 -0400
Tom, not meaning to make this "hard"...really...was simply looking for an
example of accomplishing an <xsl:choose> condition to return a result, based
on the 'name' attribute of an element. I did mention that I'm not getting an
error now, just that my <xsl:when> result skips to the <xsl:otherwise>
section regardless of what's in my xml file.

Thanks for your example. Using the $rowcolor variable is SO MUCH SIMPLER
than what I was trying to do. But my result is still that all rows are blue
even though one of the three should be red because they have <Board>

I'll have to keep playing with it I guess. Thanks. Kathy

p.s. BTW, I've seen TR bgcolor attribute used many times in books, etc. I
believe it is the user's preference...  :-)

-----Original Message-----
From: Passin, Tom [mailto:tpassin@xxxxxxxxxxxx]
Sent: Friday, September 26, 2003 3:20 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Re: <xsl:choose> or variable syntax incorrect?

[ Kathy Burke]

> First, I truly appreciate your responding. But please tell me 
> how I did not
> "explain the problem I've solving"? I honestly thought I did!

Kathy, stop making this so hard!  You are trying to transform some input
into some output.  You have not really told us accurately and concisely
what the output should be, and you have not told us what you get when
you say that "it doesn't work".  For example, the bgcolor attribute
belongs on the td, not the tr. That is an HTML problem.  You need to get
your HTML right, then think about the transform. One of your posts
contained non-wellformed xml in a template.  That is an xml problem.
You need to say how you know it isn't working, like the error message or
the actual results.

Think simple.  Based on what you have said - and I know that ultimately
you want to do something more complex - here is a simple solution that
works in the sense that it creates either a red or a blue background
cell filled with the station name, depending on the presence of
boards/board elements.  It ought to be self-explanatory.

<xsl:template match='data'>
      <xsl:apply-templates select='station'/>

<xsl:template match="station">
   <xsl:variable name='rowcolor'>
         <xsl:when test='boards/board'>red</xsl:when>
      <td bgcolor='{$rowcolor}'><xsl:value-of select='@name'/></td>



Tom P

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread