You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@forrest.apache.org by Johannes Schaefer <jo...@uidesign.de> on 2004/11/04 09:04:05 UTC

match DOCTYPE in project-sitemap

Hi!

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.

Thanks!
Johannes


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

-- 
User Interface Design GmbH * Teinacher Str. 38 * D-71634 Ludwigsburg
Fon +49 (0)7141 377 000 * Fax  +49 (0)7141 377 00-99
Geschäftsstelle: User Interface Design GmbH * Lehrer-Götz-Weg 11 * D-81825 München
www.uidesign.de

Buch "User Interface Tuning" von Joachim Machate & Michael Burmester 
www.user-interface-tuning.de

Attraktivität von interaktiven Produkten messen mit 
www.attrakdiff.de


Re: match DOCTYPE in project-sitemap

Posted by Johannes Schaefer <jo...@uidesign.de>.
No time to check it out right now,
but by end of next week I'll do.
Thanks!
js

Ross Gardler wrote:

> David Crossley wrote:
>
>> Oh double drat, i should have read right through
>> that thread. The final suggestion was exactly what
>> i had suggested to you. Please try it.
>
>
>
> :-))
>
>
> I used that technique in the simplified-docbook plugin on Nicola-Kens 
> advice, and can confirm it works!
>
> Ross
>
>


-- 
User Interface Design GmbH * Teinacher Str. 38 * D-71634 Ludwigsburg
Fon +49 (0)7141 377 000 * Fax  +49 (0)7141 377 00-99
Geschäftsstelle: User Interface Design GmbH * Lehrer-Götz-Weg 11 * D-81825 München
www.uidesign.de

Buch "User Interface Tuning" von Joachim Machate & Michael Burmester 
www.user-interface-tuning.de

Attraktivität von interaktiven Produkten messen mit 
www.attrakdiff.de


Re: match DOCTYPE in project-sitemap

Posted by Ross Gardler <rg...@apache.org>.
David Crossley wrote:
> Oh double drat, i should have read right through
> that thread. The final suggestion was exactly what
> i had suggested to you. Please try it.


:-))


I used that technique in the simplified-docbook plugin on Nicola-Kens 
advice, and can confirm it works!

Ross

Re: match DOCTYPE in project-sitemap

Posted by David Crossley <cr...@apache.org>.
Oh double drat, i should have read right through
that thread. The final suggestion was exactly what
i had suggested to you. Please try it.

-- 
David Crossley


Re: match DOCTYPE in project-sitemap

Posted by David Crossley <cr...@apache.org>.
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


Re: match DOCTYPE in project-sitemap

Posted by David Crossley <cr...@apache.org>.
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.

> [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

-- 
David Crossley