Between two anchors

07/11/18

Between two anchors

I've been trying to figure out the best way to retrieve all nodes between two anchors; I'm not changing the document hierarchy (i.e. I'm not tagging them), but I want them for labelling purposes etc. But doing following:: and preceding:: or using the following/preceding operators (>>) operators with intersect isn't very efficient.

It's nice because we have @xml:ids on these things, so it's easy enough to know when to stop. It's not generalized for non-id'd things (although, I bet you could use generate-id(.)).

Basically, it works by taking in two boundary points, using the left one and stepping to the next node; if the node immediately following that one is the anchor tag, then exit; if it's not, run the thing again, but using the next node ($f1). This is all actually documented in the LEMDO code, but thought I should put it here in case.