You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tobias Berlinger <tb...@web.de> on 2004/01/16 23:14:04 UTC

Help: Sending Xml from Pipe to Pipe

Hi,

here is my problem, hope someone here can help me.

i have a pipe which creates a xml like this:

<elements>
   <element name="a">
      <b/>
   </element>
   <element name="b">
      <b/>
   </element>
   <element name="c">
      <b/>
   </element>
   <element name="d">
      <b/>
   </element>
   ....
</elements>

now i want to send some element subtrees to a different sub pipes. the
subtree "element" should processed by the subpipe and after processing the
result of the subpipe should be replaced with the "element" subtree.

how could i realize this in cocoon? i have tried several ways, but no one
works.

thanks in advance

tobias
-- 
Tobias Berlinger

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


RE: Help: Sending Xml from Pipe to Pipe

Posted by Morley Howell <mo...@cogeco.ca>.
Tobias,

I have done something like this using CInclude.

With CInclude, you can include the output from a source. You can use the
cocoon: protocol to specify that the source should be a Cocoon source (ie.
another pipeline).

You can also pass parameters to that other pipeline. You could embed XML
into one of those parameters. You would then need to use the Request
generator in your subpipe. This generator produces XML that describes the
request, including the content of all parameters. If it sees a parameter
whose name starts with 'xml:', then it will actually parse the XML in that
parameter so that it's available in your subpipe. Then you need something to
strip out the rest of the stuff that the Request generator creates, and you
should be in business. Whatever output is generated by the subpipe is then
included as a fragment in the original XML.

One issue I see is that the amount of XML you can include in a parameter may
be limited. It's possible you may also need to escape the XML to pass it as
a parameter, although Cocoon may do that auto-magically, I'm not sure.

Good luck!

Morley

> -----Original Message-----
> From: Upayavira [mailto:uv@upaya.co.uk]
> Sent: Saturday January 17, 2004 8:31 AM
> To: users@cocoon.apache.org
> Subject: Re: Help: Sending Xml from Pipe to Pipe
>
>
> Tobias Berlinger wrote:
>
> >>Tobias Berlinger wrote:
> >>
> >>
> >>
> >>>Hi,
> >>>
> >>>here is my problem, hope someone here can help me.
> >>>
> >>>i have a pipe which creates a xml like this:
> >>>
> >>><elements>
> >>>  <element name="a">
> >>>     <b/>
> >>>  </element>
> >>>  <element name="b">
> >>>     <b/>
> >>>  </element>
> >>>  <element name="c">
> >>>     <b/>
> >>>  </element>
> >>>  <element name="d">
> >>>     <b/>
> >>>  </element>
> >>>  ....
> >>></elements>
> >>>
> >>>now i want to send some element subtrees to a different sub pipes. the
> >>>subtree "element" should processed by the subpipe and after processing
> >>>the
> >>>result of the subpipe should be replaced with the "element" subtree.
> >>>
> >>>how could i realize this in cocoon? i have tried several ways,
> but no one
> >>>works.
> >>>
> >>>
> >>>
> >>>
> >>Tobias, If you want help here, I think you're going to have to be more
> >>clear. I don't understand what you mean by 'pipe' or 'subpipe'.
> >>
> >>If you want to transform each element differently, you can just use XLST
> >>templates, e.g.:
> >>
> >><xsl:template match="element[@name='a']">
> >>  do something
> >></xsl:template>
> >>
> >><xsl:template match="element[@name='b']">
> >>  do something else
> >></xsl:template>
> >><etc...
> >>
> >>If you want, you can include these templates in separate files and use
> >><xsl:import> or <xsl:include> to import them into your stylesheet.
> >>
> >>Regards, Upayavira
> >>
> >>
> >>
> >
> >hi, thanks for your email.
> >
> >i want to splitt the xml and run each <elment> through a new cocoon pipe
> >(like xinclude).
> >
> >pipe means for me the processing chain (starting with a
> >generator/matcher). from my "main" pipe i want to start several new pipes
> >(subpipes). to do this could it be possible to transfer data from pipe A
> >to pipe B?. pipe B should be matched not by url, it should be matched by
> >the type attribute in the xml snipped (<element type="xxx">).
> >
> >
> In cocoon, you can aggregate multiple inputs into a single output, but
> you can't split a single input into multiple outputs. It doesn't make
> sense in the web request/response paradigm.
>
> If you want four outputs, have one or more pipelines that, called four
> times with a different parameter, would give you your four outputs.
>
> >now i hope you can understand my situation better :-)
> >
> >
> Still not there yet. Are you wanting to do this within a web page? Or
> are you wanting to use Cocoon's functionality outside a web page?
>
> Regards, Upayavira
>
>
>
>
>
> ---------------------------------------------------------------------
> 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: Help: Sending Xml from Pipe to Pipe

Posted by Upayavira <uv...@upaya.co.uk>.
Tobias Berlinger wrote:

