xsl-list
[Top] [All Lists]

Re: [xsl] if a condition is not met

2007-05-15 13:58:18
Michael Kay wrote:
Very pretty.

I was thinking in terms of grouping, time arithmetic, min/max...

Indeed and same here.
With the solution of George C. Bina in mind, I wanted to give the XSLT 2.0 approach a new try. Well, it ends up somewhere high in the obfuscated code bin, I believe. Here's the tree-walking algorithm from George applied in a single XPath 2.0 expression:

times/time[(_at_)time = ../../cells/cell[last()]/@endTime]/following-sibling::* 
|
times/time[(_at_)time = ../../cells/cell[1]/@startTime]/preceding-sibling::* |
times/time[(_at_)time = ../../cells/cell[(_at_)endTime != following-sibling::*[1]/@startTime]/@endTime]
   /(self::* |
   (following-sibling::*
[(_at_)time = ../../cells/cell[(_at_)startTime != preceding-sibling::*[1]/@endTime]
       /@startTime][1]/preceding-sibling::*
    except preceding-sibling::*))


I leave the explanation of this monster as an exercise to the reader ;) I just wanted to find out whether the OP's request was doable on one line (and I am sure it can be done more concise and hopefully without the expensive 'except' operator, I tried '>>' etc, but had some context-node problems).

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>