You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by arj123 <ar...@unnat-e.com> on 2008/10/20 09:04:42 UTC

Cocoon transformation through javascript

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?

Thanks.
-- 
View this message in context: http://www.nabble.com/Cocoon-transformation-through-javascript-tp20064241p20064241.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon transformation through javascript

Posted by arj123 <ar...@unnat-e.com>.
Thanks for your prompt reply Luca.
I will try this.



Luca Morandini-2 wrote:
> 
> arj123 wrote:
>> Thanks Luca.
>> I want to invoke these pipeLines from javascript and not from browser.
>> Is it possible?
> 
> Sure, they're like any other URL, hence they can be invoked by a 
> browser, an HTML form within a browser, client-side Javascript, etc.
> 
> Regards,
> 
> --------------------
>     Luca Morandini
> www.lucamorandini.it
> --------------------
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Cocoon-transformation-through-javascript-tp20064241p20088305.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon transformation through javascript

Posted by Luca Morandini <lm...@ieee.org>.
arj123 wrote:
> Thanks Luca.
> I want to invoke these pipeLines from javascript and not from browser.
> Is it possible?

Sure, they're like any other URL, hence they can be invoked by a 
browser, an HTML form within a browser, client-side Javascript, etc.

Regards,

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon transformation through javascript

Posted by arj123 <ar...@unnat-e.com>.
Thanks Luca.
I want to invoke these pipeLines from javascript and not from browser.
Is it possible?



Luca Morandini-2 wrote:
> 
> 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: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Cocoon-transformation-through-javascript-tp20064241p20087596.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Cocoon transformation through javascript

Posted by Luca Morandini <lm...@ieee.org>.
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org