Thank you Ludovic, this seems as a
perfect solution for me.
Sorry for confusing you by not
explaining clearly what I need.
Thanks
Anna
----- Original Message -----
Sent: Wednesday, December 18, 2002 1:30
PM
Subject: Re: Writing output of pipeline
to a file
Sorry Anna, i didn't understand it.
I thought you had to generate data and next save
and transfom them, but you have datas in a file and want to transform them and
next save and send them to your browser.
A solution could be to write a transformer (in
XSL with redirection or in Java), localized after your transformer in the
pipeline. This one does not transform XML datas, but copy (not redirect)
them in a file.
Ludovic
----- Original Message -----
Sent: Wednesday, December 18, 2002
11:57 AM
Subject: Re: Writing output of pipeline
to a file
Thank you Ludovic.
Just to ensure that I got you
right:
You say that I need to write an
action that will get the content of the file, will write it, and then in the
same pipeline there will be generator that will just read the file that was
written and will serialize the output to the browser?
But I need to write the
file after it was transformed by the xsl. How this is possible in
sitemap?
I just don't understand the logic
of what I need to do in order to both write to the file and output file to
the browser.
Sorry I'm bothering you, but can
you just explain me in little more detail what I need to do?
Thank you very very
much.
Anna
----- Original Message -----
Sent: Wednesday, December 18, 2002
12:44 PM
Subject: Re: Writing output of
pipeline to a file
Hi Anna,
When you use <redirect:write
file="testWrite.xml">, your XML datas are redirected, so you have to
generate other XML datas for your serializer. In your case in error, no
XML datas are passed after the transformation.
So, in your case, you have to transform AND
save your XML datas. i think the best solution is saving these datas in
file in an Action, and use this file for transformation.
Ludovic
----- Original Message -----
Sent: Wednesday, December 18, 2002
8:44 AM
Subject: Re: Writing output of
pipeline to a file
Thank you all for answering
me, but I still can't manage to do it.
Here is my
pipeline:
<map:match
pattern="test.html">
<map:generate src=""/>
<map:transform src=""/>
<map:serialize type="xml"/>
<map:match>
Here is my
writeToFile.xsl:
<?xml version="1.0"
encoding="UTF-8"?>
<xsl:output
method="xml"/>
<xsl:template match="/">
<xsl:copy-of select="*"/>
<redirect:open
file="testWrite.xml"/> <redirect:write
file="testWrite.xml"> <xsl:copy-of
select="*"/> </redirect:write>
<redirect:close file="testWrite.xml"/>
</xsl:template>
</xsl:stylesheet>
When I am running this, I get the following
error message from the Cocoon:
type fatal
message Exception in
HTMLGenerator.generate()
description
org.apache.cocoon.ProcessingException: Exception in
HTMLGenerator.generate(): java.lang.NullPointerException
sender
org.apache.cocoon.servlet.CocoonServlet
source Cocoon servlet
request-uri
If I remove all the redirect: lines, then I get
the serialized input file, so the input is OK, obviously,
I have some problems with this
redirect:
Can anybody please tell me what's
wrong?
Thank you very much for help.
Anna
----- Original Message -----
Sent: Tuesday, December 17, 2002
4:36 PM
Subject: Re: Writing output of
pipeline to a file
First, i had just to save it (not to send
the result file to the client). I did it in a stylesheet like this
:
<?xml version="1.0"
encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect" extension-element-prefixes="redirect">
<xsl:output method="xml"
encoding="ISO-8859-1"/> <xsl:template
match="/"> <redirect:write
file="{$path}"> <xsl:copy-of
select="*"/> </redirect:write>
<TEXTE>output for the
client</TEXTE>
</xsl:template
> </xsl:stylesheet>
But there was problems with some
configuration, so finally i did it in my Action who had to generate
the XML.
If you have to duplicate your XML stream,
one for saving, another for the client, i think you have to do
this in an action. It generates the XML file and this one is next
transformed/serialized.
<map:match
pattern="some.html">
<map:act type="YourAction">
<map:generate src=""/>
<map:transform src=""/>
<map:serialize type="html"/>
</map:match>
Ludovic
----- Original Message -----
Sent: Tuesday, December 17,
2002 3:09 PM
Subject: Re: Writing output of
pipeline to a file
Hi Ludovic. Thank you for
answering.
Can you say what do you
do to save this XML file?
I mean, if I have the
following pipeline:
<map:match
pattern="some.html">
<map:generate src=""/>
<map:transform src=""/>
<map:serialize type="xml"/>
</map:match>
this pipeline produces an
xml file. What should I use in order to save this file as
"some.xml".
Sorry for asking almost
exactly the same, I just didn't understood from you answer what
should I do.
Thank you very much for
help.
Anna
----- Original Message -----
Sent: Tuesday, December 17,
2002 4:03 PM
Subject: Re: Writing output
of pipeline to a file
Hi Anna,
I had this problem and didn't find a
solution for caching the output of the pipeline to perform an
OutputAction as saving in a file. Finally i chose to save the XML,
and to perfom the transformation/serialization when a request need
the transformed file. It supposes that the transformers are not
modified.
Another solution should be using the
CommandLine classes to perform the pipeline in an action but i
can't say more about it.
Hope a better solution
exists...
Ludovic
----- Original Message -----
Sent: Tuesday, December 17,
2002 2:19 PM
Subject: Writing output of
pipeline to a file
Hello
All!
I know that today I
ask too many questions, but since cocoon is new to
me,
sometimes I don't
even know where to look for the information, so you are my only
help.
Thanks for everyone
who took time to answer my questions. Here is another
one:
At the end of the
pipeline the result file is output to the
browser.
I need the result
file also to be saved in the file on my hard drive.
How can I do
this?
I read about the
SourceWritingTransformer, but I understood that I can write
<source:write> tag in xml only, not in xsl.
Or maybe I can use it
to do what I need, and I just don't know how?
Please tell
me.
Thank you very much
for your help.
Anna
|