cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Blake <p...@sparkbc.com.au>
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"
     xmlns:xsp="http://apache.org/xsp"
     xmlns:psi="http://prescience.org/logicsheets/app/2.0">
     <psi:page>
         <title>This is the title</title>
         <subject>This unrealness of things</subject>
         <introduction>Things can be unreal. This is an example of 
that.</introduction>
         <p>Nuff said.</p>
     </psi:page>
</xsp:page>


StandardPage.xsl is a standard stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<!-- Root Match -->
     <xsl:template match="/">
         <xsl:apply-templates select="/" mode="page"/>
     </xsl:template>

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

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

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

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


BluePage.xsl imports StandardPage.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:psi="http://prescience.org/logicsheets/app/2.0"
     exclude-result-prefixes="psi"
     version="2.0">

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

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


When WebPage.xsp is transformed using StandardPage.xsl I get (as 
expected)
<html>
	<head>
		<title>This is the title</title>
	</head>
	<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>
	</body>
</html>


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,

Phil



---------------------------------------------------------------------
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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message