xsl-list
[Top] [All Lists]

Re: [xsl] if a condition is not met

2007-05-15 14:01:50
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[(_at_)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



--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>