You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Robby Pelssers <ro...@ciber.nl> on 2008/06/24 14:43:43 UTC

question about how to reference a css file from within xslt (cocoon 2.2)

Hi all,

 

I can't seem to retrieve the css file (myDemo.css).  Anybody who could
give me a hint about what's wrong with my current configuration?

 

When I take a look at the generated html page, the source looks OK to
me.

 

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>Cocoon Demo by Ciber</title>
    <link type="text/css" href="resource/external/css/myDemo.css"
rel="stylesheet" />
  </head>
  <body>
    ....
 
But I do not see any css styling applied and when I try to take a look
at the css file (via firefox webdeveloper plugin) that should ship with
this page, it looks as if cocoon serves the transformed page-home.xml as
myDemo.css
 

 

 

My folder structure looks like:

 

* COB-INF

            * myDemo

                        * page

                                    * page-home.xml           

                        * xslt    

                                    * xml2xhtml.xslt

            * resource

                        *external

                                   * css

                                               * myDemo.css

 

 

Xml2html.xslt snippet:

 

  <xsl:template match="/">

    <html>

      <head>

        <title><xsl:value-of select="page/title/text()"/></title>

        <link rel="stylesheet" href="resource/external/css/myDemo.css"
type="text/css"/>

      </head>

      <body>

        <xsl:apply-templates/>

      </body>

    </html>

  </xsl:template>

 

 

 

Sitemap snippet:

-------------------------

 

<map:pipelines>

  <map:pipeline id="genericPages">

    <map:match pattern="page-home.xml"/>

    <map:generate src="myDemo/page/page-home.xml"/>

            <map:transform src="myDemo/xslt/xml2xhtml.xslt"/>

            <map:serialize type="xhtml"/>

  </map:pipeline>

   ....    

  <map:pipeline id="external-resource">

            <map:match pattern="resource/external/css/myDemo.css">

      <map:read src="resource/external/css/myDemo.css"/>

    </map:match>                      

    <map:match pattern="resource/external/**">

      <map:read src="resource/external/{1}"/>

    </map:match>

  </map:pipeline>  

   ...

</map:pipelines>

            

 

Cheers,

 

Robby Pelssers


Re: question about how to reference a css file from within xslt (cocoon 2.2)

Posted by Johannes Hoechstaedter <j....@memocomp.de>.
Hi Robby,

I bet you have to adjust the path:
try: ../resource/external/css/myDemo.css or anything.

Robby Pelssers schrieb:
>
> Hi all,
>
> I can’t seem to retrieve the css file (myDemo.css). Anybody who could 
> give me a hint about what’s wrong with my current configuration?
>
> When I take a look at the generated html page, the source looks OK to me.
>
> <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html>
>   <head>
>     <title>Cocoon Demo by Ciber</title>
>     <link type="text/css" href="resource/external/css/myDemo.css" rel="stylesheet" />
>   </head>
>   <body>
>     ....
>  
> But I do not see any css styling applied and when I try to take a look at the css file (via firefox webdeveloper plugin) that should ship with this page, it looks as if cocoon serves the transformed page-home.xml as myDemo.css
>  
>
> My folder structure looks like:
>
> * COB-INF
>
> * myDemo
>
> * page
>
> * page-home.xml
>
> * xslt
>
> * xml2xhtml.xslt
>
> * resource
>
> *external
>
> * css
>
> * myDemo.css
>
> Xml2html.xslt snippet:
>
> <xsl:template match="/">
>
> <html>
>
> <head>
>
> <title><xsl:value-of select="page/title/text()"/></title>
>
> <link rel="stylesheet" href="resource/external/css/myDemo.css" 
> type="text/css"/>
>
> </head>
>
> <body>
>
> <xsl:apply-templates/>
>
> </body>
>
> </html>
>
> </xsl:template>
>
> Sitemap snippet:
>
> -------------------------
>
> <map:pipelines>
>
> <map:pipeline id="genericPages">
>
> <map:match pattern="page-home.xml"/>
>
> <map:generate src="myDemo/page/page-home.xml"/>
>
> <map:transform src="myDemo/xslt/xml2xhtml.xslt"/>
>
> <map:serialize type="xhtml"/>
>
> </map:pipeline>
>
> ....
>
> <map:pipeline id="external-resource">
>
> <map:match pattern="resource/external/css/myDemo.css">
>
> <map:read src="resource/external/css/myDemo.css"/>
>
> </map:match>
>
> <map:match pattern="resource/external/**">
>
> <map:read src="resource/external/{1}"/>
>
> </map:match>
>
> </map:pipeline>
>
> ...
>
> </map:pipelines>
>
> Cheers,
>
> Robby Pelssers
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: question about how to reference a css file from within xslt (cocoon 2.2)

