Katharina Kreis | 1 May 2006 09:26
Picon

XInclude with dynamically created xml in a matcher

Hi!

I'm trying to integrate a svg graphic into a pdf doc using xinclude. I have one matcher which should create a
pdf file using the fo2pdf serializer. I produce the 'fo' content for the pdf with a xslt file named
'pdftest.xsl'. In this file, I have a xinclude inside, which references to another matcher called
'bsplt_pdf_stockwerk'. This matcher creates a large svg file (here I have only a sample file). Both
matchers are working without the xinclude command. If I have the xinclude command inside, I get directly
after the xinclude transformer the error message: A xml file must have a root element. But both files have!
Can anybody tell me what is wrong here?

Sitemap:
=======

<map:match pattern="pdftest">
...
<map:transform type="xslt" src="pdftest.xsl"/>
<map:transform type="xinclude"/>
<map:serialize type="fo2pdf!/>
</map:match>

<map:match pattern="bsplt_pdf_stockwerk">
<map:generate src="svgtest.xml"/>
<map:serialize type="xml"/>
</map:match>

pdftest.xsl:
=========

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
(Continue reading)

Ard Schrijvers | 1 May 2006 11:16
Picon

RE: Custom Pipeline Caching

The specific thing you describe you want to implement is not possible. But, there are options to improve on some points, but it really depends on a few things (especially getting the external content):
 
I will try to summarize some of your options here:
 
1) How up to date should the external content be? Can you say, it is valid for at least 5 minutes? Then, use the expiring cche of cocoon
2) Can you get a timestamp of the external content (just like on filesystem, a lastmodified)? Then, normal cocoon cache should work. Only disadvantage, is that for checking the validity of your cached pipeline, a call to the external resource is made for something like a timestamp.
3) This is by far the nicest solution, but probably not useable for you: if you have external calls to for example a repository, eventCaching is the way to go, where for example after changes, jms messages invalidate the corresponding pipelines. But, probably, you just read external content which is not yours.
 
These are your options I think.
 
If you want to understand more about the cocoon caching mechanism, and how cocoon checks for cached pipelines (especially what the order of checks are, like cache keys and validity objects), check out:
 
Regards Ard
--

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
a.schrijvers <at> hippo.nl / http://www.hippo.nl
--------------------------------------------------------------
 
 
 
 Hello Antonio,

I am not sure whether I can use the ExpiresCachingPipeline because I am implementing a kind of Proxy, so I have to make sure the content is up2date.

To explain it better, here a simple description of the pipeline:

1. Transformations (Preparation)
2. Fetching of external content
3. Transformation

After having fetched the content, I can decide if it changed or not, so I could skip step 3. I can't cache step 2 as I can never be sure that the external content did not change...

How can I implement a cache mechanism for my special case?

Hi Nils,

This thread may help you [1]

Best Regards,

Antonio Gallardo

[1] http://marc.theaimsgroup.com/?t=114071517900001

Nils Kaiser escribió:
Hello,

I have a complex pipeline which contains some self written components that generate and transform data in steps that cannot really be cached (dependent on external resources like the result of a request...).

What are the possibilities to implement a custom cachin scheme? Is there a way to define a step in the pipeline where caching is possible again (not just if all preceding components are cache-aware?).

Greetings,

Nils


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



Joost Kuif | 1 May 2006 11:30
Picon
Favicon

2.1.9 and changed flowscripts not picked up

Hi,

 

I am experiencing the following behavior since we moved from cocoon 2.1.8 to 2.1.9:

Cocoon seems to reload flowscripts (which are changed on disk) only after a restart of cocoon.

Before I start digging into this problem.. Does anyone know why and maybe how I can solve this?

 

 

Thanks in advance,

 

 

Joost

Ard Schrijvers | 1 May 2006 11:42
Picon

RE: InputModule output and pipeline caching ?