>>Tobias Berlinger wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>here is my problem, hope someone here can help me.
>>>
>>>i have a pipe which creates a xml like this:
>>>
>>><elements>
>>>  <element name="a">
>>>     <b/>
>>>  </element>
>>>  <element name="b">
>>>     <b/>
>>>  </element>
>>>  <element name="c">
>>>     <b/>
>>>  </element>
>>>  <element name="d">
>>>     <b/>
>>>  </element>
>>>  ....
>>></elements>
>>>
>>>now i want to send some element subtrees to a different sub pipes. the
>>>subtree "element" should processed by the subpipe and after processing
>>>the
>>>result of the subpipe should be replaced with the "element" subtree.
>>>
>>>how could i realize this in cocoon? i have tried several ways, but no one
>>>works.
>>>
>>>
>>>      
>>>
>>Tobias, If you want help here, I think you're going to have to be more
>>clear. I don't understand what you mean by 'pipe' or 'subpipe'.
>>
>>If you want to transform each element differently, you can just use XLST
>>templates, e.g.:
>>
>><xsl:template match="element[@name='a']">
>>  do something
>></xsl:template>
>>
>><xsl:template match="element[@name='b']">
>>  do something else
>></xsl:template>
>><etc...
>>
>>If you want, you can include these templates in separate files and use
>><xsl:import> or <xsl:include> to import them into your stylesheet.
>>
>>Regards, Upayavira
>>
>>    
>>
>
>hi, thanks for your email.
>
>i want to splitt the xml and run each <elment> through a new cocoon pipe
>(like xinclude).
>
>pipe means for me the processing chain (starting with a
>generator/matcher). from my "main" pipe i want to start several new pipes
>(subpipes). to do this could it be possible to transfer data from pipe A
>to pipe B?. pipe B should be matched not by url, it should be matched by
>the type attribute in the xml snipped (<element type="xxx">).
>  
>
In cocoon, you can aggregate multiple inputs into a single output, but 
you can't split a single input into multiple outputs. It doesn't make 
sense in the web request/response paradigm.

If you want four outputs, have one or more pipelines that, called four 
times with a different parameter, would give you your four outputs.

>now i hope you can understand my situation better :-)
>  
>
Still not there yet. Are you wanting to do this within a web page? Or 
are you wanting to use Cocoon's functionality outside a web page?

Regards, Upayavira





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


Re: Help: Sending Xml from Pipe to Pipe

Posted by Upayavira <uv...@upaya.co.uk>.
Tobias Berlinger wrote:

>Hi,
>
>here is my problem, hope someone here can help me.
>
>i have a pipe which creates a xml like this:
>
><elements>
>   <element name="a">
>      <b/>
>   </element>
>   <element name="b">
>      <b/>
>   </element>
>   <element name="c">
>      <b/>
>   </element>
>   <element name="d">
>      <b/>
>   </element>
>   ....
></elements>
>
>now i want to send some element subtrees to a different sub pipes. the
>subtree "element" should processed by the subpipe and after processing the
>result of the subpipe should be replaced with the "element" subtree.
>
>how could i realize this in cocoon? i have tried several ways, but no one
>works.
>  
>
Tobias, If you want help here, I think you're going to have to be more 
clear. I don't understand what you mean by 'pipe' or 'subpipe'.

If you want to transform each element differently, you can just use XLST 
templates, e.g.:

<xsl:template match="element[@name='a']">
  do something
</xsl:template>

<xsl:template match="element[@name='b']">
  do something else
</xsl:template>
<etc...

If you want, you can include these templates in separate files and use 
<xsl:import> or <xsl:include> to import them into your stylesheet.

Regards, Upayavira


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


Re: Help: Sending Xml from Pipe to Pipe

Posted by toto <en...@free.fr>.
Tobias Berlinger wrote:

>>Tobias Berlinger wrote:
>>
>>    
>>
>>>>Tobias Berlinger wrote:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi,
>>>>>
>>>>>here is my problem, hope someone here can help me.
>>>>>
>>>>>i have a pipe which creates a xml like this:
>>>>>
>>>>><elements>
>>>>> <element name="a">
>>>>>    <b/>
>>>>> </element>
>>>>> <element name="b">
>>>>>    <b/>
>>>>> </element>
>>>>> <element name="c">
>>>>>    <b/>
>>>>> </element>
>>>>> <element name="d">
>>>>>    <b/>
>>>>> </element>
>>>>> ....
>>>>></elements>
>>>>>
>>>>>now i want to send some element subtrees to a different sub pipes. the
>>>>>subtree "element" should processed by the subpipe and after processing
>>>>>the
>>>>>result of the subpipe should be replaced with the "element" subtree.
>>>>>
>>>>>how could i realize this in cocoon? i have tried several ways, but no
>>>>>one
>>>>>works.
>>>>>
>>>>>thanks in advance
>>>>>
>>>>>tobias
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>what kind of processing do you want to do?
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>hi,
>>>a transformation. the subtree structure will be the same after walking
>>>through the subpipe.
>>>i looked at xinlude, but i want to include not a file.
>>>
>>>
>>>
>>>      
>>>
>>You mean for each <element> you want to launch something but the xml
>>structure/content never changes?
>>
>>    
>>
>true, but it could be possible the the subtree in the <element> tag could
>be changed by the subpipe.
>
>  
>
I'm not sure to understand what your <element> processing consists in. 
But, maybe
writing your own transformer could do the job :
You would see <element> tags passing through (startElement()) and then 
launch your
processing there.