Posted by Johannes Hoechstaedter <j....@memocomp.de>.
I once had the similar problem.

See http://www.mail-archive.com/users@cocoon.apache.org/msg42286.html

Robby Pelssers schrieb:
>
> Hi Joachim,
>
> I would expect the pipeline below to match the request for the css 
> file. What is wrong with this assumption?
>
> <map:pipeline id="external-resource">
>
> <map:match pattern="resource/external/css/myDemo.css">
>
> <map:read src="resource/external/css/myDemo.css"/>
>
> </map:match>
>
> <map:match pattern="resource/external/**">
>
> <map:read src="resource/external/{1}"/>
>
> </map:match>
>
> </map:pipeline>
>
> ------------------------------------------------------------------------
>
> *From:* Jasha Joachimsthal [mailto:j.joachimsthal@onehippo.com]
> *Sent:* dinsdag 24 juni 2008 14:58
> *To:* users@cocoon.apache.org
> *Subject:* RE: question about how to reference a css file from within 
> xslt (cocoon 2.2)
>
> Hi Robby,
>
> You have to add a matcher in your sitemap to serve the CSS (with a 
> reader). If you request in your browser 
> resource/external/css/myDemo.css (relative from the URI of the page) 
> you probably get an error "No pipeline matches request".
>
> Regards,
>
> Jasha Joachimsthal
>
> www.onehippo.com <http://www.onehippo.com/>
> Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466
> San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA 
> 94952-3329 +1 (707) 773-4646
>
>     ------------------------------------------------------------------------
>
>     *From:* Robby Pelssers [mailto:robby.pelssers@ciber.nl]
>     *Sent:* dinsdag 24 juni 2008 14:44
>     *To:* users@cocoon.apache.org
>     *Subject:* question about how to reference a css file from within
>     xslt (cocoon 2.2)
>
>     Hi all,
>
>     I can’t seem to retrieve the css file (myDemo.css). Anybody who
>     could give me a hint about what’s wrong with my current configuration?
>
>     When I take a look at the generated html page, the source looks OK
>     to me.
>
>     <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
>     <html>
>
>       <head>
>
>         <title>Cocoon Demo by Ciber</title>
>
>         <link type="text/css" href="resource/external/css/myDemo.css" rel="stylesheet" />
>
>       </head>
>
>       <body>
>
>         ....
>
>      
>
>     But I do not see any css styling applied and when I try to take a look at the css file (via firefox webdeveloper plugin) that should ship with this page, it looks as if cocoon serves the transformed page-home.xml as myDemo.css
>
>      
>
>     My folder structure looks like:
>
>     * COB-INF
>
>     * myDemo
>
>     * page
>
>     * page-home.xml
>
>     * xslt
>
>     * xml2xhtml.xslt
>
>     * resource
>
>     *external
>
>     * css
>
>     * myDemo.css
>
>     Xml2html.xslt snippet:
>
>     <xsl:template match="/">
>
>     <html>
>
>     <head>
>
>     <title><xsl:value-of select="page/title/text()"/></title>
>
>     <link rel="stylesheet" href="resource/external/css/myDemo.css"
>     type="text/css"/>
>
>     </head>
>
>     <body>
>
>     <xsl:apply-templates/>
>
>     </body>
>
>     </html>
>
>     </xsl:template>
>
>     Sitemap snippet:
>
>     -------------------------
>
>     <map:pipelines>
>
>     <map:pipeline id="genericPages">
>
>     <map:match pattern="page-home.xml"/>
>
>     <map:generate src="myDemo/page/page-home.xml"/>
>
>     <map:transform src="myDemo/xslt/xml2xhtml.xslt"/>
>
>     <map:serialize type="xhtml"/>
>
>     </map:pipeline>
>
>     ....
>
>     <map:pipeline id="external-resource">
>
>     <map:match pattern="resource/external/css/myDemo.css">
>
>     <map:read src="resource/external/css/myDemo.css"/>
>
>     </map:match>
>
>     <map:match pattern="resource/external/**">
>
>     <map:read src="resource/external/{1}"/>
>
>     </map:match>
>
>     </map:pipeline>
>
>     ...
>
>     </map:pipelines>
>
>     Cheers,
>
>     Robby Pelssers
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: question about how to reference a css file from within xslt (cocoon 2.2)