> 
> Hello
> 
> AFAIK, Cocoon caching mechanism tries to cache a pipeline processing
> workflow "until it meets a non-cacheable element" (correct me if I'm
> mistaken :)).
> 
> My question is rather simple, given the above hopefully correct
> assumption. If I have a pipeline with type="caching" that looks like :

Normal caching pipeline does not work like this:

A cocoon pipeline is only cached cached (apart from expiring cache which works little differnt, and the
CachingPointProcessingPipeline ), if EVERY single thing in it can be cached. So, if you have a very long
pipeline, with 100 transformers, all cached very well, except, for example, your last transformer not
(like a dynamic i18n transformer which is implemented in a noncaching pipeline), then, your entire
pipeline wont be cached! (cocoon tries to create just 1 cachekey for 1 pipeline. It can not have 1 cachekey
for the first parts of the pipeline (unless you are planning to use CachingPointProcessingPipeline))

If you have one single part in the pipeline which is uncacheable, there is no difference in performance
wether you use caching or non-caching pipelines.

But, if the last part of your pipeline is uncacheable, but for example the xml generator is, then you can use
in the map:part a src="cocoon:/cacheable/foo/bar"

and make sure that the /cacheable/foo/bar pipeline is cached. This way, at least the generation of you xml
is cached. This is more or less comparable to CachingPointProcessingPipeline I think....

> 
> <map:match pattern="foo">
> <map:aggregate element="root">
> <!-- various map:part reading xml flat files on disk which are
> sometimes updated -->
> </map:aggregate>
> <map:transform src="{myinputmodule:someproperty}/foo.xslt"/>
> <map:serialize type="xml"/>
> </map:match>
> 
> and given that the someproperty output value is dynamic, because based
> on dynamic request parameters the myinputmodule uses to alter that
> property :

This is certainly not a reason why it can not be cached (what about request-parameters passed into an xsl. An
xsl can still be perfectly cached!!)

> 
> will Cocoon cache the first inputmodule return value, and use it until
> the cache has to be refreshed, or will it *instead* cache each and
> every inputmodule value returned ?

I dont really know what you mean, but it depends on your myinputmodule implementation

> 
> in other words, will I end up with one cached xslt transformation
> bound to the first inputmodule value ever returned, or with multiple
> cached transformations, because Cocoon is "smart enough" to understand
> the transformer part uses a dynamic source, knowing that the {} might
> return different values ?

You just have to make sure, that depending on the request-param, your myinputmodule returns a cached
"someproperty" depending on the request-parameter you want it to depend on. (like an xsl
transformation, you pass in map:paramters, where the cache then also depends on ( unless you configure
"use-request-parameters" to "true" for xsl transformations, then it uses ALL request-parameters,
which you should never do if you ask me))

Hope this clears things up.

Ard
-- 

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
a.schrijvers <at> hippo.nl / http://www.hippo.nl
-------------------------------------------------------------- 

> 
> thanks
> laurent
> 
> 
> --
> <a href="http://in-pocket.blogspot.com">http://in-pocket.blogspot.com
> - Mobile world, technology and more</a>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
> 
> 
Ard Schrijvers | 1 May 2006 11:46
Picon

RE: What is the cachepoint pipeline?

CachingPointProcessingPipeline is to avoid recomputing the whole pipeline when the generator is still valid. Your problem can not be solved with this, because the problem lies in your generator which can't be cached.
 
Ard

--

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
a.schrijvers <at> hippo.nl / http://www.hippo.nl
--------------------------------------------------------------

 
 

Hello,

as I am getting deeper into caching these days (see my other post about caching complex transformers depending on external requests), I was asking myself what the cachepoint caching pipeline is?

I could only find very few information on the mailing list, on daisy the page is empty. Maybe someone can point me to the right location?

Greets,

Nils
Ard Schrijvers | 1 May 2006 11:56
Picon

RE: Custom Pipeline Caching - Using DelayedValidity?


