You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jörn Heid <he...@fh-heilbronn.de> on 2001/06/10 11:53:51 UTC

Adding dynamically element

I want to add an element dynamically to a xml document (depending of a
attribute in the session object).
With C1 it works with XML->XSP->XSLT.
I tried the same in C2:

			<map:match pattern="**.xml">
				<map:generate src="{1}.xml"/>
				<map:transform src="ses/ses_xsp.xsl"/>
				<map:transform src="xsl/page.xsl"/>
				<map:serialize/>
			</map:match>

But in the output the <xsp:logic> part is printed out so that I thing it
isn't parsed. So I tried to set the type of the second transformation to
'xsp' and 'serverpages' without success.

Or should I use aggregation? Depending on my on matcher? Please help.

JOERN_HEID


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


AW: Adding dynamically element

Posted by Jorn Heid <he...@fh-heilbronn.de>.
I didn't find such DTD in beta1...

-----Ursprungliche Nachricht-----
Von: sam-smile@dxd2.com [mailto:sam-smile@dxd2.com]Im Auftrag von Samuel
ARNOD-PRIN
Gesendet: Sonntag, 10. Juni 2001 14:50
An: cocoon-users@xml.apache.org
Betreff: Re: Adding dynamically element


I can not answer correctly to your question...

but logically there should be a way to do something like this :

<map:match pattern="**.xml">
<map:generate src="{1}.xml"/>
<map:transform src="myfile.xsp.xsl">
	<map:generate type="serverpages" src="myfile.xsp.xsl"/>
</map:transform>
<map:serialize/>
</map:match>

otherwise, look in the MAP dtd or schema ...

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


AW: Adding dynamically element

Posted by Jörn Heid <he...@fh-heilbronn.de>.
Sorry, that doesn't work as XSP couldn't be a transformer (in C1 it can).
I have written my own transformer and I think that's the only possibility.
As mentioned, my source is a normal xml file and could not be a xsp.

But thanks for your answer.

-----Ursprüngliche Nachricht-----
Von: Martin Man [mailto:martin@funny.localnet]Im Auftrag von Martin Man
Gesendet: Montag, 11. Juni 2001 11:37
An: Jorn Heid
Cc: cocoon-users@xml.apache.org
Betreff: Re: Adding dynamically element


