Re: Find content between <text:change-start /> and <text:change-end />

"G. Ken Holman" <[email protected]> Wed, 17 Feb 2010 11:21:00 -0500
Newsgroups gmane.comp.openoffice.devel.xml
Message-ID <[email protected]>
At 2010-02-17 17:41 +0300, ashok _ wrote:
>I am struggling  a bit with trying to extract inserted text in a
>change tracked ODF
>document --
>
>since text inserts are recorded in the document using the 2 elements 
>which share
>the id attribute : <text:change-start id="an_id" /> and
><text:change-end id="an_id" />
>placed arbitrarily in the document depending upon where new text was inserted
>  (See example below ).
>
>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()

This is a common requirement and is included in one of the hands-on 
exercises in our five-day class on XSLT/XQuery.  In the exercise 
there are additional constraints of excluding particular text nodes 
based on ancestry, which you may find applies in your case.  If true, 
then add some predicates to the left operand.

I hope this helps.

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

p.s. registration is still open for the last two remaining seats for 
XSLT/XQuery training after http://www.XMLPrague.cz

>e.g.
>
><text:section text:style-name="Sect1" text:name="Section2">
>       <text:p text:style-name="Standard"/>
>       <text:p text:style-name="Standard">Neque porro quisquam est, qui
>dolorem ipsum
>       quia dolor sit amet, consectetur, adipisci velit, sed quia non
>numquam eius
>       modi <text:change-start text:change-id="ct472232592"/></text:p>
>     ........................
>     ........................
>     <text:p text:style-name="Standard">Sed ut perspiciatis unde 
> omnis iste natus
>         error sit voluptatem accusantium doloremque laudantium, totam
>rem aperiam,
>         nihil molestiae consequatur, vel illum qui dolorem eum fugiat
>quo voluptas
>         nulla pariatur?<text:change  text:change-id="ct472209600"/></text:p>
>     ........................
>     ........................
>  </text:section>


--
XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19
XSLT/XQuery/XPath training:   San Carlos, California 2010-04-26/30
Vote for your XML training:   http://www.CraneSoftwrights.com/x/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
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