xsl-list
[Top] [All Lists]

RE: Match nodes with a range of values

2004-07-15 09:41:44
I would settle for:

1)  select all event nodes id=1
2)  pass off current() to a named template
3)  in a for-each loop, (identify, find, mark, return) the conflicting
times -- an ugly <xsl:choose> would suffice, or a simple <xsl:if> if that
works.  The XML source is not huge, and by examining each event by id makes
the source even smaller.

Does something like this seem reasonable?  What I don't need to do, is
return a document tree fragment.  (hope that made sense)

VISUALLY:  I might add a layer to my HTML source that is the presumed
overlapping / conflicting scheduled event.  I have uploaded a sample of what
I have so far here:

HTML Sample Result:
http://www.meetscoresonline.com/test_sched.html

XSLT:
http://www.meetscoresonline.com/test_sched.xsl

XML Source:
http://www.meetscoresonline.com/sched.xml


Karl


-----Original Message-----
From: Michael Kay [mailto:mhk(_at_)mhk(_dot_)me(_dot_)uk]
Sent: Thursday, July 15, 2004 8:43 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Match nodes with a range of values


"Select all nodes where current nodes timebeg falls between
the timebeg and timeend of all event 1's".

You can do this in XPath 2 as

//node[every $n in //node[(_at_)id=1] satisfies
        (@timebeg ge $n/@timebeg and @timebeg le $n/@timeend)]

You can't do general joins in XPath 1 (it's not relationally complete). The
nearest you can get is

<xsl:for-each select="//node">
  <xsl:variable name="n" select="."/>
  <xsl:copy-of select="$n[not(//node[(_at_)id=1][@timebeg &lt;= $n/@timebeg or
                                            @timeget &gt;= $n/@timeend)]"/>
</xsl:for-each>

Michael Kay


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