Posted by David Legg <da...@searchevent.co.uk>.
Jasha wrote:
> Your reference to the CSS is relative to the request URI of the page. 
> If the request URI for the page is /foo/bar/page.html your browser 
> will attempt to request the CSS on 
> /foo/bar/resource/external/css/myDemo.css. This may not be matched in 
> your sitemap.

That's right and of course if you use relative URLs in your CSS file (to 
include background images etc) they are relative to the CSS file and not 
the web page so your site map may have to cope with those too.


David Legg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: question about how to reference a css file from within xslt (cocoon 2.2)

Posted by Jasha Joachimsthal <j....@onehippo.com>.
Your reference to the CSS is relative to the request URI of the page. If
the request URI for the page is /foo/bar/page.html your browser will
attempt to request the CSS on /foo/bar/resource/external/css/myDemo.css.
This may not be matched in your sitemap.
 
Jasha


________________________________

	From: Robby Pelssers [mailto:robby.pelssers@ciber.nl] 
	Sent: dinsdag 24 juni 2008 15:07
	To: users@cocoon.apache.org
	Subject: RE: question about how to reference a css file from
within xslt (cocoon 2.2)
	
	

	Hi Joachim,

	 

	I would expect the pipeline below to match the request for the
css file. What is wrong with this assumption?

	 

	  <map:pipeline id="external-resource">

	            <map:match
pattern="resource/external/css/myDemo.css">

	      <map:read src="resource/external/css/myDemo.css"/>

	    </map:match>                      

	    <map:match pattern="resource/external/**">

	      <map:read src="resource/external/{1}"/>

	    </map:match>

	  </map:pipeline>  

	 

	 

	
________________________________


	From: Jasha Joachimsthal [mailto:j.joachimsthal@onehippo.com] 
	Sent: dinsdag 24 juni 2008 14:58
	To: users@cocoon.apache.org
	Subject: RE: question about how to reference a css file from
within xslt (cocoon 2.2)

	 

	Hi Robby,

	 

	You have to add a matcher in your sitemap to serve the CSS (with
a reader). If you request in your browser
resource/external/css/myDemo.css (relative from the URI of the page) you
probably get an error "No pipeline matches request".

	 

	Regards,

	 

	Jasha Joachimsthal 

	www.onehippo.com <http://www.onehippo.com/> 
	Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam
+31(0)20-5224466 
	San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
94952-3329 +1 (707) 773-4646

		 

		
________________________________


		From: Robby Pelssers [mailto:robby.pelssers@ciber.nl] 
		Sent: dinsdag 24 juni 2008 14:44
		To: users@cocoon.apache.org
		Subject: question about how to reference a css file from
within xslt (cocoon 2.2)

		Hi all,

		 

		I can't seem to retrieve the css file (myDemo.css).
Anybody who could give me a hint about what's wrong with my current
configuration?

		 

		When I take a look at the generated html page, the
source looks OK to  me.

		 

		<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
		<html>
		  <head>
		    <title>Cocoon Demo by Ciber</title>
		    <link type="text/css"
href="resource/external/css/myDemo.css" rel="stylesheet" />
		  </head>
		  <body>
		    ....
		 
		But I do not see any css styling applied and when I try
to take a look at the css file (via firefox webdeveloper plugin) that
should ship with this page, it looks as if cocoon serves the transformed
page-home.xml as myDemo.css
		 

		 

		 

		My folder structure looks like:

		 

		* COB-INF

		            * myDemo

		                        * page

		                                    * page-home.xml


		                        * xslt    

		                                    * xml2xhtml.xslt

		            * resource

		                        *external

		                                   * css

		                                               *
