This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Applying a stylesheet to a stylesheet.
- To: xsl-list at mulberrytech dot com
- Subject: Applying a stylesheet to a stylesheet.
- From: Matt Watson <Matt dot Watson at rufusleonard dot co dot uk>
- Date: Tue, 25 Jul 2000 12:19:47 +0100
- Reply-To: xsl-list at mulberrytech dot com
Hi,
I'm still trying to evaluate coocon (1.7.4) for a client. So the problem I
have is
just a simple test that I have composed.
I want to transform an xml file - a.xml - by applying multiple stylesheets
one after the other.
ie. b.xsl and then c.xsl
to produce the final output of
<html>
<head>
</head>
<body>
This is the value of D = 123
</body>
</html>
Here are my three files:-
a.xml
------------------------------------------------------------
<?xml version="1.0"?>
<?xml-stylesheet href="b.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<a>
<b>1</b>
<b>2</b>
<b>3</b>
</a>
b.xsl
------------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="a">
<xsl:processing-instruction
name="cocoon-process">type="xslt"</xsl:processing-instruction>
<xsl:processing-instruction
name="xml-stylesheet">href="c.xsl"</xsl:processing-instruction>
<a>
<xsl:for-each select="b">
<xsl:copy>
<xsl:value-of select="."/>
</xsl:copy>
</xsl:for-each>
<d>
<xsl:apply-templates select="b"/>
</d>
</a>
</xsl:template>
<xsl:template match="b">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
c.xsl
------------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="d">
<xsl:processing-instruction
name="cocoon-format">type="text/html"</xsl:processing-instruction>
<html>
<head>
</head>
<body>
This is the value of D = <xsl:value-of select="."/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
If I remove the additional translation logic from b.xsl the output works
fine and gives the expected result. However when I apply an additional
transformation - c.xsl - I get the following error...
org.apache.cocoon.processor.ProcessorException: Could not associate
stylesheet to document: no matching stylesheet for: explorer
at
org.apache.cocoon.processor.xslt.XSLTProcessor.getResource(XSLTProcessor.jav
a, Compiled Code)
at
org.apache.cocoon.processor.xslt.XSLTProcessor.process(XSLTProcessor.java,
Compiled Code)
at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
at org.apache.cocoon.Cocoon.service(Cocoon.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled
Code)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled
Code)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java, Compiled Code)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
Compiled Code)
at java.lang.Thread.run(Thread.java, Compiled Code)
Can anybody tell me what I've doing wrong? Any suggestions would be
fantastic as I'm a bit stuck as this error message seems a little weird.
thanks in advance,
cheers,
-matt
ps: I am following the code that is included with Cocoon for the slides
example.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list