You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andreas Vallen <va...@gmx.net> on 2002/05/13 17:55:13 UTC

no way to get content-type?

Hello cocoon-users,

Is there really no way to determine the content type of a resource 
requested with a generator? 
I've spent some time since my last mail looking at the sources and it seems 
as if cocoon in its current form can't handle this seemingly simple task.

Am I overlooking something?

Look at the following sitemap fragment for an example of what I want to 
achieve:

<!-- get any resource, the exact content-type is unknown at "compile-time" -->
<map:generate src="**" type="file" />

     <!-- select transformation according to content-type -->
     <map:select type="contentType">

            <map:when test="text/wml">
              <map:transform src="wml2xhtml.xsl"/>
              <map:serialize type="xhtml" />
            </map:when>

            <map:when test="text/chtml">
              <map:transform src="chtml2xhtml.xsl"/>
              <map:serialize type="xhtml" />
            </map:when>

            <map:otherwise>
              <map:transform src="hdml2xhtml.xsl"/>
              <map:serialize type="xhtml" />
            </map:otherwise>

       </map:select>

I would hope that something along this way is easily implementable. 
To me it seems though as if I would have to dig deep into cocoon's
classes ( URLSource.java came to my mind ) - something I'd like to 
avoid.

thanks,
Andreas Vallen

---------------------------------------------------------------------
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>