"Well, after browsing around I wonder if I could use a delayed validity to implement this. It would not help
me skipping the request step for the external content, but I could get a validity on the content and
therefore skip the following transformers"

Yes, as I wrote on your other thread, if you can find the validity on the content, then you could make it
cacheable apart from having todo the request for the validity.

"Am I right with the delayed validity beeing the solution here?"

I am not sure why to use a delayed validity...all your generator should do, is that during cocoon cachekey
checking and validity checking, your generator should fetch something like a timestamp of lastmodified
of your external source. Has nothing to do with delayed validity if you ask me. 

"What is the best start point to implement delayed validity (sample component)?"

If you are sure you need this one, look at the DirectoryGenerator and the TraxTransformer. They both
implement delayed validity (more precize, delayed agregated validity)

Check the end of http://cocoon.zones.apache.org/daisy/documentation/writing/690.html, it really
might help you understanding cocoon cache,

Regards, AS

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
a.schrijvers <at> hippo.nl / http://www.hippo.nl
-------------------------------------------------------------- 

Greetings,

Nils
Ard Schrijvers | 1 May 2006 12:07
Picon

RE: modular DatabaseAction and database description file

I cannot really help with map:action and xsp's, because I never use them, but if you're heading for a little
bit more complex things and database queries, try to take a look at how things are made persistent with
BrickCms (it is not a cms, but an example): http://wiki.apache.org/cocoon/BricksCms and 
http://www.cocoongt.org/binaries/bricks-cms-overview.pdf.

Your maintainance will be way easier and your application much cleaner.

Regards Ard

-- 

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
a.schrijvers <at> hippo.nl / http://www.hippo.nl
-------------------------------------------------------------- 

> 
> Hi all, I am trying to run a query.
> 
> sitemap.xml:
>   <map:action-sets>
>     <map:action-set name="process">
>       <map:act type="req-params">
>          <map:parameter name="parameters" value="qry-node node.id"/>
>          <map:act type="mod-db-qry" mode="one">
>             <map:parameter name="table-set" value="querytableset"/>
>             <map:parameter name="dummy" value="123"/>
>          </map:act>
>       </map:act>
>     </map:action-set>
>   </map:action-sets>
> 
>   ...
> 
>   <map:pipelines>
>     <map:pipeline>
>       <map:match pattern="*.html">
>         <map:act set="process">
>           <map:parameter name="use-request-parameters" value="true" />
>         </map:act>
>         <map:aggregate element="site">
>            <map:part src="cocoon:/menu"/>
>            <map:part src="cocoon:/body/{1}"/>
>         </map:aggregate>
>         <map:transform src="context://stylesheets/site-to-xhtml.xsl"/>
>         <map:serialize type="html"/>
>       </map:match>
>     </map:pipeline>
>   </map:pipelines>
> 
> database description file:
> 
>   <table name="querytable">
>     <queries>
>        <query mode="others">select id from node where id=?</query>
>     </queries>
>     <keys>
>         <key name="id"          type="int" autoincrement="true">
>            <mode name="auto"    type="autoincr"/>
>         </key>
>     </keys>
>   </table>
> 
> I don't get any errors, but as well the XSP {1} does not get 
> any attributes. In a future version I would like to call SQL 
> stored procedures. Can anyone help, with may be a description 
> or a DTD of the database description file? Thank you, mare..at.web.de
> 
> 
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
> 
> 
Andre Fiedler | 1 May 2006 12:26
Picon
Picon

SQLTransformer Help

Hi everybody,

I am creating a cocoon application talking to a database, extracting  
the basic information via SQLTransformer and let it be displayed. So  
far so good .. almost everything is fine, instead of one thing. After  
database communication creates the XML-file in (A) my XSLT (B) should  
transform it and give the output in a table .. But even after  
successfully calling the correct template and print some nonsens for  
debugging purposes I am still not able to address the sql createt  
elements in the XML-file one level deeper ... :-/ u know what I  
meen ? let me show you:

