You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Phil Blake <ph...@sparkbc.com.au> on 2002/08/26 09:06:23 UTC
issue... maybe
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: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: issue... maybe
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Phil Blake wrote:
...
> Then a second stylesheet named BluePage.xsl imports StandardPage.xsl. It
> overrides only one template - match="/*" mode="pageBody"
There are a few more differences, namely
> xmlns:psi="http://prescience.org/logicsheets/app/2.0"
and, most odd:
> version="2.0">
This means the processor should use XSLT v 2.0, which
is probably something the processor does not like.
It's somewhat strage that you get the typical result
of default templates kicking in (all text copied, tags
stripped), instead of an error.
Your StandardPage.xsl is a bit strange too,
no XSL version on the document element, which is usually
a fatal error, and:
> <xsl:template match="/" mode="page">
...
> <xsl:value-of select="title"/>
I'm surprised you get a title.
What processor are you using? Xalan? Which release?
Try to change version="1.0" in your blue style sheet,
this could be enough to fix the problem.
J.Pietschman
---------------------------------------------------------------------
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>