forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <cross...@apache.org>
Subject Re: Own type of documen transformed to document-v20
Date Mon, 15 May 2006 01:23:01 GMT
Ross Gardler wrote:
> Cameron McCormack wrote:
> >Gav:
> >
> >>Ok, will take another look, but initially I assumed you wanted to use 
> >>DTDs as you declared them in your code, this is why it is failing as 
> >>It can not find the specified DTD.
> >
> >Right, OK.  I just declared them because, from looking at the sample
> >sitemap.xmap file, I gathered that was the way you had to do it.
> 
> The sourcetype resolver can only work if you define the type of 
> document. To do this you have to use DTD's.

No that is not true. There are other ways.
See http://article.gmane.org/gmane.text.xml.forrest.user/3540
which refers to http://forrest.apache.org/docs/dev/cap.html
One does not need a DTD to use the SourceTypeAction, for example
can use a namespace instead.

> You could work without DTD's but you would have to place your home grown 
> files in a specific directory so that you can match on location rather 
> than type.
> 
> If you did this you would have to turn validation off (see 
> forrest.properties)
> 
> see below for more...
> 
> >OK, forget I mentioned DTDs. :-)
> >
> >There must be some way I can tell Cocoon/Forrest, via the sitemap.xmap
> >file, that when a file called status.xml is requested, it should be
> >passed transformed with a particular XSLT file into a document-v20
> >document, and from there, converted into either HTML or PDF, as would
> >normally be done.  Cocoon is quite complicated, though, and I haven't
> >yet got my head around it.  (Nor do I quite understand the relationship
> >between Forrest and Cocoon...)
> 
> (you don't mention which version of Forrest you are working with, the 
> below is 0.7, in 0.8-dev this will still work but you should realy use 
> the locationmap to resolve source locations).
> 
> <map:match pattern ="path/to/my/files/**.xml">
>   <map:generate src="{project:content.xdocs}/path/to/my/sources/{{1}.xml"/>
>   <map:transform src="myFormat-to-document.xsl"/>
>   <map:serialize type="xml"/>
> </map:match>
> 
> Gavin points to some examples in forrest, but these all use the 
> sourceresolver, and requrie a DTD.

Not necessarily, see above.

> I really would recomend using a DTD it makes things much more flexible 
> and will prevent time hunting errors in your source files. But the 
> choice is yorus.

I agree with that. But one does not need to use DTDs.
Use a specific namespace on the source documents, as above,
then use a RELAX NG grammar to do validation. That can
be done as a separate task outside of Forrest.
Alternatively Forrest provides Jing, so one could have
an Ant task to do RNG validation. Alternatively Forrest
provides validation pipelines with the Cocoon Validation
block in Forrest-0.8-dev. See http://forrest.apache.org/docs/dev/changes.html
and search for "validation".

-David

Mime
View raw message