Hoi Geert,

Copying as a side effect of a transformation is somewhat of an antipattern - iirc.
OK, now that i'm reading more closely I see what you want - use the xml in the pipeline as a kind of script that does the copying. I don't think there's a transformer like that yet. Maybe you could even make an AntTransformer, so you can reuse Ant's copy/move/zip/etc. functionality.
Of course you're still in the side effect transformation trap.
Another way would be calling helper classes from flowscript. Again you can use Ant classes: I did something similar with an array of files returned by the Ant DirectoryScanner, which gives you a lot of filtering and wildcards-operations for free.


Groet
Rogier


Geert Josten wrote:
Hi all,

I'm new to this list, so forgive me if I'm blunt or off-topic..

On the Cocoon users mailing list, there were some questions about copying files. We came up with solutions like using the copy-source actor, flowscript or perform an include and write it again using sourcewritingtransformer.

I personally like the transformer alternative, sounds more dynamic to me than the others. But including and serializing requires generating SAX out of the source and streaming it again. One might be able to do this even with binary files, but wouldn't it be nicer to for instance allow the sourcewritingtransformer take a 'src' feature? (as an alternative to the 'fragment' feature, or as an attribute of the fragment element?)

Or have I simply overlooked a transformer that already provide this kind of functionality?

Cheers,
Geert




Reply via email to