arj123 wrote:
Hi,
In my project currently I am transforming XML to HTML from client side
javascript using browser dependent Xslt transformations.
Now I want to use Cocoon for this perpose.
Is it possible to call some cocoon APIs to do the transformation and append
the result to a static html?
Of course yes, though the "API" is mostly declarative (the sitemap).
Say you have, client-side, a list expressed as XML, and you want it to
be transformed into visually-appealing HTML; you may then invoke
http://localhost/cocoon/prettylist.html with a POST request containing a
request parameter named rawlist with said list as XML.
On the server-side, the request is matched and a Stream generator [1] is
used to gather the value of rawlist, then the XSLT transformer is
invoked to do the processing and the now-prettyfied list is served as XHTML.
Such a pipeline may look like:
<map:match pattern="prettylist.html">
<map:generate type="stream">
<map:parameter name="form-name" value="rawlist"/>
<map:parameter name="defaultContentType" value="text/xml"/>
</map:generate>
<map:transformer type="xslt" src="list2html.xsl"/>
<map:serializer type="xhtml"/>
</map:match/>
If you want to append this output to a static HTML page, you have to
write another pipeline combining the two using aggregation [2] or the
Cocoon Include transformer [3].
Regards,
[1] http://cocoon.apache.org/2.1/userdocs/stream-generator.html
[2] http://cocoon.apache.org/2.1/userdocs/concepts/sitemap.html
[3] http://cocoon.apache.org/2.1/userdocs/cinclude-transformer.html
--------------------
Luca Morandini
www.lucamorandini.it
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]