cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonas Lundberg <my.name.is.h...@gmail.com>
Subject Re: Using the output of a pipeline to call another pipeline?
Date Tue, 27 Sep 2005 15:54:02 GMT
Thanks for the replies, I'll explain in more detail then.

The images are referenced in an HTML page, which means that the
browser will request them separately after the page is sent. Do you
propose that I somehow embed the image data in the page?

All paths in the system are virtual. I use XML files to create virtual
hierarchies, that gives depth and structure to a site. That means that
the same contents can be rendered using several different site
layouts, at the same time.

Therefore, all images are stored in one big collection in the eXist
database. To avoid that any two images get the same file name, each
file is renamed when uploaded, and given a unique name (a number). The
actual name, and the virtual path where it is to be shown, is stored
in the meta data file.

In the html page generation pipeline, I could put the new file name
directly in the html page, but that would violate the separation
between storage and presentation. The author of the document should
decide what file name to present to the user, not the system. A strict
separation between storage and presentation is a main point with my
system.

Also, if I execute an xquery to provide the file name, then I can at
the same time check whether the metadata file states that the file is
"live" or "waiting". It should not be possible to retreive an image
before it is published. And when I am doing that, I can also check
whether the particular user requesting the file should be allowed to
see it. If the user is not allowed to see the image, or if it is not
there, I can simply send a different image.

So, when the xquery has created an xml file with the image:
<file>
44500.jpg
</file>
Then I cannot send a HTML file with an <img src...> because the
browser has requested the actual image file. Also, if I do that, then
I have to check the user premissions, and the live-status of the image
again, when the browser requests the actual image.

If I instead simply cinclude the image then I will get
<file>
image data
</file>
That would be an image embedded in XML, which is not what I want.

So, what I want to do is very basic:

First, I want to generate the internal file name using xQuery, given
the virtual path and the virtual file name. At the same time I check
whether the image is live ,and whether the particular user should be
allowed to view it.
Then, I want to call a different (internal) pipeline using the
resulting file name (embedded in the <file></file> tag) (for instance
44400.jpg) as the request, and return the result of that pipeline.

Any ideas now of how I can achieve that?

Hans








On 9/27/05, Derek Hohls <dhohls@csir.co.za> wrote:
>
> Its not clear what you mean by the "second pipeline" - do
> you mean the **.jpg ?  If so, can you not simply call that
> from the page where it needs to appear?  (And the page
> itself is generated using the output from the first pipeline;
> cinclude or simply a map:aggregate will feed the XML into your
> page prior to a final transform.)
>
> If you need more help, you may have to lay out your problem
> a little more clearly.
>
> >>> my.name.is.hans@gmail.com 2005/09/27 11:40:16 AM >>>
>
> I've got a very basic question that I got stuck with.... maybe someone
> can help me out?
>
> I have a web publishing system that stores all images in eXist, using
> a number as the file name, e.g. 44500.jpg
>
> Each image has a metadata file, describing at what URL the image
> should be shown (and also some other things, not shown here), e.g.
> <metadata>
> <live><at>webdesign/cocoon</at></live>
> <filename>banner.jpg</filename>
> </metadata>
>
> In the html files, the url to the file points at its virutal location,
> and virtual name, e.g. webdesign/cocoon/banner.jpg
> Thus, I could write a cocoon sitemap matcher like this:
>
> <map:match pattern="*/*/*.jpg>
> <map:generate src="xq/{1}.xq" type="xquery">
> <map:parameter name="file" value="{1}/{2}/{3}"/>
> </map:generate>
> ? How to call the second pipeline with the result of the query?
> </map:match>
>
> The xquery generates the file name to use in the second pipeline, like this
> <file>
> 44500.jpg
> </file>
>
> The image is then to be fetched from eXist using this pipeline:
> <map:match pattern="*.jpg">
> <map:read type="image"
>
> src="http://guest:guest@localhost:8080/cocoon/webdav/db/contents/jpeg/{1}.jpg"
> "
> mime-type="text/jpg "/>
> </map:match>
>
> But how do I call the second pipeline, using the file name created by
> the generator in the first pipeline? This is a very basic question,
> but I got stuck with it anyway... Any ideas?
>
> Hans
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
> --
> This message is subject to the CSIR's copyright, terms and conditions and
> e-mail legal notice.
> Views expressed herein do not necessarily represent the views of the CSIR.
>
> CSIR E-mail Legal Notice
>
> CSIR Copyright, Terms and Conditions
>
> For electronic copies of the CSIR Copyright, Terms and Conditions and the
> CSIR Legal Notice
> send a blank message with "REQUEST LEGAL" in the subject line to CSIR
> HelpDesk
>
>
> This message has been scanned for viruses and dangerous content by
> MailScanner,
> and is believed to be clean. MailScanner thanks Transtec Computers for their
> support.

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


Mime
View raw message