[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: George Cristian Bina <george@xxxxxxxxxxxxx>
Date: Tue, 15 May 2007 23:50:40 +0300
Re:  if a condition is not met
Here it is a 2.0 solution following the same idea as the 1.0 solution but using a function and a call to that function.

<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:g="http://www.oxygenxml.com/george">
    <xsl:output indent="yes"/>

<xsl:function name="g:freeTimes">
<xsl:param name="time"/>
<xsl:param name="cell"/>
<xsl:sequence select="
if ($time/@time=$cell/@startTime) then
(g:freeTimes( $time/following-sibling::time[@time=$cell/@endTime], $cell/following-sibling::cell[1]) )
else if ($time/following-sibling::*) then ($time, g:freeTimes($time/following-sibling::time[1], $cell)) else ()
"/>
</xsl:function>
<xsl:template match="/*">
<free><xsl:copy-of select="g:freeTimes(times/time[1], cells/cell[1])"/></free>
</xsl:template>
</xsl:stylesheet>


Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Abel Braaksma wrote:
Michael Kay wrote:
This will almost certainly be easier in XSLT 2.0 than in 1.0. Would you be
content with a 2.0 solution?

my thoughts exactly. But I did such a poor attempt that George C Bina's XSLT 1.0 solution looks far more elegant and simpler than my XSLT 2.0 version.... :D

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-2011 All Rights Reserved.