You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by O....@sh.cvut.cz on 2004/01/04 22:15:31 UTC

XSL template from database

Hi, 

I'd like to make the pipeline, where is the XSL template readed from SQL 
database (not from filesystem). Is it possible? Selecting of appropriate 
template depends on the one key, it is generated either with serverpages 
generator or it can be contained in the URI (doesn't care). 

Thanks a lot!

otmar


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


Re: XSL template from database

Posted by Christian Haul <ha...@informatik.tu-darmstadt.de>.
Joerg Heinicke wrote:
> I guess this means, you can not access a reader via cocoon:. This error 
> is rather logical: internal pipelines normally spit out SAX events, a 
> reader does not. So I guess further, that the suggested solution won't 
> work and you have to go on with the other proposal of writing a Source. 
> Christian, yes, you again :), do you have something working using 
> cocoon: with a reader?

Probably not ;-)

	Chris.

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


Re: XSL template from database

Posted by Joerg Heinicke <jo...@gmx.de>.
I guess this means, you can not access a reader via cocoon:. This error 
is rather logical: internal pipelines normally spit out SAX events, a 
reader does not. So I guess further, that the suggested solution won't 
work and you have to go on with the other proposal of writing a Source. 
Christian, yes, you again :), do you have something working using 
cocoon: with a reader?

Joerg

On 07.01.2004 19:16, O.Vobejda@sh.cvut.cz wrote:

> Thanks, I tried it, but cocoon returns error message: "Streaming of an internal 
> pipeline is not possible with a reader.". What does it mean?
> 
> Otmar
> 
> 
>>This is not necessary. One could use the cocoon: protocol when
>>specifying the source for the stylesheet. Next, a pipeline for the
>>stylesheet is needed that consists only of the database reader et voilŕ.
> 
> 
> 
> 
> My sources:
> 
> <map:match pattern="*/*/*/stylesheet/*">
>   <map:read type="databasereader" src="{1}" mime-type="text/xml">
>   <map:parameter name="table" value="subweb s, article a, article_version v, 
> article_version_format avf, format f, language l"/>
>   <map:parameter name="image" value="v.body"/>
>   <map:parameter name="key" value="s.name"/>
>   <map:parameter name="where" value="s.stylesheet=a.id and a.id=v.article and 
> v.id=avf.article_version and avf.format=f.id and f.name='{2}' and 
> v.language=l.id and l.name='{3}'"/>
>   </map:read>
> </map:match>
> 
> <map:match pattern="*/html/*/*/*.html">
>   <map:generate type="serverpages" src="logic/main.xsp">
>     <map:parameter name="language" value="{2}"/>
>     <map:parameter name="format" value="html"/>
>     <map:parameter name="subweb" value="{1}"/>
>     <map:parameter name="id" value="{4}"/>
>     <map:parameter name="content" value="{3}"/>
>   </map:generate>
>   <map:transform src="cocoon:/{1}/html/{2}/stylesheet/0"/>
>   <map:serialize type="html"/>
> </map:match>


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


Re: XSL template from database

Posted by O....@sh.cvut.cz.
Thanks, I tried it, but cocoon returns error message: "Streaming of an internal 
pipeline is not possible with a reader.". What does it mean?

Otmar

> This is not necessary. One could use the cocoon: protocol when
> specifying the source for the stylesheet. Next, a pipeline for the
> stylesheet is needed that consists only of the database reader et voilŕ.



My sources:

<map:match pattern="*/*/*/stylesheet/*">
  <map:read type="databasereader" src="{1}" mime-type="text/xml">
  <map:parameter name="table" value="subweb s, article a, article_version v, 
article_version_format avf, format f, language l"/>
  <map:parameter name="image" value="v.body"/>
  <map:parameter name="key" value="s.name"/>
  <map:parameter name="where" value="s.stylesheet=a.id and a.id=v.article and 
v.id=avf.article_version and avf.format=f.id and f.name='{2}' and 
v.language=l.id and l.name='{3}'"/>
  </map:read>
</map:match>

<map:match pattern="*/html/*/*/*.html">
  <map:generate type="serverpages" src="logic/main.xsp">
    <map:parameter name="language" value="{2}"/>
    <map:parameter name="format" value="html"/>
    <map:parameter name="subweb" value="{1}"/>
    <map:parameter name="id" value="{4}"/>
    <map:parameter name="content" value="{3}"/>
  </map:generate>
  <map:transform src="cocoon:/{1}/html/{2}/stylesheet/0"/>
  <map:serialize type="html"/>
</map:match>

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


Re: XSL template from database

Posted by Christian Haul <ha...@informatik.tu-darmstadt.de>.
Jorg Heymans wrote:
> Hi,
> 
> Can you elaborate a bit on what you mean by creating a source? Is this 
> an avalon component? I've seen this word popup every now and then, just 
> curious :)

please see http://avalon.apache.org/excalibur/api/

	Chris.

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


Re: XSL template from database

Posted by Jorg Heymans <jh...@domek.be>.
Hi,

Can you elaborate a bit on what you mean by creating a source? Is this 
an avalon component? I've seen this word popup every now and then, just 
curious :)

Christian Haul wrote:

> Jorg Heymans wrote:
> 
>> You could make a custom transformer that reads the stylesheet from the 
> 
> 
> This is not necessary. One could use the cocoon: protocol when
> specifying the source for the stylesheet. Next, a pipeline for the
> stylesheet is needed that consists only of the database reader et voilà.
> 
> And if you don't like the extra pipeline, consider creating a source for
> relational databases.
> 
>     Chris.


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


Re: XSL template from database

Posted by Geoff Howard <co...@leverageweb.com>.
Christian Haul wrote:
> Jorg Heymans wrote:
> 
>> You could make a custom transformer that reads the stylesheet from the 
> 
> 
> This is not necessary. One could use the cocoon: protocol when
> specifying the source for the stylesheet. Next, a pipeline for the
> stylesheet is needed that consists only of the database reader et voilà.
> 
> And if you don't like the extra pipeline, consider creating a source for
> relational databases.

Also, you'll want to look into caching this result for performance 
reasons.  Caching database driven results can be a tricky thing, of 
course.  Look into the "eventcache" block if you're using 2.1 for one 
option.  The other is to roll your own system - see caching xsp example 
if you're using xsp.  As things stand, I don't think there's an easy 
caching solution for readers, so you may need to use a simple 
generate->serialize pipeline for your stylesheet.

Geoff


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


Re: XSL template from database

Posted by Christian Haul <ha...@informatik.tu-darmstadt.de>.
Jorg Heymans wrote:
> You could make a custom transformer that reads the stylesheet from the 

This is not necessary. One could use the cocoon: protocol when
specifying the source for the stylesheet. Next, a pipeline for the
stylesheet is needed that consists only of the database reader et voilà.

And if you don't like the extra pipeline, consider creating a source for
relational databases.

	Chris.

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


Re: XSL template from database

Posted by Jorg Heymans <jh...@domek.be>.
You could make a custom transformer that reads the stylesheet from the 
database, then using the saxon or xalan java API applies this 
transformation to the generated xml (look at the transform() function of 
abstractDOMtransformer, that's where your stuff will go).

It's not that difficult, just puzzling the pieces together.

Jorg

O.Vobejda@sh.cvut.cz wrote:

> Hi, 
> 
> I'd like to make the pipeline, where is the XSL template readed from SQL 
> database (not from filesystem). Is it possible? Selecting of appropriate 
> template depends on the one key, it is generated either with serverpages 
> generator or it can be contained in the URI (doesn't care). 
> 
> Thanks a lot!
> 
> otmar


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