Hi all. I am trying to create a stylesheet using
cocoon and then apply this stylesheet to some input. I need to declare a root
element with different namespace declarations.
When I was using batch file instead of Cocoon, I
just wrote it as a string, e.g.:
<xsl:text
disable-output-escaping="yes">
<xsl:stylesheet
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
</xsl:text>
Since I was writing
it to a file, it was written out as an root element.
But when I try to use
the same method from Cocoon, it doesn't work, because Cocoon writes this out as
a string, and in this case the output document will not have a root
element.
I tried to declare
the root inside an element, like this:
<xsl:element
name="xsl:stylesheet">
<xsl:attribute
name="version">1.0</xsl:attribute>
<xsl:attribute
name="xmlns:xsl">http://www.w3.org/1999/XSL/Transform</xsl:attribute>
<xsl:attribute
name="xmlns:saxon">http://icl.com/saxon</xsl:attribute>
<xsl:attribute
name="xmlns:rdf">http://www.w3.org/1999/02/22-rdf-syntax-ns#</xsl:attribute>
<xsl:attribute
name="extension-element-prefixes">saxon</xsl:attribute>
</xsl:element>
But what I get in the
output is this:
<xsl:stylesheet
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
extension-element-prefixes="saxon">
i.e. xmlns:saxon and
xmlns:rdf weren't written out.
And then, when I try
to run the generated stylesheet on the html input, I get an
error:
type fatal
message
org.apache.cocoon.ProcessingException: Could not read resource
file:/C:/Program Files/Apache Group/Tomcat
4.1/webapps/cocoon/ub/violations.html: javax.xml.transform.TransformerException:
org.xml.sax.SAXException: Invalid processing instruction name
(saxon:warning)
sender
org.apache.cocoon.servlet.CocoonServlet
source Cocoon
servlet I guess this is
because the above namespace declarations are missing, because if I apply the xsl
that was generated outside the Cocoon (using batch file) - it works fine, and
the only difference that I can see between these two files is that namespace
declarations thing.
Maybe it's because something else, I don't know,
I am not good in Cocoon yet.
So if somebody have some idea, what is wrong
with my code, and what should I do, please tell me.
P.S. I searched the archives for the issue of
"invalid processing instruction (saxon:warning)" and found one topic, but I
didn't understood it and I even don't know if this relates to my
problem.
Thank you very much for help.
Anna
|
- Re: Stylesheet in Cocoon Anna Afonchenko
- Re: Stylesheet in Cocoon Joerg Heinicke