(A) generated XML File
--------------------------------

<speiseplan xmlns:xi="http://www.w3.org/2001/XInclude">
	<tage nrofrows="5" name="tage" xmlns:sql="http://apache.org/cocoon/ 
SQL/2.0" xmlns="http://apache.org/cocoon/SQL/2.0">
		<tag>
			<tag_id>1</tag_id>
			<tag_name>Montag</tag_name>
		</tag>
		<tag>
			<tag_id>2</tag_id>
			<tag_name>Dienstag</tag_name>
		</tag>
		<tag>
			<tag_id>3</tag_id>
			<tag_name>Mittwoch</tag_name>
		</tag>
		<tag>
			<tag_id>4</tag_id>
			<tag_name>Donnerstag</tag_name>
		</tag>
		<tag>
			<tag_id>5</tag_id>
			<tag_name>Freitag</tag_name>
		</tag>
	</tage>
	<content>
		<rowset nrofrows="3" xmlns:sql="http://apache.org/cocoon/SQL/2.0"  
xmlns="http://apache.org/cocoon/SQL/2.0">
			<row>
				<essen_titel>Essen 1</essen_titel>
				<essen_beschreibung>Senfeier mit Backkartoffeln und  
Schwarzwurzeln</essen_beschreibung>
				<essen_preis>2.5</essen_preis>
			</row>
			<row>
				<essen_titel>Essen 2</essen_titel>
				<essen_beschreibung>Tomatensuppe, dazu Basilikum. Croutons und  
Gew&uuml;rze der Provence</essen_beschreibung>
				<essen_preis>2.99</essen_preis>	
			</row>
			<row>
				<essen_titel>Bio-Essen</essen_titel>
				<essen_beschreibung>Spaghetti Bolognese mit frischem Parmesan</ 
essen_beschreibung>
				<essen_preis>3.8</essen_preis>
			</row>
		</rowset>	
	</content>	
</speiseplan>

(B) XSLT extract
----------------------
...
<xsl:template name="tag" match="sql:rowset">
        <br/> <br/>
         <p class="p">
             <xsl:value-of select="$var"/>
         </p>
         <br/> <br/>
         <table width="600" class="content_table" cellpadding="5"  
cellspacing="0">
             <tr>
                 <td class="content_table_top" width="20%">Titel</td>
                 <td class="content_table_top"  
width="60%">Beschreibung</td>
                 <td class="content_table_top" width="20%">Preis in  
EURO</td>
             </tr>
          <xsl:call-template name="essen"/>
         </table>
  </xsl:template>

   <xsl:template name="essen" match="rowset/sql:row">
         <tr>
             <td class="content_table_td" width="20%">b<xsl:value-of  
select="sql:essen_titel"/></td>
             <td class="content_table_td" width="60%">b<xsl:value-of  
select="sql:essen_beschreibung"/></td>
             <td class="content_table_td" width="20%">b<xsl:value-of  
select="sql:essen_preis"/></td>
         </tr>
   </xsl:template>
...

(C) generated HTML extract
--------------------------------------
...
<table cellspacing="0" cellpadding="5" class="content_table"  
width="600">
<tr>
<td width="20%" class="content_table_top">Titel</td><td width="60%"  
class="content_table_top">Beschreibung</td><td width="20%"  
class="content_table_top">Preis in EURO</td>
</tr>
<tr>
<td width="20%" class="content_table_td">b</td><td width="60%"  
class="content_table_td">b</td><td width="20%"  
class="content_table_td">b</td>
</tr>
</table>
	
Essen 1Senfeier mit Backkartoffeln und Schwarzwurzeln2.5Essen  
2Tomatensuppe, dazu Basilikum. Croutons und Gew&uuml;rze der  
Provence2.99Bio-EssenSpaghetti Bolognese mit frischem Parmesan3.8	

