cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Blake <>
Subject <import> issue... maybe
Date Mon, 26 Aug 2002 07:06:23 GMT
Hi everyone,

I apologise for the code - I've tried to keep it brief. This is an 
import misunderstanding I think.

To start with I have one xsp document (WebPage.xsp) and one stylesheet 
(StandardPage.xsl). It transforms just as expected - no problems there.

Then a second stylesheet named BluePage.xsl imports StandardPage.xsl. It 
overrides only one template - match="/*" mode="pageBody"

However, when WebPage.xsp is transformed using BluePage.xsl then 
transformation is less than expected... The result is below.

Here is the code. Comments follow.

WebPage.xsp is a basic xsp page.
<xsp:page language="java"
         <title>This is the title</title>
         <subject>This unrealness of things</subject>
         <introduction>Things can be unreal. This is an example of 
         <p>Nuff said.</p>

StandardPage.xsl is a standard stylesheet
<xsl:stylesheet xmlns:xsl="">
	<!-- Root Match -->
     <xsl:template match="/">
         <xsl:apply-templates select="/" mode="page"/>

     <!-- Root match in page mode -->
     <xsl:template match="/" mode="page">
                      <xsl:value-of select="title"/>
             <xsl:apply-templates select="*" mode="pageBody"/>

     <xsl:template match="/*" mode="pageBody">
         <body bgcolor="#ffffff">

     <xsl:template match="subject">
             <h4><xsl:value-of select="."/></h4>

     <xsl:template match="introduction">
             <p><xsl:value-of select="."/></p>

BluePage.xsl imports StandardPage.xsl
<xsl:stylesheet xmlns:xsl=""

     <xsl:import href="StandardPage.xsl"/>

     <xsl:template match="/*" mode="pageBody">
         <body bgcolor="#0000ff">

When WebPage.xsp is transformed using StandardPage.xsl I get (as 
		<title>This is the title</title>
	<body bgcolor="#ffffff">
		<h4>This unrealness of things</h4>
		<p>Things can be unreal. This is an example of that.</p>
		<p>The paragraph</p>

However when I transform WebPage.xsp using BluePage.xsl I get

         This is the title
         This unrealness of things
         Things can be unreal. This is an example of that.
         The paragraph

is all it's glory. What happened? It appears that the imported templates 
are not matched.

My expectation was that I would get output identical to the StandardPage 
transformation except with the #0000ff bgcolor. Can anyone see what I 
have done wrong or what I've misunderstood?

Thanks for your time,


Please check that your question  has not already been answered in the
FAQ before posting.     <>

To unsubscribe, e-mail:     <>
For additional commands, e-mail:   <>

View raw message