cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Piroumian" <kpiroum...@apache.org>
Subject Fw: Serving static XML files a la Cocoon-1
Date Thu, 25 Apr 2002 16:01:37 GMT
Seems that you didn't get my message. Trying again...

 From: "C├ędric Damioli" <cedric.damioli@anyware-tech.com>
 > Peter Flynn wrote:
 ...
 > >
 > >Don't get me wrong, I love the idea of Cocoon. It was just an error
 > >to distribute it without the previous default (Cocoon 1) already
 > >enabled, ie any XML files already on disk should be processed with
 > >their XSL[T] files and served up as HTML/PDF by default.
 > >
 > You don't understand the Cocoon2 concepts at all.

 It must be on the 75% the problem of Cocoon docs, but this question is
 definitely lightened in the rest 25% ;)

 > It is nonsense to serve XML files with "their" XSL files : the principle
 > is to separe data and presentation, ie XML source and XSL.

 Sometimes you need to use unique XSL file for several XML files, but this
is
 also solved by the sitemap in a varios ways, e.g.:

 <map:match pattern="*.xml">
     <map:generate src="{1}.xml/>
     <map:transform src="{1}.xsl"/>
     <map:serialize />
 </map:match>

 For a request like '/cocoon/page.xml' the following will be performed:
     'page.xml' file will be read, parsed into SAX events
     'page.xsl' will be read, then applied to the generated SAX event stream
     default (HTML) serializer will output the result as HTML

 This will work if you name your stylesheets as your xml files
 (my-page.xml -> my-page.xsl). There a lot more possibilities for doing
this,
 even generating a stylesheet on the fly or serving it from a database.

 --
 Konstantin

 > So you have to write a pipeline (or to copy/paste one from an existing
> > sitemap) to generate HTML stuff from XML by transforming it through XSL.
> >
> > The sample sitemap bundled with Cocoon offers these 'defaults' already.
> > Please read the docs and reffer to the samples. They will learn you
much.
> >
> > >
> > >>Something like
> > >>
> > >><map:match pattern=3D"rtfm/*.xml">
> > >>  <map:generate src=3D"somewhere/{1}.xml/>
> > >>
> > >
> > >But I don't want to *generate* any XML. I already have XML documents.
> > >
> > Yes, you want !!!!
> > In Cocoon2 terminology, "generate" means  you generate SAX events from a
> > source. In your case, the source is an XML document. So you have to use
:
> > <map:generate src="XXX.xml"/>
> >
> > >
> > >
> > >>  <map:transform src=3D"xslt-stuff/transform.xsl"/>
> > >>  <map:serialize type=3D"xml"/>
> > >></map:match>
> > >>
> > >
> > >///Peter
> > >
> > >---------------------------------------------------------------------
> > >Please check that your question has not already been answered in the
> > >FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> > >
> > >To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> > >For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> >
> > To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
> > For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
> >
>

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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


Mime
View raw message