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

Re: Match nodes with a range of values

Subject: Re: Match nodes with a range of values
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 15 Jul 2004 16:06:09 +0100
event id 1080
as I said in my original reply I don't think you can do this with a pure
xslt 1 expression, you could in xslt2 or you need to use an xslt costruct:

<SCHED>
	<Schedule>
    	<Day id="1">
			<Squad id="1">

<event id="1" timebeg="1350" timeend="1500"/>

<event id="1" timebeg="1100" timeend="1400"/>

    			<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"/>
    			<event id="1" timebeg="1081" timend="1141"/>
	    	</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>






<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output indent="yes"/>

<xsl:template match="/">
equal:
<xsl:copy-of select="/SCHED/Schedule/Day/Squad/event[@id='2']
 [@timebeg = ../preceding-sibling::Squad/event[@id='2']/@timebeg]
"/>
overlap:
<xsl:for-each select="/SCHED/Schedule/Day/Squad/event[@id='1']">
<xsl:if
test="../../Squad/event[@id='1'][generate-id()!=generate-id(current())]
[@timebeg &lt;= current()/@timebeg and @timeend &gt;= current()/@timebeg]">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>


$ saxon squad.xml squad.xsl
<?xml version="1.0" encoding="utf-8"?>
equal:
<event id="2" timebeg="960" timend="1020"/>
overlap:
<event id="1" timebeg="1350" timeend="1500"/>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.