S
Scott W Gifford
Hello,
I'm considering using XML to represent a stream of location
information, and XPath to do queries against it. I've got most of it
figured out (at least on paper), but I can't figure out how to create
an XPath statement asking for the "last node with a value less than" a
given value.
I need this to be able to ask "Where was Scott at 11:00 yesterday",
which should find the last sighting of Scott before or at 11:00
yesterday. For example, in this (simplified) data:
<!-- Thousands of previous sightings -->
<saw> <who> Scott </who><where> Office </where><when> 10:57 </when></saw>
<saw> <who> Tom </who><where> Office </where><when> 10:57 </when></saw>
<saw> <who> Scott </who><where> Hallway </where><when> 10:58 </when></saw>
<saw> <who> Tom </who><where> Breakroom </where><when> 10:59 </when></saw>
<saw> <who> Sally </who><where> Rooftop </where><when> 11:00 </when></saw>
<saw> <who> Scott </who><where> Dungeon </where><when> 11:01 </when></saw>
<!-- Thousands of later sightings -->
I want:
<saw> <who> Scott </who><where> Hallway </where><when> 10:58 </when></saw>
Is it possible to express this in XPath? And if so, what's the best way?
Thanks!
----ScottG.
I'm considering using XML to represent a stream of location
information, and XPath to do queries against it. I've got most of it
figured out (at least on paper), but I can't figure out how to create
an XPath statement asking for the "last node with a value less than" a
given value.
I need this to be able to ask "Where was Scott at 11:00 yesterday",
which should find the last sighting of Scott before or at 11:00
yesterday. For example, in this (simplified) data:
<!-- Thousands of previous sightings -->
<saw> <who> Scott </who><where> Office </where><when> 10:57 </when></saw>
<saw> <who> Tom </who><where> Office </where><when> 10:57 </when></saw>
<saw> <who> Scott </who><where> Hallway </where><when> 10:58 </when></saw>
<saw> <who> Tom </who><where> Breakroom </where><when> 10:59 </when></saw>
<saw> <who> Sally </who><where> Rooftop </where><when> 11:00 </when></saw>
<saw> <who> Scott </who><where> Dungeon </where><when> 11:01 </when></saw>
<!-- Thousands of later sightings -->
I want:
<saw> <who> Scott </who><where> Hallway </where><when> 10:58 </when></saw>
Is it possible to express this in XPath? And if so, what's the best way?
Thanks!
----ScottG.