[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How Do I Generate A Set-Difference With Context -

Subject: Re: How Do I Generate A Set-Difference With Context - Part A
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 13 Mar 2005 12:35:17 +1100
xsl generate diff
On Sun, 13 Mar 2005 00:52:23 +0000, Aron Bock <aronbock@xxxxxxxxxxx> wrote:

> Now for a question: each <story> has, say, a @date attribute; multiple
> stories in 1 feed may have the same @date value.  If I find a changed (or
> new) story, I want to pass through not just that story, but also all other
> stories with that same @date value, no matter they're unchanged.
> 
> My first thougth about accomplishing this is to perform some sort of
> pipeline processing (it's immaterial if it's done in-situ in the XSLT
> processor).  The first pass would generate a diff result, and a second pass
> would add back all stories of the same [unique] dates as the ones in the
> diff result.
> 
> It would be nice to do this in one [conceptual] pass:
> --for every story check if it should pass through
> --if a passthrough also pass through otheries stories with the same @date
> 
> Of course, a naive approach would have stories output multiply, unless I
> somehow "remember" what [say, dates] has already passed through.  I could do
> that in a procedural language, but don't know how to [efficiently] in a
> functional one such as XSLT.  While I read up on functional programming
> techniques, if anybody can suggest a way to accomplish this, please post.
> 
> Here are 2 sample feeds:
> 
> feed1.xml
> ======
> <feed>
>  <story @date="1" text="a"/>
>  <story @date="2" text="a"/>
> </feed>
> 
> feed2.xml
> ======
> <feed>
>  <story @date="1" text="a"/>
>  <story @date="1" text="b"/>
>  <story @date="2" text="a"/>
> </feed>
> 
> If feed2.xml were the "current" feed, and feed1.xml the propr one, I want to
> end up with the following, in 1 pass.
> 
> final.xml
> =====
> <feed>
>  <story @date="1" text="a"/>
>  <story @date="1" text="aa"/>
> </feed>
> 
> Thank you
> 
> --A

This is confusing:

   There is no "text" attribute with value "aa" in the two xml documents.


It's true that nobody's replied to the first post until now. I didn't,
because I didn't find a complete and clear description of the problem
-- one has to put some effort in specifying a problem in precise
manner, this is a logical pre-condition for people being able to help.

Additionally, if performance is to be optimised, this requires that
real (or at least realistic) input files are included.

Cheers,
Dimitre Novatchev.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.