Checking node position

Subject: Checking node position
From: "David W. Black" <black_david@xxxxxxxxx>
Date: Fri, 01 Sep 2000 15:56:27 0000
Hi all,

I essentially have an undifferentiated list of elements (old html) that I need to transform to xml, and the only hooks I have are certain textual consistencies:



Thus I want to itentify the position of the <p> with text="head1" (ie. 2), the position of <p> with text="head2" (ie.5) so that I can then wrap all <p>s between 2 and 5 with an element in the result tree.

My problem is what XPath expression returns the 'correct' position?
//p[text()=head1] returns "1" (1st occurrence of p with text = head1), as opposed to "2" the position of p which _incidentally_ is head1 amongst all <p>s.

I can, I suppose, pre-process using generate-id() to ascribe and id attribute to each <p> and then do my transformations.... but I'd really like to ties this up in one stylesheet, not two?

Any ideas, anyone??



Get your FREE Email and Voicemail at Lycos Communications at

 XSL-List info and archive:

Current Thread