You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gunter D'Hondt <gu...@sofico.be> on 2004/05/17 16:14:40 UTC

doing a Cocoon XSL transformation inside java code

Hello,

Inside my apple (Cocoon block) I've got a org.w3c.dom.Document (coming
from a org.apache.excalibur.source.Source-object) which I'd like to
transform into another org.w3c.dom.Document using an XSL transformation
(stylesheet is available thru a Source-object); how can I do this with
the Cocoon classes?

So something like:
private Document doTheTransformation(Source xmlsrc, Source
stylesheetsrc) {
	Document outputdoc;
	
	//get the document from the source-obj            
	InputSource inputsource = new
InputSource(xmlsrc.getInputStream());
      Document inputdoc = DomHelper.parse(inputsource);	

	//do the xsl transformation using the stylesheetsrc
	Transformer transformer = .. ??
	transformer.transform(inputdoc, outputdoc);

	//return the result document
	return outputdoc;
}

Regards,
Gunter D'Hondt 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: doing a Cocoon XSL transformation inside java code

Posted by Gunter D'Hondt <gu...@sofico.be>.
Indeed I'm not using flowscript but apples (Cocoon block - sames as
flowscript but in Java code); but as I can read from the javadocs from
PipelineUtil:


Gunter D'Hondt 


-----Original Message-----
From: users-return-67706-gudo=sofico.be@cocoon.apache.org
[mailto:users-return-67706-gudo=sofico.be@cocoon.apache.org] On Behalf
Of Joerg Heinicke
Sent: maandag 17 mei 2004 23:14
To: users@cocoon.apache.org
Subject: Re: doing a Cocoon XSL transformation inside java code


On 17.05.2004 16:14, Gunter D'Hondt wrote:

> Hello,
> 
> Inside my apple (Cocoon block) I've got a org.w3c.dom.Document (coming

> from a org.apache.excalibur.source.Source-object) which I'd like to 
> transform into another org.w3c.dom.Document using an XSL 
> transformation (stylesheet is available thru a Source-object); how can

> I do this with the Cocoon classes?
> 
> So something like:

I'm not familiar on this, so I can't help you directly with it. I just
want you to suggest to pass the original document to a pipeline 
and get the transformed document back from there. There is a 
PipelineUtil.processToDOM(uri, viewData) method: 
http://wiki.cocoondev.org/Wiki.jsp?page=FOM_Cocoon. But I don't know 
exactly how to combine those pieces as you don't use flowscript, do you?

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: doing a Cocoon XSL transformation inside java code

Posted by Joerg Heinicke <jo...@gmx.de>.
On 17.05.2004 16:14, Gunter D'Hondt wrote:

> Hello,
> 
> Inside my apple (Cocoon block) I've got a org.w3c.dom.Document (coming
> from a org.apache.excalibur.source.Source-object) which I'd like to
> transform into another org.w3c.dom.Document using an XSL transformation
> (stylesheet is available thru a Source-object); how can I do this with
> the Cocoon classes?
> 
> So something like:

I'm not familiar on this, so I can't help you directly with it.
I just want you to suggest to pass the original document to a pipeline 
and get the transformed document back from there. There is a 
PipelineUtil.processToDOM(uri, viewData) method: 
http://wiki.cocoondev.org/Wiki.jsp?page=FOM_Cocoon. But I don't know 
exactly how to combine those pieces as you don't use flowscript, do you?

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org