cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Huib Verwey <Huib.Ver...@mpi.nl>
Subject PS. Re: Cocoon 2.2, STX block, TraxTransformer, transformer-factory
Date Thu, 09 Jun 2011 11:44:55 GMT
It's still a bit shady to me. Just tried it again and again it didn't work. So sometimes it
works, sometimes it doesn't. Maybe, apparently.

Anyway, I added a version attribute in the XSL namespace to the STX stylesheet root element
and now it works again.

xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0"

(It seems to me that it shouldn't make a difference, but hey, I started doing crazy things
when nothing seemed to work! :-) )

Just wanted to let fellow "stylesheets requires version attribute" victims know.

Hartelijke groet,

Huib Verweij.

--
Drs. Huib Verweij
Senior software developer - The Language Archive
Max Planck Institute for Psycholinguistics
P.O. Box 310
6500 AH Nijmegen
The Netherlands
t +31-24-3521911
e huib.verwey@mpi.nl<mailto:huib.verwey@mpi.nl>
w http://www.mpi.nl/

Op 30 jan 2011, om 13:42 heeft Huib Verweij het volgende geschreven:

Looking further into it I found that defining a separate "XSLT processor" allows me to use
the STX transformer:

in META-INF/cocoon/avalan/cocoon-core-xslt-stx.xconf I now have:
<components>
 <component role="org.apache.excalibur.xml.xslt.XSLTProcessor/stx"
  class="org.apache.cocoon.components.xslt.TraxProcessor">
  <parameter name="transformer-factory" value="net.sf.joost.trax.TransformerFactoryImpl"/>
 </component>
</components>


and in META-INF/cocoon/avalan/sitemap-transformers-stx-tansformer.xconf I have:

<map:components xmlns:map="http://apache.org/cocoon/sitemap/1.0">

    <map:transformers>
        <map:transformer name="stx" src="org.apache.cocoon.transformation.TraxTransformer">
            <xslt-processor-role>stx</xslt-processor-role>
        </map:transformer>
    </map:transformers>
</map:components>

and it works! Excellent!

So I answered my own question. I always have the same thing with directions as well: the moment
I ask for directions, I'm almost there ;-).

Huib Verweij.


Op 30 jan 2011, om 12:59 heeft Huib Verweij het volgende geschreven:

Hi,

I'd like to use the STX block in Cocoon 2.2, but it doesn't work, I get the same error as
mentioned here: http://www.mail-archive.com/dev@cocoon.apache.org/msg52324.html ("stylesheet
requires attribute version").

I think the problem is in the TraxTransformer that no longer supports the "transformer-factory"
config option (the Cocoon 2.1.11 version does).In the stx block the stx transformer is declared
like this:

<map:transformer name="stx"
                     logger="sitemap.transformer.stx"
                     src="org.apache.cocoon.transformation.TraxTransformer">
        <transformer-factory>net.sf.joost.trax.TransformerFactoryImpl</transformer-factory>
    </map:transformer>

so it is using the "transformer-factory" config option. So what happens is, I think, the default
transformer factory for XSLT stylesheets is used, it generates a transformer, which is a XSLT
transformer, which checks for the version attribute on the <xsl:stylesheet/> element,
which does not exist in the STX stylesheet, and it generates the above error. Or something
like that.

So, do you have any tips on how to get this working again?

Huib Verweij.




Mime
View raw message