You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marcello Granata <mg...@matrix.it> on 2000/01/31 15:39:31 UTC

xml, html and wml

Hi!
I have a simple problem:
I'd like to apply a different xsl to an xml document in orde to obtain html or wml output. Do oyu know if there is a particular syntax that tells cocooon to do this?
I'm looking at the example included with cocoon; it starts this way:

<?xml version="1.0"?>
<?xml-stylesheet href="portfolio.html.xsl" type="text/xsl"?>
<?xml-stylesheet href="portfolio.wml.xsl" type="text/xsl" media="wap"?>
<?cocoon-process type="xslt"?>

Cocoon uses always the first xsl. I tried with the following code: "....portfolio.xml?media=wap" with no result.

Anyone can help me?

thanks

° Marcello

Re: xml, html and wml

Posted by Ted <te...@gs2admin1.e-meet.com>.
Marcello,

1) Write a simple code to grab the User Agent header of your WAP browser
2) Check out the cocoon.properties file. Make sure that the User Agent
name is bound to a name, like "wap". If not, then add it to the
properties file, so that media="wap" will work.
3) Call the XML with the WAP browser.

Ted

> Marcello Granata wrote:
> 
> Hi!
> I have a simple problem:
> I'd like to apply a different xsl to an xml document in orde to obtain
> html or wml output. Do oyu know if there is a particular syntax that
> tells cocooon to do this?
> I'm looking at the example included with cocoon; it starts this way:
> 
> <?xml version="1.0"?>
> <?xml-stylesheet href="portfolio.html.xsl" type="text/xsl"?>
> <?xml-stylesheet href="portfolio.wml.xsl" type="text/xsl"
> media="wap"?>
> <?cocoon-process type="xslt"?>
> 
> Cocoon uses always the first xsl. I tried with the following code:
> "....portfolio.xml?media=wap" with no result.
> 
> Anyone can help me?
> 
> thanks
> 
> ° Marcello

Re: xml, html and wml

Posted by Stefano Mazzocchi <st...@apache.org>.
> Marcello Granata wrote:
> 
> Hi!
> I have a simple problem:
> I'd like to apply a different xsl to an xml document in orde to obtain
> html or wml output. Do oyu know if there is a particular syntax that
> tells cocooon to do this?

There is, see below.

> I'm looking at the example included with cocoon; it starts this way:
> 
> <?xml version="1.0"?>
> <?xml-stylesheet href="portfolio.html.xsl" type="text/xsl"?>
> <?xml-stylesheet href="portfolio.wml.xsl" type="text/xsl"
> media="wap"?>
> <?cocoon-process type="xslt"?>
> 
> Cocoon uses always the first xsl. I tried with the following code:
> "....portfolio.xml?media=wap" with no result.
> 
> Anyone can help me?

The above doesn't work. You should map a "media" label to a particular
user agent, then call cocoon with that user agent to trigger the new
media.

For example, if you put the following in your cocoon.properties

browser.4 = wap=my-user-agent

and call

  portfolio.xml?user-Agent=my-user-agent

that will trigger the "wap" media, exactly like the Nokia WAP toolkit
will trigger the wap media if the "Nokia-WAP-Toolkit" string is found as
User-Agent i your http headers.

by providing the user-agent as http query string, you overwrite that
operation.

This two way process is done to decouple the media string in your
stylesheets from the actual user agent to simplify management.

Stefano.