[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: if a condition is not met

Subject: Re: if a condition is not met
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Tue, 15 May 2007 22:16:35 +0200
Re:  if a condition is not met
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[@time = ../../cells/cell[last()]/@endTime]/following-sibling::* |
times/time[@time = ../../cells/cell[1]/@startTime]/preceding-sibling::* |
times/time[@time = ../../cells/cell[@endTime != following-sibling::*[1]/@startTime]/@endTime]
/(self::* |
(following-sibling::*
[@time = ../../cells/cell[@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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.