On Sun, 13 Mar 2005 00:52:23 +0000, Aron Bock <aronbock(_at_)hotmail(_dot_)com>
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.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--