forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject Re: XSL transformation as part of the page content?
Date Mon, 13 Feb 2006 09:33:51 GMT
El lun, 13-02-2006 a las 01:27 -0800, Victor Okunev escribió:
> I guess this approach won't work if the transformation produces raw
> html, which is not to be interpreted by Forrest. E.g. the result of my
> transformation is not an HTML table but rather a <div>-based layout.
> However, according to http://forrest.apache.org/dtd/document-v20.dtd,
> these tags are not allowed in <body> element.
> 
> I think a situation like this one is very typical: someone has a
> legacy html that does not necessarily validates against Forrest DTD,
> but it needs to be embedded to the page.

...and this is why we developing the dispatcher (new feature in 0.8-dev)
which solves this problem. ;-)

salu2

> -- Victor
> 
> On 2/12/06, David Crossley <crossley@apache.org> wrote:
> > Victor Okunev wrote:
> > > Hi All,
> > >
> > > I have an XSLT style sheet that I use to generate an HTML table. Is it
> > > possible with Forrest v0.7 to perform the transformation as part of
> > > the site build and include the results under a document's section?
> > > Here is a pseudo code that kind of illustrates what I am after:
> > >
> > > index.xml
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <!--
> > >   Copyright....
> > > -->
> > > <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN"
> > > "http://forrest.apache.org/dtd/document-v20.dtd">
> > > <document>
> > >   <header>
> > >     <title>Page Title</title>
> > >   </header>
> > >   <body>
> > >     <section id="sectionid">
> > >       <title>Section Title</title>
> > >       <transform src="data.xml" stylesheet="table.xsl"/>
> > >     </section>
> > >   </body>
> > > </document>
> >
> > Yes, the Cocoon sitemap enables this and more.
> > This is a good situation to explain the powers
> > of teh Cocoon sitemap.
> >
> > Remove that <transform ... from your source xml
> > and use the sitemap language to specify the extra
> > transformer to inject the table into the xml stream.
> >
> > http://forrest.apache.org/docs/project-sitemap.html
> >
> > I attached some example files to a new issue.
> > http://issues.apache.org/jira/browse/FOR-814
> > You can download and use them. Later we will create
> > a document from this explanation.
> >
> > The source file xdocs/one-announce.xml is the main
> > announcement text. Like yours above, but without
> > the <transform> pseudo-stuff and with another section.
> >
> > The data table will be inserted in the top of the
> > first section.
> >
> > Here is the data file xdocs/one-data.xml
> > <data>
> >  <item>Foo</item>
> > </data>
> >
> > Here is the relevant section of the sitemap ...
> >
> >  <map:pipelines>
> >   <map:pipeline>
> >    <map:match pattern="**-announce.xml">
> >     <map:aggregate element="announce-and-data">
> >       <map:part src="{project:content.xdocs}{1}-announce.xml"/>
> >       <map:part src="{project:content.xdocs}{1}-data.xml"/>
> >      </map:aggregate>
> >     <map:transform src="{project:resources.stylesheets}/add-table.xsl" />
> >     <map:serialize type="xml-document"/>
> >    </map:match>
> >   </map:pipeline>
> >  </map:pipelines>
> >
> > Browser request is localhost:8888/one-announce.html
> >
> > So that generates an aggregated xml stream like this ...
> > <announce-and-data>
> >  <document>
> >    ... the normal source xdoc, e.g. one-announce.xml
> >  </document>
> >  <data>
> >   <item>Foo</item>
> >  </data>
> > </announce-and-data>
> >
> > The add-table transformer then strips off the outer wrapper,
> > copies over the <document> content, deals with the first
> > <section> element and inserts the table by processing
> > the <data> element. It serialises as the "xml-document"
> > which is Forrest's internal format. Forrest takes over
> > and does the rest of the transforming and rendering.
> >
> > That is the general idea. There are probably other
> > ways to do it too.
> >
> > The new dispatcher will be even more versatile.
> >
> > -David
> >
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Mime
View raw message