myDemo.css

		 

		 

		Xml2html.xslt snippet:

		 

		  <xsl:template match="/">

		    <html>

		      <head>

		        <title><xsl:value-of
select="page/title/text()"/></title>

		        <link rel="stylesheet"
href="resource/external/css/myDemo.css" type="text/css"/>

		      </head>

		      <body>

		        <xsl:apply-templates/>

		      </body>

		    </html>

		  </xsl:template>

		 

		 

		 

		Sitemap snippet:

		-------------------------

		 

		<map:pipelines>

		  <map:pipeline id="genericPages">

		    <map:match pattern="page-home.xml"/>

		    <map:generate src="myDemo/page/page-home.xml"/>

		            <map:transform
src="myDemo/xslt/xml2xhtml.xslt"/>

		            <map:serialize type="xhtml"/>

		  </map:pipeline>

		   ....    

		  <map:pipeline id="external-resource">

		            <map:match
pattern="resource/external/css/myDemo.css">

		      <map:read src="resource/external/css/myDemo.css"/>

		    </map:match>                      

		    <map:match pattern="resource/external/**">

		      <map:read src="resource/external/{1}"/>

		    </map:match>

		  </map:pipeline>  

		   ...

		</map:pipelines>

		            

		 

		Cheers,

		 

		Robby Pelssers


RE: question about how to reference a css file from within xslt (cocoon 2.2)

Posted by Robby Pelssers <ro...@ciber.nl>.
Hi Joachim,

 

I would expect the pipeline below to match the request for the css file.
What is wrong with this assumption?

 

  <map:pipeline id="external-resource">

            <map:match pattern="resource/external/css/myDemo.css">

      <map:read src="resource/external/css/myDemo.css"/>

    </map:match>                      

    <map:match pattern="resource/external/**">

      <map:read src="resource/external/{1}"/>

    </map:match>

  </map:pipeline>  

 

 

________________________________

From: Jasha Joachimsthal [mailto:j.joachimsthal@onehippo.com] 
Sent: dinsdag 24 juni 2008 14:58
To: users@cocoon.apache.org
Subject: RE: question about how to reference a css file from within xslt
(cocoon 2.2)

 

Hi Robby,

 

You have to add a matcher in your sitemap to serve the CSS (with a
reader). If you request in your browser resource/external/css/myDemo.css
(relative from the URI of the page) you probably get an error "No
pipeline matches request".

 

Regards,

 

Jasha Joachimsthal 

www.onehippo.com <http://www.onehippo.com/> 
Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 
San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
94952-3329 +1 (707) 773-4646

	 

	
________________________________


	From: Robby Pelssers [mailto:robby.pelssers@ciber.nl] 
	Sent: dinsdag 24 juni 2008 14:44
	To: users@cocoon.apache.org
	Subject: question about how to reference a css file from within
xslt (cocoon 2.2)

	Hi all,

	 

	I can't seem to retrieve the css file (myDemo.css).  Anybody who
could give me a hint about what's wrong with my current configuration?

	 

	When I take a look at the generated html page, the source looks
OK to  me.

	 

	<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<html>
	  <head>
	    <title>Cocoon Demo by Ciber</title>
	    <link type="text/css"
href="resource/external/css/myDemo.css" rel="stylesheet" />
	  </head>
	  <body>
	    ....
	 
	But I do not see any css styling applied and when I try to take
a look at the css file (via firefox webdeveloper plugin) that should
ship with this page, it looks as if cocoon serves the transformed
page-home.xml as myDemo.css
	 

	 

	 

	My folder structure looks like:

	 

	* COB-INF

	            * myDemo

	                        * page

	                                    * page-home.xml           

	                        * xslt    

	                                    * xml2xhtml.xslt

	            * resource

	                        *external

	                                   * css

	                                               * myDemo.css

	 

	 

	Xml2html.xslt snippet:

	 

	  <xsl:template match="/">

	    <html>

	      <head>

	        <title><xsl:value-of
select="page/title/text()"/></title>

	        <link rel="stylesheet"
