BURGHARD Éric wrote:

- handle the <?xml-stylesheet?> processing instruction by serializing
straight XML for those browsers that do support it, and process on the
server for others.


great idea !

By extension, why not having an XSLGenerator and an XSLReader ?


Hmm... you're starting to build pipelines-in-one-component. This doesn't
seem to have the same kind of benefits than the serializer.


Right, i thought that for simple pipelines that are only
generator + xslt transformer + xml serializer

<read type="xslt" src="{xmldb:///}" xslt="stylesheets/site2xhtml.xsl"/>

would be more readable, but i'm not convinced in fact.


:-)

As i must use the
sourceResolver here, there's no obvious benefit over
<generator src="{xmldb:///}">
<serialize type="xslt" src="stylesheets/site2xhtml.xsl">

Exactly.

For the precompiled xslt, it's better perhaps to modify the TraxTransformer
to cache the Templates object.

Templates *are* cached already. This is done by the XSLTProcessor component.

For the generator, i think that the use must be limited to simplified
stylesheets. Xsl try to be a template and a transform language (the root of
the stylesheet itself can be <xsl:transform> or <xsl:stylesheet>). For
templating, sometimes you don't need an input document, so you generally do

<generate src="empty.xml"/>
<transform src="mypage.xsl">
<param/>
...
</transform>
<transform src="site2xhtml.xsl"/>
<serialize/>

i would prefer here

<generate type="xslt" src="mypage.xsl>
<param>
...
</generate>
<transform src="site2xhtml.xsl"/>
<serialize/>

that way, the difference between templating and transforming xsl appear soon
on the sitemap side, and because there's no xslt attribute, bad habits are
not possible.

Have a look in trunk at src/blocks/scratchpad/trunk/java/org/apache/cocoon/generation/TraxGenerator. It's already there :-)

It's probably time to promote this to the core.

Sylvain

--
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director

Reply via email to