[xsl] Using XML output from Cocoon?

Subject: [xsl] Using XML output from Cocoon?
From: "Captain N ." <nintendosan@xxxxxxxxx>
Date: Fri, 17 Jun 2005 20:56:59 +0200
Hi there,

This is my situation. I have a URI which ends at
"publish/collection:**/file:**/xpath:**". I use cocoon to match on
this pattern.

Collection is the name of the document set. File is the name of the
XML file I want to view, and Xpath is a Xpath Query which points to a
node which I want to be highlighted.

In the match I generate the xml file, and then I want to transform it
with a XSLT file. I want to match a template with the given Xpath
query. But variables in the match attribute are not allowed in XSLT. I
tried using eXSLT, but no luck. It gives me the error "illegal tokens"
(there are position tests in the Xpath query, and I think that's the
problem).

Anyway, I came up with a different idea. I want to preprocess the XSLT
sheet so I'll have a XSLT sheet in which the Xpath query is set from
the beginning, and doesn't have to be calculated on run-time (what
doesn't work). I have made the following code in Cocoon (2.1.7):

<map:pipeline>
 <map:match pattern="publish/collection:**/file:**/xpath:**">
  <map:generate type="file" src="preprocess.xsl"/>
  <map:transform src="preprocessor.xsl">
   <map:parameter name="xpath" value="{3}"/>
  </map:transform>
  <map:serialize type="xml"/>
 </map:match>
</map:pipeline>

This piece of code should output a XSLT sheet which I can use to
transform the XML file. Now my question is: how?! I can not simple put
a generate and a transform elelement after the serialize, cause then I
get an error saying that I have already defined a generator.

I hope somebody can help me. Other suggestions are of course welcome too!

Kind regards, Karel.

Current Thread