I would not want to use text()3 but is there some way I could extract the text out between a@name='hw2' and /a@name='hw3' If there is just one text node between the two a elements, then the following would be quite simple: a@name='hw3'/preceding::text()1 If there are more than one text nodes between the two elements, then you need to express the intersection of all text nodes following the first element with all text nodes preceding the second element. The formula for intersection of two nodesets (aka Kaysian method of intersection) is: $ns1count(.|$ns2) = count($ns2) So, just replace in the above expression $ns1 with: a@name='hw2'/following-sibling::text() and $ns2 with: a@name='hw3'/preceding-sibling::text() Lastly, if you really have XQuery (or XPath 2), then this is simply: a@name='hw2'/following-sibling::text() intersect /a@name='hw3'/preceding-sibling::text().
I would not want to use text()3 but is there some way I could extract the text out between /a@name='hw2' and /a@name='hw3'. If there is just one text node between the two elements, then the following would be quite simple: /a@name='hw3'/preceding::text()1 If there are more than one text nodes between the two elements, then you need to express the intersection of all text nodes following the first element with all text nodes preceding the second element. The formula for intersection of two nodesets (aka Kaysian method of intersection) is: $ns1count(.|$ns2) = count($ns2) So, just replace in the above expression $ns1 with: /a@name='hw2'/following-sibling::text() and $ns2 with: /a@name='hw3'/preceding-sibling::text() Lastly, if you really have XQuery (or XPath 2), then this is simply: /a@name='hw2'/following-sibling::text() intersect /a@name='hw3'/preceding-sibling::text().
This handles your expanded case, while letting you select by attribute value rather than position: let $item := HELLOWORLD1 world1 HELLOWORLD2 world2 HELLOWORLD3 world3 return $item//node(). /preceding-sibling::a/@name = "hw2"1 This gets the first node that has a preceding-sibling "a" element with a name attribute of "hw2".
Your xpath is selecting the text of the a nodes, not the text of the td nodes: $item//a@name='hw'/text() Change it to this: $itema/@name='hw'/text() Update (following comments and update to question): This xpath selects the second text node from $item that have an a tag containing a name attribute set to hw: $itema/@name='hw'//text()2.
This isn't working for me. FYI $item contains the entire html page as xml – Technocrat Jun 23 '10 at 11:26 What if the html contains : HELLOWORLD1 world1 HELLOWORLD2 world2 HELLOWORLD3 world3 I want to extract only world2 without using text(2)2. Is there a way to specify "extract the text after /a@name="hw1" and before /a@name="hw2" – Technocrat Jun 23 '10 at 11:34 @Technocrat - answer updated, following your expanded explanation.
– Oded Jun 23 '10 at 12:17 You seem not to look at your answers! – Dimitre Novatchev Jun 23 '10 at 16:03.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.