href="resource/external/css/myDemo.css" type="text/css"/>

	      </head>

	      <body>

	        <xsl:apply-templates/>

	      </body>

	    </html>

	  </xsl:template>

	 

	 

	 

	Sitemap snippet:

	-------------------------

	 

	<map:pipelines>

	  <map:pipeline id="genericPages">

	    <map:match pattern="page-home.xml"/>

	    <map:generate src="myDemo/page/page-home.xml"/>

	            <map:transform src="myDemo/xslt/xml2xhtml.xslt"/>

	            <map:serialize type="xhtml"/>

	  </map:pipeline>

	   ....    

	  <map:pipeline id="external-resource">

	            <map:match
pattern="resource/external/css/myDemo.css">

	      <map:read src="resource/external/css/myDemo.css"/>

	    </map:match>                      

	    <map:match pattern="resource/external/**">

	      <map:read src="resource/external/{1}"/>

	    </map:match>

	  </map:pipeline>  

	   ...

	</map:pipelines>

	            

	 

	Cheers,

	 

	Robby Pelssers


RE: question about how to reference a css file from within xslt (cocoon 2.2)

Posted by Jasha Joachimsthal <j....@onehippo.com>.
Hi Robby,
 
You have to add a matcher in your sitemap to serve the CSS (with a
reader). If you request in your browser resource/external/css/myDemo.css
(relative from the URI of the page) you probably get an error "No
pipeline matches request".
 
Regards,
 
Jasha Joachimsthal 

www.onehippo.com <http://www.onehippo.com/> 
Amsterdam - Hippo B.V. Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 
San Francisco - Hippo USA Inc. 101 H Street, suite Q Petaluma CA
94952-3329 +1 (707) 773-4646


________________________________

	From: Robby Pelssers [mailto:robby.pelssers@ciber.nl] 
	Sent: dinsdag 24 juni 2008 14:44
	To: users@cocoon.apache.org
	Subject: question about how to reference a css file from within
xslt (cocoon 2.2)
	
	

	Hi all,

	 

	I can't seem to retrieve the css file (myDemo.css).  Anybody who
could give me a hint about what's wrong with my current configuration?

	 

	When I take a look at the generated html page, the source looks
OK to  me.

	 

	<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
	<html>
	  <head>
	    <title>Cocoon Demo by Ciber</title>
	    <link type="text/css"
href="resource/external/css/myDemo.css" rel="stylesheet" />
	  </head>
	  <body>
	    ....
	 
	But I do not see any css styling applied and when I try to take
a look at the css file (via firefox webdeveloper plugin) that should
ship with this page, it looks as if cocoon serves the transformed
page-home.xml as myDemo.css
	 

	 

	 

	My folder structure looks like:

	 

	* COB-INF

	            * myDemo

	                        * page

	                                    * page-home.xml           

	                        * xslt    

	                                    * xml2xhtml.xslt

	            * resource

	                        *external

	                                   * css

	                                               * myDemo.css

	 

	 

	Xml2html.xslt snippet:

	 

	  <xsl:template match="/">

	    <html>

	      <head>

	        <title><xsl:value-of
select="page/title/text()"/></title>

	        <link rel="stylesheet"
href="resource/external/css/myDemo.css" type="text/css"/>

	      </head>

	      <body>

	        <xsl:apply-templates/>

	      </body>

	    </html>

	  </xsl:template>

	 

	 

	 

	Sitemap snippet:

	-------------------------

	 

	<map:pipelines>

	  <map:pipeline id="genericPages">

	    <map:match pattern="page-home.xml"/>

	    <map:generate src="myDemo/page/page-home.xml"/>

	            <map:transform src="myDemo/xslt/xml2xhtml.xslt"/>

	            <map:serialize type="xhtml"/>

	  </map:pipeline>

	   ....    

	  <map:pipeline id="external-resource">

	            <map:match
pattern="resource/external/css/myDemo.css">

	      <map:read src="resource/external/css/myDemo.css"/>

	    </map:match>                      

	    <map:match pattern="resource/external/**">

	      <map:read src="resource/external/{1}"/>

	    </map:match>

	  </map:pipeline>  

	   ...

	</map:pipelines>

	            

	 

	Cheers,

	 

	Robby Pelssers