You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lionel Crine <cr...@4dconcept.fr> on 2003/02/10 13:42:35 UTC

Call a css into an xsl

I'd like to generate an html document using a css file, with an xsl 
transformation.

Here is what i wrote :


<xsl:template match="content">
  <html>
  <head>
  </head>
  <link rel="stylesheet" type="text/css" href="style.css"/>
    <body>
    <h1 align="center">DEMO</h1>
       <xsl:apply-templates/>
    </body>
  </html>
</xsl:template>
...

I think this is not the way to use css with cocoon?
I read about a resource tag but I don't figure out how to join my documents.



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Call a css into an xsl

Posted by Lionel Crine <cr...@4dconcept.fr>.
I did, my mistake.

At 14:09 10/02/2003 +0100, you wrote:
>Lionel Crine wrote:
>><xsl:template match="content">
>>  <html>
>>  <head>
>>  </head>
>>  <link rel="stylesheet" type="text/css" href="style.css"/>
>
>I assume this was just a typo, but you need to put the <link> element 
>inside the <head> element, not outside.
>
>         Ugo
>
>--
>Ugo Cei - http://www.beblogging.com/blog/
>
>
>---------------------------------------------------------------------
>Please check that your question  has not already been answered in the
>FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
>To unsubscribe, e-mail:     <co...@xml.apache.org>
>For additional commands, e-mail:   <co...@xml.apache.org>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Call a css into an xsl

Posted by Ugo Cei <u....@cbim.it>.
Lionel Crine wrote:
> <xsl:template match="content">
>  <html>
>  <head>
>  </head>
>  <link rel="stylesheet" type="text/css" href="style.css"/>

I assume this was just a typo, but you need to put the <link> element 
inside the <head> element, not outside.

	Ugo

-- 
Ugo Cei - http://www.beblogging.com/blog/


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Call a css into an xsl

Posted by "Emmanuil Batsis (Manos)" <mb...@humanmarkup.org>.
When the result of the transformation goes to the browser, the latter 
will make a new request for the resource "style.css".

You can handle that request as any other with a matcher (for *.css). You 
need a reader for css files, not the generator>transformer>serializer 
usual. Try something like the following in your sitemap:

<map:match pattern="style.css">
    <map:read mime-type="text/css" src="path/to/style.css"/>
</map:match>


Usefull tips on that and other things are on the wiki.

hth,

Manos

Lionel Crine wrote:
> I'd like to generate an html document using a css file, with an xsl 
> transformation.
> 
> Here is what i wrote :
> 
> 
> <xsl:template match="content">
>  <html>
>  <head>
>  </head>
>  <link rel="stylesheet" type="text/css" href="style.css"/>
>    <body>
>    <h1 align="center">DEMO</h1>
>       <xsl:apply-templates/>
>    </body>
>  </html>
> </xsl:template>
> ....
> 
> I think this is not the way to use css with cocoon?
> I read about a resource tag but I don't figure out how to join my 
> documents.
> 
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
> 
> 
> 
> 


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Call a css into an xsl

Posted by Upayavira <uv...@upaya.co.uk>.
Lionel,

> I'd like to generate an html document using a css file, with an xsl 
> transformation.

What you suggest is the correct way to do it. What you need though is a little bit of 
code in your sitemap to tell Cocoon how to handle requests for CSS files. This 
would do it:

   <map:match pattern="*.css">
    <map:read src="html/{1}.css" mime-type="text/css"/>
   </map:match>

What this is saying is 'for any file ending in .css, pass the equivalent file from the 
html directory. The fact that you are using a reader means that you will pass the 
content out unprocessed, i.e. not going through an XML pipeline.

Hope that helps.

Regards, Upayavira
> 
> Here is what i wrote :
> 
> 
> <xsl:template match="content">
>   <html>
>   <head>
>   </head>
>   <link rel="stylesheet" type="text/css" href="style.css"/>
>     <body>
>     <h1 align="center">DEMO</h1>
>        <xsl:apply-templates/>
>     </body>
>   </html>
> </xsl:template>
> ...
> 
> I think this is not the way to use css with cocoon?
> I read about a resource tag but I don't figure out how to join my documents.


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>