At 2010-02-18 11:57 +0300, ashok _ wrote:
On Wed, Feb 17, 2010 at 7:21 PM, G. Ken Holman
<[email protected]> wrote:
How do i get the text content contained by these two tags ?
>
> You don't ask which technology you are using, but if it is based on XPath
> 2.0 then you could use this to get all of the text nodes, assuming that the
> starting element is in $n:
>
>  $n/following::text() except
>  $n/following::*...@text:change-id=$n/@text:change-id][1]/following::text()
>
>


Thanks, this seems workable ... however i am restricted to using XPath
1.0 so the 'except' operator is out of the window.

So i guess, I simply have to run the 2 Xpaths on either side of the
'except'  individually and filter the nodes of the right hand side
from the left hand side via the dom API ?

I wouldn't have approached it that way ... I would have tried to come up with an XPath address that only addressed the nodes desired.

I haven't tested the following on your data, but if the current node is the <text:change-start> element then I believe this will find all text nodes up until the <text:change-end> element with the same identifier using XPath 1:

  following::text()[preceding::text:change-start[1]/@id=current()/@id and
                    not(preceding::text:change-end[1]/@id=current()/@id)]

I try to remind my students that the more work you can do addressing the nodes you want, the less work you'll have to do trying to get rid of the ones you don't want. Which gives the processor more opportunity to optimize the finding of the nodes you do want.

I hope this helps.

. . . . . . . . . . . . Ken

--
XSLT/XQuery training:      after http://XMLPrague.cz 2010-03-15/19
XSLT/XQuery training:         San Carlos, California 2010-04-26/30
Principles of XSLT for XQuery Writers: San Francisco,CA 2010-05-03
XSLT/XQuery/UBL/Code List training: Trondheim,Norway 2010-06-02/11
Vote for your XML training:   http://www.CraneSoftwrights.com/x/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
G. Ken Holman                 mailto:[email protected]
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to