Have you looked into Selectors? Here is
what you can do with the default sitemap setup:
<map:match pattern="*">
<map:generate type="serverpages"
src=""pages/{1}.xml"/>
<map:select>
<map:when
test="wap">
<map:transform
src=""pages/common2wap.xsl"/>
<map:serialize type="wml" />
</map:when>
<map:otherwise>
<map:transform src=""pages/common.xsl"/>
<map:serialize
type="xml"/>
</map:otherwise>
</map:match>
What you found on O'Reilly's site is what Cocoon used to
use in 1.x. However, when you place such a declaration in your file you violate
one of the contracts defined in Cocoon: separation of presentation from content
from site management.
-----Original Message-----
From: Sergei Severin
[mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002
2:54 PM
To: [EMAIL PROTECTED]
Subject: Cocoon and Nokia Toolkit
Hello,
My question is on configuring Cocoon to work with Nokia WAP Toolkit. I am
trying to build and return a page based on the type of the device that sends a
request. According to the documentation that I found on Cocoon site, this
functionality has been tested with Nokia WAP Toolkit so I decided to give
it a try.
In my sitemap configuration I have the following entry in the pipeline:
<map:match pattern="*">
<map:generate type="serverpages"
src=""pages/{1}.xml"/>
<map:transform src=""pages/common.xsl"/>
<map:serialize />
</map:match>
I have also created a new XSL file, common2wap.xsl, that formats
the content accroding to WAP spec. What do I need to do in order to
force Cocoon to use common2wap.xsl instead of common.xsl whenever I
hit the page from Nokia simulator? So far, the only site that I found to
provide the answer to this is O'Reilly OnJava.com (http://www.onjava.com/pub/a/onjava/excerpt/java_xml_ch9/?page=5)
Example 9-4 on this page suggests that I need to put
<?xml-stylesheet href=""pages\common2wap.xsl""
type="text/xsl" media="explorer"?>
in my XML file in order to use the stylesheet appropriate for WAP. I've tried
that but it did not work. The output is still built according to common.xsl. Is
there a better way of doing this or am I missing something here?
Thank you,
Sergei Severin