(D)
-----
Obvisously I want the Entries "Essen 1..." appear in the table and  
not afterwards .. :-( and do undergo that mechanism as much as row- 
elements appear, not only once as it is now .. (rember the rows of  
"b" in (A))

Do you know an answer to that? currently it has driving me crazy for  
5 hours ..

thanks and greetings

Andre
Ard Schrijvers | 1 May 2006 12:37
Picon

RE: SQLTransformer Help


See in code:

> 
> 
> Hi everybody,
> 
> I am creating a cocoon application talking to a database, extracting  
> the basic information via SQLTransformer and let it be displayed. So  
> far so good .. almost everything is fine, instead of one 
> thing. After  
> database communication creates the XML-file in (A) my XSLT 
> (B) should  
> transform it and give the output in a table .. But even after  
> successfully calling the correct template and print some nonsens for  
> debugging purposes I am still not able to address the sql createt  
> elements in the XML-file one level deeper ... :-/ u know what I  
> meen ? let me show you:
> 
> (A) generated XML File
> --------------------------------
> 
> <speiseplan xmlns:xi="http://www.w3.org/2001/XInclude">
> 	<tage nrofrows="5" name="tage" 
> xmlns:sql="http://apache.org/cocoon/ 
> SQL/2.0" xmlns="http://apache.org/cocoon/SQL/2.0">
> 		<tag>
> 			<tag_id>1</tag_id>
> 			<tag_name>Montag</tag_name>
> 		</tag>
> 		<tag>
> 			<tag_id>2</tag_id>
> 			<tag_name>Dienstag</tag_name>
> 		</tag>
> 		<tag>
> 			<tag_id>3</tag_id>
> 			<tag_name>Mittwoch</tag_name>
> 		</tag>
> 		<tag>
> 			<tag_id>4</tag_id>
> 			<tag_name>Donnerstag</tag_name>
> 		</tag>
> 		<tag>
> 			<tag_id>5</tag_id>
> 			<tag_name>Freitag</tag_name>
> 		</tag>
> 	</tage>
> 	<content>
> 		<rowset nrofrows="3" 
> xmlns:sql="http://apache.org/cocoon/SQL/2.0"  
> xmlns="http://apache.org/cocoon/SQL/2.0">
> 			<row>
> 				<essen_titel>Essen 1</essen_titel>
> 				<essen_beschreibung>Senfeier 
> mit Backkartoffeln und  
> Schwarzwurzeln</essen_beschreibung>
> 				<essen_preis>2.5</essen_preis>
> 			</row>
> 			<row>
> 				<essen_titel>Essen 2</essen_titel>
> 				
> <essen_beschreibung>Tomatensuppe, dazu Basilikum. Croutons und  
> Gew&uuml;rze der Provence</essen_beschreibung>
> 				<essen_preis>2.99</essen_preis>	
> 			</row>
> 			<row>
> 				<essen_titel>Bio-Essen</essen_titel>
> 				<essen_beschreibung>Spaghetti 
> Bolognese mit frischem Parmesan</ 
> essen_beschreibung>
> 				<essen_preis>3.8</essen_preis>
> 			</row>
> 		</rowset>	
> 	</content>	
> </speiseplan>
> 
> 
> (B) XSLT extract
> ----------------------
> ...
> <xsl:template name="tag" match="sql:rowset">
>         <br/> <br/>
>          <p class="p">
>              <xsl:value-of select="$var"/>
>          </p>
>          <br/> <br/>
>          <table width="600" class="content_table" cellpadding="5"  
> cellspacing="0">
>              <tr>
>                  <td class="content_table_top" width="20%">Titel</td>
>                  <td class="content_table_top"  
> width="60%">Beschreibung</td>
>                  <td class="content_table_top" width="20%">Preis in  
> EURO</td>
>              </tr>
>           <xsl:call-template name="essen"/>
>          </table>
>   </xsl:template>
> 
> 
>    <xsl:template name="essen" match="rowset/sql:row">

Here you have a mistake: rowset belongs to the sql namespace, so use sql:rowset/sql:row. Always watch out
for namespaces, they are tricky. Once you are familiaar with it, you know where to look (for example,
sql:rowset[ <at> rowset='3']/sql:row would not work either, but sql:rowset[ <at> sql:rowset='3']/sql:row
would) 

>          <tr>
>              <td class="content_table_td" width="20%">b<xsl:value-of  
> select="sql:essen_titel"/></td>
>              <td class="content_table_td" width="60%">b<xsl:value-of  
> select="sql:essen_beschreibung"/></td>
>              <td class="content_table_td" width="20%">b<xsl:value-of  
> select="sql:essen_preis"/></td>
>          </tr>
>    </xsl:template>
> ...
> 
> 
> (C) generated HTML extract
> --------------------------------------
> ...
> <table cellspacing="0" cellpadding="5" class="content_table"  
> width="600">
> <tr>
> <td width="20%" class="content_table_top">Titel</td><td width="60%"  
> class="content_table_top">Beschreibung</td><td width="20%"  
> class="content_table_top">Preis in EURO</td>
> </tr>
> <tr>
> <td width="20%" class="content_table_td">b</td><td width="60%"  
> class="content_table_td">b</td><td width="20%"  
> class="content_table_td">b</td>
> </tr>
> </table>
> 	
> Essen 1Senfeier mit Backkartoffeln und Schwarzwurzeln2.5Essen  
> 2Tomatensuppe, dazu Basilikum. Croutons und Gew&uuml;rze der  
> Provence2.99Bio-EssenSpaghetti Bolognese mit frischem Parmesan3.8	
> 
> 
> (D)
> -----
> Obvisously I want the Entries "Essen 1..." appear in the table and  
> not afterwards .. :-( and do undergo that mechanism as much as row- 
> elements appear, not only once as it is now .. (rember the rows of  
> "b" in (A))
> 
> Do you know an answer to that? currently it has driving me crazy for  
> 5 hours ..
> 
> thanks and greetings
> 
> Andre
> 

Regards Ard

--

-- 

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
a.schrijvers <at> hippo.nl / http://www.hippo.nl
-------------------------------------------------------------- 

> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
> For additional commands, e-mail: users-help <at> cocoon.apache.org
> 
> 
Nils Kaiser | 1 May 2006 12:47
Picon

Re: Custom Pipeline Caching

Well I think in my environment step 2 is the way to go... Creating a timestamp or cache-key might not be a problem. The only thing might be that the content to fetch is itself initialized by some transformations and therefore submitted as SAX events, which gives me the problem that I would need to get access to the pipeline content and beeing able to return my timestamp during transform...

Is that possible? Sounds not really cocoon-like ;)

I don't want to skip the fetching of the external content because up-to-date data is a strong requirement in my case. So what I need is a way to skip the following transforms.

Thx,

Nils

Ard Schrijvers schrieb:
The specific thing you describe you want to implement is not possible. But, there are options to improve on some points, but it really depends on a few things (especially getting the external content):
 
I will try to summarize some of your options here:
 
1) How up to date should the external content be? Can you say, it is valid for at least 5 minutes? Then, use the expiring cche of cocoon
2) Can you get a timestamp of the external content (just like on filesystem, a lastmodified)? Then, normal cocoon cache should work. Only disadvantage, is that for checking the validity of your cached pipeline, a call to the external resource is made for something like a timestamp.
3) This is by far the nicest solution, but probably not useable for you: if you have external calls to for example a repository, eventCaching is the way to go, where for example after changes, jms messages invalidate the corresponding pipelines. But, probably, you just read external content which is not yours.
 
These are your options I think.
 
If you want to understand more about the cocoon caching mechanism, and how cocoon checks for cached pipelines (especially what the order of checks are, like cache keys and validity objects), check out:
 
Regards Ard
--

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
a.schrijvers <at> hippo.nl / http://www.hippo.nl
--------------------------------------------------------------




Gmane