You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "keith d. zimmerman" <li...@kdz13.net> on 2004/05/04 23:49:56 UTC
design questions/need ideas
I have been starting to use cocoon for my personal web site, and I am
becoming quite fond of it... Congrats go out to all devs.
I have a few apps i'd like to build, and either I am too new to cocoon
to understand all that i should, or what I want to do is stupid. In any
case, here we go.
I would like to write an application to create a local cache of certain
websites i like to monitor. The flow of the application is that the
first time a user requests a certain resource, the server goes out and
queries the web for it. It uses xslt, etc, etc to transform the source,
and then stores it locally for future use. The locally stored copy is
then sent out to the users. The local copy is never updated once it is
successfully aquired one time.
So, with that in mind, the questions...
1. Is the best way to do the download and save step to create an
action, and run this action conditionally in a resource-exists selector?
Is there a better way, or preferably one that I could do (being my
lazy self) without writing java/perl code, but just add stuff to the
sitemap?
2. I have a list of resources available. I want the user to be able to
view them all on one page (all as in all for the day), or each
individually. Ideally, I would store these resources in an xml file,
and generate the list with xslt. But my sitemap also needs an entry for
each of these. I tried to do this:
<map:match pattern="resourses.xmap>
...
<map:serialize type="xml"/>
</map:match>
<map:mount uri-prefix="" check-reload="yes" src="cocoon:/resourses.xmap"/>
but it failed. Interestingly enough it knew if a resource was available
or not, but simply returned a blank page. I am assuming from reading
archives of the list that this is not supported, but I was wondering
what is the best way to do this? The resource list needs to store
various properties like a name, an originating url, etc. I thought
about saving this all in the sitemap, and then using xslt to parse the
sitemap file to create the list that contains them all, but couldn't
think where to store the url and things like that.
So, any assistance would be kindly appreciated, and once again I love
the app.
thanks,
-kz
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: design questions/need ideas
Posted by "keith d. zimmerman" <li...@kdz13.net>.
g[R]eK wrote:
> There is simpler way than writing own action. We have SourceWriting Transformer
> [1] ;-)
> I think, sitemap snip will explain everything:
> <map:generate type="jx" src="query_resource_template.xml"/> [2]
> <map:transform type="cinclude"/> [3]
> <map:transform type="xslt" src="your_xslt_transformations.xsl"/>
> <map:transform type="write-source"/>
> <map:transform type="xslt" src="other_transformations.xsl"/>
> <map:serialize type="xml"/>
>
> Your query template should be filled up with informations abaout resource by the
> JXTemplateGenerator. CInclude Transformer will query the resource and include
> it. Of course this snip is needed when resource local copy of resource doesn't
> exist.
I had found this since the orinigal post....
> kdz> 2. I have a list of resources available. I want the user to be able to
> kdz> view them all on one page (all as in all for the day), or each
> kdz> individually. Ideally, I would store these resources in an xml file,
> kdz> and generate the list with xslt. But my sitemap also needs an entry for
> kdz> each of these. I tried to do this:
>
> You can access xml file from sitemap using input module XMLFileModule[4] but I'm
> not sure if it is necessary.
but not this. So yes, a tremendous help.
Now, i have one question about the source writer. As far as i can tell
this could be used for xml. Part of my application would be to parse
out and download images (no, not pr0n, thanks for caring though). I
don't assume there would be any way to use the source writer and an
input module? to do this?
thanks,
-kz
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: design questions/need ideas
Posted by "g[R]eK" <gR...@warsztat.pac.pl>.
<. Hi keith! .>
Tuesday, May 4, 2004, 11:49:56 PM, you wrote:
kdz> I have been starting to use cocoon for my personal web site, and I am
kdz> becoming quite fond of it... Congrats go out to all devs.
kdz> I have a few apps i'd like to build, and either I am too new to cocoon
kdz> to understand all that i should, or what I want to do is stupid. In any
kdz> case, here we go.
kdz> I would like to write an application to create a local cache of certain
kdz> websites i like to monitor. The flow of the application is that the
kdz> first time a user requests a certain resource, the server goes out and
kdz> queries the web for it. It uses xslt, etc, etc to transform the source,
kdz> and then stores it locally for future use. The locally stored copy is
kdz> then sent out to the users. The local copy is never updated once it is
kdz> successfully aquired one time.
kdz> So, with that in mind, the questions...
kdz> 1. Is the best way to do the download and save step to create an
kdz> action, and run this action conditionally in a resource-exists selector?
kdz> Is there a better way, or preferably one that I could do (being my
kdz> lazy self) without writing java/perl code, but just add stuff to the
kdz> sitemap?
There is simpler way than writing own action. We have SourceWriting Transformer
[1] ;-)
I think, sitemap snip will explain everything:
<map:generate type="jx" src="query_resource_template.xml"/> [2]
<map:transform type="cinclude"/> [3]
<map:transform type="xslt" src="your_xslt_transformations.xsl"/>
<map:transform type="write-source"/>
<map:transform type="xslt" src="other_transformations.xsl"/>
<map:serialize type="xml"/>
Your query template should be filled up with informations abaout resource by the
JXTemplateGenerator. CInclude Transformer will query the resource and include
it. Of course this snip is needed when resource local copy of resource doesn't
exist.
kdz> 2. I have a list of resources available. I want the user to be able to
kdz> view them all on one page (all as in all for the day), or each
kdz> individually. Ideally, I would store these resources in an xml file,
kdz> and generate the list with xslt. But my sitemap also needs an entry for
kdz> each of these. I tried to do this:
You can access xml file from sitemap using input module XMLFileModule[4] but I'm
not sure if it is necessary.
Links:
[1] http://cocoon.apache.org/2.1/userdocs/transformers/sourcewriting-transformer.html
[2] http://wiki.cocoondev.org/Wiki.jsp?page=JXTemplateGenerator
[3] http://cocoon.apache.org/2.1/userdocs/transformers/cinclude-transformer.html
[4] http://wiki.cocoondev.org/Wiki.jsp?page=InputModules
Hope this help. :-)
--
Best regards
<. g[R]eK mailto:gReK@warsztat.pac.pl .>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org