On Sun, Jun 10, 2001 at 04:53:37PM +0200, Jorn Heid wrote:
> Yes... As XSP is a generator, should I write my own transformer or
> aggregator... Give me an answer, please... ;(
>
> The question again:
> I want to produce a html from a xml (not XSP) page but depending on the
> session object there moght be an additional element. In C1 it worked with
> XML->XSP->XSLT->HTML. But how does it (best) work with C2?
> XML->Aggreation->XSLT->HTML or XML->MyTransformer->XSLT->HTML?
>
in c2 you do it best using XSP, handling session, and xincluding (look at
aggregate.xsp sample) static xml content



rgds,
martin

--
----------------------------------------------------------------------------
---
"Only dead fish swims with a stream"
gpg_key_available: http://globales.cz/~mman/martin.man.gpg
gpg_key_fingerprint: 2CC0 4AF6 92DA 5CBF 5F09  7BCB 6202 7024 6E06 0223

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: AW: Adding dynamically element

Posted by Giacomo Pati <gi...@apache.org>.
Quoting Jörn Heid <he...@fh-heilbronn.de>:

> Thanks for answer.
> 
> But there's a problem:
> 
> 'Giacomo' wrote: "An XSP page is a generator, point.". As I have to use
> a
> xml page I would have to write a XSP which reads (from FileReader) the
> xml... I think that's not the best way as the pipeline should do this
> for
> me. So I wrote a transformer which works well, but I do not know hoe to
> get
> the HTTPServletRequest (written in another mail).

Use the following:

   import org.apache.cocoon.environment.Request;
   ...
   Request req = (Request) objectModel.get(Cocoon.REQUEST_OBJECT);

> Am I right? In C1 you could use XSP as a transformer and I'm looking fo
> something similar...

There are no such things like Transformers in C1 (AFAIR). But as I'm not very 
familiar with C1 you might know better.

Giacomo

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


AW: Adding dynamically element

Posted by Jörn Heid <he...@fh-heilbronn.de>.
Thanks for answer.

But there's a problem:

'Giacomo' wrote: "An XSP page is a generator, point.". As I have to use a
xml page I would have to write a XSP which reads (from FileReader) the
xml... I think that's not the best way as the pipeline should do this for
me. So I wrote a transformer which works well, but I do not know hoe to get
the HTTPServletRequest (written in another mail).

Am I right? In C1 you could use XSP as a transformer and I'm looking fo
something similar...

JOERN_HEID

-----Ursprüngliche Nachricht-----
Von: Martin Man [mailto:martin@funny.localnet]Im Auftrag von Martin Man
Gesendet: Montag, 11. Juni 2001 11:37
An: Jorn Heid
Cc: cocoon-users@xml.apache.org
Betreff: Re: Adding dynamically element


On Sun, Jun 10, 2001 at 04:53:37PM +0200, Jorn Heid wrote:
> Yes... As XSP is a generator, should I write my own transformer or
> aggregator... Give me an answer, please... ;(
>
> The question again:
> I want to produce a html from a xml (not XSP) page but depending on the
> session object there moght be an additional element. In C1 it worked with
> XML->XSP->XSLT->HTML. But how does it (best) work with C2?
> XML->Aggreation->XSLT->HTML or XML->MyTransformer->XSLT->HTML?
>
in c2 you do it best using XSP, handling session, and xincluding (look at
aggregate.xsp sample) static xml content



rgds,
martin

--
----------------------------------------------------------------------------
---
"Only dead fish swims with a stream"
gpg_key_available: http://globales.cz/~mman/martin.man.gpg
gpg_key_fingerprint: 2CC0 4AF6 92DA 5CBF 5F09  7BCB 6202 7024 6E06 0223


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Adding dynamically element

Posted by Martin Man <Ma...@seznam.cz>.
On Sun, Jun 10, 2001 at 04:53:37PM +0200, Jorn Heid wrote:
> Yes... As XSP is a generator, should I write my own transformer or
> aggregator... Give me an answer, please... ;(
> 
> The question again:
> I want to produce a html from a xml (not XSP) page but depending on the
> session object there moght be an additional element. In C1 it worked with
> XML->XSP->XSLT->HTML. But how does it (best) work with C2?
> XML->Aggreation->XSLT->HTML or XML->MyTransformer->XSLT->HTML?
> 
in c2 you do it best using XSP, handling session, and xincluding (look at
aggregate.xsp sample) static xml content



rgds,
martin

-- 
-------------------------------------------------------------------------------
"Only dead fish swims with a stream"
gpg_key_available: http://globales.cz/~mman/martin.man.gpg
gpg_key_fingerprint: 2CC0 4AF6 92DA 5CBF 5F09  7BCB 6202 7024 6E06 0223

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


AW: Adding dynamically element

Posted by Jorn Heid <he...@fh-heilbronn.de>.
Yes... As XSP is a generator, should I write my own transformer or
aggregator... Give me an answer, please... ;(

The question again:
I want to produce a html from a xml (not XSP) page but depending on the
session object there moght be an additional element. In C1 it worked with
XML->XSP->XSLT->HTML. But how does it (best) work with C2?
XML->Aggreation->XSLT->HTML or XML->MyTransformer->XSLT->HTML?


-----Ursprungliche Nachricht-----
Von: giacomo [mailto:giacomo@apache.org]
Gesendet: Sonntag, 10. Juni 2001 15:26
An: cocoon-users@xml.apache.org; samuel.arnod-prin@dxd2.ch
Betreff: Re: Adding dynamically element


On Sun, 10 Jun 2001, Samuel ARNOD-PRIN wrote:

> I can not answer correctly to your question...
>
> but logically there should be a way to do something like this :

No, there is no logic in there.

An XSP page is a generator, point. A C2 pipeline has only one generator.
Transformers cannot produce or be transformed into xsp pages. This is not
the
concept.

Giacomo


> <map:match pattern="**.xml">
> <map:generate src="{1}.xml"/>
> <map:transform src="myfile.xsp.xsl">
> 	<map:generate type="serverpages" src="myfile.xsp.xsl"/>
> </map:transform>
> <map:serialize/>
> </map:match>
>
> otherwise, look in the MAP dtd or schema ...
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Adding dynamically element

Posted by giacomo <gi...@apache.org>.
On Sun, 10 Jun 2001, Samuel ARNOD-PRIN wrote:

> I can not answer correctly to your question...
>
> but logically there should be a way to do something like this :

No, there is no logic in there.

An XSP page is a generator, point. A C2 pipeline has only one generator.
Transformers cannot produce or be transformed into xsp pages. This is not the
concept.

Giacomo


> <map:match pattern="**.xml">
> <map:generate src="{1}.xml"/>
> <map:transform src="myfile.xsp.xsl">
> 	<map:generate type="serverpages" src="myfile.xsp.xsl"/>
> </map:transform>
> <map:serialize/>
> </map:match>
>
> otherwise, look in the MAP dtd or schema ...
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
>
>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Adding dynamically element

Posted by Samuel ARNOD-PRIN <sa...@smile.ch>.
I can not answer correctly to your question...

but logically there should be a way to do something like this :

<map:match pattern="**.xml">
<map:generate src="{1}.xml"/>
<map:transform src="myfile.xsp.xsl">
	<map:generate type="serverpages" src="myfile.xsp.xsl"/>
</map:transform>
<map:serialize/>
</map:match>

otherwise, look in the MAP dtd or schema ...

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


AW: Adding dynamically element

Posted by Jörn Heid <he...@fh-heilbronn.de>.
Thanks for answer but the generator is a simple xml file not a xsp. It
couldn't be a xsp. The xsp or whatever has to transform the xml file to
another (depending on the session). This generated file has to be
transformed to html vai xslt.


-----Ursprüngliche Nachricht-----
Von: Sven Kuenzler [mailto:svenk@gmx.net]
Gesendet: Sonntag, 10. Juni 2001 12:33
An: cocoon-users@xml.apache.org
Betreff: Re: Adding dynamically element


> I want to add an element dynamically to a xml document (depending of a
> attribute in the session object).
> With C1 it works with XML->XSP->XSLT.
> I tried the same in C2:
>
> <map:match pattern="**.xml">
> <map:generate src="{1}.xml"/>
> <map:transform src="ses/ses_xsp.xsl"/>
> <map:transform src="xsl/page.xsl"/>
> <map:serialize/>
> </map:match>

> But in the output the <xsp:logic> part is printed out so that I thing it
> isn't parsed. So I tried to set the type of the second transformation to
> 'xsp' and 'serverpages' without success.

Despite being implemented using XSLT, XSP is not really a transformation,
but a generation step from C2's point of view. If you look at the
<map:transformers/> element in your sitemap you'll note that there is no
such thing as an XSPTransformer

assuming that "{1}.xml" contains the <xsp:logic/> which adds the element,
tell C2 to use the XSP generator instead of the default FileGenerator:

<map:generate src="{1}.xml" type="serverpages"/>

If ses_xsp.xsl needs to be applied before, it should be registered as
Logicsheet (or taglib or whatever the official terminology is). Please have
a look at cocoon.xconf to learn how to do that.

    HTH, Sven.....


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Adding dynamically element

Posted by Sven Kuenzler <sv...@gmx.net>.
> I want to add an element dynamically to a xml document (depending of a
> attribute in the session object).
> With C1 it works with XML->XSP->XSLT.
> I tried the same in C2:
>
> <map:match pattern="**.xml">
> <map:generate src="{1}.xml"/>
> <map:transform src="ses/ses_xsp.xsl"/>
> <map:transform src="xsl/page.xsl"/>
> <map:serialize/>
> </map:match>

> But in the output the <xsp:logic> part is printed out so that I thing it
> isn't parsed. So I tried to set the type of the second transformation to
> 'xsp' and 'serverpages' without success.

Despite being implemented using XSLT, XSP is not really a transformation,
but a generation step from C2's point of view. If you look at the
<map:transformers/> element in your sitemap you'll note that there is no
such thing as an XSPTransformer

assuming that "{1}.xml" contains the <xsp:logic/> which adds the element,
tell C2 to use the XSP generator instead of the default FileGenerator:

<map:generate src="{1}.xml" type="serverpages"/>

If ses_xsp.xsl needs to be applied before, it should be registered as
Logicsheet (or taglib or whatever the official terminology is). Please have
a look at cocoon.xconf to learn how to do that.

    HTH, Sven.....


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>