I'm trying to create an XSL stylesheet which generates an XML document
with an embedded XSL stylesheet. I'm using Cocoon. The problem is that I
can't seem to be able to declare the xmlns:xsl namespace _in the
generated xsl:stylesheet element_. I'm using xsl:namespace-alias.
My generated XML document has the xmlns:xsl declaration at the root
element instead. Cocoon won't process the embedded stylesheet. If I
manually move the namespace declaration in the generated document to the
xsl:stylesheet element and process it, it works.
I've been able to get around this by constructing the stylesheet with
xsl:element (as described in the FAQ), but this generates a weird prefix
n0 for it and its children, _and_ I have to construct all of the
children with similar xsl:element commands, which is _very_ cumbersome.
(These working but very inelegant examples not included.)
Given a very simple root tree and a similarly simple srctest2.xml file,
[formatted for visual reasons purely]
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="#ibnsina" type="text/xsl"?>
<someOtherNode>Some other data</someOtherNode>
<!-- This page was served in 199 milliseconds by Cocoon 1.8.2 -->
If I move the xmlns:xsl declaration from the document element to the
xsl:stylesheet element, the styelsheet works. Otherwise, it doesn't.
Is there a way for me to force Cocoon to include the declaration in the
xsl:stylesheet element? I've tried for three days now, and am getting a
bit desperate. Sorry if this has been asked before; I couldn't find it
in the FAQ nor by browsing the mailing list archives for the past three
months. Other approaches are also appreciated, of course.