forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <cross...@apache.org>
Subject Re: match DOCTYPE in project-sitemap
Date Thu, 04 Nov 2004 09:27:28 GMT
David Crossley wrote:
> Johannes Schaefer wrote:
> > 
> > Adding a new content type works fine as long as I can
> > match by filename (see [1]):
> > 
> >   <map:pipeline>
> >    <map:match pattern="**download.xml">
> >      <map:generate src="{project:content.xdocs}{1}download.xml" />
> >      <map:transform src="{project:resources.stylesheets}/download2document.xsl"
/>
> >      <map:serialize type="xml"/>
> >    </map:match>
> >   </map:pipeline>
> > 
> > How can I do the same thing for all my XML-files that
> > refer to a specific DOCTYPE? Any other XML-files should 
> > be processed normally by forrest.
> > Something like:
> > 
> >   <map:pipeline>
> >    <map:match pattern="**.xml" && DOCTYPE="myDocType.dtd">
> >      <map:generate src="{project:content.xdocs}{1}.xml" />
> >      <map:transform src="{project:resources.stylesheets}/myDocType2document.xsl"
/>     
> >      <map:serialize type="xml"/>
> >    </map:match>
> >   </map:pipeline>
> > 
> > Only thing I can think of right now is putting them
> > into a special directory and do a
> >    <map:match pattern="myDocTypeDocs/**.xml">
> > but there may be a better way.
> 
> You have not read far enough into the document [1]
> What you have shown above is the simple solution.
> Go on to the advanced solution at [2]
> 
> However your main question is still relevant.
> Try the following alteration to example shown at [2]
> (Big Disclaimer: not yet tested) ...
> 
> <map:match pattern="**.xml">
>  <map:generate src="{project:content.xdocs}{1}.xml"/>
>  <map:act type="sourcetype" src="{project:content.xdocs}{1}.xml">
>   <map:select type="parameter">
>    <map:parameter name="parameter-selector-test" value="{sourcetype}" />
>     <map:when test="download-v1.0">
>      <map:generate src="{project:content.xdocs}{1}.xml"/>
>      <map:transform
>         src="{project:resources.stylesheets}/download2document.xsl" />
>      <map:serialize type="xml"/>
>     </map:when>
>    </map:select>
>   </map:act>
> </map:match>
>
> If that match is not triggered then it would
> pass-through to forrest main processing.

Oh drat, i spoke to soon on that. There is a thread
right now on the dev list (Re [RT] plugin infrastructure)
which suggested trying that for another situation.
However the advice is that the map:generate needs to
happen before the sourcetype action, and once Cocoon
generates a file, then that pipeline is the last to
be executed. Therefore it would never pass-through
to the main forrest sitemaps.

Perhaps one of those dev smartypants can come up
with a clever solution.

--David

> > [1] 
> > http://forrest.apache.org/docs/your-project.html#adding_new_content_type
> 
> [2]
> http://forrest.apache.org/docs/your-project.html#adding_new_content_type_2


Mime
View raw message