cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conny Krappatsch <co...@smb-tec.com>
Subject Re: [C2] Multiple Stylesheets/Transformations in Sitemap
Date Tue, 15 May 2001 08:01:09 GMT
On Monday 14 May 2001 17:52, andrew oliver wrote:
> Hello,
>
> This is my first post to the list. I've just started looking at Cocoon2
> (with JDK1.3, Tomcat 4.0b5, Windows 98, IE5.5) and am stuggling with trying
> to set up a multiple transformation in the sitemap. This is part of my
> sitemap:
>
>    <map:match pattern="docs/test.xml">
>      <map:generate  src="docs/page_layout.xml"/>
>      <map:transform src="stylesheets/page_header_to_html.xsl"/>
>      <map:transform src="stylesheets/page_footer_to_html.xsl"/>
>      <map:serialize type="html"/>
>    </map:match>
>
> If I specify only one of the transforms then everything works ok, but when
> I specify them together (as above) I receive a blank page in the browser.
> I'm completely stuck and have tried various things in the XSL. Here's my
> two XSL files:
>
> page_header_to_html.xsl:
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 	<xsl:template match="text()|@*"/>
>
> 	<xsl:template match="head">
> 		the head
> 	</xsl:template>
> </xsl:stylesheet>
>
> page_footer_to_html.xsl:
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 	<xsl:template match="text()|@*"/>
>
> 	<xsl:template match="foot">
> 		the foot
> 	</xsl:template>
> </xsl:stylesheet>
>
> for completeness here's my page_layout.xml:
>
> <?xml version="1.0"?>
> <page>
> <head>head</head>
> <foot>foot</foot>
> </page>
>
>
> I've also checked the cocoon.log and no obvous errors are being generated.
> Any help would be greatly appreciated. Am I missing something obvious ?

Well, yes! ;-)

Your stylesheets are applied one after another, i.e. page_header_to_html.xsl 
is applied to your XML file and produces something like:

     the head

page_footer_to_html.xsl is applied to this and produces:

[nothing]

Depending on you want to do you should either use one stylesheet or the first 
stylesheet has to copy everything it doesn't handle itself, e.g. with:

<xsl:template match="*">
    <xsl:copy-of select="."/>
</xsl:template>

(This is getting more and more an XSLT question. Hope I'm not getting too 
off-topic ;-)

regards,
Conny Krappatsch

BTW: It's strange that you don't get an error, althoug the XML after the 
first stylesheet does only contain a text node (no root element). This is not 
well formed XML. Any ideas on this?
-- 
______________________________________________________________________
Conny Krappatsch                              mailto:conny@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.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