xsl-list
[Top] [All Lists]

Re: [xsl]Counting Child Nodes?

2007-10-21 08:55:14
Alice Ju-Hsuan Wei wrote:
Hi,

Thanks to all of you who helped pitch in to make this code work. Now, this code is basically working, but I don't know why it generates the background image as either _med.png or _large.png, while those with string length smaller than 25 characters still generate the second <xsl:if> statement, by generating the _med.png just the same as the second condition.

 Is this another boolean problem I am having? Any suggestions?

Yes. Re-read the comments of Scott and Michael. You haven't (yet) applied their advice. Comparing numbers as strings (MK & Scott), using xsl:if when xsl:when is better and vv (Scott & MK), being overly verbose (Scott & MK), a possible full solution (Scott) and questions about the code in general (MK) were all points of attention not reflected in this new post of you. Maybe you missed their messages? Check back what they wrote (19-10-2007 17:01 and 17:02 resp). If things are not clear, ask them to clarify.

Some of the points mentioned are well-explained in "Beginning XSLT" by Tennison. which you mention in your sample xml: if you don't have it yet, I recommend buying it, it is a good read and may very well teach you how to write XSLT declarative instead of imperative (which it is now), making your code more adapt to changes and less error prone.

Cheers,
-- Abel Braaksma

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>