Re: Can I pass a sitemap resource as a parameter to an xslt transformer?

2011-01-17 Thread Jasha Joachimsthal
You don't need to pass it as a parameter. Just use map:aggregate with a
map:part that gets all the authors. To cache the result of the SQL query you
can use an expires pipeline with a very long expiration time.

Jasha Joachimsthal

j.joachimst...@onehippo.com - ja...@apache.org

Hippo
Europe   •   Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31 (0)20 522
4466
USA   •   San Francisco  755 Baywood Drive Second Floor  •  Petaluma CA
94954   •  +1 877 414 4776 (toll free)
Canada  •   Montréal  5369 Boulevard St-Laurent #430  •  Montréal QC H2T 1S5
 •  +1 (514) 316 8966
www.onehippo.com  •  www.onehippo.org  •  i...@onehippo.com


On 16 January 2011 11:54, Andre Juffer ajuf...@sun3.oulu.fi wrote:

 On 01/14/2011 06:23 PM, Des Magner wrote:

 Hi

 I want to combine two pieces of XML that gets passed to my XSL
 transformation. I have a list of authors that needs only to be read
 once. I then have a page to edit different articles and this page must
 present the list of authors for selection. But I do not want to read the
 list of authors from the database every time an article needs to be
 edited. So I thought the best way to do this would be to define a
 resource that contains the list of authors and pass this as a parameter
 to the transformation for the article edit page as outlined below. Is it
 possible to somehow refer to the authors resource where I have placed
 the ???.


 As far as I know this is NOT possible.

 As an alternative, you could include XML file with the authors list into
 the XML file containing the page that requires editing (or include the XML
 file containing the page into the XML file holding the authors list), before
 you use your transformer. The transformer that selects from the authors'
 node what it needs to produce the proper SQL.



 Any help much appreciated
 Regards
 Des

 map:resource name=authors
 map:generate src=authors.xml/
 map:transform type=sql
 map:parameter name=use-connection value=myConnection/
 /map:transform
 /map:resource

 map:generate src=article.xml/
 map:transform type=sql
 map:parameter name=use-connection value=myConnection/
 map:parameter name=article-id value={request-param:article}/
 /map:transform
 map:transform src=article.xsl
 map:parameter name=authors value={???}/
 /map:transform


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



 --
 Andre H. Juffer  | Phone: +358-8-553 1161
 Biocenter Oulu and   | Fax: +358-8-553-1141
 Department of Biochemistry   | Email: andre.juf...@oulu.fi
 University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/
 StruBioCat   | WWW: www.strubiocat.oulu.fi
 NordProt | WWW: www.nordprot.org
 Triacle Biocomputing | WWW: www.triacle-bc.com


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




RE: Can I pass a sitemap resource as a parameter to an xslt transformer?

2011-01-14 Thread Binkley, Peter
I would use a regular pipeline for the authors list, with caching turned
on (so it doesn't run the query every time - check the cocoon docs for
how to control expiry etc.):

map:pipeline type=caching
map:match pattern=authors
...

And then include it from within the article.xsl using the cocoon:
protocol, which is used to address a pipeline in the sitemap:
 
xsl:variable name=authors
select=document('cocoon:/authors')/

Resources are used when you want to include the same series of
components in more than one pipeline. I don't think a resource can do
caching: that would be up to the pipelines in which it is called.


Peter





-Original Message-
From: Des Magner [mailto:d...@icandriveatractor.com] 
Sent: Friday, January 14, 2011 9:24 AM
To: users@cocoon.apache.org
Subject: Can I pass a sitemap resource as a parameter to an xslt
transformer?

Hi

I want to combine two pieces of XML that gets passed to my XSL 
transformation. I have a list of authors that needs only to be read 
once. I then have a page to edit different articles and this page must 
present the list of authors for selection. But I do not want to read the

list of authors from the database every time an article needs to be 
edited. So I thought the best way to do this would be to define a 
resource that contains the list of authors and pass this as a parameter 
to the transformation for the article edit page as outlined below. Is it

possible to somehow refer to the authors resource where I have placed 
the ???.

Any help much appreciated
Regards
Des

map:resource name=authors
map:generate src=authors.xml/
map:transform type=sql
map:parameter name=use-connection value=myConnection/
/map:transform
/map:resource

map:generate src=article.xml/
map:transform type=sql
map:parameter name=use-connection value=myConnection/
map:parameter name=article-id value={request-param:article}/
/map:transform
map:transform src=article.xsl
map:parameter name=authors value={???}/
/map:transform


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


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