You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Palol Carlos <ca...@gmail.com> on 2008/11/14 04:26:10 UTC

[2.1] Generator src from document content

Hi list,

I'm trying to query a Daisy 2.2 repository from a Lenya 2 website  
(Cocoon 2.1)

So i have XML documents like this:

<mydoc>
   <query>
     SELECT name WHERE InCollection('xyz')
   </query>
</mydoc>

And would like to query that repository through HTTP API, like this:

http://user:user@mydaisyserver.com/repositoryquery?q=SELECT+name+WHERE  
InCollection%28%27xyz%27%29
which returns an XML result.

What i would like to do (in the pipeline) is:

1. Read de XML "query" text node.
2. Escape the string, create de full url in an action, XSLT or else.
3. Generate (file generator) using the full url.
4. Transform, etc

I can't find a simple way to take content to de sitemap. Is it  
necessary to use an action and access the document from it?

Thanks in advance for any suggestion,

--
Carlos Palol








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


Re: [2.1] Generator src from document content

Posted by Palol Carlos <ca...@gmail.com>.
On 14.11.2008, at 08:23, Joerg Heinicke wrote:

> On 14.11.2008 04:26, Palol Carlos wrote:
>
>> I'm trying to query a Daisy 2.2 repository from a Lenya 2 website  
>> (Cocoon 2.1)
>> So i have XML documents like this:
>> <mydoc>
>>  <query>
>>    SELECT name WHERE InCollection('xyz')
>>  </query>
>> </mydoc>
>> And would like to query that repository through HTTP API, like this:
>> http://user:user@mydaisyserver.com/repositoryquery?q=SELECT+name+WHERE 
>>  InCollection%28%27xyz%27%29
>> which returns an XML result.
>> What i would like to do (in the pipeline) is:
>> 1. Read de XML "query" text node.
>> 2. Escape the string, create de full url in an action, XSLT or else.
>> 3. Generate (file generator) using the full url.
>> 4. Transform, etc
>> I can't find a simple way to take content to de sitemap. Is it  
>> necessary to use an action and access the document from it?
>
> Hi Carlos,
>
> There is no direct access to the content in the sitemap as you  
> describe it. Also you would need 2 generators in a pipeline what's  
> not possible (first one querying the repository, second one reading  
> the file).
>
> You need a 2-pipeline setup. In the main pipeline you query the  
> repository, transform the result adding an xinclude "directive" (an  
> element in the xinclude namespace) to it, run the xinclude  
> transformer and maybe some post transformations. The "included"  
> document (even it will replace the original XML from the query  
> completely) will be created from a sub-request to Cocoon (cocoon:/- 
> protocol), i.e. second pipeline. Here you have again the free choice  
> about what to do.
>
> Hope this helps,
> Joerg
>


The xinclude worked fine! that was the way to send some string from  
content to the sitemap:

<map:match pattern="mainrequest.html">
   <map:generate src="content/query.xml"/>
   <map:transform src="xslt/prepare-the-url.xsl"/> (this makes a  
xinclude calling to queryrepo pipeline)
   <map:transform type="xinclude"/>
   <map:serialize type="xml"/>
</map:match>

<map:match pattern="queryrepo/**">
   <map:generate src="http://alltheserverthing.com/repository/query? 
q={1}"/>
   <map:serialize type="xml"/>
</map:match>

Thanks a lot,

--
Carlos Palol


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


Re: [2.1] Generator src from document content

Posted by Joerg Heinicke <jo...@gmx.de>.
On 14.11.2008 04:26, Palol Carlos wrote:

> I'm trying to query a Daisy 2.2 repository from a Lenya 2 website 
> (Cocoon 2.1)
> 
> So i have XML documents like this:
> 
> <mydoc>
>   <query>
>     SELECT name WHERE InCollection('xyz')
>   </query>
> </mydoc>
> 
> And would like to query that repository through HTTP API, like this:
> 
> http://user:user@mydaisyserver.com/repositoryquery?q=SELECT+name+WHERE 
> InCollection%28%27xyz%27%29
> which returns an XML result.
> 
> What i would like to do (in the pipeline) is:
> 
> 1. Read de XML "query" text node.
> 2. Escape the string, create de full url in an action, XSLT or else.
> 3. Generate (file generator) using the full url.
> 4. Transform, etc
> 
> I can't find a simple way to take content to de sitemap. Is it necessary 
> to use an action and access the document from it?

Hi Carlos,

There is no direct access to the content in the sitemap as you describe 
it. Also you would need 2 generators in a pipeline what's not possible 
(first one querying the repository, second one reading the file).

You need a 2-pipeline setup. In the main pipeline you query the 
repository, transform the result adding an xinclude "directive" (an 
element in the xinclude namespace) to it, run the xinclude transformer 
and maybe some post transformations. The "included" document (even it 
will replace the original XML from the query completely) will be created 
from a sub-request to Cocoon (cocoon:/-protocol), i.e. second pipeline. 
Here you have again the free choice about what to do.

Hope this helps,
Joerg

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