>  
>



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


Re: Help: Sending Xml from Pipe to Pipe

Posted by Tobias Berlinger <tb...@web.de>.
> Tobias Berlinger wrote:
>
>>>Tobias Berlinger wrote:
>>>
>>>
>>>
>>>>Hi,
>>>>
>>>>here is my problem, hope someone here can help me.
>>>>
>>>>i have a pipe which creates a xml like this:
>>>>
>>>><elements>
>>>>  <element name="a">
>>>>     <b/>
>>>>  </element>
>>>>  <element name="b">
>>>>     <b/>
>>>>  </element>
>>>>  <element name="c">
>>>>     <b/>
>>>>  </element>
>>>>  <element name="d">
>>>>     <b/>
>>>>  </element>
>>>>  ....
>>>></elements>
>>>>
>>>>now i want to send some element subtrees to a different sub pipes. the
>>>>subtree "element" should processed by the subpipe and after processing
>>>>the
>>>>result of the subpipe should be replaced with the "element" subtree.
>>>>
>>>>how could i realize this in cocoon? i have tried several ways, but no
>>>> one
>>>>works.
>>>>
>>>>thanks in advance
>>>>
>>>>tobias
>>>>
>>>>
>>>>
>>>>
>>>what kind of processing do you want to do?
>>>
>>>
>>>
>>hi,
>>a transformation. the subtree structure will be the same after walking
>>through the subpipe.
>>i looked at xinlude, but i want to include not a file.
>>
>>
>>
> You mean for each <element> you want to launch something but the xml
> structure/content never changes?
>
true, but it could be possible the the subtree in the <element> tag could
be changed by the subpipe.

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


Re: Help: Sending Xml from Pipe to Pipe

Posted by toto <en...@free.fr>.
Tobias Berlinger wrote:

>>Tobias Berlinger wrote:
>>
>>    
>>
>>>Hi,
>>>
>>>here is my problem, hope someone here can help me.
>>>
>>>i have a pipe which creates a xml like this:
>>>
>>><elements>
>>>  <element name="a">
>>>     <b/>
>>>  </element>
>>>  <element name="b">
>>>     <b/>
>>>  </element>
>>>  <element name="c">
>>>     <b/>
>>>  </element>
>>>  <element name="d">
>>>     <b/>
>>>  </element>
>>>  ....
>>></elements>
>>>
>>>now i want to send some element subtrees to a different sub pipes. the
>>>subtree "element" should processed by the subpipe and after processing
>>>the
>>>result of the subpipe should be replaced with the "element" subtree.
>>>
>>>how could i realize this in cocoon? i have tried several ways, but no one
>>>works.
>>>
>>>thanks in advance
>>>
>>>tobias
>>>
>>>
>>>      
>>>
>>what kind of processing do you want to do?
>>
>>    
>>
>hi,
>a transformation. the subtree structure will be the same after walking
>through the subpipe.
>i looked at xinlude, but i want to include not a file.
>
>  
>
You mean for each <element> you want to launch something but the xml 
structure/content never changes?


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


Re: Help: Sending Xml from Pipe to Pipe

Posted by Tobias Berlinger <tb...@web.de>.
> Tobias Berlinger wrote:
>
>>Hi,
>>
>>here is my problem, hope someone here can help me.
>>
>>i have a pipe which creates a xml like this:
>>
>><elements>
>>   <element name="a">
>>      <b/>
>>   </element>
>>   <element name="b">
>>      <b/>
>>   </element>
>>   <element name="c">
>>      <b/>
>>   </element>
>>   <element name="d">
>>      <b/>
>>   </element>
>>   ....
>></elements>
>>
>>now i want to send some element subtrees to a different sub pipes. the
>>subtree "element" should processed by the subpipe and after processing
>> the
>>result of the subpipe should be replaced with the "element" subtree.
>>
>>how could i realize this in cocoon? i have tried several ways, but no one
>>works.
>>
>>thanks in advance
>>
>>tobias
>>
>>
>
> what kind of processing do you want to do?
>
hi,
a transformation. the subtree structure will be the same after walking
through the subpipe.
i looked at xinlude, but i want to include not a file.

regards tobias

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


Re: Help: Sending Xml from Pipe to Pipe

Posted by toto <en...@free.fr>.
Tobias Berlinger wrote:

>Hi,
>
>here is my problem, hope someone here can help me.
>
>i have a pipe which creates a xml like this:
>
><elements>
>   <element name="a">
>      <b/>
>   </element>
>   <element name="b">
>      <b/>
>   </element>
>   <element name="c">
>      <b/>
>   </element>
>   <element name="d">
>      <b/>
>   </element>
>   ....
></elements>
>
>now i want to send some element subtrees to a different sub pipes. the
>subtree "element" should processed by the subpipe and after processing the
>result of the subpipe should be replaced with the "element" subtree.
>
>how could i realize this in cocoon? i have tried several ways, but no one
>works.
>
>thanks in advance
>
>tobias
>  
>

what kind of processing do you want to do?






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