Subject: Counting nodes up to a certain sibling
From: mclagett@xxxxxxxxxxx
Date: Thu, 08 Mar 2007 20:45:27 +0000
|
Hi -
I am transforming an input html doc into an xml formatted output stream. The portion of the document I am now working with has been laid out in html as a set of columns, but instead of using tables they did it by inserting spaces enclosed within span tags (aaarrrggghhh!). I am attempting to implement this simple rule:
for each span tag that includes a space, take all sibling nodes up to the next span tag and output thes within a single output tag.
The document is structured such that these will only be text nodes or formatting nodes like <i> or <b> or <sub>. I'm having a hell of a time, however, figuring out how to create a node set that includes only nodes in between a current span node and its next sibling span node. I've been trying to work with the position() function, but in order to identify the next span node, I have to do it with an axis expression and a filter and then position() only tells me the position of the node with respect to the filtered set. I need to identify the position of a node matching my characteristics in an unfiltered parent node set. Can't seem to figure out how to do it. Is there a way?
Thanks for any help anyone can offer. If this has been answered before, I apologize. I've spent an awful lot of time looking for it.
Regards,
Mike
|