[xsl] Re: Looking for a starting point that can be used torepeatedly/recursively transform an input stream

Subject: [xsl] Re: Looking for a starting point that can be used torepeatedly/recursively transform an input stream
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 1 Dec 2003 20:11:54 +0100
"Alan Johnson" <ajohnson@xxxxxxxxxx> wrote in message
news:sfcb2576.020@xxxxxxxxxxxxxxxxxx
> Folks,
>
>  Good morning. I'm new to this list, so that might be a FAQ, but based on
my review of it I don't think so, hence my posting. I need a transformation
that is, in a sense, "mutating". By this I mean I need the transform to
incorporate itself into the output stream, along with the input content,
wrapped in a generic container. Consider for example the following xml:
>
> initial XML stream
> <resultSet>
>  <anElement>value</anElement>
>  <anotherElement> value </anotherElement>
> </resultSet>
>
> subsequent XML stream
>
> <differentresultSet>
>  <anElement>value</anElement>
>  <anotherElement> value </anotherElement>
> </differentresultSet>
>
> realize that these two streams are not available concurrently, but
serially. I also don't want to cache the file explicitly to address this
need. I would like to transform the first in such a way that a new
transformation is produced, one that could transform the second when passed
through it into a merged product, say something like the following:
>
> <containers>
> <container>
>  <resultSet>
>  <anElement>value</anElement>
>  <anotherElement> value </anotherElement>
> </resultSet>
> </container>
> <container>
> <differentresultSet>
>  <anElement>value</anElement>
>  <anotherElement> value </anotherElement>
> </differentresultSet>
> </container>
> </containers>
>
> This would be able to add as many containers as required, one for each
time it was called. The endpoint at any point in time would be parseable
into a set of containers.
>
> Does this make sense? Can someone give me a reasonable starting point?

Yes.

This has been done with FXSL. See for example:

   http://sources.redhat.com/ml/xsl-list/2001-11/msg01096.html

or


http://fxsl.sourceforge.net/articles/PartialApps/Partial%20Applications.html

In this example the result is accumulated and the current result is a
container (very close to what we call "object") with a fixed number of
functions (very similar to methods of an object and even to virtual
functions).

The result at any time may be used for another update (transformation) or
for selectively display itself (the value of a variable, given its name).


Although this concrete example is for implementing a "Calculator store with
simple variables", the approach is general and can be used to solve a
general category of problems that require the partial result to be
"self-sufficient" and to be able "to act upon itself" and "produce future
versions of itself".

This was done more than two years ago. Since then I successfully used this
general approach as part of my implementation of a general Monad class -
type functionality, allowing the reliable sequencing and maintaining of
"state" in an XSLT application.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread