Subject: Re: Alternating table row colors with recursion From: Mike Brown <mike@xxxxxxxx> Date: Tue, 28 Nov 2000 16:48:21 -0700 (MST) |
David Carlisle wrote: > > I think he wants the rows to alternate for each message. > > So did I. but I thought that the input was such that each of those > selects would only pick up one message. (Without seeing the input > it's a bit hard to tell:-) True. We are left to speculate as to what he's actually working with. > > <xsl:apply-templates select = "//Message[ParentMessageID = '$MID']"> This led me to believe that his input is an unordered set of <Message> elements that are related to each other by virtue of common ParentMessageID values, like: <Messages> <Message ID="msg.1"> <Data>blahblahblah...</Data> </Message> <Message ID="msg.2"> <ParentMessageID>msg.1</ParentMessageID> <Data>blahblahblah2...</Data> </Message> <Message ID="msg.3"> <ParentMessageID>msg.1</ParentMessageID> <Data>blahblahblah3...</Data> </Message> <Message ID="msg.4"> <ParentMessageID>msg.2</ParentMessageID> <Data>blahblahblah4...</Data> </Message> </Messages> ...thus implying an arbitrarily deep threading structure. He is probably wanting to process each 'orphan' Message that starts a new thread, and below each of these show all the 'descendants' of that message. It's not too difficult to do that part, but throw in the alternating colors and it becomes quite a chore. I think that to determine the color of the current Message's row, he has to know whether the previous Message sibling (in the thread tree, not the actual source tree, so using straight XPath is out) was odd or even, and whether it has an odd or even number of descendants. If there was no previous sibling, then use the last of the parent's siblings. I suspect that keys could play a major role in the solution. > $MID isn't a parameter to the template so if any instance of > select = "//Message[ParentMessageID = '$MID']"> I am guessing he meant to assign a MID variable and then reference it without the single quotes. C'mon, folks, it's good to post representative code samples, but don't cut too much out! :) - Mike ____________________________________________________________________ Mike J. Brown, software engineer at My XML/XSL resources: webb.net in Denver, Colorado, USA http://skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Alternating table row colors wi, David Carlisle | Thread | Re: Alternating table row colors wi, Steve Muench |
Re: how to .., Mike Brown | Date | URL stroke passing in XSL, Albert Tsun |
Month |