Alexander Nofftz wrote:
Hi!
I want to do something like Apache Webserver's content negotiation using
MultiViews with Cocoon.
For example, I have documents like this:
doc.de.xml
doc.fr.xml
doc.xml (default language)
And want to do something like this:
<map:act type="locale">
<map:match pattern="doc">
try {
<map:generate src="doc.{../language}.xml"/>
} catch (FileNotFoundException e) {
<map:generate src="doc.xml"/>
}
<map:serialize/>
</map:match>
</map:act>
Is something like this possible?
Yep, using the resource-exists selector:
<map:match pattern="doc">
<map:select type="resource-exists">
<map:when test="doc.{../language}.xml"/>
<map:generate src="doc.{../language}.xml"/>
</map:when>
<map:otherwise>
<map:generate src="doc.xml"/>
</map:otherwise>
</map:select>
</map:match>
Sylvain
--
Sylvain Wallez Anyware Technologies
http://bluxte.net http://www.anyware-tech.com
Apache Software Foundation Member Research & Technology Director
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]