[xsl] XPATH - Finding similar/conflicting nodes

Subject: [xsl] XPATH - Finding similar/conflicting nodes
From: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Jul 2004 09:59:40 -0700
Hello,
Below is an XML source (work in progress, but enough sample data to support
my XPATH question).

Brief Overview:
I am working on a scheduling application for a gymnastics program.  The
application will assist in scheduling the events each squad trains on -- it
will keep track of who's training on what and when.  There are many squads
and many events which these squads can be assigned to.  The idea here is to
simplify these assignment but ultimately , to help in avoiding conflicts in
the schedule.

I've layed out my XML source (see below).
Now I have an XPATH question.

I have created a conflict within the schedule on purpose, see:
Squad id=1, Event id=2 VS. Squad id=3, Event id=2
(Both squads are on the same event at the same time:  960 - 10020)
Note on time values:  These times are expressed in minutes (i.e, 960 = 3:00
PM)

Is there an XPATH query that can be written to find this conflict?  The
query would be the result of a search on event.  In other words (in natural
English):

"Show me all Event number 2's where 2 or more start times are the same as
another Event number 2"
-and-
"Show me all Event number 2's where the start time for the event overlaps
the finish time of an event".

I appreciate your input!  Any suggestions or similar experience is welcomed!
Karl







==================== XML SOURCE =================================


<SCHED>
	<Schedule>
    	<Day id="1">
			<Squad id="1">
    			<event id="1" timebeg="900" timend="960"/>
    			<event id="2" timebeg="960" timend="1020"/>
		    	<event id="3" timebeg="1020" timend="1080"/>
    			<event id="4" timebeg="1080" timend="1140"/>
	    	</Squad>
			<Squad id="3">
    			<event id="4" timebeg="900" timend="960"/>
    			<event id="2" timebeg="960" timend="1020"/>
		    	<event id="3" timebeg="1020" timend="1080"/>
    			<event id="1" timebeg="1080" timend="1140"/>
	    	</Squad>
			<Squad id="7">
    			<event id="2" timebeg="900" timend="960"/>
    			<event id="3" timebeg="960" timend="1020"/>
		    	<event id="4" timebeg="1020" timend="1080"/>
    			<event id="1" timebeg="1080" timend="1140"/>
	    	</Squad>
        </Day>
        <Day id="2"/>
        <Day id="3"/>
        <Day id="4"/>
        <Day id="5"/>
        <Day id="6"/>
	</Schedule>
    <Squads>
    	<Squad timebeg="900" timeend="1140" id="1" group="1" name="Level
8,9,10" description="Girls Optionals Level 8,9,10">
        	<Days>
            	<Day id="1"/>
            	<Day id="3"/>
            	<Day id="5"/>
            </Days>
    	</Squad>
    	<Squad timebeg="900" timeend="1140" id="3" group="1" name="Level 7"
description="Girls Optional Levels 7">
        	<Days>
            	<Day id="1"/>
            	<Day id="3"/>
            	<Day id="5"/>
            </Days>
    	</Squad>
    	<Squad timebeg="900" timeend="1140" id="3" group="2" name="Level 6"
description="Girls Compulsory Team Level 6">
        	<Days>
            	<Day id="1"/>
            	<Day id="3"/>
            	<Day id="5"/>
            </Days>
    	</Squad>
    </Squads>
    <groups>
    	<group id="1" name="Optional Team" description="Girls Optional Team"/>
    </groups>
    <events>
    	<event id="1" name="Bars" description="Women's Uneven Bars"
location="1"/>
    </events>
    <locations>
    	<location id="1" map="C4" description="Girls Comp Bar Area"/>
    </locations>
    <Days>
    	<Day id="1">Monday</Day>
    	<Day id="2">Tuesday</Day>
    	<Day id="3">Wednesday</Day>
    	<Day id="4">Thursday</Day>
    	<Day id="5">Friday</Day>
    	<Day id="6">Saturday</Day>
    	<Day id="7">Sunday</Day>
    </Days>
</SCHED>

Current Thread